Skip to contentSkip to conversation

Can anyone help?

DISCUSSION Adrian McMenamin 2 participants 10 messages Feb 9, 2006 – Feb 13, 2006

lore
Share & tools
lore
#0 lore raw

I cannot get aplay to work on my architecture (afaics anyway) eg

/ # aplay -D hw:0,0 /bin/busybox
aplay: pcm.c: 2119: snd_pcm_open: Assertion `pcmp && name' failed. Aborted

(Nobody has explained to me what that error is - and my reading of the code hasn't helped too much :-< )

So how can I test my driver code?

I can do things like this:

/ # cat /bin/busybox > /dev/snd/pcmC0D0p
ALSA /home/adrian/aica/aica/snd_card_aica.c:151: In snd_aicapcm_pcm_open
cat: Write Error: File descriptor in bad state
/ # Feb 10 00:01:02 dreamy user.warn kernel:
ALSA /home/adrian/aica/aica/snd_card_aica.c:151: In snd_aicapcm_pcm_open

But as the above fragment shows this opens the device file but not much else (as I assume it has no automagic way of accessing the alsa subsystem)

My driver code is at http://newgolddream.dyndns.info/repos btw

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

#1 lore raw
Quoted 19 lines · Adrian McMenamin

I cannot get aplay to work on my architecture (afaics anyway) eg

/ # aplay -D hw:0,0 /bin/busybox
aplay: pcm.c: 2119: snd_pcm_open: Assertion `pcmp && name' failed. Aborted

(Nobody has explained to me what that error is - and my reading of the code hasn't helped too much :-< )

So how can I test my driver code?

I can do things like this:

/ # cat /bin/busybox > /dev/snd/pcmC0D0p
ALSA /home/adrian/aica/aica/snd_card_aica.c:151: In snd_aicapcm_pcm_open
cat: Write Error: File descriptor in bad state
/ # Feb 10 00:01:02 dreamy user.warn kernel:
ALSA /home/adrian/aica/aica/snd_card_aica.c:151: In snd_aicapcm_pcm_open

Quoted 3 lines

But as the above fragment shows this opens the device file but not much else (as I assume it has no automagic way of accessing the alsa subsystem)

It looks like you fail to set card->id in your __devinit routine. This field is used by the alsa-lib to find the right config file in /usr/share/alsa/cards/. For example if alsa-lib is supposed to use /usr/share/alsa/cards/Audigy2.conf set it to "Audigy2".

The ID is available in /proc/asound/cardX/id.

Here is the code from the emu10k1 driver:

        if (!*card->id && c->id) { 
                int i, n = 0; 
                strlcpy(card->id, c->id, sizeof(card->id));
                for (;;) {
                        for (i = 0; i < snd_ecards_limit; i++) {
                                if (snd_cards[i] && !strcmp(snd_cards[i]->id, card->id))
                                        break;
                        }
                        if (i >= snd_ecards_limit)
                                break;
                        n++;
                        if (n >= SNDRV_CARDS)
                                break;
                        snprintf(card->id, sizeof(card->id), "%s_%d", c->id, n);
                }
        }

Lee

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

#2 lore raw
Quoted 7 lines · Lee Revell

On Thu, 2006-02-09 at 23:07 +0000, Adrian McMenamin wrote:

It looks like you fail to set card->id in your __devinit routine. This field is used by the alsa-lib to find the right config file in /usr/share/alsa/cards/. For example if alsa-lib is supposed to use /usr/share/alsa/cards/Audigy2.conf set it to "Audigy2".

I don't think that is it:

/ # modprobe snd_card_aica
ALSA /home/adrian/aica/aica/snd_card_aica.c:323: Probing for AICA device ALSA /home/adrian/aica/aica/snd_card_aica.c:305: Loading aica firmware ALSA /home/adrian/aica/aica/snd_card_aica.c:366: ALSA Driver for Yamaha AICA Super Intelligent Sound Processor on slot 0
/ # cd /proc/asound
/proc/asound # ls
AICA card0 cards devices modules pcm timers version
/proc/asound # cd card0
/proc/asound/card0 # ls -l

-r--r--r--    1 root     root            0 Feb 10 00:39 id
dr-xr-xr-x    3 root     root            0 Feb 10 00:39 pcm0p

/proc/asound/card0 # cat id
AICA

There are no setup files, but the wiki says that aplay -D hw:0,0 ought to get round that anyway. have I misunderstood that?

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

#3 lore raw
Quoted 3 lines · Adrian McMenamin

There are no setup files, but the wiki says that aplay -D hw:0,0 ought to get round that anyway. have I misunderstood that?

Do you mean you have nothing under /usr/share/alsa? You should try installing alsa-lib and see what happens. The ALSA wikis are full of bad information.

Lee

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

#4 lore raw
Quoted 11 lines · Lee Revell
Quoted 3 lines · Adrian McMenamin

There are no setup files, but the wiki says that aplay -D hw:0,0 ought to get round that anyway. have I misunderstood that?

Do you mean you have nothing under /usr/share/alsa? You should try installing alsa-lib and see what happens. The ALSA wikis are full of bad information.

Lee

I have done this now - build and installed the library again: configured thus:

CC=/home/adrian/buildroot/build_sh4/staging_dir/bin/sh4-linux-gcc LDFLAGS=-L/tftpboot/192.168.61.55/lib ./configure --host=sh4-linux --with-debug=yes --prefix=/tftpboot/192.168.61.55/usr

Unfortunately the install fails towards the end (this is being linked against uclibc rather than glibc) - (see below - though )

But the basic problem remains the same:

/lib # aplay -L
aplay: pcm_list:280: snd_config_updte: Invalid argument /lib # aplay -L
aplay: pcm_list:280: snd_config_update: Invalid argument /lib # aplay -D hw:0,0
aplay: pcm.c: 2119: snd_pcm_open: Assertion `pcmp && name' failed. Aborted

Though I have a populated /usr/share/alsa directory on the target machine now... have I missed something?

Thanks for all the help.

Adrian

Install output...

/home/adrian/buildroot/build_sh4/staging_dir/bin/sh4-linux-gcc
-shared .libs/sbase.o -Wl,--rpath -Wl,/tftpboot/192.168.61.55/usr/lib
-L/tftpboot/192.168.61.55/lib -L/tftpboot/192.168.61.55/usr/lib -lasound
-Wl,-soname -Wl,smixer-sbase.so -o .libs/smixer-sbase.so
/home/adrian/buildroot/build_sh4/staging_dir/lib/gcc/sh4-linux-uclibc/3.4.2/../../../../sh4-linux-uclibc/bin/ld: cannot find /lib/libc.so.0
collect2: ld returned 1 exit status
libtool: install: error: relink `smixer-sbase.la' with the above command
before installing it
/bin/sh ../../../libtool --mode=install /usr/bin/install -c
smixer-ac97.la /tftpboot/192.168.61.55/usr/lib/alsa-lib/smixer/smixer-ac97.la
libtool: install: warning: relinking `smixer-ac97.la'
(cd /home/adrian/alsa-lib-1.0.10/modules/mixer/simple; /bin/sh ../../../libtool --mode=relink /home/adrian/buildroot/build_sh4/staging_dir/bin/sh4-linux-gcc -g -O2 -W -Wall -g -O2 -L/tftpboot/192.168.61.55/lib -o smixer-ac97.la -rpath /tftpboot/192.168.61.55/usr/lib/alsa-lib/smixer -module -avoid-version ac97.lo sbasedl.lo ../../../src/libasound.la ) /home/adrian/buildroot/build_sh4/staging_dir/bin/sh4-linux-gcc
-shared .libs/ac97.o .libs/sbasedl.o -Wl,--rpath
-Wl,/tftpboot/192.168.61.55/usr/lib -L/tftpboot/192.168.61.55/lib
-L/tftpboot/192.168.61.55/usr/lib -lasound -Wl,-soname
-Wl,smixer-ac97.so -o .libs/smixer-ac97.so
/home/adrian/buildroot/build_sh4/staging_dir/lib/gcc/sh4-linux-uclibc/3.4.2/../../../../sh4-linux-uclibc/bin/ld: cannot find /lib/libc.so.0
collect2: ld returned 1 exit status
libtool: install: error: relink `smixer-ac97.la' with the above command
before installing it
/bin/sh ../../../libtool --mode=install /usr/bin/install -c
smixer-hda.la /tftpboot/192.168.61.55/usr/lib/alsa-lib/smixer/smixer-hda.la
libtool: install: warning: relinking `smixer-hda.la'
(cd /home/adrian/alsa-lib-1.0.10/modules/mixer/simple; /bin/sh ../../../libtool --mode=relink /home/adrian/buildroot/build_sh4/staging_dir/bin/sh4-linux-gcc -g -O2 -W -Wall -g -O2 -L/tftpboot/192.168.61.55/lib -o smixer-hda.la -rpath /tftpboot/192.168.61.55/usr/lib/alsa-lib/smixer -module -avoid-version hda.lo sbasedl.lo ../../../src/libasound.la ) /home/adrian/buildroot/build_sh4/staging_dir/bin/sh4-linux-gcc
-shared .libs/hda.o .libs/sbasedl.o -Wl,--rpath
-Wl,/tftpboot/192.168.61.55/usr/lib -L/tftpboot/192.168.61.55/lib
-L/tftpboot/192.168.61.55/usr/lib -lasound -Wl,-soname
-Wl,smixer-hda.so -o .libs/smixer-hda.so
/home/adrian/buildroot/build_sh4/staging_dir/lib/gcc/sh4-linux-uclibc/3.4.2/../../../../sh4-linux-uclibc/bin/ld: cannot find /lib/libc.so.0
collect2: ld returned 1 exit status
libtool: install: error: relink `smixer-hda.la' with the above command
before installing it
make[4]: *** [install-pkglibLTLIBRARIES] Error 1
make[4]: Leaving directory
`/home/adrian/alsa-lib-1.0.10/modules/mixer/simple'
make[3]: *** [install-am] Error 2
make[3]: Leaving directory
`/home/adrian/alsa-lib-1.0.10/modules/mixer/simple'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/home/adrian/alsa-lib-1.0.10/modules/mixer'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/adrian/alsa-lib-1.0.10/modules'
make: *** [install-recursive] Error 1

NB the /lib directory on the target box is like this...

/lib # ls -l

drwxr-xr-x    2 root     root         4096 Jan 2:34 firmware
-rwsr-xr-x    1 root     root        17204 Jan 28 23:11
ld-uClibc-0.9.28.so
lrwxrwxrwx    1 root     root           19 Jan 28 23:11 ld-uClibc.so.0
-> ld-uClibc-0.9.28.so
-rw-r--r--    1 root     root        76028 Jan 28 23:11 libbusybox.so
lrwxrwxrwx    1 root     root           9 Jan 28 23:11 libbusybox.so.1

-> libbusybox.so.1.1.1
-rw-r--r-- 1 root root 76028 Jan 28 23:11
libbusybox.so.1.1
-rw-r--r-- 1 root root 76028 Jan 28 23:11
libbusybox.so.1.1.1
lrwxrwxrwx 1 root root 19 Jan 28 23:11 libc.so.0 ->
libuClibc-0.9.28.so
-rw-r--r-- 1 root root 8888 Jan 28 23:11
libcrypt-0.9.28.so
lrwxrwxrwx 1 root root 18 Jan 28 23:11 libcrypt.so.0 ->
libcrypt-0.9.28.so

-rw-r--r--    1 root     root         9036 Jan 28 23:11 libdl-0.9.28.so
lrwxrwxrwx    1 root     root           15 Jan 28 23:11 libdl.so.0 ->
libdl-0.9.28.so
lrwxrwxrwx    1 root     root           13 Jan 28 23:11 libgcc_s.so ->
libgcc_s.so.1
-rw-r--r--    1 root     root        62104 Jan 28 23:11 libgcc_s.so.1
-rw-r--r--    1 root     root        54136 Jan 28 23:11 libm-0.9.28.so
lrwxrwxrwx    1 root     root           14 Jan 28 23:11 libm.so.0 ->

libm-0.9.28.so
lrwxrwxrwx 1 root root 15 Jan 28 23:11 libncurses.so ->
libncurses.so.5
lrwxrwxrwx 1 root root 17 Jan 28 23:11 libncurses.so.5
-> libncurses.so.5.5
-rw-r--r-- 1 root root 271140 Jan 28 23:11
libncurses.so.5.5

-rw-r--r--    1 root     root         4784 Jan 28 23:11 libnsl-0.9.28.so
lrwxrwxrwx    1 root     root           16 Jan 28 23:11 libnsl.so.0 ->

libnsl-0.9.28.so
-rw-r--r-- 1 root root 73951 Jan 28 23:11
libpthread-0.9.28.so
lrwxrwxrwx 1 root root 20 Jan 28 23:11 libpthread.so.0
-> libpthread-0.9.28.so
-rw-r--r-- 1 root root 4788 Jan 28 23:11
libresolv-0.9.28.so
lrwxrwxrwx 1 root root 19 Jan 28 23:11 libresolv.so.0
-> libresolv-0.9.28.so

-rw-r--r--    1 root     root         4732 Jan 28 23:11 lirt-0.9.28.so
lrwxrwxrwx    1 root     root           15 Jan 28 23:11 librt.so.0 ->

librt-0.9.28.so
-rw-r--r-- 1 root ro 13076 Jan 28 23:11
libthread_db-0.9.28.so
lrwxrwxrwx 1 root root 22 Jan 28 23:11 libthread_db.so.1
-> libthread_db-0.9.28.so
-rw-r--r-- 1 root root 289544 Jan 28 23:11
libuClibc-0.9.28.so
-rw-r--r-- 1 root root 4860 Jan 28 23:11
libutil-0.9.28.so
lrwxrwxrwx 1 root root 17 Jan 28 23:11 libutil.so.0 ->
libutil-0.9.28.so
lrwxrwxrwx 1 root root 13 Jan 28 23:11 libz.so ->
libz.so.1.2.3
lrwxrwxrwx 1 root root 13 Jan 28 23:11 libz.so.1 ->
libz.so.1.2.3

-rw-r--r--    1 root     root        59276 Jan 28 23:11 libz.so.1.2.3
drwxr-xr-x    4 root     root         4096 Feb  7 21:37 modules

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

#5 lore raw
Quoted 10 lines · Adrian McMenamin

But the basic problem remains the same:

/lib # aplay -L
aplay: pcm_list:280: snd_config_updte: Invalid argument /lib # aplay -L
aplay: pcm_list:280: snd_config_update: Invalid argument /lib # aplay -D hw:0,0
aplay: pcm.c: 2119: snd_pcm_open: Assertion `pcmp && name' failed. Aborted

You must be forgetting to initialize something in the driver.

Go over your driver source carefully with a known working driver side-by-side.

Add more debug output to alsa-lib and your driver.

I really have no idea what's wrong.

Lee

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

#6 lore raw
Quoted 12 lines · Lee Revell
Quoted 10 lines · Adrian McMenamin

But the basic problem remains the same:

/lib # aplay -L
aplay: pcm_list:280: snd_config_updte: Invalid argument /lib # aplay -L
aplay: pcm_list:280: snd_config_update: Invalid argument /lib # aplay -D hw:0,0
aplay: pcm.c: 2119: snd_pcm_open: Assertion `pcmp && name' failed. Aborted

Quoted 9 lines

You must be forgetting to initialize something in the driver.

Go over your driver source carefully with a known working driver side-by-side.

Add more debug output to alsa-lib and your driver.

I really have no idea what's wrong.

Does /usr/share/alsa/alsa.conf exist?

Lee

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

#7 lore raw
In reply to Adrian McMenamin
Quoted 8 lines · Adrian McMenamin

/ # cat /bin/busybox > /dev/snd/pcmC0D0p ALSA /home/adrian/aica/aica/snd_card_aica.c:151: In snd_aicapcm_pcm_open
cat: Write Error: File descriptor in bad state / # Feb 10 00:01:02 dreamy user.warn kernel:
ALSA /home/adrian/aica/aica/snd_card_aica.c:151: In snd_aicapcm_pcm_open

Quoted 5 lines

But as the above fragment shows this opens the device file but not much
else (as I assume it has no automagic way of accessing the alsa subsystem)

Yes, "cat file > /dev/snd/pcmX" makes no sense, that's now how ALSA works. The only supported interface to these is via alsa-lib.

Lee

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

#8 lore raw
In reply to Adrian McMenamin
Quoted 6 lines · Adrian McMenamin

I cannot get aplay to work on my architecture (afaics anyway) eg

/ # aplay -D hw:0,0 /bin/busybox
aplay: pcm.c: 2119: snd_pcm_open: Assertion `pcmp && name' failed. Aborted

Try this patch:

home/rlrevell/cvs/alsa/alsa-lib/src/pcm/pcm.c renamed from home/rlrevell/cvs/alsa/alsa-lib/src/pcm/pcm.c~ +2 -1
@@ -2124,7 +2124,8 @@
 		 snd_pcm_stream_t stream, int mode)
 {
 	int err;
-	assert(pcmp && name);
+	assert(pcmp);
+        assert(name);
 	err = snd_config_update();
 	if (err < 0)
 		return err;

to see if it's the PCM handle or name that's not set.

Lee

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

#9 lore raw
Quoted 10 lines · Lee Revell
Quoted 6 lines · Adrian McMenamin

I cannot get aplay to work on my architecture (afaics anyway) eg

/ # aplay -D hw:0,0 /bin/busybox
aplay: pcm.c: 2119: snd_pcm_open: Assertion `pcmp && name' failed. Aborted

Try this patch:

[snip]

Quoted 3 lines

to see if it's the PCM handle or name that's not set.

Lee

Get this now:
/usr/share/alsa # aplay -L
aplay: pcm_list:280: snd_config_update: Invalid argument /usr/share/alsa # aplay -D hw:0,0
aplay: pcm.c: 2120: snd_pcm_open: Assertion `name' failed. Aborted

alsa.conf is installed.

Thanks for the help, I'll return to this tomorrow - it's getting on for 1am here now :)

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642