Bluetooth HSP/HFP not working but A2DP is

13,751

Solution 1

I would try this:

wget https://www.dropbox.com/s/owropuric6iz898/BCM20702A0-05ac-21e1.hcd
sudo cp BCM20702A0-05ac-21e1.hcd /lib/firmware/brcm/BCM20702A0-0a5c-21e1.hcd
sudo modprobe -r btusb
sudo modprobe btusb

Then check dmesg | tail for any info:

sudo apt-get install linux-headers-$(uname -r) build-essential
wget https://www.dropbox.com/s/xu80svavlazttaf/bluetooth-3.19.tar.gz
tar xpvf bluetooth-3.19.tar.gz
cd bluetooth
cp /boot/config-$(uname -r) .config
cp /usr/src/linux-headers-$(uname -r)/Module.symvers Module.symvers
make -C /lib/modules/$(uname -r)/build M=$PWD modules
sudo cp btusb.ko /lib/modules/$(uname -r)/kernel/drivers/bluetooth/
sudo modprobe -r btusb
sudo modprobe btusb

See if it works

You will lose the HSP/HFP after a kernel update. When that happens, you should do:

cd bluetooth
make -C /lib/modules/$(uname -r)/build M=$PWD clean
cp /boot/config-$(uname -r) .config
cp /usr/src/linux-headers-$(uname -r)/Module.symvers Module.symvers
make -C /lib/modules/$(uname -r)/build M=$PWD modules
sudo cp btusb.ko /lib/modules/$(uname -r)/kernel/drivers/bluetooth/
sudo modprobe -r btusb
sudo modprobe btusb

Solution 2

My guess is that it's a bt profile problem with pulseaudio, unless it's something more problematic.

Install and run pavucontrol (apt-get install pavucontrol) and go to the last page (configuration) check if bluetooth profile is there and try changing it.

My bt audio conf is default withoyt any changes (ubuntu 14.04) /etc/bluetooth/audio.conf

Now, Just tested these steps with a bt-headset (a2dp and hsp capabel) and got it working. Not the best way, but worked.

  1. Pair bt-device
  2. Check with pavucontrol that profile is HSP from configuration page.
  3. Start skype (I know, but it's easy to test with it)
  4. Run movesink.sh script
  5. Start test call to skype testing service
  6. Select recording tab from pavucontrol and select "Skype input from" to match your bluetooth device.
  7. Speak and see if the volume bar moves.
  8. If probles, start call again and run movesink.sh during the test call

a) Check bt-device name:

pactl list sinks|grep Name
# or
pactl list sinks|grep card:

b) Run movesinks.sh with that name

./movesink.sh bluez_sink.48_C1_AC_C1_C3_85.hsp
# or
./movesink.sh bluez_sink.48_C1_AC_C1_C3_85

And here's the movesink.sh script that I've made. It moves your program sound outputting to your bt device (this does not move mic automatically from integrated to bt-headset):

#!/bin/bash 
echo "Setting default sink to: $1";
# where new pa should output sound for new programs
pacmd set-default-sink $1
# get "active" programs and with while read
pactl list sink-inputs short |cut -f1 | while read line    
do
echo "Moving input: ";
echo $line
#| cut -f2 -d' ';
echo "to sink: $1";
#  move audio to the newly assigned output.
pacmd move-sink-input `echo $line | cut -f2 -d' '` $1

done

Hopefully this will verify that your setup works. (I used to have a keybinding, that paired the bt-headset, moved inputs to that and when I used it again, it reverted that setup.)

You should get your main audio back to default with:

./movesink.sh alsa_output.pci-0000_00_1b.0.analog-stereo
# or
./movesink.sh alsa_output.pci-0000_00_1b.0
Share:
13,751

Related videos on Youtube

Dylan
Author by

Dylan

I'm a self taught Linux enthusiast! I guess I started off as a "script kiddie" and now when I copy things on average I understand about half of it ;) So I guess you would call me a "script teen"... But serious I just use Linux because I enjoy the ability to have better control of my system and embrace the open source nature! Every time I see a new command I have never seen before I get excited, guess I am kinda a nerd...

Updated on September 18, 2022

Comments

  • Dylan
    Dylan over 1 year

    I have a Broadcom internal bluetooth adapter. It is model BCM20702A0 (Vendor=0a5c ProdID=21e1 Rev=01.12) I am able to get the A2DP function to operate but not the HSP/HFP mode. I have tried different firmware and also different configs under /etc/bluetooth/audio.conf but have had no luck. Does anyone have any idea what I can do? I have searched and searched google and tried various things going on two hours. Thought I would give you gurus a try. Below are my system details, please let me know if you need anything else.

    dylan@laptop:~$ uname -a
    Linux laptop 3.19.0-20-generic #20-Ubuntu SMP Fri May 29 10:10:47 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
    
    
    dylan@laptop:~$ dmesg | grep Bluetooth
    [    4.179038] Bluetooth: Core ver 2.20
    [    4.179051] Bluetooth: HCI device and connection manager initialized
    [    4.179054] Bluetooth: HCI socket layer initialized
    [    4.179056] Bluetooth: L2CAP socket layer initialized
    [    4.179060] Bluetooth: SCO socket layer initialized
    [    5.501272] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
    [    5.501275] Bluetooth: BNEP filters: protocol multicast
    [    5.501281] Bluetooth: BNEP socket layer initialized
    [    5.508181] Bluetooth: RFCOMM TTY layer initialized
    [    5.508188] Bluetooth: RFCOMM socket layer initialized
    [    5.508193] Bluetooth: RFCOMM ver 1.11
    
    USB-DEVICES...
    T:  Bus=04 Lev=02 Prnt=02 Port=05 Cnt=01 Dev#=  3 Spd=12  MxCh= 0
    D:  Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=0a5c ProdID=21e1 Rev=01.12
    S:  Manufacturer=Broadcom Corp
    S:  Product=BCM20702A0
    S:  SerialNumber=083E8E9B280C
    C:  #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
    I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
    I:  If#= 1 Alt= 2 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
    I:  If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
    
    
    dylan@laptop:~$ dkms status; uname -a
    bcmwl, 6.30.223.248+bdcom, 3.19.0-16-generic, x86_64: installed
    bcmwl, 6.30.223.248+bdcom, 3.19.0-18-generic, x86_64: installed
    bcmwl, 6.30.223.248+bdcom, 3.19.0-20-generic, x86_64: installed
    bcmwl, 6.30.223.248+bdcom, 3.19.0-21-generic, x86_64: installed
    vboxhost, 4.3.28, 3.19.0-16-generic, x86_64: installed
    vboxhost, 4.3.28, 3.19.0-18-generic, x86_64: installed
    vboxhost, 4.3.28, 3.19.0-20-generic, x86_64: installed
    vboxhost, 4.3.28, 3.19.0-21-generic, x86_64: installed
    Linux laptop 3.19.0-21-generic #21-Ubuntu SMP Sun Jun 14 18:31:11 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
    
    
    dylan@laptop:~$ dmesg | grep -i bluetooth; dmesg | grep firmware
    [    4.085160] Bluetooth: Core ver 2.20
    [    4.085171] Bluetooth: HCI device and connection manager initialized
    [    4.085175] Bluetooth: HCI socket layer initialized
    [    4.085176] Bluetooth: L2CAP socket layer initialized
    [    4.085181] Bluetooth: SCO socket layer initialized
    [    4.109764] bluetooth hci0: Direct firmware load for brcm/BCM20702A0-0a5c-21e1.hcd failed with error -2
    [    4.109773] Bluetooth: hci0: BCM: patch brcm/BCM20702A0-0a5c-21e1.hcd not found
    [    5.332794] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
    [    5.332797] Bluetooth: BNEP filters: protocol multicast
    [    5.332803] Bluetooth: BNEP socket layer initialized
    [    5.346411] Bluetooth: RFCOMM TTY layer initialized
    [    5.346419] Bluetooth: RFCOMM socket layer initialized
    [    5.346425] Bluetooth: RFCOMM ver 1.11
    [    4.109764] bluetooth hci0: Direct firmware load for brcm/BCM20702A0-0a5c-21e1.hcd failed with error -2
    
    • Jeremy31
      Jeremy31 almost 9 years
      It might be missing firmware, check dmesg | grep -i firmware
    • Dylan
      Dylan almost 9 years
      @Jeremy31 This is the output... I have tried so many things it may be in an inconsistent state but this is the current output of the command you suggested. dylan@laptop:~$ dmesg | grep -i firmware [ 0.188628] [Firmware Bug]: ACPI: BIOS _OSI(Linux) query ignored
    • Jeremy31
      Jeremy31 almost 9 years
      @Pilot6 can you remove /* Broadcom SoftSailing reporting vendor specific */ { USB_DEVICE(0x0a5c, 0x21e1) }, from your dkms package so it can be tested?
    • Pilot6
      Pilot6 almost 9 years
      @Jeremy31 From which dkms package?
    • Jeremy31
      Jeremy31 almost 9 years
      @Pilot6 The bluetooth test one. It seems Marcel missed one with this commit
    • Pilot6
      Pilot6 almost 9 years
      @Jeremy31 I made the package "btusb-for-jeremy31-dkms". It will be available after build.
  • Dylan
    Dylan almost 9 years
    I performed these steps exactly as laid out here. Same results. A2DP works but HSP/HFP does not work for sound or input. Any other ideas.? Here is the output of dmesg | tail after following your steps. [71906.997877] usb 1-4: new high-speed USB device number 4 using xhci_hcd [71907.127678] cdc_acm 1-4:1.1: ttyACM0: USB ACM device [72443.660663] usbcore: deregistering interface driver btusb [72449.568465] usbcore: registered new interface driver btusb [72464.982373] input: 11:22:33:02:45:EE as /devices/virtual/input/input26
  • Dylan
    Dylan almost 9 years
    Also after following these steps the output from dmesg | grep -i firmware is still the same. No change
  • Jeremy31
    Jeremy31 almost 9 years
    Reboot and see if dmesg | grep Bluetooth contains something like Jun 6 11:09:29 braun-X551MA kernel: [149550.832977] Bluetooth: hci0: BCM: patching hci_ver=06 hci_rev=2000 lmp_ver=06 lmp_subver=410e Jun 6 11:09:30 braun-X551MA kernel: [149551.432479] Bluetooth: hci0: BCM: firmware hci_ver=06 hci_rev=222d lmp_ver=06 lmp_subver=410e
  • Dylan
    Dylan almost 9 years
    Below is the input and here is the link. pastebin.com/UaV1nsRZ
  • Dylan
    Dylan almost 9 years
    [ 4.115409] Bluetooth: HCI device and connection manager initialized [ 4.115413] Bluetooth: HCI socket layer initialized [ 4.115415] Bluetooth: L2CAP socket layer initialized [ 4.115420] Bluetooth: SCO socket layer initialized [ 5.444886] Bluetooth: BNEP (Ethernet Emulation) ver 1.3 [ 5.444890] Bluetooth: BNEP filters: protocol multicast [ 5.444895] Bluetooth: BNEP socket layer initialized [ 5.457765] Bluetooth: RFCOMM TTY layer initialized [ 5.457773] Bluetooth: RFCOMM socket layer initialized [ 5.457778] Bluetooth: RFCOMM ver 1.11
  • Dylan
    Dylan almost 9 years
    Anyone have any avenues I can investigate?
  • Jeremy31
    Jeremy31 almost 9 years
    Double check lsusb to see if the device is 21e1 like in your usb-devices output or 21e8 that you show in the first sentence of your question
  • Dylan
    Dylan almost 9 years
    on 'lsusb' the output comes up '0a5c:21e1' and it says the same when i issue 'usb-devices' so I messed that up sorry.
  • Jeremy31
    Jeremy31 almost 9 years
    Install updates and see if you get a newer kernel that works. What is the result of modinfo btusb | grep -i 0a5c
  • Dylan
    Dylan almost 9 years
    I installed pavcontrol and under the config tab both BT profiles show up. HSP and A2DP. When I have it on A2DP sounds works. But when i change it to HSP the sound stops working and it does not record. I used my original audio.conf and also your profile as well. With your profile A2DP does not even work.
  • Manwe
    Manwe almost 9 years
    @false The recording might be device order thing. Try running pacmd list-sink-inputs and pacmd list-sinks with A2DP, HSP and without bt connected. I can't find my bt-script (don't have the device anymore), but the device could be "state: suspended" or not default (I think I used pacmd set-default-sink SINKNAME to change that)
  • Dylan
    Dylan almost 9 years
    I have updated. I am on the newest stable kernel. The output of the above command. alias: usb:v0A5Cp*d*dc*dsc*dp*icFFisc01ip01in* alias: usb:v0A5Cp21E1d*dc*dsc*dp*ic*isc*ip*in*
  • Dylan
    Dylan almost 9 years
    Here is the output of the above commands. I am not sure what I am looking for in that output so I feel like a noob but perhaps it will shed some light. pastebin.com/g64MpAkn
  • Jeremy31
    Jeremy31 almost 9 years
    Did you modify the source code of btusb or install some dkms file? I think the second alias output is the reason it doesn't work like it should. Please post the output of dkms status; uname -a edit your question if the output is long and use a comment to indicate the update
  • Dylan
    Dylan almost 9 years
    I have had to install some dkms files to get the broadcom wireless chip to work. I also had to patch the wireless driver in order to get it to work but I have not modified the source of btusb or any other files that I can remember and this is basically a brand new install. Answer edited to include output of command
  • Dylan
    Dylan almost 9 years
    As you can tell I have also installed the same package numerous times in different attempts to get it to work...
  • Manwe
    Manwe almost 9 years
    @dylan That was the output without bluetooth speaker connected? Try with it connectected and hsp selected from pavucontrol
  • Dylan
    Dylan almost 9 years
    Here are the two paste bins with the output you requested. With HSP selcted --> pastebin.com/c9sPsyNp and this is with A2DP selected --> pastebin.com/Qiyds4WR
  • Manwe
    Manwe almost 9 years
    Try pacmd set-default-sink bluez_sink.48_C1_AC_C1_C3_85.hsp with hsp and see if you have sound then. I'll try to have a better look tomorrow. Also you could try to fiddle in sound settings and in pavucontrol.
  • Dylan
    Dylan almost 9 years
    so i issued pacmd set-default-sink bluez_sink.48_C1_AC_C1_C3_85.hsp and now anything with audio wont play. For example youtube or netflix brings up the player but just wont start playing. no video no audio noting.. just the blank player. any ideas?
  • Dylan
    Dylan almost 9 years
    Once I change the profile to HSP the sound stops working. I then proceed with the following steps and run the script using the name of my hsp profile bluez_sink.48_C1_AC_C1_C3_85.hsp but it does not work. Your script runs successful but doesn't have an impact. This is great as it shows you are trying. I will award 150 bounty points if we can get this working. I will even reward some bounty points even if we cant but if you will keep working with me. I am not going to be lazy, I am going to research so I can understand your script. I understand scripting just not these commands...
  • Manwe
    Manwe almost 9 years
    One thing I noticed is that your bluez_sink ends with .hsp. Mine does not change when I move from hsp to a2dp, but your "card: 1 <bluez_card.48_C1_AC_C1_C3_85>" line stays the sami. Try without .hsp-suffix.
  • Manwe
    Manwe almost 9 years
    Try changing volume from pavucontrol for the HSP device. I think at one point one device needed a "shake" before it started working (auto-sleep or something).
  • Jeremy31
    Jeremy31 almost 9 years
    Please file a bug report before attempting my fix with the kernel you have
  • Dylan
    Dylan almost 9 years
    I will file the bug report now. I also tried your method and it still has the same outcome... Thanks for the idea though!!!
  • Dylan
    Dylan almost 9 years
    alias: usb:v0A5Cp*d*dc*dsc*dp*icFFisc01ip01in* is the output now
  • Jeremy31
    Jeremy31 almost 9 years
    And dmesg | grep -i bluetooth; dmesg | grep firmware It almost looks as it should work
  • Dylan
    Dylan almost 9 years
    edited answer to show output. Ah there is an error!!! That is almost good news in this case lol
  • Jeremy31
    Jeremy31 almost 9 years
    I might have messed up the name on the firmware file sudo cp BCM20702A0-05ac-21e1.hcd /lib/firmware/brcm/BCM20702A0-0a5c-21e1.hcd reboot and see. I will edit my answer if it works correctly
  • Dylan
    Dylan almost 9 years
    THAT DID IT!!!!!!!!!!!!!!!!! YOU FIXED IT WITH THAT KERNEL PATCH!!!!
  • Dylan
    Dylan almost 9 years
    So I have to wait 24 hours to start another bounty. I will award it to you of course, thank you so much. Two things I noticed which I will start another question or maybe if its wasy you could advise me where to look. The audio quality on HSP is very poor. something that pops out is that under the pulse audio sound check. HSP is mono sound and A2DP is stereo... second I have to remove the kernel module and add it using modprobe -r and modprobe... I am sure I can figure out the latter
  • Pilot6
    Pilot6 almost 9 years
    @Jeremy31 This needs to be sent to Marcel.
  • Jeremy31
    Jeremy31 almost 9 years
    @Dylan HSP/HFP is not very good quality as it is intended for phone calls and only uses mono and not stereo like A2DP
  • kiko
    kiko over 4 years