How I fixed my Galaxy Earbuds+ microphone issue on Ubuntu
This is a repost of my answer to a question in Ask Ubuntu. I post it here for documentation reasons because it is removed from Ask Ubuntu by moderators.
The Problem
I bought a pair of Samsung Galaxy Earbuds+ true wireless headphones to use them while working from home. Unfortunately, I couldn’t use their microphone on Ubuntu simply because the microphone did not appear in sounds settings.
Background
After some investigation, it turned out that there are lots of bluetooth communication standards known as bluetooth profiles. In order to use a bluetooth headset (listening and talking simultaneously) your device should support HFP or HSP profiles. Most of the bluetooth headphones support both HFP and HSP but Earbuds+ only supports HFP.
On the other hand, PulseAudio only supports HSP out-of-the-box. So I had to use oFono to enable HFP for PulseAudio.
Solution (AskUbuntu Answer)
I had the similar problem with Galaxy Earbuds+ and here is how I solved it:
My earbuds profiles were A2DP, AVRCP and HFP and no support for HSP. Pulseaudio only supports HSP out-of-the-box. That’s why I couldn’t switch to HSP/HFP. In order to make HSP/HFP work, you have to enable HFP on pulseaudio which needs ofono. Here is how I did it on Ubuntu 18.04:
- Install
ofono
:
1 | sudo apt install ofono |
- Config pulseaudio to use ofono:
- Goto
/etc/pulse/default.pa
find the lineload-module module-bluetooth-discover
and change it toload-module module-bluetooth-discover headset=ofono
. - Add the user
pulse
to groupbluetooth
to grant the permission:sudo useradd -g bluetooth pulse
(probably it’s already correct) - VERY IMPORTANT: To grant the permission, add this to
/etc/dbus-1/system.d/ofono.conf
(before</busconfig>
):
1 | <policy user="pulse"> |
- Provide
phonesim
toofono
. In order to make ofono work, you have to provide a modem to it! You can install a modem emulator called phonesim (implemented by ofono) to make it work:
- install
ofono-phonesim
(in some distros it is calledphonesim
). in Ubuntu 18.04:
1 | sudo apt install ofono-phonesim |
- Configure phonesim by adding the following lines to
/etc/ofono/phonesim.conf
:
1 | [phonesim] |
- Restart
ofono
:
1 | sudo systemctl restart ofono.service |
- Start
phonesim
:
1 | ofono-phonesim -p 12345 /usr/share/phonesim/default.xml |
Note that the command can be phonesim
. To make sure phonesim is started correctly you can clone the ofono repo and use their test scripts:
1 | cd /tmp |
You should see the modem in the result. You might have to first enable the modem by executing enable-modem
and online-modem
scripts in the same directory.
Once the modem is enabled, you should be able to enable HFP profile.
- autostart phonesim. Since you have executed phonesim manually, after every restart you should execute it again. Instead you can install
ofono-phonesim-autostart
which will start the phonesim as a service.
References: