[alsa-devel] my udev rules are breaking my dmixer setup why?

Takashi Iwai tiwai at suse.de
Tue Nov 11 11:37:28 CET 2008

At Tue, 11 Nov 2008 10:43:00 +0100,
Jelle de Jong wrote:
> Takashi Iwai wrote:
> > At Sun, 09 Nov 2008 15:59:03 +0100,
> > Jelle de Jong wrote:
> >> Hello everybody,
> >>
> >> I am trying to use udev to get fixed device names depending on the
> >> location of the device on the usb bus. The udev rules seems to be
> >> working fine, however i cant get dmix to work with the udev rules using
> >> only hw dies work. If i remove the udev rules the dmixer works fine.
> >>
> >> Can somebody look at the attachment, and maybe do some testing, i would
> >> highly appreciate it.
> > 
> > Swapping the card numbers with udev might have a problem because
> > the driver itself remembers the card index, and this number isn't
> > swapped -- thus you get inconsistency between the device file and
> > the internal index number.
> > 
> > BTW, if you just would like to keep the fixed device index for a
> > certain usb device path, try my old patch below.
> > It adds devpath option to snd-usb-audio, and you can specify the
> > usb device path string ("usb-$BUSNAME-$DEVPATH").
> > 
> > 
> > Takashi
> Thank you Takashi for thanking the time to answer the question. I don't
> understand. If udev created the card numbers in the first place,
> swapping them should not make a difference?

udev just renames a file.
But, the index number is stored in the driver itself, and it can be
read via an API function.

> and why does the audio work
> fine with only hw:x and not when using dmix:x.

Unless you change the device file name, it works.
Or, use an id string instead of an index number.  The id string is
found in /proc/asound/cards as [xxx].
Or, you can simply set up the slots option of snd module or set up
the index option of each module.  See ALSA-Configuration.txt.

> How is the internal index
> number created?

Either via a module / kernel boot option, or created dynamically
via the driver.

> Can I control this index with udev? did I forget
> something in my udev rules?

No.  As mentioned, your udev rule just renames the file.

> Custom compiling sound modules is no option, it will break
> maintainability of the system in every way, sorry for this not being an
> sustainable option.

IMO, changing udev rule could be more fragile than a custom module...

> Almost all devices can be managed with udev rules, that is where the
> system is designed for, there are also alsa rules in there, if they
> don't work what is wrong then? is it an alsa issue, or udev, what are
> the dependencies when alsa uses hardware. How are the /dev/snd/* devices
> used and what is the /proc/asound/* for ?

The card index mechanism in ALSA was introduced much before udev
was born.  It's just a legacy mechanism, but it's hard to kill without
breaking the running system, unfortunately.


More information about the Alsa-devel mailing list