1

I manage to use a bluetooth earpiece from Plantronics by fiddling the sound settings as follows, and am looking for ways to hard-wire this UI laden workflow to happen by default as the headset connects.

The workflow I currently go through every time is the following:

  1. Once the headset is powered on and connected through bluetooth, then the system automatically establishes the following configuration whereby the output-only A2DP mode is selected and only output to the headset can take place:

    enter image description here


  1. I then switch it to HSP/HFP and voila as seen below, the system seems to automatically select the headset as an input source on the bottom pane of the window, and thus the headset's microphone becomes enabled:

    enter image description here

    I guess that the settings GUI simply polls PulseAudio, and that the automatic selection of the headset for both output and then input that I get in the settings GUI is due to one or both of the followings lines in /etc/pulse/deafult.pa:

    load-module module-switch-on-port-available

    load-module module-switch-on-connect

    So I guess no mystery about why the settings change once the headset is connected. However I'd like to set this as the default for this bluetooth headset as well as my other (same model) headset or even whenever I re-pair them to the computer.


  1. Finally, I go and switch back to my computer speakers for output, as I'm only interested in using the headset for microphone input: enter image description here

My question is, how do I get that final status automatically applied whenever a bluetooth headset connects? namely, that upon bluetooth connection, the microphone of the bluetooth device will be set as the input source but the device will not be simultaneously selected for sound output.


version information:

$ pacmd --version
pacmd 13.99.1
Compiled with libpulse 13.99.0
Linked with libpulse 13.99.0

Thanks!!

2

2 Answers 2

1

There is a chance of detecting the connection event via dbus.

This is an answer on another topic that also performs checking dbus to detect events.

There is no need to reproduce here the contents, as they are in SE or ubuntu.com

3
  • Nice, I was however naively expecting that this could be set up in configuration or even via code using a modular programming language, avoiding hard to decypher scriptese. I would ideally like to learn the involved concepts in a disciplined way that does not go through teasing apart bash scripts. I might even have to manage these aspects inside a code base that needs to satisfy users at a level of abstraction to them in order to accomplish its overall designation.
    – matanox
    Mar 26, 2021 at 20:10
  • @matanster - If yo uare aiming for code, a good place for posting is Stackoverflow. As for scripting, it is really not that hard. Other languages may be a little easier in some aspects (e.g., string handling), but that's about it. I have posted the linked answer, and checking events via dbus was really easy. Mar 26, 2021 at 22:09
  • As is, this answer does not really show a solution nor really go any length in motivating why a certain approach should work. It has more wording about why not to answer the question as asked than words towards a solution, and only points out at a chance of a solution. As is, not really an answer. Will see what else comes up.
    – matanox
    Mar 30, 2021 at 19:19
0

Sharing what worked for me.I spent many hours googling. Hope this helps someone else. I am using Ubuntu 22.04

This was the link that saved me: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/975

I added the following line:

load-module module-card-restore restore_bluetooth_profile=true

to file = /etc/pulse/default.pa

Rebooted.

Now it remembers the Audio profile set on the bluetooth device.

This really should be an out of the box setting....

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .