Score:0

Pulseaudio: how to stop audio sink from switching automatically to usb-c hub?

us flag

I'm using Ubuntu 21.04 with an intel tablet and a lenovo usb-c hub that has an audio adapter.

I never have anything hooked into the audio jack on usb-c hub, yet every time I plug my tablet into the usb-c hub the sound output switches to the usb-c hub instead of staying routed to the tablet speakers. I then have to go either into settings or use a sound output extension to switch it back to the speakers.

This issue does not happen when using Windows 10 - audio stays routed through the tablet speakers - my guess is that it goes a step further and detects whether an audio jack actually has a cable plugged in or not.

In /etc/pulse/default.pa I've tried commenting out the module-switch-on-connect option and later tried commenting out the module-switch-on-port-available option too, it still seems to switch automatically upon connecting the hub.

see also OS confusion about default audio sink - pulse

24601 avatar
in flag
Bug reports should be filed at https://askubuntu.com/questions/5121/how-do-i-report-a-bug
us flag
done: https://bugs.launchpad.net/ubuntu/+bug/1938623
Nate T avatar
it flag
cn you list the output of `pactl list sinks` while the hub is plugged in and the issue is occuring? I can give you a reversible solution (config file) that will make it so the hub audio is inactive unless they are the only option. Nevermind. It is the second solution below. Set priority to 1 and it will never intercept the sink input unless the other sinks are out of commission altogether.
Score:2
in flag

I have a similar problem (Ubuntu 18), and this is how I solved it.

The pulse audio system has a module that automatically switches audio devices when a new device is plugged in. Typically, this is helpful, especially when you plug in headphones and unplug them. I found disabling this module is not really helpful. Newer versions of pulseaudio support blacklisting devices, but I think the following is sometimes a better solution and works with older versions of pulseaudio.

In a few cases, devices that are not primarily audio (such as your usb hub, and video cards with HDMI audio capability) make this messy. The system has priories to fix this, but USB audio devices have the highest priority.

Fixing this involves creating two files for your device. For explanation purposes, let's call this device 'myunusedaudio'.

The first file is /etc/udev/rules.d/99-myunusedaudio.rules This file needs to include a udev rule to recognize the device. Typically, you would want to match it with one or more attributes such as ATTRS{idProduct} ATTRS{idVendor} ATTRS{serial} The match line should include the attribute ENV{PULSE_PROFILE_SET}="myunusedaudio.conf" which links it to the next file. Please check with other guides on how to build and test a udev match rule for your device. If you make changes to this file, generally unplugging the usb device and plugging it back in will make the changes take effect.

The second file would be: /usr/share/pulseaudio/alsa-mixer/profile-sets/myunusedaudio.conf (Note filename match with above.) In this file, you set a priority so that your device is the lowest priority and will never be a default device. The file contents should be:

[General]
priority = 1

After these two files are in place, your audio device should no longer be chosen as the default when you plug it in.

us flag
Thanks! Will try to explore this option soon. I might have found another possible method using just the pulseeffects app (using settings>pulseaudio>use default & possibly blocklist) as well but haven't had a chance to rigorously test it yet.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.