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:

  1. Install ofono:
1
sudo apt install ofono
  1. Config pulseaudio to use ofono:
  • Goto /etc/pulse/default.pa find the line load-module module-bluetooth-discover and change it to load-module module-bluetooth-discover headset=ofono.
  • Add the user pulse to group bluetooth 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
2
3
<policy user="pulse">
<allow send_destination="org.ofono"/>
</policy>
  1. Provide phonesim to ofono. 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 called phonesim). in Ubuntu 18.04:
1
sudo apt install ofono-phonesim
  • Configure phonesim by adding the following lines to /etc/ofono/phonesim.conf:
1
2
3
4
[phonesim]
Driver=phonesim
Address=127.0.0.1
Port=12345
  • 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
2
3
4
cd /tmp
git clone git://git.kernel.org/pub/scm/network/ofono/ofono.git
cd ofono/test
./list-modems

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.

  1. 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: