11

I'd like to receive/record audio from bluetooth device on my linux box. The one I have works properly as a headset (microphone works properly in particular) i.e. on macOS yet I cannot get it working with linux - raspbian jessy in particular - yet from what I can see it affects other distros as well.

  • the device is paired and connected properly using bluetoothctl
  • A2DP profile works correctly
  • pactl ls reports among others headset_head_unit: Headset Head Unit (HSP/HFP) (priority 20, available: no)
  • while trying to switch to headset_head_unit pulseaudio reports [pulseaudio] module-bluez5-device.c: Refused to switch profile to headset_head_unit: Not connected

I've found and tried various suggestions as for upgrading bluez, pulseaudio, use ofono etc. yet without any success. Most common comments are that HSP/HFP support has been dropped in recent bluez and the ofono should be used (yet I'm not sure how ofono is supposed to help here as AFAIK it is related when BT susystem is being used as a client i.e. connected to mobile phone). I can see a number of unresolved bugs i.e. for freedesktop here and here, redhat, ubuntu and debian and also similar questions asked on stackexchange. While there are some successes reported, I was not able to move forward trying i.e.

  • use pulseaudio config load-module module-bluetooth-discover headset=ofono (and auto, native variants as well), versions 7, 8, 10
  • bluez 5.24, 5.42, 5.43 (was not able to found other versions for debian as i.e. there is some success reported with bluez 5.35)
  • re-pairing and reconnecting the headset device with bluetoothctl

Also there is some confusion in the reports as probably some people are mixing using linux bluetooth stack as client/server - at least this is my understanding of using ofono.

While there are also some problem reports regarding bluetooth on RPI 3 in particular, I would like to find first any sign if the HFP/HSP is ever possible with current bluez/pulseaudio. Having any success report with clear steps i.e. on debian (and even better on raspbian) would help me a lot. Even any successful setup on any other distro may help me to build the same on my box. Looks like the problem affects pulseaudio/bluez stack for more then a year and it is hard to believe people cannot use their BT headsets i.e. for VOiP calls for so long... Not sure if I've provided all the important details from my investigation so in case of comments I can update this question.

Also wonder if there is some bug report with some active development and chances for solution.

UPDATE: Most probably after removing ofono I've finally managed to be able to switch the connection to headset_head_unit yet while trying to record or play sound the device shows some activity (i.e. pulsating builtin led) but no data is being received/send (i.e. parec creates empty wav of size 44b which is just wav header). I've tested same device using a2dp_sink profile and can play sound without any problem. I wonder how it can be debugged.

5
  • This might not help much, but I have a HSF/HSP headset which "just works" (in both HSF/HSP and AD2P modes) using PulseAudio 8 and BlueZ 5.43. I don't have any oFono packages installed. Feb 2, 2017 at 9:58
  • Actually this is important information, thanks for sharing and good to know it is possible to have it working. And are you on debian or other distro? Could you check the /etc/pulse/default.pa if it contains headset parameter at the end of the line load-module module-bluetooth-discover?
    – ciekawy
    Feb 2, 2017 at 14:55
  • The PA 8 setup is on Fedora 24; I also have it working with PA 10 on Debian 9. Neither setup mentions headset anywhere in /etc/pulse/default.pa. Feb 2, 2017 at 15:02
  • I have one more question Stephen, I assume you're using i.e. skype for headset mode. Have you tried to just record from the micrphone (bluetooth source) using i.e. arecord or any other command?
    – ciekawy
    Feb 5, 2017 at 17:50
  • I'm using WebRTC in Firefox in headset mode. Recording works with anything that goes through PulseAudio; I haven't tried recording through ALSA, I'll give that a shot tomorrow... Feb 5, 2017 at 18:07

2 Answers 2

4

My solution:

I just found my solution in Fedora 26, using Plantronics Legend and Pluggable Bluetooth USB, after a lot of searching.

I am going back through my history, and updating threads with my solution where I can. This worked for me, direct from Plugable (which is the USB module I am using).

See this post.

Command summary per above link

wget https://s3.amazonaws.com/plugable/bin/fw-0a5c_21e8.hcd
sudo mkdir /lib/firmware/brcm
sudo mv fw-0a5c_21e8.hcd /lib/firmware/brcm/BCM20702A0-0a5c-21e8.hcd
sudo cp /lib/firmware/brcm/BCM20702A0-0a5c-21e8.hcd /lib/firmware/brcm/BCM20702A1-0a5c-21e8.hcd

Then reboot.

2
  • 1
    I know we're not supposed to thank in the comments, but man I've been searching for answers on this one, and struggled as much as OP with all the wrong solutions and answers. Let me add a common errors seen when switching to HSP/HFP: * mplayer says "Audio device got stuck!" * pavucontrol doesn't show microphone sound bar for the device * No sound at all
    – iMil
    Jul 8, 2020 at 8:42
  • wow. thanks a bunch man! <3
    – mofoe
    Nov 4, 2020 at 18:12
2

I was facing the same issue with Oneplus Wireless Z Bass edition. My headset microphone was not detected by PulseAudio and the problem is that my headphones don't have HSP profile, only HFP profile. After trying for 2 days, I came to the solution of replacing PulseAudio with Pipewire sound server, which supports HSP, HFP and A2DP by itself. So there will be no need to install any other utility like ofono, phonesim. Also, to be noted that my problem wasn't resolved even after following all the steps to configure ofono in PulseAudio. So I came up with the steps to replace PulseAudio with PipeWire.

Here is the detailed article I have written to resolve this problem, the steps of which I'm also adding here. You can follow it and most probably be able to solve your problem.

Bluetooth headset microphone not detected

Open your terminal and follow these steps:

  1. We will use a PPA for adding Pipewire to Ubuntu 20.04, which is maintained regularly:

    sudo add-apt-repository ppa:pipewire-debian/pipewire-upstream
    
  2. To update the PPA packages in your system do:

    sudo apt update
    
  3. Install the package:

    sudo apt install pipewire
    
  4. There is also a dependency needed to be installed with Pipewire, otherwise you will face the issue of “Bluetooth headset won’t connect after installing pipewire”. Install the dependency by:

    sudo apt install libspa-0.2-bluetooth
    
  5. Now, to install the client libraries:

    sudo apt install pipewire-audio-client-libraries
    
  6. Reload the daemon:

    systemctl --user daemon-reload
    
  7. Disable PulseAudio:

    systemctl --user --now disable pulseaudio.service pulseaudio.socket
    
  8. If you are on Ubuntu 20.04, you also need to “mask” the PulseAudio by:

    systemctl --user mask pulseaudio
    

I am not sure but, if possible, you can try to run this on other versions too.
9. After a new update of Pipewire, you also need to enable pipewire-media-session-service:

   systemctl --user --now enable pipewire-media-session.service
  1. You can ensure that Pipewire is now running through:

    pactl info
    

    This command will give the following output, in Server Name you can see:

    PulseAudio (on PipeWire 0.3.28)
    

    Things should be working by now and you can see your microphone.

If it doesn’t show up, then try restarting Pipewire by this command:

systemctl --user restart pipewire

You also need to uninstall ofono and ofono-phonesim if you have them installed:

sudo apt remove ofono
sudo apt remove ofono-phonesim

If it’s still not showing your microphone, you can try rebooting once and remove and pair your Bluetooth device again to check if it works now.

I hope I have helped you solve your problem.

If you want to rollback all the changes we did, you can do it by using:

systemctl --user unmask pulseaudio
systemctl --user --now enable pulseaudio.service pulseaudio.socket
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.