26

I got the Sony MDR-ZN770BN connected to my PC via bluetooth. But I can only use A2DP. When I switch it to HSP, I get message "Failed to change profile to headset_head_unit", so no skype calls possible. Any help guys? :/

4
  • 1
    Try changing to "off" profile before switching to headset – Jeremy31 Sep 30 '16 at 14:35
  • I confirm that changing profile to "off" and then back to "a2dp" works on Xubuntu 16.04 – wlk Dec 23 '16 at 20:51
  • 1
    How is your comment related to the question? @wlk – theV0ID Dec 21 '18 at 18:26
  • 1
    As of Xubuntu 18.04 LTS (in April 2020) changing profile in Blueman to "off" and then to "Headset" does not work with gen 1 Apple Airpods. – Denis Nikolaenko Mar 27 '20 at 6:56
41

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:
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 in load-module module-bluetooth-discover headset=ofono.
  • Add the user pulse to group bluetooth to grant the permission: sudo usermod -aG 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>):
<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 (for Ubuntu 20.04 follow this link):
sudo apt install ofono-phonesim
  • Configure phonesim by adding the following lines to /etc/ofono/phonesim.conf:
[phonesim]
Driver=phonesim
Address=127.0.0.1
Port=12345
  • Restart ofono:
sudo systemctl restart ofono.service
  • Start phonesim:
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:

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.

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

15
  • 1
    This solved it for me with AirPods on Ubuntu 18.04 Thanks! – Christian Gill Jun 23 '20 at 16:26
  • 3
    I've never been so clueless when following orders, but it actually got my Huawei Freelace headphones to work! Thanks a lot. – iSWORD Sep 1 '20 at 14:44
  • 3
    ofono-phonesim-autostart is not really working for me. How do I set it up? – Akhilesh Siddhanti Oct 10 '20 at 23:58
  • 2
    When I try to run ./enable-modem, I get the following error: File "/usr/lib/python3/dist-packages/dbus/connection.py", line 652, in call_blocking reply_message = self.send_message_with_reply_and_block( dbus.exceptions.DBusException: org.ofono.Error.Failed: Operation failed What does it mean and how do I get around it? – Zoltán Oct 13 '20 at 21:19
  • 1
    I had to use ./enable-modem /phonesim and ./online-modem /phonesim in order to earphones mic to work but output quality becomes terrible so I prefer using Internal Microfone Built-in and discard this solution. – Eduardo Feb 11 at 21:56
9

I originally posted this as an edit to @alisabzevari's post, but the edit was rejected :( I still think the information is very valuable, and I wouldn't like to lose it, so I'm posting it as an answer:

As of 2020-10-17, in Ubuntu 20.04 ofono-phonesim-autostart is not available. What you could do is create the following systemd units to start it as a daemon on startup:

To run ofono-phonesim -p 12345 /usr/share/phonesim/default.xml on startup as a systemd unit, create the file /etc/systemd/system/ofono-phonesim.service (as root) with the following contents:

    
[Unit]
    
Description=Run ofono-phonesim in the background
    

    
[Service]
    
ExecStart=ofono-phonesim -p 12345 /usr/share/phonesim/default.xml
    
Type=simple
    
RemainAfterExit=yes
    

    
[Install]
    
WantedBy=multi-user.target
    

After ofono-phonesim runs, you'll need to also enable and put the phonesim modem online. I (@Zoltán) did this by creating another systemd unit file that depends on the above ofono-phonesim systemd unit. Put the following contents in /etc/systemd/system/phonesim-enable-modem.service:

    
[Unit]
    
Description=Enable and online phonesim modem
    
Requires=ofono-phonesim.service
    

    
[Service]
    
ExecStart=/<path-to-cloned-ofono-git-repo>/test/enable-modem /phonesim
    
ExecStart=/<path-to-cloned-ofono-git-repo>/test/online-modem /phonesim
    
Type=oneshot
    
RemainAfterExit=yes
    

    
[Install]
    
WantedBy=multi-user.target
    

Then run the following commands to run both daemons:

    
sudo systemctl daemon-reload

    
sudo systemctl enable ofono-phonesim.service
    
sudo systemctl enable phonesim-enable-modem.service
    
sudo service phonesim-enable-modem start
    

Check if the service is running with

    
sudo service phonesim-enable-modem status
    

Finally, restart pulseaudio with pulseaudio -k. Now you should be able to switch the profile to headset_head_unit.

5
  • Thanks for writing this. I also don't know why your edit got rejected. StackExchange has some strict rules. – alisabzevari Dec 19 '20 at 19:28
  • 1
    Getting error when executing command sudo service phonesim-enable-modem.service start as Failed to start phonesim-enable-modem.service.service: Unit phonesim-enable-modem.service.service not found. – timekeeper Dec 20 '20 at 12:15
  • 1
    Before last command should be sudo service phonesim-enable-modem.service start – Andriy Slobodyanyk Dec 24 '20 at 9:58
  • Thanks @AndriySlobodyanyk, that's correct and I see your edit was already approved. – Zoltán Dec 26 '20 at 17:01
  • @timekeeper see Andriy's comment, there was an error in my post. – Zoltán Dec 26 '20 at 17:01
2

I tried everything i possibly could, even the above answers. But i couldn't use the microphone of my headset. So i found another way to use a mic.

All you need is an Android phone which has bluetooth.

Firstly, go to google playstore on your phone and download a bluetooth microphone app.

I used this one (Simple Bluetooth Mic): https://play.google.com/store/apps/details?id=com.app.google.chrischan.simplebluetoothmic

Alternatively, you can use this: https://play.google.com/store/apps/details?id=wimlog.com.myandroidtest4.

Connect the phone's bluetooth to your PC.

Now connect your bluetooth headset to the PC. (Both the devices must be connected simultaneously)

Open the Simple Bluetooth Mic App on your phone, click on speak.

Voila, that's it.

Basically you are using your phone's mic, because we can't use the bluetooth headset for both audio input and output.(changing from A2DP to HSP everytime you need to use the headset mic is irritating af)

If this doesn't work, go to your sound settings and choose the input device as your phone's bluetooth.

HOPE THIS HELPS :)

1
  • Many BT headsets cannot be connected to two devices at the same time. – Fran Marzoa Apr 12 at 19:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.