I will potentially have several USB sound cards connected to a single Raspberry PI and I want to play be able to play sound on speciffic sound card identified by physical USB port it's connected to
I can find USB sound cards using shell script
find /sys/devices/ -name id | grep sound | grep usb
Which results in something like that (currently only one is connected)
/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5.2/1-1.5.2:1.0/soundCard1/id
The 1-1.5.2
part describes the physical USB port it's connected to.
In Java when I fetch Mixer.Info
using AudioSystem.getMixerInfo()
none of the properties of that sound card get me the info about USB port or specific device in /sys/devices/
:
info.getName(); // "Device [plughw:1,0]"
info.getDescription() // Direct Audio Device: USB Audio Device, USB Audio, USB Audio
info.toString() // Device [plughw:1,0], version 5.10.103-v7+
Is there a way to match Mixer.Info
to a speciffic device found in /sys/devices/
? Or any other way to identify device by USB port it's connected to?