Skip to contentSkip to conversation

can not access the alsa driver

DISCUSSION Ning Zhang 3 participants 5 messages Jan 5, 2008 – Jan 10, 2008

lore
Share & tools
lore

Ning Zhang

author
#0 lore raw

Dear all,
I wrote an alsa device driver for my arm_based platform. Then I cross compiled the alsa-lib-1.0.15, and build an application (static) with the lib.
I build the driver in the kernel, so after the kernel booted, I can get these information:

# cat /proc/asound/version
Advanced Linux Sound Architecture Driver Version 1.0.14rc1 (Tue Jan 09
09:56:17 2007 UTC).

cat /proc/asound/devices
0: [ 0] : control
16: [ 0- 0]: digital audio playback
24: [ 0- 0]: digital audio capture
33: : timer

# cat /proc/asound/cards
 0 [XYZ       ]: XYZ - ARM
                      XYZ  at 0xc485e000 0xc4870000 irq 57

( I did not found /dev/snd or /dev/dsp )

But when I run the application, I got these errors:

# /tmp/pcm_play_arm_s default
ALSA lib pcm.c:2145:(snd_pcm_open_noupdate) Unknown PCM default
Playback open error: No such file or directory

I googled the Internet, and add two files manually :

# cat /etc/alsa/alsa.conf
pcm.default{
        type hw
        card 0
}
# cat ~/.asoundrc
pcm.default {
        type hw
        card 0
}

But I still can not let the application to access the pcm device, this time I got the following information:

# /tmp/pcm_play_arm_s default
cannot open audio device default (No such file or directory)

Here are my questions:
1, When we install the alsa-lib, we can get some libs, besides those, do we also get some config files according to the local linux environment and alsa-lib will use these config files to access the real driver? If that, how can I install the alsa-lib to a embedded platform directly or what config files should I port to embedded platform?

2, Must I edit ~/.asoundrc and /etc/alsa/alsa.conf ? In my situation, what should I do ? Is somebody so kind can give me a simple template?

Because I am a newbie in alsa world, I must make some mistakes, so I am lookinf forward to your advice.

Thanks in advance for your help.

David.

#1 lore raw
Quoted 7 lines · Ning Zhang

Dear all,
I wrote an alsa device driver for my arm_based platform. Then I cross compiled the alsa-lib-1.0.15, and build an application (static) with the lib.
I build the driver in the kernel, so after the kernel booted, I can get these information:

I am having much the same problem!

You can test that the driver works by loading the oss emulation eg (one your module is loaded)

modprobe snd-pcm-oss
cat /dev/urandom > /dev/dsp

You should then get continuous white noise.

I'd be very interested in the answer to your other questions though - this aspect of writing and installing a driver doesn't appear to be (well) documented anywhere.

#2 lore raw
In reply to Ning Zhang

Hi,

Quoted 6 lines · Ning Zhang

( I did not found /dev/snd or /dev/dsp )

But when I run the application, I got these errors:

# /tmp/pcm_play_arm_s default
ALSA lib pcm.c:2145:(snd_pcm_open_noupdate) Unknown PCM default
Playback open error: No such file or directory

Well, I think, the /dev/snd/* devices files have to exist. Do you use udevd? If not, I guess you have to create these files manually - or by using the snddevices script in alsa-driver package.
If you use udevd, then - perhaps - your are missing some rules files (/etc/udev/rules.d). Have a look at your Linux distributions rules files of your host PC.

Quoted 9 lines

Here are my questions:
1, When we install the alsa-lib, we can get some libs, besides those, do we also get some config files according to the local linux environment and alsa-lib will use these config files to access the real driver? If that, how can I install the alsa-lib to a embedded platform directly or what config files should I port to embedded platform?

2, Must I edit ~/.asoundrc and /etc/alsa/alsa.conf ? In my situation, what should I do ? Is somebody so kind can give me a simple template?

I cannot really say something about your questions - I hadn't to create any special config. files, when I started using my own driver (for a PPC405 based board (ML403)). I just cross-compiled and installed alsa-lib and alsa-tools (to have aplay and arecord).

Joachim

#3 lore raw
Quoted 24 lines · Joachim Foerster

Hi,

Quoted 6 lines · Ning Zhang

( I did not found /dev/snd or /dev/dsp )

But when I run the application, I got these errors:

# /tmp/pcm_play_arm_s default
ALSA lib pcm.c:2145:(snd_pcm_open_noupdate) Unknown PCM default
Playback open error: No such file or directory

Well, I think, the /dev/snd/* devices files have to exist. Do you use udevd? If not, I guess you have to create these files manually - or by using the snddevices script in alsa-driver package.
If you use udevd, then - perhaps - your are missing some rules files (/etc/udev/rules.d). Have a look at your Linux distributions rules files of your host PC.

Quoted 7 lines

Here are my questions:
1, When we install the alsa-lib, we can get some libs, besides those, do we also get some config files according to the local linux environment and alsa-lib will use these config files to access the real driver? If that, how can I install the alsa-lib to a embedded platform directly or what config files should I port to embedded platform?

Quoted 8 lines
Quoted 2 lines

2, Must I edit ~/.asoundrc and /etc/alsa/alsa.conf ? In my situation, what should I do ? Is somebody so kind can give me a simple template?

I cannot really say something about your questions - I hadn't to create any special config. files, when I started using my own driver (for a PPC405 based board (ML403)). I just cross-compiled and installed alsa-lib and alsa-tools (to have aplay and arecord).

Any chance you could publish your configuration here?

#4 lore raw

Hi Adrian,

Quoted 10 lines · Adrian McMenamin
Quoted 10 lines
Quoted 9 lines

Here are my questions:
1, When we install the alsa-lib, we can get some libs, besides those, do we also get some config files according to the local linux environment and alsa-lib will use these config files to access the real driver? If that, how can I install the alsa-lib to a embedded platform directly or what config files should I port to embedded platform?

2, Must I edit ~/.asoundrc and /etc/alsa/alsa.conf ? In my situation, what should I do ? Is somebody so kind can give me a simple template?

Quoted 6 lines
Quoted 5 lines

I cannot really say something about your questions - I hadn't to create any special config. files, when I started using my own driver (for a PPC405 based board (ML403)). I just cross-compiled and installed alsa-lib and alsa-tools (to have aplay and arecord).

Any chance you could publish your configuration here?

Well, I had _not_ to create any extra/additional config files.

- I fetched alsa-lib and alsa-tools source packages (at that time I used 1.0.13 and later 1.0.14).
- I used ELDK 4.0 for PPC405 as cross-compiler environment. <rootdir> is the root directory used by the ML403 board.
- Compiled alsa-lib:

   $ ./configure --host=powerpc-linux
   $ make
   $ make DESTDIR=<rootdir> install
- Compiled alsa-tools (linked against alsa-lib)
   $ ./configure --host=powerpc-linux \
     --with-alsa-inc-prefix=<rootdir>/usr/include \
     --with-alsa-prefix=<rootdir>/usr/lib
   $ make
   $ make DESTDIR=<rootdir> install
- Login to board, modprobe my driver
- Make sure udev is running and created /dev/snd/* files OR
  - Create /dev/snd/* files with snddevices script from alsa-tools
package
- alsamixer (adjust volume), aplay somefile.wav

So, that's it - but I'm afraid that this won't help you. I never touched any files installed by "make install" of both packages.

Joachim