90

With Ubuntu 16.04 I've been attempting to pair by Apple airpods as a headset. They come up as headphones. They work fine as headphones, but I would like the microphone to be available

airpods pairing as headphones, not headset

Doug T.
  • 1,180
  • I don't have an answer to your question, but just hoping to get more info: are you able to listen to music from Ubuntu 16.04 on you airpods via bluetooth? I didn't realize they were using standard protocols that Ubuntu could use. – Artur Sapek Oct 16 '17 at 00:15
  • 2
    I have the same problem with Airpods: In Ubuntu we can only see the AD2P bluetooth profile for the airpods. But there is no HFP bluetooth profile presented to use the microphone. – chronos00 Nov 10 '17 at 18:02
  • Any updates on this? – highsciguy Jan 02 '18 at 19:54
  • There is a related bug report here https://bugs.freedesktop.org/show_bug.cgi?id=93898. The issue seems to be related to pulseaudio. Some report to have the microphone of their (non-Apple) equipment working when setting an option in /etc/pulse/default.pa. I have also tried to install pulseaudio from ppa. These efforts did not take me anywhere, unfortunately. – highsciguy Jan 02 '18 at 19:57
  • 3
    There still doesn't seem to be an answer to the question of using the AirPods microphone in Ubuntu as of June 2020. – kas Jun 02 '20 at 19:45
  • check this out https://github.com/4khi1/i3blocks-airpods – Akhil Jul 17 '20 at 15:05
  • Check this out: https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Bluetooth/

    It has helped me to fix the issue.

    – Henrique dos Santos Goulart May 04 '21 at 14:24
  • for me only https://cri.dev/posts/2021-01-04-Pair-AirPods-with-Linux-Ubuntu/ article was very helpful, because no one answer below helped me (helped only partly). All I missed - "Press the button on the back for 5 sec and wait for the yellow blinking light." - and it really helped! – Vaha Dec 28 '21 at 11:16

4 Answers4

87

I was helped by the instruction below.

  1. Set ControllerMode = bredr or ControllerMode = dual by editing /etc/bluetooth/main.conf file using sudo nano /etc/bluetooth/main.conf command (or another text editor of your choice)
  2. sudo /etc/init.d/bluetooth restart
  3. Try to pair again.
damadam
  • 2,833
Alexander
  • 903
  • Setting ControllerMode = dual worked for me. – Rajesh Chaudhary Jun 19 '19 at 10:33
  • 8
    setting dual does not really make sense as it is the default mode – Wlad Dec 13 '19 at 09:09
  • 20
    Setting ControllerMode = bredr worked for me on Ubuntu 18.04, Airpods 1. – samb102 Dec 16 '19 at 08:31
  • Same for me, 18.04 airpods 2 with bredr works. – intijk Feb 06 '20 at 08:51
  • 4
    Are the AirPods being connected as a headset though when using this approach? – johnnyodonnell May 26 '20 at 17:40
  • 11
    Thank you. I wasn't able to connect my AirPods Pro in Ubuntu 20.04 LTS. Adding "ControllerMode = bredr" fixed the issue for me. Also echoing that "ControllerMode = dual" was the default. I can't confirm that this answers the original question though, about the AirPods being connected as a headset. – kas Jun 02 '20 at 19:35
  • 1
    Microphone input does not seem to come from the AirPods. – kas Jun 02 '20 at 19:41
  • 1
    Thanks, i use Ubuntu 20.04 LTS, with ControllerMode = bredr fixed the issue. – Raymond Chiu Jun 07 '20 at 09:44
  • 1
    Setting ControllerMode = bredr and restarting with systemctl restart bluetooth did the trick on Arch Linux with Gnome – emccracken Jun 13 '20 at 18:50
  • 16
    This answer is highly upvoted but it's about connecting airpods, not about the original question which is about connecting them as headset. – Arthur B Oct 02 '20 at 10:23
  • doesn't work for me – Mario Palumbo Oct 27 '20 at 14:37
  • 9
    I can confirm that this does NOT allow you to use the air pods as headsets on Ubuntu 18.04 on a Thinkpad T440p, tried this with both ControllerMode = dual as well as ControllerMode = bredr. As stated before this does NOT answer the original question! – Philipp Doerner Nov 24 '20 at 12:59
  • 1
    This helped to connect them for me on 20.04 LTS, thanks! However, as other's have mentioned, the microphone still doesn't work. I'd love to get an answer to that. – spacemanjosh Mar 31 '21 at 05:01
  • Thinkpad T14s with Ubuntu 21.04. Tried multiple things, only ControllerMode = bredr did the trick for me! – marc Mar 04 '22 at 10:28
  • sudo systemctl restart bluetooth – Sergei G Aug 12 '23 at 06:34
22

I was desperately searching on the websites, but I finally found this blog post which was really helpful to get familiar with a complementary Bluetooth stack. Here's the solution which I have changed and added to it according to my experience:

  1. Install bluez Bluetooth stack (like a full set of Bluetooth drivers which allows the Linux OS direct access to Bluetooth):

    sudo apt-get install 'bluez*'

  2. Optional: install Bluetooth manager, Blueman:

    sudo apt-get install blueman

  3. Load USB Bluetooth driver (Bluetooth dongle):

    modprobe btusb

  4. Restart bluetooth service:

    sudo systemctl restart bluetooth

  5. Add controller mode setting to be dual Bluetooth configuration /etc/bluetooth/main.conf change this mode to bredr or le in case you have problem with your AirPods:

    ControllerMode = dual

  6. Now try to pair your AirPods!

The source of the issue is that Ubuntu's Bluetooth driver doesn't cover AirPods' one.

My system specification:

  • Ubuntu 18.04.2 LTS
  • Mini Bluetooth 4.0 USB 2.0 CSR4.0 Dongle Adapter

UPDATE:

You might need to choose either dual or bredr for ControllerMode in step 5.

enter image description here

  • 3
    dual is the default, I doubt setting it make any difference. There is another command to manage services which is IMO much easier to remember: sudo service bluetooth restart, sudo service bluetooth status. It comes with tap autocomplete so you can type sudo service hit TAB and see all available services or type sudo service blue + hit TAB which will show all services starting with blue or autocomplete to bluetooth – Wlad Dec 13 '19 at 09:24
  • 14
    Setting to bredr made pairing of AirPods Pro finally succeed - but only as headphones, not as headset. The volume was a bit too low so I had to activate Over-Amplification in sound settings to allow volume up beyond 100%. – Wlad Dec 13 '19 at 09:38
  • 1
    @Wlad I have the same partial solution, still no way to use as headset – c-o-d Mar 24 '20 at 22:16
  • The same result can be achieved in much fewer steps with the other answer. – kas Jun 02 '20 at 19:47
  • This is what worked for me on Pop_os uname -a

    Linux pop-os 5.11.0-7620-generic #21~1626191760~21.04~55de9c3-Ubuntu SMP Tue Jul 20 22:18:55 UTC x86_64 x86_64 x86_64 GNU/Linux

    – sdc Aug 29 '21 at 03:37
13

Ubuntu 23.04

On this one it will just work, as it uses pipewire.

Ubuntu 21.04/22.04

First, some words of context of what's might be going on for Ubuntu 21.04. Pulseaudio doesn't have complete/perfect support for HFP/HSP (the bluetooth standards for headset and headphones).let’s install pipewire (replacement of pulseaudio) (https://askubuntu.com/a/1339908/170833 ) and you will get 16k quality on the microphone.

Install latest Pipewire (and disable pulseaudio)

  1. install PPA with this commands (looks like it’s not necessary to install a PPA on Ubuntu 22.04):
sudo add-apt-repository ppa:pipewire-debian/pipewire-upstream
sudo apt-get update
  1. Install pipewire!
sudo apt install pipewire pipewire-pulse \
  pipewire-tests pipewire-locales gstreamer1.0-pipewire libspa-0.2-bluetooth \
  libspa-0.2-jack pipewire-audio-client-libraries
  1. Disable pulseaudio
sudo systemctl disable --global pulseaudio
  1. Enable pipewire
sudo systemctl enable --global pipewire-pulse
  1. Check pipewire is integrated checking the output of this command
$ pactl info | grep "Server Name"
Server Name: PulseAudio (on Pipewire 0.3.35)

At this point you should have a working audio system!

LAST STEP

Now you should have an audio system that can use "Headset Head Unit" protocol. Let's click it! (and yes, now is a good moment to pray to "Mary, Undoer of Knots")

Enter Settings -> Sound -> Output, select "Headset Head Unit (HSP/HFP)" and what you will see that on "Input" also changes.

airpods connected in HSP/HFP mode

Hopefully you enjoyed all this scripting and hacking in your machine! If things go sideways, remember to undo stuff so that your computer doesn't become bloated and full of random scripts from people on the internet (specially from me).

morhook
  • 1,610
  • 14
  • 23
  • Has anyone gotten this to work with 21.04? I'm not having any luck. The list-modems command is giving me a lot of 0s and blank entries. – krumpelstiltskin Aug 31 '21 at 19:08
  • 1
    My settings will allow me to select (HSP/HFP) but it will not remain selected when I close and then reopen the Sound setting window. – krumpelstiltskin Aug 31 '21 at 19:52
  • Try to change with "blueman" UI the settings. Sometimes is more stable (and also you'll have visual feedback if something went wrong). I have to restart from time to time the services with sudo systemctl restart ofono && sudo systemctl restart ofono-phonesim && sudo systemctl restart phonesim-enable-modem.service – morhook Sep 01 '21 at 11:54
  • 1
    Thanks @morhook. Blueman is a little better in that it gives me a vague error message "Failed to change profile to headset_head_unit" when I choose the HSP/HFP profile. Now I need to figure out why it is failing. – krumpelstiltskin Sep 04 '21 at 15:10
  • Thanks @morhook! Blueman will let me choose the HSP/HFP profile as long as I restart all the daemons directly beforehand. – krumpelstiltskin Sep 04 '21 at 15:22
  • works for me, thanks @morhook – Pastor Durán A. Nov 02 '21 at 15:48
  • It works but the input/output quality is really terrible, is it just me? – Alexandre Daubricourt Aug 29 '22 at 06:22
  • 1
    @AlexandreDaubricourt if you installed via pipewire and select codec mSBC you should get a decent quality of microphone. I will erase the ofono-phonesim option so that people stop using it. – morhook Aug 29 '22 at 15:33
  • @morhook Just switched back to WIndows with WSL/SSH.. Linux for desktop is not that good unfortunately – Alexandre Daubricourt Aug 30 '22 at 08:41
  • Worked for me after I actually ran the prepare_for_meeting script before continuing to the next step. – Zach Boyd Jun 22 '23 at 21:38
7

I finally had my microphone working with Ubuntu 18.04 and Airpods Pro. It seems it is not just Airpods, but Galaxy Buds and several other bluetooth variants. We need HSP (low speaker output but mic enabled) and not A2DP.

Please refer to this very nice write-up: https://askubuntu.com/a/1236379/692059