@Akasonny I did some looking and on my digirig lite I have the following attributes that I would look into seeing if they’re different.
looking at parent device '/devices/platform/soc/3f980000.usb/usb1':
...
ATTRS{serial}=="3f980000.usb"```
looking at parent device '/devices/platform/soc/3f980000.usb':
...
ATTRS{guid}=="GUID = 0x2708a000"
and for my DigiRig Moblie
I ran the following command find /sys/bus/usb/devices/usb*/ -name dev
and got this output which seems to indicate something like a mac address difference between my devices, maybe this is enough to help you find the difference in your DigiRig devices.
/sys/bus/usb/devices/usb1/dev
/sys/bus/usb/devices/usb1/1-1/1-1.5/dev
/sys/bus/usb/devices/usb1/1-1/1-1.5/1-1.5.1/1-1.5.1:1.0/gpiochip3/dev
/sys/bus/usb/devices/usb1/1-1/1-1.5/1-1.5.1/1-1.5.1:1.0/ttyUSB0/tty/ttyUSB0/dev
/sys/bus/usb/devices/usb1/1-1/1-1.5/1-1.5.1/dev
/sys/bus/usb/devices/usb1/1-1/1-1.5/1-1.5.2/dev
/sys/bus/usb/devices/usb1/1-1/1-1.5/1-1.5.2/1-1.5.2:1.0/sound/card1/pcmC1D0c/dev
/sys/bus/usb/devices/usb1/1-1/1-1.5/1-1.5.2/1-1.5.2:1.0/sound/card1/pcmC1D0p/dev
/sys/bus/usb/devices/usb1/1-1/1-1.5/1-1.5.2/1-1.5.2:1.0/sound/card1/controlC1/dev
/sys/bus/usb/devices/usb1/1-1/1-1.5/1-1.5.2/1-1.5.2:1.3/0003:0D8C:0012.0003/input/input3/event2/dev
/sys/bus/usb/devices/usb1/1-1/1-1.5/1-1.5.2/1-1.5.2:1.3/0003:0D8C:0012.0003/hidraw/hidraw2/dev
/sys/bus/usb/devices/usb1/1-1/1-1.3/1-1.3:1.3/0003:0D8C:0012.0002/input/input2/event1/dev
/sys/bus/usb/devices/usb1/1-1/1-1.3/1-1.3:1.3/0003:0D8C:0012.0002/hidraw/hidraw1/dev
/sys/bus/usb/devices/usb1/1-1/1-1.3/dev
/sys/bus/usb/devices/usb1/1-1/1-1.3/1-1.3:1.0/sound/card0/controlC0/dev
/sys/bus/usb/devices/usb1/1-1/1-1.3/1-1.3:1.0/sound/card0/pcmC0D0c/dev
/sys/bus/usb/devices/usb1/1-1/1-1.3/1-1.3:1.0/sound/card0/pcmC0D0p/dev
/sys/bus/usb/devices/usb1/1-1/1-1.1/dev
/sys/bus/usb/devices/usb1/1-1/dev
I would be looking to create perhaps some sort of mapping based on the USB port that a digirig is connected to gets mapped to a specific device number “/dev/hidraw1”… “/dev/hidraw2”
To ensure a USB sound card always appears as the same /dev/ device on a Linux system based on the USB port it’s plugged into, you can use udev rules to map the device to a consistent device file. This can be achieved by identifying the USB port’s unique attributes and creating a persistent symlink. Below is a step-by-step guide to accomplish this:
Step 1: Identify the USB Sound Card and Port Details
-
Plug in the USB Sound Card to the desired USB port on the motherboard.
-
Check the Device Information: Run the following command to list USB devices and their attributes:
bash
lsusb
This will display a list of USB devices, including your sound card. Note the vendor ID and product ID (e.g., 1234:5678).
- Get Detailed USB Port Information: Use lsusb -t to see the USB device tree and identify the port path:
bash
lsusb -t
This shows the USB hierarchy, including bus and port numbers (e.g., Bus 01.Port 3). Note the bus and port number for your sound card.
- Find the Device in /sys: Run udevadm info to get detailed information about the device:
bash
udevadm info -a -p $(udevadm info -q path -n /dev/snd/controlC0)
Replace /dev/snd/controlC0 with the actual device node of your sound card (check /dev/snd/ to find the correct one, e.g., controlC0, controlC1, etc.). Look for attributes like:
-
ATTRS{idVendor} (matches the vendor ID from lsusb)
-
ATTRS{idProduct} (matches the product ID from lsusb)
-
ATTRS{port} (the USB port number)
-
KERNELS (shows the USB port path, e.g., 1-3 for Bus 1, Port 3)
The KERNELS or DEVPATH will include the USB port path, which is critical for identifying the specific port.
Step 2: Create a udev Rule
- Write a udev Rule: Create a new udev rule file, e.g., /etc/udev/rules.d/90-usb-soundcard.rules:
bash
sudo nano /etc/udev/rules.d/90-usb-soundcard.rules
- Add a Rule Based on USB Port: Use the USB port path and device attributes to create a persistent symlink. For example:
bash
SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS=="1-3", ATTRS{idVendor}=="1234", ATTRS{idProduct}=="5678", SYMLINK+="snd/mysoundcard"
-
SUBSYSTEM==“sound”: Targets sound devices.
-
KERNEL==“controlC*”: Matches the sound card control device (adjust if needed, e.g., controlC0, controlC1).
-
KERNELS==“1-3”: Matches the USB port path (replace 1-3 with the port path from udevadm info, e.g., 1-3 for Bus 1, Port 3).
-
ATTRS{idVendor}==“1234”, ATTRS{idProduct}==“5678”: Matches the sound card’s vendor and product IDs.
-
SYMLINK+=“snd/mysoundcard”: Creates a symlink at /dev/snd/mysoundcard for the device.
Save and close the file.
- Test the Rule: Reload udev rules and trigger them:
bash
sudo udevadm control --reload-rules
sudo udevadm trigger
- Verify the Symlink: Unplug and replug the USB sound card into the same port, then check if the symlink appears:
bash
ls -l /dev/snd/
You should see something like:
bash
lrwxrwxrwx 1 root root 12 Jun 9 12:57 mysoundcard -> controlC0
Step 3: Verify Consistency
-
Plug the sound card into a different USB port to ensure the symlink only appears when connected to the specified port.
-
If the symlink doesn’t appear or points to the wrong device, double-check the KERNELS, idVendor, and idProduct values in the udev rule.
Additional Notes
-
Port Path Specificity: The KERNELS attribute ensures the rule applies only to the specific USB port. If the motherboard has multiple USB controllers, the Bus number might change, so verify the port path with lsusb -t or udevadm info.
-
Multiple Sound Cards: If you have multiple USB sound cards, use unique idVendor and idProduct values or additional attributes like ATTRS{serial} to differentiate them.
-
Dynamic Device Nodes: The actual device node (controlC0, controlC1, etc.) may change based on the order devices are detected. The symlink ensures your application always references the same path (/dev/snd/mysoundcard).
-
Debugging: If the rule doesn’t work, check udev logs:
bash
sudo udevadm monitor
Then plug in the device to see how udev processes it.
Example for Clarity
Suppose your USB sound card has:
Your udev rule would look like:
bash
SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS=="1-2", ATTRS{idVendor}=="0d8c", ATTRS{idProduct}=="013c", SYMLINK+="snd/mysoundcard"
This creates a consistent /dev/snd/mysoundcard symlink whenever the sound card is plugged into the specified port.
Troubleshooting
-
No Symlink: Ensure the KERNELS value matches the exact port path from udevadm info.
-
Wrong Device: Verify the idVendor and idProduct are correct and unique to your sound card.
-
Permissions: If the symlink is created but inaccessible, add a MODE=“0660”, GROUP=“audio” to the udev rule to set appropriate permissions:
bash
SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS=="1-2", ATTRS{idVendor}=="0d8c", ATTRS{idProduct}=="013c", SYMLINK+="snd/mysoundcard", MODE="0660", GROUP="audio"
This approach ensures your USB sound card is consistently mapped to the same /dev/ device based on the USB port, making it reliable for applications that require a fixed device path.
@K0TX is a serial number something that might be able to be added to the DigiRig devices in the future or is this up to the “C-Media Electronics Inc.”