Disable docking station sound card while still being able to use a USB sound card
How do I blacklist or otherwise permanently disable the sound card on the docking station, while keeping the ability to use USB sound devices and the ability to use the other features of the docking station?
Hardware:
- I have a USB soundcard based set of earphones.
Bus 002 Device 014: ID 046d:0a44 Logitech, Inc. Headset H390
- I also have a Dell D3100 docking station that I use as a USB multiplier and to run an additional screen. These USB devices I believe are related to the USB Hub:
Bus 003 Device 005: ID 17e9:436e DisplayLink
Bus 003 Device 004: ID 2109:0813 VIA Labs, Inc.
Bus 003 Device 003: ID 17e9:436e DisplayLink
Bus 003 Device 002: ID 2109:0813 VIA Labs, Inc.
Bus 002 Device 005: ID 2109:2813 VIA Labs, Inc.
Bus 002 Device 003: ID 2109:2813 VIA Labs, Inc.
Here are all the sound devices:
# cat /proc/asound/modules
0 snd_hda_intel # Built in HP Audio
1 snd_usb_audio # Dell Docking Station Sound
2 snd_hda_intel # Built in HP Audio (HDMI)
3 snd_usb_audio # Headset
Here are details about the device I wish to keep using:
T: Bus=02 Lev=03 Prnt=16 Port=00 Cnt=01 Dev#= 19 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=16 #Cfgs= 1
P: Vendor=046d ProdID=0a44 Rev=01.27
S: Manufacturer=Logitech
S: Product=Logitech USB Headset
C: #Ifs= 4 Cfg#= 1 Atr=80 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=snd-usb-audio
I: If#= 1 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio
I: If#= 2 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio
I: If#= 3 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid
description: Audio device
product: Logitech USB Headset
vendor: Logitech
physical id: 1
bus info: usb@2:4.2.1
version: 1.27
capabilities: usb-1.10 audio-control
configuration: driver=usbhid maxpower=100mA speed=12Mbit/s
And here are details about the device I wish to blacklist:
T: Bus=03 Lev=02 Prnt=06 Port=02 Cnt=03 Dev#= 8 Spd=5000 MxCh= 0
D: Ver= 3.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs= 1
P: Vendor=17e9 ProdID=436e Rev=31.24
S: Manufacturer=DisplayLink
S: Product=Dell D3100 USB3.0 Dock
S: SerialNumber=1709142212
C: #Ifs= 7 Cfg#= 1 Atr=e0 MxPwr=8mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=03 Driver=usbfs
I: If#= 1 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
I: If#= 2 Alt= 0 #EPs= 1 Cls=01(audio) Sub=01 Prot=20 Driver=snd-usb-audio
I: If#= 3 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=20 Driver=snd-usb-audio
I: If#= 4 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=20 Driver=snd-usb-audio
I: If#= 5 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0d Prot=00 Driver=cdc_ncm
I: If#= 6 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver=cdc_ncm
And the Sound Device Specifically:
*-usb:2
description: Audio device
product: Dell D3100 USB3.0 Dock
vendor: DisplayLink
physical id: 3
bus info: usb@3:4.3
version: 31.24
serial: 1709142212
capabilities: usb-3.10 audio-control
configuration: driver=cdc_ncm maxpower=8mA speed=5000Mbit/s
I don't have this specific dock, but I have a similar one (the Dell WD19) which also has line-out and headphones sockets. It's frustrating because PulseAudio will automatically switch sound output to the dock headphones output every time I connect the dock, even if there's no headphones connected. If I'm taking a call I'll connect a USB headset, so I have no use for the headphones or line-out ports on the dock. I do quite like having PulseAudio switch automatically to the USB headset though, so I don't want to disable the automatic switching altogether. It's possible to change the active output through the command line, as described in this question, but the automatic switching still goes back to the dock outputs when I disconnect the headset.
It turns out it's not so hard to have PulseAudio ignore a device, through a udev rule. (Original source)
1. Find USB device vendor and product IDs
Run pactl list sinks
to see the details of all the audio outputs known to PulseAudio. This will produce quite a lot of output, but it should be easy enough to find the specific device(s) we want to blacklist.
Sink #21
State: RUNNING
Name: alsa_output.usb-Generic_USB_Audio_200901010001-00.HiFi__hw_Dock__sink
Description: USB Audio Headphones
Driver: module-alsa-card.c
Sample Specification: s24le 2ch 48000Hz
Channel Map: front-left,front-right
Owner Module: 37
Mute: no
Volume: front-left: 30419 / 46% / -20.00 dB, front-right: 30419 / 46% / -20.00 dB
balance 0.00
Base Volume: 65536 / 100% / 0.00 dB
Monitor Source: alsa_output.usb-Generic_USB_Audio_200901010001-00.HiFi__hw_Dock__sink.monitor
Latency: 21709 usec, configured 18750 usec
Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY
Properties:
alsa.resolution_bits = "24"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "USB Audio"
alsa.id = "USB Audio"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "0"
alsa.card = "1"
alsa.card_name = "WD19 Dock"
alsa.long_card_name = "Dell-WD15-Dock"
alsa.driver_name = "snd_usb_audio"
device.bus_path = "pci-0000:00:14.0-usb-0:1.3.4:1.0"
sysfs.path = "/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1.3/1-1.3.4/1-1.3.4:1.0/sound/card1"
udev.id = "usb-Generic_USB_Audio_200901010001-00"
device.bus = "usb"
device.vendor.id = "0bda"
device.vendor.name = "Realtek Semiconductor Corp."
device.product.id = "402e"
device.product.name = "USB Audio"
device.serial = "Generic_USB_Audio_200901010001"
device.string = "hw:Dock"
device.buffering.buffer_size = "576000"
device.buffering.fragment_size = "288000"
device.access_mode = "mmap+timer"
device.profile.name = "HiFi: hw:Dock: sink"
device.profile.description = "Headphones"
alsa.mixer_device = "hw:Dock"
device.description = "USB Audio Headphones"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card-usb"
Ports:
[Out] Headphones: Headphones (priority: 100)
Active Port: [Out] Headphones
Formats:
pcm
We are looking for the lines device.vendor.id = "0bda"
and device.product.id = "402e"
.
2. Create custom udev rule
Create a file /etc/udev/rules.d/89-pulseaudio-usb.rules
(with your preferred editor) and insert a line like this, using the vendor and product IDs found before:
ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="402e", ENV{PULSE_IGNORE}="1"
Save the file, then disconnect the dock.
3. Reconnect (restart not needed)
udev should read this new rule and tell PulseAudio to ignore the device the very next time it is connected - a restart shouldn't be necesary (at least I didn't need to on Ubuntu 20.04). The device will no longer show up at all as an output device for PulseAudio, so it won't be chosen automatically as the output device.