Headphones microphone is not working

92,770

Solution 1

By design, the Bluetooth A2DP profile is unidirectional. We can not use a microphone unless our headset and adapter were capable to be paired simultaneously on both HSP, and A2DP protocol, or the application switches from A2DP to HSP on demand.

See also this enlightning discussion on bug #508522.

Solution 2

As it was already pointed out that A2DP is unidirectional, you have to switch to HSP profile every time you need to use the microphone. But doing so manually is not ideal, and unless application sets media.role=phone for the stream (most non-voip apps don't), pulseaudio won't switch it automatically by default.

But starting from Pulseaudio v. 11.0, it's possible to automatically switch the profile whenever microphone access is requested by the application, but it's disabled by default.

  1. Find load-module module-bluetooth-policy line in /etc/pulse/default.pa
  2. Change it to load-module module-bluetooth-policy auto_switch=2

Now pulseaudio will switch the device profile to HSP whenever microphone access is requested and change it back to A2DP after stream is closed.

You need to reload pulseaudio module after this for the changes to take effect:

  1. pulseaudio -k
  2. pulseaudio -D

Solution 3

I've just installed a solution for Bluetooth not selecting the mic on my Bose QC35 II on Ubuntu 16.04 LTS.

Since the internal mic on my Samsung laptop is too close to the fan audio sounds like inside an airplane for all participants in a videocall.

The solution is Blueman that adds functionality for Bluetooth.

Install it: sudo apt-get install blueman

I had to restart network-manager (sudo service network-manager restart) after WiFi stopped working (could be unrelated, but hey better have it just in case).

Blueman GUI

I can now switch to Headeset Head Unit (HSP/HFP) and choose the headset mic in Sound settings

Sound settings - input

Still a bit of a hassle when it does not switch automatically (like Android does) but it's still better than being in a Jumbojet storage!

Solution 4

Along with the steps mentioned above by @Glub, that is,

  1. Find load-module module-bluetooth-policy line in /etc/pulse/default.pa
  2. Change it to load-module module-bluetooth-policy auto_switch=2

I had to reset the Pulseaudio configs and restart the Pulseaudio module by

mv ~/.config/pulse/ ~/.config/pulse.old
systemctl --user restart pulseaudio

Solution 5

This - https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Bluetooth/#index5h2 helped for me. Don't forget to install ofono and ofono-phonesim and start service.

The necessity to provide a modem to oFono makes the headset setup rather cumbersome. If you do not have a GSM/UMTS modem connected to your system (like in most desktop environments), you need a modem emulator. Unfortunately oFono does not allow to use a mobile (hfp modem, see below) as a modem to support headsets.

The best emulator choice is "phonesim" because there is a version that is maintained together with ofono. Most distributions contain a package ofono-phonesim or similar while the git version can be found at git://git.kernel.org/pub/scm/network/ofono/phonesim.git.

To set up phonesim, first create or edit the file phonesim.conf in /etc/ofono. It should contain the following lines:

[phonesim]
Driver=phonesim
Address=127.0.0.1
Port=12345

Restart oFono and check with list-modems if the phonesim modem was found. Start phonesim with

ofono-phonesim -p 12345 /usr/share/phonesim/default.xml&

The paths to phonesim.conf and default.xml might be different if you compiled ofono and/or phonesim from source. Now you can enable the modem either by using the enable-modem script or by issuing the following command:

dbus-send --print-reply --system --dest=org.ofono /phonesim org.ofono.Modem.SetProperty string:"Powered" variant:boolean:"true"

list-modems should show that the modem is powered and online. If you want to play with the modem emulator, you can add the -gui option to the phonesim command. Then a GUI will pop up as soon as you enable the modem.

Once the modem is set up properly, you can connect your headset and the "Headset Head Unit (HSP/HFP)" profile should be available in pulseaudio.

Share:
92,770

Related videos on Youtube

Aleksi Kinnunen
Author by

Aleksi Kinnunen

Updated on September 18, 2022

Comments

  • Aleksi Kinnunen
    Aleksi Kinnunen over 1 year

    I'm trying to use my headphones with my Ubuntu 13.10. My headphones are Nokia BH-905i, which can be connected via Bluetooth or green+pink wires.

    If I use bluetooth, voice quality is terrible or microphone doesn't work. If I try to choose "Headset" option from In and Out tabs in Sound Settings, they're disabling each together.

    In Out tab, I'm using "High sound quality A2DP", because it betters voice quality.

    How could I get my microphone working? Sound out works fine.

  • Takkat
    Takkat over 6 years
    The question was on getting the microphone to work in A2DP mode, which AFAIK still is not possible. Using a mic in HFP mode is rather trivial and should work OOB without any additional applications needed. If you needed blueman in addition to get it working there may be an issue with your audio setup in the fist place.
  • Valross.nu
    Valross.nu over 6 years
    Well Takkat, it's a known problem with using BT mic in headphones on Ubuntu so it's not an audio setup for the mic problem... And sorry I accidentially downvoted your answer yesterday, could not reverse it. =(
  • Takkat
    Takkat over 6 years
    en.wikipedia.org/wiki/… - it is inherent to the Bluetooth profile definition. Nothing we or any other OS could do to overcome this - but you are quite correct in that issues with HFP-mode sadly still exist.
  • Valross.nu
    Valross.nu over 6 years
    I disagree here because most OS do make the switch between the two protocols without user interaction. As pointed out Android or Windows or ios switches automatically, where Ubuntu does not... So there is a solution in place for automation between the two...
  • kommradHomer
    kommradHomer about 4 years
    on Ubuntu 18.04 , i get the error "Failed to change profile to headset_head_unit" when i try to switch to HFP
  • xmar
    xmar almost 4 years
    When trying to set HSP/HPF, I get the following error: Failed to change profile to headset_head_unit shown in the footer of the Blueman. Any hint here?
  • Rohit Karadkar
    Rohit Karadkar almost 4 years
    Thank you. My sony SBH24 mic only works on HSP mode. This helps in auto-switching.
  • Arxeiss
    Arxeiss over 3 years
    How you were able to install phonesim? I'm trying to do it with apt-get on my Ubuntu 20.04 but I'm not successful...
  • IvanTheFirst
    IvanTheFirst over 3 years
    I installed this on Mint 19 based on Ubuntu 18.04 LTS.
  • Serhii Polishchuk
    Serhii Polishchuk over 3 years
    My Marshall MID works now! Thank you!
  • Fabio Filho
    Fabio Filho over 3 years
    This didn't work for my JBL LIVE650BTNC, do you know the reason?
  • Ufos
    Ufos over 3 years
    seems to have locked my headphones into a HSP/HFP mode. But at least it now uses the mic consistently.
  • Sephethus
    Sephethus over 3 years
    Didn't work for airpods pro. Ugh.
  • user1366476
    user1366476 over 3 years
    This is really frustrating, why does linux not support a2dp w/ microphones like android?
  • Yogi Katba
    Yogi Katba over 3 years
    Getting E: [pulseaudio] main.c: Daemon startup failed. error when tried pulseaudio -D
  • Mayur Dangar
    Mayur Dangar almost 3 years
    @YogiKatba I have also got the same error, now not able to hear anything.
  • Deep Dalsania
    Deep Dalsania over 2 years
    I also got the same error. Anything from your side @Glub
  • backslashN
    backslashN over 2 years
    Try systemctl --user restart pulseaudio if Daemon startup fails.
  • Nilesh
    Nilesh over 2 years
    When we connect the same device to the mobile phone, we can listen to high-quality audio(probably A2DP) even while using a mic. Then how come its limitation of A2DP and not ubuntu?
  • Peter
    Peter over 2 years
    systemctl --user restart pulseaudio fails with Failed to restart pulseaudio.service: Unit pulseaudio.service is masked.