[LAU] ALSA +udev + Identify two identical audio devices

From: Miguel Negrao <miguel.negrao-lists@email-addr-hidden>
Date: Fri Dec 09 2011 - 15:03:43 EET

Hi all,

I’m trying to configure a pc with puredyne 9.11 and 2 RME HDSPM soundcards[1]. I manage to get sound perfectly, and I also managed to merge the two sound cards into one using .asoundrc. My problem is that the cards are identical and at every boot they get a random order. I was trying to follow [2] to try to give them a name based on the hardware location of the pci cards.

I created a file which I placed in /etc/udev/rules.d/85-wfs-script.rules with the following:

SUBSYSTEM!="sound", GOTO="wfs_pci_cards"
ACTION!="add", GOTO="wfs_pci_cards"

DEVPATH=="/devices/pci0000:00/0000:00:14.4/0000:02:0e.0/sound/card?", ATTR{id}="HDSPM_1"
DEVPATH=="/devices/pci0000:00/0000:00:14.4/0000:02:09.0/sound/card?", ATTR{id}="HDSPM_2"

LABEL="wfs_pci_cards"

Then when I reboot or reload the driver I get one of them with the correct name and the other one with “default”

/proc/asound/cards
0 [default ]: HDSPM - HDSPM MADI
                       RME HDSPM MADI at 0xfdce0000, irq 16
1 [HDSPM_1 ]: HDSPM - HDSPM MADI
                       RME HDSPM MADI at 0xfdcd0000, irq 17

Which one gets the “default” name is random and changes every time I boot. I tried changing the number 85 to all sorts of numbers, to change the order in which the rule is run, but it doesn’t really make a difference. Running udevd --debug and reloading the driver reports :

1323357358.505334 [3088] udev_rules_apply_to_event: ATTR '/sys/devices/pci0000:00/0000:00:14.4/0000:02:09.0/sound/card0/id' writing 'HDSPM_2' /etc/udev/rules.d/90-wfs-pci-cards.rules:5
1323357358.505393 [3088] udev_rules_apply_to_event: error opening ATTR{/sys/devices/pci0000:00/0000:00:14.4/0000:02:09.0/sound/card0/id} for writing: No such file or directory

Btw, the file is there, and doing "more /sys/devices/pci0000:00/0000:00:14.4/0000:02:09.0/sound/card0/id” yields “default” or “default_1”.

How can I stop the “default” name overriding the names that I set in the .rules file ? Any help appreciated !!!!

best regards,

-- 
Miguel Negrão // ZLB
http://www.friendlyvirus.org/artists/zlb/
[1] http://www.mjmwired.net/kernel/Documentation/sound/alsa/hdspm.txt
[2] http://alsa.opensrc.org/Udev#Identify_two_identical_audio_devices
-- 
Miguel Negrão // ZLB
http://www.friendlyvirus.org/artists/zlb/
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-user
Received on Fri Dec 9 16:15:02 2011

This archive was generated by hypermail 2.1.8 : Fri Dec 09 2011 - 16:15:02 EET