More HSP/HFP bluetooth headset woes (WH-XB700) [SOLVED]

Well, I think you have seen the previous posts (below) where I rambled about connection problems with bluetooth headphones/headsets on Debian.

If you’ve already read it, be aware that they don’t reflect the current situation. I’ll elaborate…

After moving back to Debian Bullseye a few months ago, I was given (a delightful gift from a lovely person, I must say) a pair of Sony WH-XB700 headphones which are now working great on that platform, BUT be aware that you may run into some problems while setting them up.

This is my current configuration:

$ inxi -F
System: Host: hp-laptop Kernel: 5.10.0-11-amd64 x86_64 bits: 64 Desktop: Cinnamon 4.8.6
Distro: Debian GNU/Linux 11 (bullseye)
...
Audio: Device-1: Intel Sunrise Point-LP HD Audio driver: snd_hda_intel
Sound Server: ALSA v: k5.10.0-11-amd64
...
Bluetooth: Device-1: Intel Bluetooth wireless interface type: USB driver: btusb
Report: ID: hci0 state: up running bt-v: 2.1 address: [REDACTED]
...

$ apt list --installed bluez blueman pulseaudio pulseaudio-module-bluetooth
blueman/stable,now 2.1.4-1+b1 amd64 [installed]
bluez/stable,now 5.55-3.1 amd64 [installed,automatic]
pulseaudio-module-bluetooth/stable,now 14.2-2 amd64 [installed,automatic]
pulseaudio/stable,now 14.2-2 amd64 [installed]

After connecting the headphones, sound is great with the a2dp_sink [High Fidelity Playback (A2DP Sink)] profile. HOWEVER, while trying to switch to headset_head_unit [Headset Head Unit (HSP/HFP)] profile to use the built-in microphone for calls and meets, pulseaudio kept hanging, crashing and restarting with the following errors (hidden on pulseaudio’s journal):

$ journalctl --user -u pulseaudio   # run this as normal user
...
Mar 05 12:28:14 hp-laptop pulseaudio[1290]: q overrun, queuing locally
Mar 05 12:28:15 hp-laptop pulseaudio[1290]: q overrun, queuing locally
Mar 05 12:28:15 hp-laptop pulseaudio[1290]: q overrun, queuing locally
...

Also, bluetooth logs showed problems while trying to set up the audio AVCTP / AVRCP protocols:

# journalctl -u bluetooth   # run this as root user
...
Mar 05 12:28:42 hp-laptop bluetoothd[840]: Starting SDP server
Mar 05 12:28:42 hp-laptop bluetoothd[840]: Bluetooth management interface 1.18 initialized
Mar 05 12:28:42 hp-laptop bluetoothd[840]: profiles/audio/avctp.c:avctp_server_socket() setsockopt(L2CAP_OPTIONS): Invalid argument (22)
Mar 05 12:28:42 hp-laptop bluetoothd[840]: avrcp-controller: Protocol not supported (93)
Mar 05 12:28:42 hp-laptop bluetoothd[840]: profiles/audio/avctp.c:avctp_server_socket() setsockopt(L2CAP_OPTIONS): Invalid argument (22)
Mar 05 12:28:42 hp-laptop bluetoothd[840]: audio-avrcp-target: Protocol not supported (93)
Mar 05 12:28:42 hp-laptop bluetoothd[840]: profiles/sap/server.c:sap_server_register() Sap driver initialization failed.
Mar 05 12:28:42 hp-laptop bluetoothd[840]: sap-server: Operation not permitted (1)
Mar 05 12:28:45 hp-laptop bluetoothd[840]: Endpoint registered: sender=:1.50 path=/MediaEndpoint/A2DPSink/sbc
Mar 05 12:28:45 hp-laptop bluetoothd[840]: Endpoint registered: sender=:1.50 path=/MediaEndpoint/A2DPSource/sbc
Mar 05 12:29:03 hp-laptop bluetoothd[840]: Endpoint unregistered: sender=:1.50 path=/MediaEndpoint/A2DPSink/sbc
Mar 05 12:29:03 hp-laptop bluetoothd[840]: Endpoint unregistered: sender=:1.50 path=/MediaEndpoint/A2DPSource/sbc
Mar 05 12:29:03 hp-laptop bluetoothd[840]: Endpoint registered: sender=:1.83 path=/MediaEndpoint/A2DPSink/sbc
Mar 05 12:29:03 hp-laptop bluetoothd[840]: Endpoint registered: sender=:1.83 path=/MediaEndpoint/A2DPSource/sbc
...

Well, after a lot of headaches and dead ends, it turned out that some process (I haven’t figured out which one, yet) was stealthily switching off the ERTM (Enhanced ReTransmission Mode) and ESCO (Enhanced SCO) protocols of my Bluetooth stack.

So if you have a similar problem, verify that your stack does not have them disabled by looking at /sys/module/bluetooth/parameters/

# grep --color . /sys/module/bluetooth/parameters/disable_e*
/sys/module/bluetooth/parameters/disable_ertm:N
/sys/module/bluetooth/parameters/disable_esco:N

If you see a Y there, you might want to try re-enabling ERTM and ESCO by issuing the following commands:

echo N > /sys/module/bluetooth/parameters/disable_ertm
echo N > /sys/module/bluetooth/parameters/disable_esco
systemctl restart bluetooth

After doing that, switching to headset_head_unit profile should work fine and the headset can be used without any problem.

I’ll try to test the same setup with the new pipewire stack in the following days, but in the meantime, kudos to Juan Pablo Lassala for describing the proper solution to this tricky problem on pulseaudio issue tracker.

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Copyright © All Rights Reserved · Green Hope Theme by Sivan & schiy · Proudly powered by WordPress