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

Canonical announces 12 year Kubernetes LTS

Canonical’s Kubernetes LTS (Long Term Support) will support FedRAMP compliance and receive at least 12…

1 hour ago

Ubuntu Weekly Newsletter Issue 878

Welcome to the Ubuntu Weekly Newsletter, Issue 878 for the week of February 2 –…

20 hours ago

How your feedback shapes the way we support open source software

At Canonical, we firmly believe that delivering an outstanding, customer-centric support experience is impossible without…

1 day ago

How To Install osTicket v1.14 On Ubuntu 20.04

I want to share how to install osTicket v1.14 for Ubuntu 20.04 server. osTicket written…

2 days ago

How To Install WordPress On Ubuntu 20.04

Now I want to share how to install WordPress on ubuntu 20.04 server. WordPress is…

2 days ago

How To Install DNS Server (Bind9) On Ubuntu 20.04

Now I want to share the DNS server installation process on your Ubuntu 20.04 server.…

2 days ago