Use Bluetooth headset with microphone (HFP) in Ubuntu 18.04

30,445

Solution 1

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

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

Solution 2

There main reason the HFP profile is not available is the Pulseaudio drivers have removed support for it. Any Bluetooth device can now only connect via A2DP configuration which does not support on-device microphone. I myself had the same problem and had spend around a week to figure out the solution that works without much hassle. You can follow the instruction mentioned at https://eternalgeek.in/index.php/2021/06/13/solving-mic-of-wireless-earbuds-not-working-on-ubuntu-20/

Hope this helps and save time at your end!

Solution 3

The problem here is that your IFROGZ Toxix Wireless do not support Headset profile (HSP). They only support Handsfree profile (HFP) as can be seen in your bluetoothctl output. PulseAudio on the other hand does not support HFP out of the box, as is explained here: https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Bluetooth/

So your only options are to install oFono or to patch and compile PulseAudio yourself. Patch is available here: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/94

Solution 4

I was facing the same issue for a long time. After researching I fixed this issue by this command as there were missing multimedia extras plugins on my system.

sudo apt install ubuntu-restricted-extras

make sure to restart the system after this. Also, before trying this make sure you research a little as it may work for me but might not work for you.

Share:
30,445
Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    My Bluetooth headset (IFROGZ Toxix Wireless) supports the Headset Head Unit profile (headset_head_unit or HSP/HFP) and the audio playback profile (a2dp_sink). It pairs and connects successfully with my Ubuntu 18.04 laptop. However, when connected, in the Settings > Sound menu, it is only listed under Output and not under Input (i.e. the mic is not recognized).

    Therefore, I can only use it for playback, and not as a headset for video meetings, which poses a big problem for me as all my work is done on this computer.

    I found that this is a known bug: https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1768625

    Are there any workarounds / pathces / solutions for this?

    (been using Ubunu for years but very much a noob here when it comes to the inner workings)


    bluetoothctl output (note it supports Handsfree HFP but not Headset HSP)

    Device 61:21:34:24:4F:20 (public)
    Name: IFROGZ Toxix Wireless
    Alias: IFROGZ Toxix Wireless
    Class: 0x00240404
    Icon: audio-card
    Paired: yes
    Trusted: yes
    Blocked: no
    Connected: yes
    LegacyPairing: no
    UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
    UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
    UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
    UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
    

    pacmd list-cards output (note at the end that headset-input has available: no):

    $ pacmd list-cards
    2 card(s) available.
    index: 0
    name: <alsa_card.pci-0000_00_1f.3>
    driver: <module-alsa-card.c>
    owner module: 7
    properties:
        alsa.card = "0"
        alsa.card_name = "HDA Intel PCH"
        alsa.long_card_name = "HDA Intel PCH at 0xb1328000 irq 134"
        alsa.driver_name = "snd_hda_intel"
        device.bus_path = "pci-0000:00:1f.3"
        sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
        device.bus = "pci"
        device.vendor.id = "8086"
        device.vendor.name = "Intel Corporation"
        device.product.id = "9d71"
        device.product.name = "Sunrise Point-LP HD Audio"
        device.form_factor = "internal"
        device.string = "0"
        device.description = "Built-in Audio"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"
    profiles:
        input:analog-stereo: Analog Stereo Input (priority 60, available: unknown)
        output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
        output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (priority 6060, available: unknown)
        output:hdmi-stereo: Digital Stereo (HDMI) Output (priority 5400, available: unknown)
        output:hdmi-stereo+input:analog-stereo: Digital Stereo (HDMI) Output + Analog Stereo Input (priority 5460, available: unknown)
        output:hdmi-stereo-extra1: Digital Stereo (HDMI 2) Output (priority 5200, available: no)
        output:hdmi-stereo-extra1+input:analog-stereo: Digital Stereo (HDMI 2) Output + Analog Stereo Input (priority 5260, available: unknown)
        output:hdmi-surround-extra1: Digital Surround 5.1 (HDMI 2) Output (priority 100, available: no)
        output:hdmi-surround-extra1+input:analog-stereo: Digital Surround 5.1 (HDMI 2) Output + Analog Stereo Input (priority 160, available: unknown)
        output:hdmi-surround71-extra1: Digital Surround 7.1 (HDMI 2) Output (priority 100, available: no)
        output:hdmi-surround71-extra1+input:analog-stereo: Digital Surround 7.1 (HDMI 2) Output + Analog Stereo Input (priority 160, available: unknown)
        output:hdmi-stereo-extra2: Digital Stereo (HDMI 3) Output (priority 5200, available: no)
        output:hdmi-stereo-extra2+input:analog-stereo: Digital Stereo (HDMI 3) Output + Analog Stereo Input (priority 5260, available: unknown)
        output:hdmi-surround-extra2: Digital Surround 5.1 (HDMI 3) Output (priority 100, available: no)
        output:hdmi-surround-extra2+input:analog-stereo: Digital Surround 5.1 (HDMI 3) Output + Analog Stereo Input (priority 160, available: unknown)
        output:hdmi-surround71-extra2: Digital Surround 7.1 (HDMI 3) Output (priority 100, available: no)
        output:hdmi-surround71-extra2+input:analog-stereo: Digital Surround 7.1 (HDMI 3) Output + Analog Stereo Input (priority 160, available: unknown)
        output:hdmi-stereo-extra3: Digital Stereo (HDMI 4) Output (priority 5200, available: no)
        output:hdmi-stereo-extra3+input:analog-stereo: Digital Stereo (HDMI 4) Output + Analog Stereo Input (priority 5260, available: unknown)
        output:hdmi-surround-extra3: Digital Surround 5.1 (HDMI 4) Output (priority 100, available: no)
        output:hdmi-surround-extra3+input:analog-stereo: Digital Surround 5.1 (HDMI 4) Output + Analog Stereo Input (priority 160, available: unknown)
        output:hdmi-surround71-extra3: Digital Surround 7.1 (HDMI 4) Output (priority 100, available: no)
        output:hdmi-surround71-extra3+input:analog-stereo: Digital Surround 7.1 (HDMI 4) Output + Analog Stereo Input (priority 160, available: unknown)
        output:hdmi-stereo-extra4: Digital Stereo (HDMI 5) Output (priority 5200, available: no)
        output:hdmi-stereo-extra4+input:analog-stereo: Digital Stereo (HDMI 5) Output + Analog Stereo Input (priority 5260, available: unknown)
        output:hdmi-surround-extra4: Digital Surround 5.1 (HDMI 5) Output (priority 100, available: no)
        output:hdmi-surround-extra4+input:analog-stereo: Digital Surround 5.1 (HDMI 5) Output + Analog Stereo Input (priority 160, available: unknown)
        output:hdmi-surround71-extra4: Digital Surround 7.1 (HDMI 5) Output (priority 100, available: no)
        output:hdmi-surround71-extra4+input:analog-stereo: Digital Surround 7.1 (HDMI 5) Output + Analog Stereo Input (priority 160, available: unknown)
        off: Off (priority 0, available: unknown)
    active profile: <output:analog-stereo+input:analog-stereo>
    sinks:
        alsa_output.pci-0000_00_1f.3.analog-stereo/#0: Built-in Audio Analog Stereo
    sources:
        alsa_output.pci-0000_00_1f.3.analog-stereo.monitor/#0: Monitor of Built-in Audio Analog Stereo
        alsa_input.pci-0000_00_1f.3.analog-stereo/#1: Built-in Audio Analog Stereo
    ports:
        analog-input-internal-mic: Internal Microphone (priority 8900, latency offset 0 usec, available: unknown)
            properties:
                device.icon_name = "audio-input-microphone"
        analog-input-mic: Microphone (priority 8700, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "audio-input-microphone"
        analog-output-speaker: Speakers (priority 10000, latency offset 0 usec, available: unknown)
            properties:
                device.icon_name = "audio-speakers"
        analog-output-headphones: Headphones (priority 9000, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "audio-headphones"
        hdmi-output-0: HDMI / DisplayPort (priority 5900, latency offset 0 usec, available: yes)
            properties:
                device.icon_name = "video-display"
                device.product.name = "2429W"
        hdmi-output-1: HDMI / DisplayPort 2 (priority 5800, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "video-display"
        hdmi-output-2: HDMI / DisplayPort 3 (priority 5700, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "video-display"
        hdmi-output-3: HDMI / DisplayPort 4 (priority 5600, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "video-display"
        hdmi-output-4: HDMI / DisplayPort 5 (priority 5500, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "video-display"
    index: 1
    name: <bluez_card.61_21_34_24_4F_20>
    driver: <module-bluez5-device.c>
    owner module: 24
    properties:
        device.description = "IFROGZ Toxix Wireless"
        device.string = "61:21:34:24:4F:20"
        device.api = "bluez"
        device.class = "sound"
        device.bus = "bluetooth"
        device.form_factor = "headset"
        bluez.path = "/org/bluez/hci0/dev_61_21_34_24_4F_20"
        bluez.class = "0x240404"
        bluez.alias = "IFROGZ Toxix Wireless"
        device.icon_name = "audio-headset-bluetooth"
        device.intended_roles = "phone"
    profiles:
        a2dp_sink: High Fidelity Playback (A2DP Sink) (priority 40, available: unknown)
        headset_head_unit: Headset Head Unit (HSP/HFP) (priority 30, available: no)
        off: Off (priority 0, available: yes)
    active profile: <a2dp_sink>
    sinks:
        bluez_sink.61_21_34_24_4F_20.a2dp_sink/#1: IFROGZ Toxix Wireless
    sources:
        bluez_sink.61_21_34_24_4F_20.a2dp_sink.monitor/#2: Monitor of IFROGZ Toxix Wireless
    ports:
        headset-output: Headset (priority 0, latency offset 0 usec, available: unknown)
            properties:
    
        headset-input: Headset (priority 0, latency offset 0 usec, available: no)
            properties:
    
  • Burak Kaymakci
    Burak Kaymakci over 3 years
    Tried this with my Sony WH-XB900Ns but I can not choose Headset Head Unit. When I click on it, it simply goes to Off mode.
  • philsf
    philsf about 3 years
    as can be seen in your bluetoothctl output can you clarify what output line gives this information in the bluetoothctl output?
  • tquadrat
    tquadrat about 3 years
    Same for my Logitech H800
  • Artur Meinild
    Artur Meinild almost 3 years
    You should include additional details directly in the answer to solve the problem for future reference (see this section about links).
  • 1nfern0
    1nfern0 almost 3 years
    @Artur Do you mean I should have included those steps in the answer to make it a better answer? I am a new user so not much versed with the format. Thanks for the info.
  • Artur Meinild
    Artur Meinild almost 3 years
    Yes, that's exactly what I meant. I upvoted your answer after you included the detailed steps - thanks!
  • raisinrising
    raisinrising almost 3 years
    This works for OnePlus Buds as well, but the audio sounds incredibly crappy on HSP/HFP. The mic "works."
  • Kapil Bhagchandani
    Kapil Bhagchandani over 2 years
    It's not working and pactl info is giving following error: Connection failure: Connection refused pa_context_connect() failed: Connection refused
  • Błażej Michalik
    Błażej Michalik over 2 years
    Good news! Seems like HFP is now implemented in the upstream pulseaudio (Ubuntu 21.10, or ppa:smoser/bluetooth for backport to Focal - note: this is not my PPA, I take no responsiblity for its contents). I've installed the patched version of pulseaudio and setting the profile now works. For details, see gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/84.
  • Abdillah
    Abdillah over 2 years
    "Pulseaudio have removed support for it (HFP profile -red)" where does this info came from? Any news or release note?
  • CryptoRex
    CryptoRex over 2 years
    Hi, when I explored the solution HFP profile was not available in pulseaudio. So, I looked in Ubuntu bug forum and found many unofficial references to it getting removed from pulseaudio due to its buggy nature. I couldn't find the exact forum/thread, though I did found that in a recent merge request they did add the support for the HFP profile (it is still a bit buggy according to some comments). You can refer to this issue: gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1181 which is around 9 months old at the time of writing this. Hope this helps!
  • Admin
    Admin about 2 years
    @KapilBhagchandani It seems you lost systemctl --user --now enable pipewire pipewire-pulse in Step 8 compared to the original post.