Categories: TutorialsUbuntu

How to use Bluetooth Headset on Ubuntu 20.04

By Simon Zambrovski, As more users switch to Linux for their daily computing needs, seamless remote communication has become essential. However, some users encounter challenges when trying to use Bluetooth headsets for conferencing.

Specifically, the current version of PulseAudio faces an issue with supporting Bluetooth headsets in both the A2DP profile (headphone mode with disabled microphone) and the HSP/HFP profile (lower headphone quality but with an enabled microphone). In this article, we explore potential solutions to address this issue and enhance the usability of Bluetooth headsets on Linux systems.

Steps
Sponsored
to Enable Hands-Free Mode for Your Headset:

  1. Install Ofono
  2. Configure PulseAudio
  3. Set Up ofono-phonesim
  4. Configure Services Autostarts

1 Install Ofono : Open your console and run the following command:
sudo apt install ofono

2 Configure PulseAudio:

: In the file /etc/pulse/default.pa, locate the section where module-bluetooth-discover is loaded. Modify it as follows:

.ifexists module-bluetooth-discover.so

load-module module-bluetooth-discover headset=ofono

.endif

Execute the following command to add the user “pulse” to the “bluetooth” group:
sudo usermod -aG bluetooth pulse

Grant Permissions for ofono: Edit the file /etc/dbus-1/system.d/ofono.conf and add the following block as the last policy:

Read: How to manage sounds using PulseAudio on Ubuntu 18.04

3 Set Up ofono-phonesim

Install ofono-phonesim by running the following command:
sudo apt install ofono-phonesim

To create a virtual modem, create a new file named /etc/ofono/phonesim.conf with the following content:
[phonesim]

Driver=phonesim

Address=127.0.0.1

Port=12345

Feel free to choose a different port if you’re unable to use port 12345.

Manual mode

System Setup Completion: Your system setup is now complete for manual usage.

Start ofono-phonesim and Restart Bluetooth Stack: To use it, follow these steps:

Start ofono-phonesim by running the command:
ofono-phonesim -p 12345 /usr/share/phonesim/default.xml &
sudo service ofono restart
sudo service bluetooth restart

Test the Phonesim Modem: As a test, run the command:
/usr/share/ofono/scripts/list-modems

You should see the phonesim modem initialized.

Configure Bluetooth Settings: Open your Bluetooth settings (you can use Blueman or the built-in Ubuntu settings). Connect your Bluetooth device and switch it to the HSP/HFP profile.

Read: How to troubleshoot sound issues in Ubuntu 22.04

Setup automation

System Setup Completion: If your manual mode is functioning correctly, you’re almost there. However, manually executing the steps each time can be tedious. Let’s optimize your system startup to streamline this process.

Creating a systemd Unit File for Phonesim: To automatically start Phonesim when your system boots up, follow these steps:

  • Create a new file named phonesim.service in the directory /etc/systemd/system/.
  • Add the following content to the phonesim.service file:

Sponsored

Read: How to display your sound card details using the terminal on Ubuntu 22.04

Adjusting Port Settings: If you’ve modified the port in your modem definition, ensure that you update it accordingly.

Also, verify that the line containing ExecStart is correctly formatted.

Configuring ofono Service: To establish a dependency between ofono.service and phonesim.service, follow these steps:

Copy the original unit definition for ofono.service to /etc/systemd/system/ofono.service.

Modify the content of the copied file to:

Create the Unit File for Phonesim Modem:

Create a new unit file named /etc/systemd/system/ofono-modem.service.

Add the following content to the ofono-modem.service file:
[Unit]

Description=Enables Phonesim Modem

After=ofono.service

Requires=ofono.service

[Service]

Type=oneshot

ExecStart=/usr/share/ofono/scripts/enable-modem /phonesim

[Install]

WantedBy=multi-user.target

This service will run just after ofono.service and enable our modem during system boot.

Activate the Services on Boot:

Reload your systemd configuration and enable them by executing:

sudo systemctl daemon-reload

sudo systemctl enable phonesim

sudo systemctl enable ofono

sudo systemctl enable ofono-modem

Finally, reboot your system.

After the reboot, verify if the modem is directly connected by running the command: /usr/share/ofono/scripts/list-modems.

You should observe output similar to the following:

 

The post How to use Bluetooth Headset on Ubuntu 20.04 appeared first on net2.

Ubuntu Server Admin

Recent Posts

What our users make with Ubuntu Pro – Episode 2

How Vaultara achieved FedRAMP compliance with Ubuntu Pro Ubuntu Pro helps businesses worldwide to innovate…

12 hours ago

How To Install Zabbix Server 7.4 On Ubuntu 22.04

Zabbix is smart monitoring system on your network. This software written by php mysql. So…

18 hours ago

How To Install Zabbix Server 7.2 On Ubuntu 22.04

Zabbix is smart monitoring system on your network. This software written by php mysql. So…

18 hours ago

SuperTuxKart 1.5 RC2 added GUI option to Choose Vulkan or DirectX 9

SuperTuxKart, the 3D kart racing game, announced the second release candidate for the next 1.5…

18 hours ago

What’s the state of open source adoption in Europe?

New research suggests 86% of European organizations believe open source is valuable for the future…

1 day ago

What are dependencies, and how do you secure them?

Open source software is everywhere. Research shows that around 97% of codebases contain open source…

1 day ago