Can't change profile to HSP for Bluetooth headset

11,354

Solution 1

Sad story,
Seems that your bluetooth card has not a fully compatible driver with bluez or whatever as mine :(.

I solved following this guide and building two stupid scripts

Getting ready

Install ofono

sudo apt install ofono

Config pulseaudio to use ofono:

  • Goto /etc/pulse/default.pa find the line load-module module-bluetooth-discover and change it in load-module module-bluetooth-discover headset=ofono.
  • Add the user pulse to group bluetooth to grant the permission: sudo usermod -aG bluetooth pulse (probably it's already correct)
  • VERY IMPORTANT: To grant the permission, add this to /etc/dbus-1/system.d/ofono.conf (add this before </busconfig>):
    <policy user="pulse">
      <allow send_destination="org.ofono"/>
    </policy>
    

Provide phonesim to ofono.
In order to make ofono work, you have to provide a modem to it! You can install a modem emulator called phonesim (implemented by ofono) to make it work:

  • install ofono-phonesim (in some distros it is called phonesim). in Ubuntu 18.04 (for Ubuntu 20.04 follow this link):
 sudo apt install ofono-phonesim
  • Configure phonesim by adding the following lines to /etc/ofono/phonesim.conf:
[phonesim]
Driver=phonesim
Address=127.0.0.1
Port=12345
  • Restart ofono:
sudo systemctl restart ofono.service
  • Clone ofono repository (contains useful scripts)
git clone git://git.kernel.org/pub/scm/network/ofono/ofono.git destination/path

Then, every time you want to enable hfp/hsp:

ofono-phonesim -p 12345 /usr/share/phonesim/default.xml &

then use

path/to/cloned/repo/test/enable-modem /phonesim

then restart pulseaudio with

pulseaudio --kill && pulseaudio --start

Now you should see a microphone device.

When you want to go back to a2dp:

path/to/cloned/repo/test/disable-modem /phonesim

then restart pulseaudio with

pulseaudio --kill && pulseaudio --start

eventually restart pulseeffects with

pulseeffects --quit && pulseeffects &

Lately i'm not using this because it's not always working, and so using a jack is faster.

Hope it helps :)

edit: Added getting ready section edit 2: Added git clone step

Solution 2

I don't have enough reputation to comment, so put this as an answer.

Lately i'm not using this because it's not always working, and so using a jack is faster.

After removing headset=ofono from load-module module-bluetooth-discover headset=ofono and restarting pulseaudio the speakers work again with microphone in Ubuntu 20.04.

E: Unable to locate package ofono-phonesim

See answer here: Failed to change profile to headset_head_unit.

Share:
11,354

Related videos on Youtube

ChemiCalChems
Author by

ChemiCalChems

Updated on September 18, 2022

Comments

  • ChemiCalChems
    ChemiCalChems over 1 year

    I bought a Bluetooth headset cause I'm tired of wires. The headset supports A2DP, HSP, HFP and AVRCP.

    I paired the headset correctly, and was greeted with the microphone not showing in the input tab of sound settings. This makes sense since the headset was in A2DP. I tried to change it to HSP/HFP in able use the microphone, but nothing seemed to happened.

    Then I tried to do all of this via Blueman. Blueman complained Failed to change profile to headset_head_unit.

    I've tried unpairing the device and pairing it again, setting the profile to off and then to HSP/HFP, but the same thing happens. It seems like I can only switch to A2DP, which only allows to hear, not use the mic.

    In case it's necessary, the headset model is AV620 by Avenzo.

  • Henrique de Sousa
    Henrique de Sousa over 3 years
    What's the link for Ubuntu 20.04? E: Unable to locate package ofono-phonesim
  • Tx_monster
    Tx_monster over 3 years