I have a couple of amateur radios that I connect to my Linux computer over USB. The radios present themselves as sound cards, and are visible like so:
$ aplay -l [...] card 1: CODEC [USB Audio CODEC], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0 card 2: CODEC_1 [USB Audio CODEC], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0 $ arecord -l **** List of CAPTURE Hardware Devices **** card 1: CODEC [USB Audio CODEC], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0 card 2: CODEC_1 [USB Audio CODEC], device 0: USB Audio [USB Audio] Subdevices: 0/1 Subdevice #0: subdevice #0 They show up on USB as:
$ lsusb | grep Audio $ lsusb | grep Aud Bus 001 Device 102: ID 08bb:2901 Texas Instruments PCM2901 Audio Codec Bus 001 Device 099: ID 08bb:2901 Texas Instruments PCM2901 Audio Codec The problem here is that I have software that wants to talk to one of them, but it doesn't know which one. The software (js8call and wsjtx) simply allows me to select the name from a dropdown, and remembers the name chosen.
The names in this dropdown are:
alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo.2 Other software (e.g. direwolf) wants the device in "plughw:2,0" format, where the other radio is "plughw:1,0".
But it's not consistent which is which. It depends on when Linux detected them, which in the best case is the order that I plugged them in, and in the normal case it's a race condition, since both are plugged in and are using the same power supply, so they boot up at the same time when I turn on the power.
So, how do I make Linux name these two sound devices in a consistent way, so that I don't have to edit config files, and change settings in a UI, every time they happen to have been detected in a different order?