diff --git a/multimedia/libdriv/alsa-utils.xml b/multimedia/libdriv/alsa-utils.xml
index a2daff73cc..da109f5b20 100644
--- a/multimedia/libdriv/alsa-utils.xml
+++ b/multimedia/libdriv/alsa-utils.xml
@@ -111,7 +111,7 @@ make
You can use the alsamixer program from the
ALSA Utilities to change this.
- The first time the dev.d
+ The first time the alsa-restore
script below is run, it will complain
that there is no state in /etc/asound.state.
You can prevent this by running the following commands as
@@ -121,73 +121,58 @@ make
alsactl store
The volume settings will be restored from the saved state using a
- dev.d handler script that will
- execute when the device is detected
- during boot (when plugged in for USB devices).
-
-
- For versions of udev greater than 0.58, this script will
- not work by default. You'll have to add dev.d compatibility by adding
- a udev rules file that contains the line
- 'RUN="/sbin/udev_send_devd" to continue using the now depreciated
- dev.d system.
-
+ shell script called by Udev that will
+ execute when the device is detected (during boot or when plugged in for
+ USB devices).
While still the
root user, create the
- dev.d script with the following
- commands:
+ /etc/udev/scripts/alsa-restore script with
+ the following commands:
-install -v -d -m755 /etc/dev.d/snd &&
-cat > /etc/dev.d/snd/alsa.dev << "EOF"
+install -v -d -m754 /etc/udev/scripts &&
+cat > /etc/udev/scripts/alsa-restore << "EOF"
#!/bin/sh -e
-# This script is called by udevd when a change in a device is
-# detected, including initial detection upon bootup.
-# udevd sets the environment variables ACTION and DEVNAME.
-
-[ "$ACTION" = "add" ] || exit 0
-DEV_BASENAME="${DEVNAME##*/}"
-N="${DEV_BASENAME#controlC}"
-case "$DEV_BASENAME" in
- controlC[0-7])
- x=0
- while [ $x -lt 20 ]; do
- # Wait up to 20 seconds for /usr to be mounted if necessary
- if [ -f /usr/sbin/alsactl ]; then
- /usr/sbin/alsactl restore $N
- exit 0
- fi
- sleep 1
- x=`expr $x + 1`
- done & # Put the while command in the background and continue
- ;;
-esac
-exit 0
-EOF
-chmod -v 755 /etc/dev.d/snd/alsa.dev
-
-
- You may wish to do additional configuration on a per card basis.
- For example, if you wish to load soundfont banks, use the following
- sample script:
-
-#!/bin/sh -e
-# Begin /etc/dev.d/snd/[DEVICE]/asfxload.dev
+# Begin /etc/udev/scripts/alsa-restore
+# $1 is (the numbered device "%n") passed in by udev/kernel.
x=0
- while [ $x -lt 20 ]; do
- # Wait up to 20 seconds for /usr to be mounted if necessary
- if [ -f /usr/bin/asfxload ]; then
- # Load 8 MB sountfont bank
- /usr/bin/asfxload /usr/share/sounds/sf2/8mbgmsfx.sf2 -D "[ALSA device string]"
- exit 0
- fi
- sleep 1
- x=`expr $x + 1`
- done & # Put the while command in the background and continue
-exit 0
-# End /etc/dev.d/snd/[DEVICE]/asfxload.dev
+# Give up to 20 seconds for /usr to be mounted
+while [ "${x}" -lt 20 ]
+do
+ sleep 1
+ if [ -f /usr/sbin/alsactl ]; then
+ /usr/sbin/alsactl restore "${1}"
+ exit 0
+ fi
+ x=`expr "${x}" + 1`
+done & # Put the loop in the background
+
+# End /etc/udev/scripts/alsa-restore
+EOF
+chmod -v 754 /etc/udev/scripts/alsa-restore
+
+ Finally, again as the
+ root user, install a new
+ Udev rules file to create the audio
+ device nodes and run the restore script:
+
+cat > /etc/udev/rules.d/15-alsa.rules << "EOF"
+# 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", NAME="snd/%k", RUN="/etc/udev/scripts/alsa-restore %n"
+KERNEL="hw[CD0-9]*", NAME="snd/%k"
+KERNEL="pcm[CD0-9cp]*", NAME="snd/%k"
+KERNEL="midiC[D0-9]*", NAME="snd/%k"
+KERNEL="timer", NAME="snd/%k"
+KERNEL="seq", NAME="snd/%k"
+EOF
+chmod 644 /etc/udev/rules.d/15-alsa.rules