Bug 89934

Summary: Does not switch to USB headset anymore
Product: PulseAudio Reporter: Paolo Borelli <pborelli>
Component: miscAssignee: pulseaudio-bugs
Status: RESOLVED FIXED QA Contact: pulseaudio-bugs
Severity: normal    
Priority: medium CC: adam, lennart, rishi.is, yanp.bugz
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Paolo Borelli 2015-04-07 09:50:26 UTC
After upgrading to Fedora 22 (not yet released), when I plug in my USB headset audio is still routed to to the system mic and speakers. I have to manually switch from the gnome audio panel.

On IRC it was suggested to report this upstream


paolo@murdock ~/dcv $ pulseaudio --version
pulseaudio 6.0

paolo@murdock ~/dcv $ rpm -qa | grep pulseaudio
pulseaudio-libs-glib2-6.0-2.fc22.x86_64
pulseaudio-utils-6.0-2.fc22.x86_64
pulseaudio-module-x11-6.0-2.fc22.x86_64
pulseaudio-6.0-2.fc22.x86_64
pulseaudio-libs-devel-6.0-2.fc22.x86_64
alsa-plugins-pulseaudio-1.0.29-1.fc22.x86_64
pulseaudio-libs-6.0-2.fc22.i686
pulseaudio-module-bluetooth-6.0-2.fc22.x86_64
pulseaudio-libs-6.0-2.fc22.x86_64
pulseaudio-gdm-hooks-6.0-2.fc22.x86_64
paolo@murdock ~/dcv $
Comment 1 Paolo Borelli 2015-04-07 09:57:35 UTC
One thing I noticed is that the module-switch-on-connect is not loaded even if it is present on the system

paolo@murdock ~/dcv $ lsof -p 1947 | grep switch
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/42/gvfs
      Output information may be incomplete.
pulseaudi 1947 paolo  mem       REG               8,18     15112 1854808 /usr/lib64/pulse-6.0/modules/module-switch-on-port-available.so
Comment 2 Tanu Kaskinen 2015-04-07 10:02:21 UTC
Being present on the system isn't enough for a module to get loaded. module-switch-on-connect is not loaded by default. Maybe you had the module enabled in /etc/pulse/default.pa before the upgrade, and the upgrade overwrote that file?
Comment 3 Paolo Borelli 2015-04-07 10:36:41 UTC
(In reply to Tanu Kaskinen from comment #2)
> Being present on the system isn't enough for a module to get loaded.
> module-switch-on-connect is not loaded by default. Maybe you had the module
> enabled in /etc/pulse/default.pa before the upgrade, and the upgrade
> overwrote that file?

Could be, but for sure I did not change it manually in the past...

Any reason why that is not part of the default?


Anyway I'll try and see if that fixes the problem
Comment 4 Tanu Kaskinen 2015-04-07 10:59:08 UTC
(In reply to Paolo Borelli from comment #3)
> Any reason why that is not part of the default?

I think the reason is that there are important use cases where it's not appropriate to switch to a new device when it appears. I don't remember what those use cases are more specifically.
Comment 5 Paolo Borelli 2015-04-07 11:13:30 UTC
(In reply to Tanu Kaskinen from comment #4)
> I think the reason is that there are important use cases where it's not
> appropriate to switch to a new device when it appears. I don't remember what
> those use cases are more specifically.

Well, pluggin in a usb headset and expecting it to work seems an important use case and something that used to work without fiddling with etc files...
Comment 6 Rex Dieter 2015-04-07 12:56:14 UTC
On my f22 box, /etc/pulse/default.pa contains:

### Should be after module-*-restore but before module-*-detect
load-module module-switch-on-port-available
Comment 7 Tanu Kaskinen 2015-04-07 17:33:18 UTC
module-switch-on-port-available is different from module-switch-on-connect. module-switch-on-port-available doesn't move streams between devices, it only controls which port is active on a sink or source that has multiple ports.
Comment 8 Raymond 2015-04-11 02:24:46 UTC
> 
> Well, pluggin in a usb headset and expecting it to work seems an important
> use case and something that used to work without fiddling with etc files...


you are assume that notebook has only one usb port , but most desktops have more than one usb port which allow  usb webcam and usb headset plugged at the same time
Comment 9 Adam Goode 2017-05-05 20:06:32 UTC
To do this properly, pulseaudio should fingerprint each audio device and remember if a user switched to it in the past. Since many devices are hotplug devices (including HDMI monitors), this is more important than it used to be.

Chrome OS had to recently implement this. Previously they had a stateless heuristic for choosing a device, but had to add persistence because of unpredictability of hotplug ordering and other issues.

http://crbug.com/308143 for reference.
Comment 10 Adam Goode 2017-05-05 20:14:53 UTC
Oh, it looks like module-default-device-restore is supposed to do this, with fingerprinting even. Sorry for not seeing this.

I guess that module is not working then?
Comment 11 Tanu Kaskinen 2017-05-06 18:05:41 UTC
module-default-device-restore is broken indeed. I hope it will be fixed in the upcoming release.
Comment 12 Adam Goode 2017-05-10 18:50:14 UTC
*** Bug 90870 has been marked as a duplicate of this bug. ***
Comment 13 Tanu Kaskinen 2017-06-29 21:12:22 UTC
I submitted a patch for fixing module-default-device-restore:
https://patchwork.freedesktop.org/patch/164480/
Comment 14 Tanu Kaskinen 2017-07-20 14:10:03 UTC
The module-default-device-restore patch is now in master. PulseAudio 11.0 should remember your choice if you set a USB device as the default.

Additionally, another patch has been applied earlier that makes USB device priority higher than built-in sound cards, so often you don't need any manual steps if you prefer to use a USB device.

I'll close this bug now.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.