Tell PulseAudio to ignore a USB device using udev

PulseAudio is fantastic software for managing sound on your desktop. However, if you have specialist audio hardware, you likely want your application to access this hardware without any interference from PulseAudio. For example, you might have a USB digital-to-analog converter (DAC) or USB soundcard.

Disabling PulseAudio often leads to more problems than it solves. A more effective solution is to tell PulseAudio to ignore a specific device using udev rules. udev is a device manager for Linux, and you can give udev instructions to apply custom configuration for specific devices.

Gather USB device information

Before creating a udev rule, you need to find a unique way to identify your USB device. lsusb will list all connected USB devices:

$ lsusb
Bus 004 Device 003: ID 1852:5110 GYROCOM C&C Co., LTD

Use the Bus and Device numbers from above to gather more information about your device. We’re mostly interested in the idVendor and idProduct:

$ sudo lsusb -v -s 004:003
idVendor           0x1852 GYROCOM C&C Co., LTD
idProduct          0x5110

Create a udev rule

Your system should have udev rules already defined in the /lib/udev/rules.d directory, such as 90-pulseaudio.rules. There should also be a /etc/udev/rules.d directory where you can define your own rules.

The rules are parsed in lexical order. Create a file called /etc/udev/rules.d/89-pulseaudio-usb.rules, so that it’s parsed just before 90-pulseaudio.rules (though you may have to experiment with the numbering if things don’t work as expected).

Open the file in your favourite editor and create a rule. Use the idVendor and idProduct numbers from earlier to uniquely match your USB device, and then set an environment variable that tells PulseAudio to ignore the device:

ATTRS{idVendor}=="1852", ATTRS{idProduct}=="5110", ENV{PULSE_IGNORE}="1"

Optionally, you might want to apply other changes to the device, such as access permissions or device ownership. Write each rule on a separate line:

ATTRS{idVendor}=="1852", ATTRS{idProduct}=="5110", ENV{PULSE_IGNORE}="1"
ATTRS{idVendor}=="1852", ATTRS{idProduct}=="5110", GROUP="mpd"

Reboot your system and PulseAudio will no longer acknowledge that your USB device exists.