Automatically switch audio devices on connection

Bug #1702794 reported by Doug McMahon
34
This bug affects 6 people
Affects Status Importance Assigned to Milestone
pulseaudio (Ubuntu)
Fix Released
Medium
Daniel van Vugt
Nominated for Xenial by Daniel van Vugt
Nominated for Zesty by Daniel van Vugt

Bug Description

This way once a user pairs & connects a bluetooth speaker device pulseaudio will auto switch to it.
As it stands now users have to open sound settings & switch manually. It's bad enough that auto discover & connect don't work, (can be scripted thru bluetoothctl), no sense adding to frustration

In the ### Automatically load driver modules for Bluetooth hardware section

.ifexists module-switch-on-connect.so
load-module module-switch-on-connect
.endif

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: pulseaudio 1:8.0-0ubuntu3.3
ProcVersionSignature: Ubuntu 4.8.0-56.61~16.04.1-generic 4.8.17
Uname: Linux 4.8.0-56-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.6
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC1: doug 1843 F.... pulseaudio
 /dev/snd/controlC0: doug 1843 F.... pulseaudio
CurrentDesktop: Unity
Date: Thu Jul 6 20:02:15 2017
SourcePackage: pulseaudio
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 09/18/2013
dmi.bios.vendor: LENOVO
dmi.bios.version: 74CN44WW(V3.05)
dmi.board.asset.tag: No Asset Tag
dmi.board.name: VIQY0Y1
dmi.board.vendor: LENOVO
dmi.board.version: 31900058STD
dmi.chassis.asset.tag: No Asset Tag
dmi.chassis.type: 10
dmi.chassis.vendor: LENOVO
dmi.chassis.version: Lenovo IdeaPad Y510P
dmi.modalias: dmi:bvnLENOVO:bvr74CN44WW(V3.05):bd09/18/2013:svnLENOVO:pn20217:pvrLenovoIdeaPadY510P:rvnLENOVO:rnVIQY0Y1:rvr31900058STD:cvnLENOVO:ct10:cvrLenovoIdeaPadY510P:
dmi.product.name: 20217
dmi.product.version: Lenovo IdeaPad Y510P
dmi.sys.vendor: LENOVO
modified.conffile..etc.pulse.default.pa: [modified]
mtime.conffile..etc.pulse.default.pa: 2017-07-04T13:42:27.651527

Revision history for this message
Doug McMahon (mc3man) wrote :
tags: added: artful
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Re: Please add module-switch-on-connect to default.pa

I like the idea. It annoys me too that this isn't the default behaviour...

https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#index65h3

I'll do some testing, see if we can get it in to artful soon and xenial later.

summary: - Please add this to default.pa
+ Please add module-switch-on-connect to default.pa
Changed in pulseaudio (Ubuntu):
assignee: nobody → Daniel van Vugt (vanvugt)
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

It seems I was requesting the same kind of fix a while back but didn't know what the answer was: bug 1692474. Thanks!

Revision history for this message
Daniel van Vugt (vanvugt) wrote :
Changed in pulseaudio (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pulseaudio - 1:10.0-2ubuntu1

---------------
pulseaudio (1:10.0-2ubuntu1) artful; urgency=medium

  * Cherrypick fixes for common crashes from upstream:
    - cb78d6f5: SIGABRT in device_start_waiting_for_profiles (LP: #1690028,
      LP: #1672171)
    - d985276c: SIGABRT in pa_alsa_path_set_volume (LP: #1539209, LP: #1562817)
  * Enable modules that needn't be disabled:
    - module-role-cork: Now enabled per upstream defaults (LP: #1701688)
    - module-switch-on-connect: Enabled for seamless hotplugging (LP: #1702794)
  * Don't try to load sounds that don't exist in Kubuntu (LP: #1703334)
  * Merge latest debian changes (see below).

 -- Daniel van Vugt <email address hidden> Tue, 11 Jul 2017 16:57:16 +0800

Changed in pulseaudio (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Khurshid Alam (khurshid-alam) wrote :

After this my bluetooth speaker simply refuses to switch to a2dp_sink profile. It always stays at hsp no mater what I do.

So far it wasn't enabled exactly for that reason. Read https://bugs.freedesktop.org/show_bug.cgi?id=93898 and https://bugs.freedesktop.org/show_bug.cgi?id=73325#c52

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Thanks. I noticed it now refuses to switch more often, but not always, and that's also not strictly a new bug. It did happen before the update too, just less often (for me).

I'll look into this soon...

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

@khurshid-alam, the bugs you refer to don't seem to mention switch-on-connect (?)

Also, I have finally stopped using my unreliable USB Bluetooth dongle and set up 17.10 on a laptop again. This feature is now working perfectly (other than on the first boot when it chose the wrong profile, but perfect many times after that).

If you have any problems at all then please log a new bug using this command:
  ubuntu-bug pulseaudio

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Also, the bugs you refer to are the opposite of what you mention in comment #6. Please log a new bug.

Revision history for this message
Khurshid Alam (khurshid-alam) wrote :

@Daniel

It was working with 1:10.0-1ubuntu2. Now most times a2dp profile is unavailable or I can't switch it to it. Anyway I will file a new bug.

summary: - Please add module-switch-on-connect to default.pa
+ Automatically switch audio devices on connection
Revision history for this message
David (dave400) wrote :

I'm affected by this same bug on my desktop and laptop - both running Ubuntu 16.04.2 (64-bit).

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

As this is a feature and not a bug, it is unlikely to be backported to Ubuntu 16.04.

But you can do it yourself by adding to /etc/pulse/default.pa:

### Use hot-plugged devices like Bluetooth or USB automatically (LP: #1702794)
.ifexists module-switch-on-connect.so
load-module module-switch-on-connect
.endif

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

It sounds like we might be able to drop module-switch-on-connect in future, as PulseAudio 11.0 solves the same problem by default:
  https://www.freedesktop.org/wiki/Software/PulseAudio/Notes/11.0/

tags: added: pulse11
Revision history for this message
Rik Mills (rikmills) wrote :

Seems this change now also result in:

https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1720519

causing pulseaudio to fail to load on Kubuntu

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Yes, I think we'll end up with two (redundant) fixes for this. Both comment #13 and bug 1720519.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.