Penguin

Differences between version 9 and predecessor to the previous major change of UDev.

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

Newer page: version 9 Last edited on Monday, July 31, 2006 10:03:51 pm by zcat(1) Revert
Older page: version 8 Last edited on Monday, July 31, 2006 10:03:00 am by IanMcDonald Revert
@@ -35,4 +35,39 @@
  
 !! Locking down a device name 
  
 If you have multiple sound cards, network cards or multiple any device the kernel might change the order randomly. One time eth0 will be one card and eth1 the other - next time it might be eth1 for the first card and udev doesn't seem to be able to override this. To get around this use udev to call them a different name e.g. lan0 and lan1. Your eth0 and eth1 will still exist but use the lan0 and lan1 in other areas instead. 
+  
+  
+!! zcat's maddening experience with sound devices  
+  
+If you have multiple soundcards you will quickly discover that each of the various devices (/dev/dsp, /dev/audio, /dev/mixer) all point to the same piece of hardware, so consequently all those useful identifiers like SYSFS{device} are identical. The only thing that changes between pseudo-devices on the same card is the kernel-allocated and randomly changing kernel device and node numbers. My Head A-Splode!  
+  
+The guide to writing udev rules (link above) says you cannot generally mix the logical and physical device parts, but later examples do exactly that and I finally came to the conclusion this is the ONLY way to sort out audio devices.  
+  
+I also decided that If I'm manually defining _all_ the sound devices, forcing the second card to be /dev/dsp1 and so on then there is never going to be a name clash so it should be fairly safe to reuse names the kernel allocates automatically (this assumption might break if I ever plug in a non-forced soundcard, but I'll deal with that when/if it becomes a problem.)  
+  
+SO; my rules look for something to identify the card (ID==0000:00:08.0 will always be the card in that particular PCI slot, I could equally use SYSFS{vendor} or DRIVER to identify the same card in any slot) and something to identify the device on that card (kernel="dsp*" will match the dsp device, whatever number the kernel was thinking of giving it) and then force a new name onto it. Repeat for each sound device, and again for each card.  
+  
+Anyhow, here's the rules I came up with to reliably keep by two PCI cards in their fixed positions. It probably isn't the idea solution, but it works! They even swap over when I tell them to!  
+  
+  
+<pre>  
+/etc/udev/rules.d/10-local.rules  
+  
+ BUS=="pci", ID=="0000:00:07.0" KERNEL=="mixer*", NAME="mixer"  
+ BUS=="pci", ID=="0000:00:07.0" KERNEL=="midi*", NAME="midi"  
+ BUS=="pci", ID=="0000:00:07.0" KERNEL=="dsp*", NAME="dsp"  
+ BUS=="pci", ID=="0000:00:07.0" KERNEL=="audio*", NAME="audio"  
+ BUS=="pci", ID=="0000:00:07.0" KERNEL=="audio*", NAME="adsp"  
+ BUS=="pci", ID=="0000:00:07.0" KERNEL=="audio*", NAME="dmmidi"  
+ BUS=="pci", ID=="0000:00:07.0" KERNEL=="audio*", NAME="dmfm"  
+  
+ BUS=="pci", ID=="0000:00:08.0" KERNEL=="mixer*", NAME="mixer1"  
+ BUS=="pci", ID=="0000:00:08.0" KERNEL=="midi*", NAME="midi1"  
+ BUS=="pci", ID=="0000:00:08.0" KERNEL=="dsp*", NAME="dsp1"  
+ BUS=="pci", ID=="0000:00:08.0" KERNEL=="audio*", NAME="audio1"  
+ BUS=="pci", ID=="0000:00:08.0" KERNEL=="audio*", NAME="adsp1"  
+ BUS=="pci", ID=="0000:00:08.0" KERNEL=="audio*", NAME="dmmidi1"  
+ BUS=="pci", ID=="0000:00:08.0" KERNEL=="audio*", NAME="dmfm1"  
+  
+</pre>