summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-05-12 21:49:18 +0200
committerLennart Poettering <lennart@poettering.net>2009-05-12 21:49:18 +0200
commita65f01de17aec844db5ba270371a743071d5f58b (patch)
tree32aeb5845911bad70dd98bcd11010ba1a4a76805
parentfaecab7cbf6d1fb06dd39d4fd436d930cc3f3522 (diff)
alsa: add persistant device rules
This patch adds persistant device node symlinks for ALSA control devices. This mimics the behaviour of the persistancy rules for other subsystems, such as v4l or storage. This patch is useful only when alsa-lib with this patch is used: http://git.alsa-project.org/?p=alsa-lib.git;a=commit;h=33ab0b5381c87e151e87e5000964edd868484886 This will allow referring to ALSA devices with device strings such as: hw:/dev/snd/by-path/pci-0000:00:1a.1-usb-0:1:1.0 instead of hw:0 where the device index might be unstable.
-rw-r--r--rules.d/60-persistent-alsa.rules15
-rw-r--r--rules.d/Makefile.am3
2 files changed, 17 insertions, 1 deletions
diff --git a/rules.d/60-persistent-alsa.rules b/rules.d/60-persistent-alsa.rules
new file mode 100644
index 0000000..4f3cf6a
--- /dev/null
+++ b/rules.d/60-persistent-alsa.rules
@@ -0,0 +1,15 @@
+# do not edit this file, it will be overwritten on update
+
+ACTION!="add|change", GOTO="persistent_alsa_end"
+SUBSYSTEM!="sound", GOTO="persistent_alsa_end"
+KERNEL!="controlC[0-9]*", GOTO="persistent_alsa_end"
+
+SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p"
+SUBSYSTEMS=="usb", ENV{ID_IFACE}="$attr{bInterfaceNumber}"
+ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="?*", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_IFACE}"
+ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
+
+IMPORT{program}="path_id %p"
+ENV{ID_PATH}=="?*", SYMLINK+="snd/by-path/$env{ID_PATH}"
+
+LABEL="persistent_alsa_end"
diff --git a/rules.d/Makefile.am b/rules.d/Makefile.am
index a6ee93f..65800ef 100644
--- a/rules.d/Makefile.am
+++ b/rules.d/Makefile.am
@@ -3,4 +3,5 @@ include $(top_srcdir)/Makefile.am.inc
udevrulesdir = $(udev_prefix)/lib/udev/rules.d
dist_udevrules_DATA = \
- 78-sound-card.rules
+ 78-sound-card.rules \
+ 60-persistent-alsa.rules