Answer the question
In order to leave comments, you need to log in
How to make usb device id static?
Good day to all!
I put an mpd player and connected two external usb audio cards, I broadcast to each different music, but the problem is that I need certain music from certain channels, which is possible if I configure the machine and do not reboot, after rebooting the usb devices are swapped and I would like to fix this but can't find where to make
the device look through so:
#cat /proc/asound/cards
0 [Codec ]: H3_Audio_Codec - H3 Audio Codec
H3 Audio Codec
1 [Device ]: USB-Audio - USB PnP Sound Device
C-Media Electronics Inc. USB PnP Sound Device at usb-1c1b400.usb-1, full speed
2 [Device_1 ]: USB-Audio - USB Audio Device
GeneralPlus USB Audio Device at usb-1c1d400.usb-1, full speed
Answer the question
In order to leave comments, you need to log in
After a long search, I came across an interesting file /etc/modprobe.d/alsa-base.conf
. For me, its contents were as follows:
options snd-usb-audio index=1
# autoloader aliases
install sound-slot-0 /sbin/modprobe snd-card-0
install sound-slot-1 /sbin/modprobe snd-card-1
install sound-slot-2 /sbin/modprobe snd-card-2
install sound-slot-3 /sbin/modprobe snd-card-3
install sound-slot-4 /sbin/modprobe snd-card-4
install sound-slot-5 /sbin/modprobe snd-card-5
install sound-slot-6 /sbin/modprobe snd-card-6
install sound-slot-7 /sbin/modprobe snd-card-7
# Cause optional modules to be loaded above generic modules
install snd /sbin/modprobe --ignore-install snd $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-ioctl32 ; /sbin/modprobe --quiet --use-blacklist snd-seq ; }
#
# Workaround at bug #499695 (reverted in Ubuntu see LP #319505)
install snd-pcm /sbin/modprobe --ignore-install snd-pcm $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-pcm-oss ; : ; }
install snd-mixer /sbin/modprobe --ignore-install snd-mixer $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-mixer-oss ; : ; }
install snd-seq /sbin/modprobe --ignore-install snd-seq $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq-midi ; /sbin/modprobe --quiet --use-blacklist snd-seq-oss ; : ; }
#
install snd-rawmidi /sbin/modprobe --ignore-install snd-rawmidi $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq-midi ; : ; }
# Cause optional modules to be loaded above sound card driver modules
install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-emu10k1-synth ; }
install snd-via82xx /sbin/modprobe --ignore-install snd-via82xx $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq ; }
# Load saa7134-alsa instead of saa7134 (which gets dragged in by it anyway)
install saa7134 /sbin/modprobe --ignore-install saa7134 $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist saa7134-alsa ; : ; }
# Prevent abnormal drivers from grabbing index 0
options bt87x index=-2
options cx88_alsa index=-2
options saa7134-alsa index=-2
options snd-atiixp-modem index=-2
options snd-intel8x0m index=-2
options snd-via82xx-modem index=-2
options snd-usb-audio index=-2
options snd-usb-caiaq index=-2
options snd-usb-ua101 index=-2
options snd-usb-us122l index=-2
options snd-usb-usx2y index=-2
# Ubuntu #62691, enable MPU for snd-cmipci
options snd-cmipci mpu_port=0x330 fm_port=0x388
# Keep snd-pcsp from being loaded as first soundcard
options snd-pcsp index=-2
# Keep snd-usb-audio from beeing loaded as first soundcard
options snd-usb-audio index=-2
options snd-usb-audio index=2 id="xxxx:xxxx"
I have not tried this with USB sound cards, but udev helps us to hang USB modems on the correct devices. Here is a link to start with, there are some good examples.
https://www.tecmint.com/udev-for-device-detection-...
There was such question only with Arduino. Also used rules in udev. I followed this example and it works:
You could try creating a udev rule that will create a symlink to that USB device and then you can use something like /dev/myUSB which will always remain the same for that particular USB device.
First you need to find some identifying information for the USB drive. Typing lsusb should display some information that looks like this:
Bus 001 Device 004: ID 0403:6001 Future Technology Devices International
In this example, 0403 is the Vendor ID and 6001 is the Product ID.
Create a file called 99_usbdevice.rules (I don't think the name matters, just the directory):
sudo nano /etc/udev/rules.d/99_usbdevices.rules
Note that the directory above may be specific to Raspbian.
Copy/paste the line below to a file and save it:
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="myUSB"
Reboot Pi or unplug USB and try again paste it. There should now be a /dev/myUSB entry which you can use in the same way as the ttyUSB# entry.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question