[LAU] udev rule for usb soundcards

0thermail at protonmail.com 0thermail at protonmail.com
Wed Dec 9 08:20:49 CET 2020


Hello,

I am using ubuntu studio 19.04 and I have a 16 port powered usb hub and 16 usb sound cards.

This much works fine - they are all listed when i type 'aplay -l' and i can get sound out of each of them.

The issue is that the usb devices don't always load in the same order so following instructions from this site (https://alsa.opensrc.org/Udev) I am attempting to write a UDEV rule to give them a unique / static ID based on which port (DEVPATH) they are plugged into. My udev rule looks like this:

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

DEVPATH=="/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.3/1-1.2.3.4/1-1.2.3.4:1.0/sound/card?", ATTR{id}="USB_1"
DEVPATH=="/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.3/1-1.2.3.3/1-1.2.3.3:1.0/sound/card?", ATTR{id}="USB_2"
DEVPATH=="/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.3/1-1.2.3.2/1-1.2.3.2:1.0/sound/card?", ATTR{id}="USB_3"
DEVPATH=="/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.3/1-1.2.3.1/1-1.2.3.1:1.0/sound/card?", ATTR{id}="USB_4"
DEVPATH=="/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.4/1-1.2.4.1/1-1.2.4.1:1.0/sound/card?", ATTR{id}="USB_5"
DEVPATH=="/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.4/1-1.2.4.2/1-1.2.4.2:1.0/sound/card?", ATTR{id}="USB_6"
DEVPATH=="/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.4/1-1.2.4.3/1-1.2.4.3:1.0/sound/card?", ATTR{id}="USB_7"
DEVPATH=="/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.4/1-1.2.4.4/1-1.2.4.4:1.0/sound/card?", ATTR{id}="USB_8"
DEVPATH=="/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1.2/1-1.2.1.2:1.0/sound/card?", ATTR{id}="USB_9"
DEVPATH=="/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1.1/1-1.2.1.1:1.0/sound/card?", ATTR{id}="USB_10"
DEVPATH=="/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1.3/1-1.2.1.3:1.0/sound/card?", ATTR{id}="USB_11"
DEVPATH=="/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.4/1-1.2.4.3/1-1.2.4.3:1.0/sound/card?", ATTR{id}="USB_12"
DEVPATH=="/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.4/1-1.2.4.4/1-1.2.4.4:1.0/sound/card?", ATTR{id}="USB_13"
DEVPATH=="/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1.2/1-1.2.1.2:1.0/sound/card?", ATTR{id}="USB_14"
DEVPATH=="/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1.1/1-1.2.1.1:1.0/sound/card?", ATTR{id}="USB_15"
DEVPATH=="/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1.3/1-1.2.1.3:1.0/sound/card?", ATTR{id}="USB_16"

LABEL="my_usb_audio_end"

and this sort of works, but only for the first 9 usb devices I plug in.

The strange thing is that it doesn't matter which 9 - I can plug any of the 16 cards into any of the 16 ports and the first 9 will always follow the udev naming rule, but after that it reverts to the default naming scheme.

Can anyone help me understand why this might be happening?

Many thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.linuxaudio.org/archives/linux-audio-user/attachments/20201209/4da10eac/attachment.html>


More information about the Linux-audio-user mailing list