ALSA Utilities - syntax errors in 15-alsa.rules, and controlC* files are not put into /dev/snd.
|Reported by:||Bryan Kadzban||Owned by:|
The 15-alsa.rules file created in current SVN BLFS (http://www.linuxfromscratch.org/blfs/view/svn/multimedia/alsa-utils.html) has several of the same syntax error in it. All occurrences of this type of rule:
need to be changed to:
(add an extra equal sign), otherwise udev-096 and above will complain when they try to load the rule. (And I do not believe the rule will actually be loaded, though I don't know for sure.)
Also, in the same file, the "controlC[0-9]*" device file(s) are not moved to the snd/ subdirectory like the rest of the Alsa devices are. This causes e.g.
alsactl restore to fail with an error similar to "no sound cards exist", if no other rule moves the device node.
The standard LFS udev-config tarball has rules in 25-lfs.rules to move the controlC* devices, but CLFS's rules files do not. (Standard LFS udev-config has rules to move the rest of the devices that 15-alsa.rules moves, also, for whatever that's worth.) But I don't think BLFS should rely on LFS's rule overriding an incorrect device node placement in any case, I think the BLFS rules should be correct.
Also, the rule to match midiC0D0 (and friends) may be incorrect. Currently it matches "midiC[D0-9]*", but that will only match "midiC" followed by digits or D characters. (Assuming udev's matching is regex-based, which I'm not at all sure about; I thought it was glob-based. But whatever.) A correct pattern is probably "midi[CD0-9]", just like all the other patterns in the file.
Marking this bug "major" since with a current CLFS, and an unmodified 15-alsa.rules file, Alsa is unusable. (Or at least, the controlC* devices aren't where they need to be, and therefore volumes are never restored. There may be other problems also.) With LFS, it's only usable by accident (because all the incorrect rules here -- both the invalid-syntax ones, and the controlC* one -- are overridden by correct rules later, in 25-lfs.rules).
A correct 15-alsa.rules file creation could look something like this:
cat <<"EOF" >/etc/udev/rules.d/15-alsa.rules # Give the audio group ownership of sound devices SUBSYSTEM=="sound", GROUP="audio" SUBSYSTEM=="snd", GROUP="audio" # ALSA Devices # When a sound device is detected, restore the volume settings KERNEL=="controlC[0-9]*", ACTION=="add", RUN+="/usr/sbin/alsactl restore %n" KERNEL=="controlC[0-9]*", NAME="snd/%k" KERNEL=="hw[CD0-9]*", NAME="snd/%k" KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k" KERNEL=="midi[CD0-9]*", NAME="snd/%k" KERNEL=="timer", NAME="snd/%k" KERNEL=="seq", NAME="snd/%k" EOF