On my Linux desktop I have multiple sound devices. Typically it’s the built-in sound card, the graphics card audio output and my GoXLR outputs. I don’t ever want to use the built-in audio or have audio routed to my monitor. But the Linux desktop has this habit of sometimes switching to one of those outputs, especially when coming out of standby because the USB audio devices provided by the GoXLR disappear.

Similarly, my webcam has a microphone, which I never ever want to use. I have a proper microphone which should be the only input.

In order to push the system to do the right thing, I want to generally disable any audio output or input device I don’t use. This can be done with udev rules, but getting the rules right is tricky and differs between USB and PCI devices.


Start by running lspci -nn, and find all the audio devices:

0c:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 21/23 HDMI/DP Audio Controller [1002:ab28]
0e:00.4 Audio device [0403]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse HD Audio Controller [1022:1487]

The last column, it looks like [xxxx:yyyy], is the PCI vendor and device ID. Now we can create the following udev rule to remove the device:

ACTION=="add", SUBSYSTEM=="sound", ATTRS{vendor}=="0x1022", ATTRS{device}=="0x1487", RUN:="/bin/sh -c 'echo 1 > $sys$devpath/device/remove'"

Note that the ATTRS{vendor} and ATTRS{device} need to be prefixed with 0x when dealing with PCI devices.

Plonk that rule in a file like /etc/udev/rules.d/40-sound.rules and restart. The respective device should no longer show up in lspci and as such won’t show up in pulseaudio/pipewire etc.


For USB we do much the same thing. Run lsusb looking for the device you want to disable. There’ll be an ID of the form xxxx:yyyy much like we had for our PCI devices:

Bus 005 Device 008: ID 2e1a:4c01 Insta360 Insta360 Link

In the case of USB, we don’t remove the device like we did with PCI. Instead, we want to mark it as unauthorized:

SUBSYSTEM=="usb", DRIVER=="snd-usb-audio", ATTRS{idVendor}=="2e1a", ATTRS{idProduct}=="4c01", ATTR{authorized}="0"

By targetting DRIVER=="snd-usb-audio" we ensure we only disable the audio device, not video. This means the webcam keeps working as intended, but its microphone is no longer an input that the system knows about. Also note that for USB we need to use idVendor and idProduct and we don’t add the 0x prefix for them.


After this, you should know how to disable audio devices using udev rules. Disabling a PCI device requires removing it, whereas for USB we can mark it as unauthorised.

Things can get more tricky if you want to disable other types of devices. It’s usually handy to start from a /dev device class, like /dev/input for mouse or keyboard:

ls /dev/input/by-id/

Ask udevadm for the device path:

udevadm info --query=path --name=/dev/input/by-id/usb-Logitech_USB_Receiver-if02-mouse

Knowing that, you can request additional information, for example by walking its attributes:

udevadm info -a -p /devices/pci0000:00/0000:00:08.1/0000:0e:00.3/usb5/5-1/5-1.1/5-1.1.2/5-

The Arch Wiki entry on udev might also prove helpful.