TransWikia.com

How to switch my phone to Headset Audio Gateway (HSP/HFP) in pulseaudio

Ask Ubuntu Asked by lapinozz on November 26, 2021

I have connected my Raspberry Pi (running Ubuntu 20) to my phone by Bluetooth.
It works well and the a2dp works as expected.
I would now like the calls to work too but find myself unable to change the profile of the card.

output of pactl list cards:

    Profiles:
        a2dp_source: High Fidelity Capture (A2DP Source) (sinks: 0, sources: 1, priority: 20, available: yes)
        headset_audio_gateway: Headset Audio Gateway (HSP/HFP) (sinks: 1, sources: 1, priority: 10, available: no)
        off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
    Active Profile: off

I did run enable-modem in the ofono test directory

I have Bluez 5.54
Pulsaudio 13.99.1
Ofono 1.31

The worst part is that I managed to make it work on my ubuntu laptop sometime ago, but I don’t remember what I did/changed to make it work.

If you have any idea of how to make it work I’d be really thankful!

One Answer

In Ubuntu 20.04 the switch between a2dp and headset_audio_gateway (HSP/HFP) happens automagically. I do use ofono as its suggested in many threads like this one: How to set up Ubuntu PC as bluetooth headset to attend calls

you could force the switch by adding to file with editor of choice (mine is vim):

vim /etc/pulse/default.pa

the following line:

"load-module module-bluetooth-policy auto_switch=2"

to section:

.ifexists module-bluetooth-discover.so
load-module module-bluetooth-policy auto_switch=2
load-module module-bluetooth-discover headset=ofono
.endif

But I think this setting is already default in pulseaudio since latest version in ubuntu 20.04.

In fact, maybe you suffer from similar issue than I do: a2dp multimedia playbay (youtube, music, systemsounds etc...) from Android to Ubuntu as Bluetooth Headset working fine, automatic switch between a2dp and HSP/HFP working fine as well. But: a2dp is capable of doing playback via Line Out or Headset etc... while HSP/HFP for some reason is not able to playback audio or use microphone when activated. In fact its working, but one has switch manually input and output source to headset sources like:

Input: Headset > FrontMicrophone
Output: Headset > Headphones

while in "Headset Audio Gateway (HSP/HFP)" mode. Which ubuntu switches to automatically in my opinion. You can see which mode is active with pulseaudio (pavucontrol) installed on your system after opening pavucontrol > Configuration you will See your phone (mine is Galaxy S8+) with Profile "Off", "High Fidelity Capture A2DP" and "Headset Audio Gateway (HSP/HFP)". You should see OS switches them automatically when your phone plays media like youtube and than switches to a phonecall vice versa.

How this can be achieved? I do use:

Sound Switcher Indicator Version 2.3.4 Written by Dmitry Kann for that purpose.

sudo apt-add-repository ppa:yktooo/ppa
sudo apt-get update
sudo apt-get install indicator-sound-switcher

So to me switching just worked fine, except sound quality is not as perfect in HSP/HFP as with a2dp AND the most frustrating aspect to me is always I have to manually switch to:

Input: Headset > FrontMicrophone
Output: Headset > Headphones

as stated above which is very annoying.

I try to set default input and output for Profile: Headset Audio Gateway (HSP/HFP) since two days, but I did not find a solution until yet.

So with this manual switch maybe your phone send and receive audio is working fine (as mine does). But we still do suffer from having to switch microphone input and headphone audio output manually.

Answered by develissimo on November 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP