Software & AppsOperating SystemLinux

How To Permanently Remove or Disable HSP/HFP Bluetooth Profile in Ubuntu

Ubuntu 21

In this article, we will discuss how to permanently remove or disable the HSP/HFP Bluetooth profile in Ubuntu. The HSP/HFP profile is used for audio communication, but there may be instances where you want to disable it, such as when it’s causing connection issues with other devices.

Quick Answer

To permanently remove or disable the HSP/HFP Bluetooth profile in Ubuntu, you can edit the PulseAudio configuration, modify the Bluetooth configuration, disable autoswitch and enable manual switching, or remove the UUID from Bluetooth services in Ubuntu 20.04 and 22.04. Try these solutions one by one to find the best option for your needs.

Understanding HSP/HFP Bluetooth Profile

The HSP (Headset Profile) and HFP (Hands-Free Profile) are Bluetooth profiles that allow for audio communication between devices. They are commonly used for telephony applications, such as making calls over Bluetooth. However, in some cases, these profiles can cause issues with audio quality or connectivity. In such cases, it can be beneficial to disable these profiles.

Solution 1: Editing PulseAudio Configuration

PulseAudio is a sound server for POSIX and Win32 systems. It allows you to do advanced operations on your sound data as it passes between your application and your hardware.

To disable the HSP/HFP profile, you can modify the PulseAudio configuration as follows:

  1. Open the terminal and type the following command to open the PulseAudio configuration file:
sudo nano /etc/pulse/default.pa
  1. Look for the section that loads the module-bluetooth-policy.so module. This module is responsible for managing policy of Bluetooth devices in PulseAudio.
  2. Add auto_switch=false to the load-module line, like this:
load-module module-bluetooth-policy auto_switch=false

This command prevents PulseAudio from automatically switching to the HSP/HFP profile when a Bluetooth device connects.

  1. Save the file and exit by pressing Ctrl+X, then Y to confirm saving changes, and finally Enter to exit.
  2. Restart PulseAudio by killing the running instance with the command:
pulseaudio -k

Then, restart it by using the command:

pulseaudio -D

Solution 2: Modifying Bluetooth Configuration

Another way to disable the HSP/HFP profile is by modifying the Bluetooth configuration.

  1. Open the terminal and type the following command to open the Bluetooth configuration file:
sudo nano /etc/bluetooth/audio.conf
  1. Add the following lines under the [General] section:
Disable=Headset

This command disables the headset service, which includes the HSP/HFP profile.

  1. Save the file and exit by pressing Ctrl+X, then Y to confirm saving changes, and finally Enter to exit.
  2. Restart the Bluetooth service with the following command:
sudo systemctl restart bluetooth

Solution 3: Disabling Autoswitch and Enabling Bluetooth Device Switching

If you want to disable the automatic switching to the HSP/HFP profile but still allow manual switching, you can modify both the PulseAudio and Bluetooth configurations.

Follow the steps in Solution 1 and Solution 2, but in addition to auto_switch=false, add load-module module-switch-on-connect to the module-bluetooth-discover.so section in the PulseAudio configuration. This module enables manual switching of Bluetooth devices.

Solution 4: Removing UUID from Bluetooth Services (Ubuntu 20.04 & 22.04)

In Ubuntu 20.04 and 22.04, you can disable the HSP/HFP profile by removing its UUID from the Bluetooth services.

  1. Find the UUID for the specific Bluetooth device’s services using Blueman or other methods.
  2. Depending on your Ubuntu version, edit the appropriate file:
# For Ubuntu 20.04
sudo nano /var/lib/bluetooth/{{deviceid}}/info

# For Ubuntu 22.04
sudo nano /var/lib/bluetooth/{{controller}}/{{deviceid}}/info
  1. Remove the UUID from the “Services” section under “General”.
  2. Save the file and exit.
  3. Restart the Bluetooth service:
sudo systemctl restart bluetooth.service

Conclusion

Disabling the HSP/HFP Bluetooth profile in Ubuntu can be done in several ways, depending on your specific needs and system configuration. It’s recommended to try these solutions one by one and see which one works best for you. Always remember to back up your configuration files before making any changes, to prevent any potential issues.

Can I disable the HSP/HFP Bluetooth profile temporarily instead of permanently?

Yes, you can disable the HSP/HFP Bluetooth profile temporarily by following the steps mentioned in Solution 1 or Solution 2. Instead of making permanent changes to the configuration files, you can revert the changes or restart the respective services to enable the profile again.

Will disabling the HSP/HFP Bluetooth profile affect other Bluetooth functionalities?

Disabling the HSP/HFP Bluetooth profile will only affect audio communication using these profiles. Other Bluetooth functionalities, such as file transfer or device pairing, will not be affected.

Leave a Comment

Your email address will not be published. Required fields are marked *