Change audio device PID and VID name?

Hello,

Is it possible to edit my audio device PID and VID to give it a custom name? My goal is to make a custom name for my audio device so when I use Roon my audio device is listed as the custom name I assign it rather than the standard PID and VID name of the device.

Thanks in advance!

Not sure where Roon reads identifiers from (or which ones PID and VID refer to) but there are those which are given by the hardware itself and there are the ALSA interface names in /etc/asound.conf. We simply override the “default” interfaces there but you can add own entries linked in a certain way to certain sound card and device (integer) IDs and when Roon uses those ALSA interface identifiers that could be what you want.

But probably someone has deeper insights then me with audio setup im general :wink:.

I’m referring to what is given by the hardware itself. The firmware in the hardware provides the PID and VID information to ALSA. Here’s what comes up when I list my audio devices"



**** List of PLAYBACK Hardware Devices ****
card 0: Audio [Intel HDMI/DP LPE Audio], device 0: HdmiLpeAudio [Intel HDMI/DP LPE Audi]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: Audio [Intel HDMI/DP LPE Audio], device 1: HdmiLpeAudio [Intel HDMI/DP LPE Audi]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: Audio [Intel HDMI/DP LPE Audio], device 2: HdmiLpeAudio [Intel HDMI/DP LPE Audi]
Subdevices: 1/1
Subdevice #0: subdevice #0



Roon displays “Intel HDMI/DP LPE Audio” I would like to edit that name so it displays what I want instead. Is this possible?

Okay, at least I have no idea if that is possible and in case how to achieve. That seems to go into Linux depth, probably not even possible in userland, but the good thing is if you (or someone else) finds or knows a method on any Linux distro, that should work on DietPi as well.

Do you happen to know of any Linux guru’s that might know what to do? I found this link but it’s over my head:

https://www.alsa-project.org/wiki/Changing_card_IDs_with_udev

If you understand what he’s saying better than me, and can decode it into steps that achieve how to do it, please let me know.

Ah okay, so the card ID is stored here: cat /sys/class/sound/card0/id
And you can change it by writing to this file: echo AwesomeCard > /sys/class/sound/card0/id
Hmm, at least it might be possible. On my VM it says: -bash: echo: write error: Invalid argument

However, now the idea is to do this via udev rule on early boot, probably this works better:

echo 'SUBSYSTEM=="sound", KERNEL=="card0", ACTION=="add", ATTR{id}="AwesomeCard"' > /etc/udev/rules.d/99-rename_card0.rules

Ok I tried that and it didn’t work for some reason. However I discovered that it’s the ATTRS{product}== that needs to be renamed, not the ATTR{id}==. So rather than renaming my HDMI ports, let’s try with a USB DAC instead. I discovered how to pull up all the detailed info on this USB DAC by running this command:

udevadm monitor --kernel --subsystem-match=sound

Then discovering the USB DAC is listed as:

/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.1/1-2.1.4/1-2.1.4:1.0/sound/card1

So then I ran:

udevadm info -ap /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.1/1-2.1.4/1-2.1.4:1.0/sound/card1

And got all the detailed info about the DAC:

looking at device ‘//devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.1/1-2.1.4/1-2.1.4:1.0/sound/card1’:
KERNEL==“card1”
SUBSYSTEM==“sound”
DRIVER==""
ATTR{id}==“Amplif”
ATTR{number}==“1”

looking at parent device ‘//devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.1/1-2.1.4’:
KERNELS==“1-2.1.4”
SUBSYSTEMS==“usb”
DRIVERS==“usb”
ATTRS{ltm_capable}==“no”
ATTRS{version}==" 2.01"
ATTRS{rx_lanes}==“1”
ATTRS{bConfigurationValue}==“1”
ATTRS{avoid_reset_quirk}==“0”
ATTRS{idProduct}==“0128”
ATTRS{bNumInterfaces}==" 3"
ATTRS{bcdDevice}==“0000”
ATTRS{busnum}==“1”
ATTRS{bMaxPower}==“100mA”
ATTRS{tx_lanes}==“1”
ATTRS{bDeviceSubClass}==“02”
ATTRS{quirks}==“0x0”
ATTRS{bNumConfigurations}==“1”
ATTRS{maxchild}==“0”
ATTRS{authorized}==“1”
ATTRS{speed}==“480”
ATTRS{bDeviceProtocol}==“01”
ATTRS{devnum}==“6”
ATTRS{bDeviceClass}==“ef”
ATTRS{manufacturer}==“Headset Meizu Corp”
ATTRS{urbnum}==“61”
ATTRS{product}==“Meizu HiFi DAC Headphone Amplifier”
ATTRS{devpath}==“2.1.4”
ATTRS{idVendor}==“2a45”
ATTRS{bmAttributes}==“a0”
ATTRS{removable}==“unknown”
ATTRS{configuration}==""
ATTRS{bMaxPacketSize0}==“64”

Since “Meizu HiFi DAC Headphone Amplifier” is what is broadcasted to Roon, it’s what I need to rename. So it’s the ATTRS{product} that needs renamed, not the ATTR{id}. If I can figure out how to do this with this USB DAC, I will be able to do it for any audio device.

I also found this page which explains another way to do it. However it’s also over my head. I tried to do what they say with no luck.

http://forums.debian.net/viewtopic.php?t=55560

I guess it also depends on the kernel itself if renaming those hardware identifiers is allowed or not.