Bug 182365 - ALSA user space doesn't add dynamic audio devices, .e.g. USB
ALSA user space doesn't add dynamic audio devices, .e.g. USB
Status: CLOSED DUPLICATE of bug 181042
Product: Fedora
Classification: Fedora
Component: alsa-lib (Show other bugs)
5
All Linux
medium Severity high
: ---
: ---
Assigned To: Martin Stransky
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-02-21 20:20 EST by Stefan Becker
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-03-07 05:06:40 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Stefan Becker 2006-02-21 20:20:53 EST
Description of problem:

When a new audio device is created by the ALSA kernel space it doesn't show up
in the user space and therefore is inaccessible to the user. If the device is
already attached during boot then it shows up in the ALSA user space. The ALSA
user space tools correctly destroy the device entry when you remove the USB
device after boot. So only the automatic creation of devices is broken.

Version-Release number of selected component (if applicable):

kernel-2.6.15-1.1955_FC5
alsa-lib-1.0.11-3.rc2.2
alsa-utils-1.0.11-2.rc2.2

How reproducible: Always

Steps to Reproduce:
1. Attach a USB audio device, e.g. headset
2. aplay -l
3.
  
Actual results:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: V8235 [VIA 8235], device 0: VIA 8235 [VIA 8235]
  Subdevices: 4/4
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
card 0: V8235 [VIA 8235], device 1: VIA 8235 [VIA 8235]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: modem [VIA 82XX modem], device 0: VIA 82XX modem [VIA 82XX modem]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Expected results:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: V8235 [VIA 8235], device 0: VIA 8235 [VIA 8235]
  Subdevices: 4/4
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
card 0: V8235 [VIA 8235], device 1: VIA 8235 [VIA 8235]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: modem [VIA 82XX modem], device 0: VIA 82XX modem [VIA 82XX modem]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: Headset [Plantronics Headset], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Additional info:

Bug #181042 is probably related to this problem.

It also happens with the bluetooth-alsa driver which creates a bridge device
between ALSA and the btsco user space daemon. As the device doesn't show up
bluetooth-alsa doesn't work with fc5test3.

Some additional info when the USB device is attached to the machine but not
visible in ALSA user space:

$ /sbin/lsmod | grep "^snd"
snd_usb_audio          69569  0
snd_usb_lib            15041  1 snd_usb_audio
snd_hwdep               9541  1 snd_usb_audio
snd_via82xx_modem      14281  0
snd_via82xx            26329  0
snd_ac97_codec         83937  2 snd_via82xx_modem,snd_via82xx
snd_ac97_bus            2497  1 snd_ac97_codec
snd_seq_dummy           3781  0
snd_seq_oss            28993  0
snd_seq_midi_event      7105  1 snd_seq_oss
snd_seq                47153  5 snd_seq_dummy,snd_seq_oss,snd_seq_midi_event
snd_pcm_oss            45009  0
snd_mixer_oss          16449  1 snd_pcm_oss
snd_pcm                76997  5
snd_usb_audio,snd_via82xx_modem,snd_via82xx,snd_ac97_codec,snd_pcm_oss
snd_mpu401_uart         7873  1 snd_via82xx
snd_timer              22597  2 snd_seq,snd_pcm
snd_rawmidi            24001  2 snd_usb_lib,snd_mpu401_uart
snd_seq_device          8909  4 snd_seq_dummy,snd_seq_oss,snd_seq,snd_rawmidi
snd                    50501  14
snd_usb_audio,snd_hwdep,snd_via82xx_modem,snd_via82xx,snd_ac97_codec,snd_seq_oss,snd_seq,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_mpu401_uart,snd_timer,snd_rawmidi,snd_seq_device
snd_page_alloc         10441  3 snd_via82xx_modem,snd_via82xx,snd_pcm

$ ls -l /proc/asound
total 3
dr-xr-xr-x 7 root root 0 Feb 21 17:24 card0
dr-xr-xr-x 5 root root 0 Feb 21 17:24 card1
dr-xr-xr-x 4 root root 0 Feb 21 17:24 card2
-r--r--r-- 1 root root 0 Feb 21 17:24 cards
-r--r--r-- 1 root root 0 Feb 21 17:24 devices
lrwxrwxrwx 1 root root 5 Feb 21 17:24 Headset -> card2
-r--r--r-- 1 root root 0 Feb 21 17:24 hwdep
lrwxrwxrwx 1 root root 5 Feb 21 17:24 modem -> card1
-r--r--r-- 1 root root 0 Feb 21 17:24 modules
dr-xr-xr-x 2 root root 0 Feb 21 17:24 oss
-r--r--r-- 1 root root 0 Feb 21 17:24 pcm
dr-xr-xr-x 2 root root 0 Feb 21 17:24 seq
-r--r--r-- 1 root root 0 Feb 21 17:24 timers
lrwxrwxrwx 1 root root 5 Feb 21 17:24 V8235 -> card0
-r--r--r-- 1 root root 0 Feb 21 17:24 version

$ ls /proc/asound/card2
id  oss_mixer  pcm0c  pcm0p  stream0  usbbus  usbid

$ cat /proc/asound/modules
 0 snd_via82xx
 1 snd_via82xx_modem
 2 snd_usb_audio

$ cat /proc/asound/pcm
00-01: VIA 8235 : VIA 8235 : playback 1 : capture 1
00-00: VIA 8235 : VIA 8235 : playback 4 : capture 1
01-00: VIA 82XX modem : VIA 82XX modem : playback 1 : capture 1
02-00: USB Audio : USB Audio : playback 1 : capture 1

$ cat /proc/asound/devices
  2:        : timer
  3:        : sequencer
  4: [ 0- 1]: digital audio playback
  5: [ 0- 1]: digital audio capture
  6: [ 0- 0]: digital audio playback
  7: [ 0- 0]: digital audio capture
  8: [ 0]   : control
  9: [ 1- 0]: digital audio playback
 10: [ 1- 0]: digital audio capture
 11: [ 1]   : control
 12: [ 2- 0]: digital audio playback
 13: [ 2- 0]: digital audio capture
 14: [ 2]   : control

$ ls -l /dev/dsp*
crw------- 1 stefanb root 14,  3 Feb 21 17:08 /dev/dsp
crw------- 1 stefanb root 14, 19 Feb 21 17:08 /dev/dsp1
crw-rw---- 1 root    root 14, 35 Feb 21 17:19 /dev/dsp2
Comment 1 Stefan Becker 2006-02-25 01:29:15 EST
I just discovered that ALSA user space seems to work differently for normal user
and root. I removed my USB headset and inserted it again.

As myself I see:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: V8235 [VIA 8235], device 0: VIA 8235 [VIA 8235]
...
card 0: V8235 [VIA 8235], device 1: VIA 8235 [VIA 8235]
...
card 1: modem [VIA 82XX modem], device 0: VIA 82XX modem [VIA 82XX modem]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

As root I see:

# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: V8235 [VIA 8235], device 0: VIA 8235 [VIA 8235]
...
card 0: V8235 [VIA 8235], device 1: VIA 8235 [VIA 8235]
...
card 1: modem [VIA 82XX modem], device 0: VIA 82XX modem [VIA 82XX modem]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: Headset [Plantronics Headset], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

alsamixer also has problems when running as normal user:

$ alsamixer
ALSA lib control.c:782:(snd_ctl_open_conf) Cannot open shared library
/usr/lib/alsa-lib/libasound_module_ctl_plug.so

alsamixer: function snd_ctl_open failed for default: No such file or directory
$ alsamixer -c0
---> opens alsamixer for card 0

and now as root:

# alsamixer
---> opens alsamixer for card 0

I'm going to disable SELinux and reboot. Let's see if it has something to do
with that...
Comment 2 Stefan Becker 2006-02-25 01:46:12 EST
OK, disabling SELinux didn't help, so it must be some other access restriction.

I looked at the whole /proc/asound and /sys/class/sound but all files are
readable by world, and directories are accessible by world.

So where does ALSA user space look to see what devices the kernel has to offer?
Comment 3 Stefan Becker 2006-02-25 04:03:01 EST
strace to the rescue!

$ strace -ff aplay -l
...
open("/dev/snd/controlC1", O_RDWR)      = 3
...
write(1, "card 1: modem [VIA 82XX modem], "..., 74) = 74
...
close(3)                                = 0
open("/dev/snd/controlC2", O_RDONLY)    = -1 EACCES (Permission denied)
open("/dev/aloadC2", O_RDONLY)          = -1 ENOENT (No such file or directory)
open("/dev/snd/controlC3", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/dev/aloadC3", O_RDONLY)          = -1 ENOENT (No such file or directory)
...

and that leads us to:

$ ls -l /dev/snd
total 0
crw------- 1 stefanb root 116, 11 Feb 24 22:53 controlC0
crw------- 1 stefanb root 116,  6 Feb 24 22:53 controlC1
crw------- 1 root    root 116, 15 Feb 25 00:38 controlC2
crw------- 1 root    root 116, 12 Feb 25 00:38 hwC2D0
crw------- 1 stefanb root 116, 10 Feb 24 22:53 pcmC0D0c
crw------- 1 stefanb root 116,  9 Feb 24 22:53 pcmC0D0p
crw------- 1 stefanb root 116,  8 Feb 24 22:53 pcmC0D1c
crw------- 1 stefanb root 116,  7 Feb 24 22:53 pcmC0D1p
crw------- 1 stefanb root 116,  5 Feb 24 22:53 pcmC1D0c
crw------- 1 stefanb root 116,  4 Feb 24 22:53 pcmC1D0p
crw------- 1 root    root 116, 14 Feb 25 00:38 pcmC2D0c
crw------- 1 root    root 116, 13 Feb 25 00:38 pcmC2D0p
crw------- 1 stefanb root 116,  3 Feb 24 22:53 seq
crw------- 1 stefanb root 116,  2 Feb 24 22:53 timer

i.e. the character device files for new sound devices are created with the wrong
UID. BTW: If I log out now and login again those get fixed...

I guess it's udev's responsibility to get the UID right? Or is it DBUS or KDE?
At least I have a workaround for the problem now.
Comment 4 Martin Stransky 2006-03-07 05:06:40 EST

*** This bug has been marked as a duplicate of 181042 ***
Comment 5 Stefan Becker 2006-03-10 00:22:55 EST
It seems the problem has been fixed by the latest changes: udev-084-13

Note You need to log in before you can comment on or make changes to this bug.