Ubuntu – Change Bluetooth Headphones default audio mode (A2DP Sink vs HSP/HFP)

18.10bluetoothheadphonespulseaudiosound

I have Sony WH-1000XM2 Bluetooth 4.1 headphones (with profiles A2DP, AVRCP, HFP, and HSP) which work with Ubuntu .

However, they constantly connect to the PC in the headset mode with subpar mono audio. For proper high def stereo, I must:

  1. Turn on headphones, wait for them to pair (auto connects to headset mode)
  2. Disconnect the headphones using Blueman-manager
  3. Reconnect to the headphones specifying the High Fidelity Playback Audio Profile.

When I try to change profiles while connected I get the Failed to change profile to a2dp_sink. Funnily enough it can change from a2dp to hsp/hsf just fine…

Is there a way to configure this Bluetooth device to auto connect to high fidelity playback?

Multiple searches for a solution on the web have found nothing useful.

Best Answer

I had the exact same problem. My Sony WH-1000XM2 used to work only when initially paired with Ubuntu 18.04. After a reboot or headphones off/on they used to connect automatically but the sound was awful. I had to remove the Bluetooth device and pair it again. I tried all of the solutions on the Internet which claim that configurations in:

/etc/bluetooth/main.conf

or

/etc/bluetooth/audio.conf

should do the trick. Well, they don't. The headphones keep working with the 'HSP/HFP' profile and the 'A2DP Sink' can not be set until the phones are repaired.

The more convenient way is to use the command line instead of physically pressing buttons and reconnecting through the UI. So this answer helped me achieve this. However, this looks like a lot of commands to me, so I scripted them in this gist. It should work out of the box.

Whenever the phones get automatically reconnected (after the initial pairing) and they start using 'HSP/HFP' just execute this script and the profile will be set to 'A2DP Sink'. You may have to tweak the sleep intervals according to your headphones.

I hope this is getting fixed in upcoming releases of PulseAudio and Ubuntu.