I have a CEL-TEC F5A headset. The spec says:

Bluetooth 4.0, profiles: Headset, Hands free, A2DP, AVRCP/HSP/HFP

It plays nicely with High Fidelity Playback (A2DP sink) profile.

When I want to switch audio input to the headset's microphone, the output profile automatically changes to Headset Head Unit (HFS/HFP) and the quality is terrible - like 8bit sound or something. When I switch it back to A2DP, the input is back to desktop mic.

I've read few of other questions and seems A2DP is expected not to support input, right? But the HFP part in HFS/HFP is High Fidelity Playback I guess? That sounds like it could work as a headset and still not sound like 1950's phone.

How could I simplify switching between the profiles so that it is HFS/HFP when I talk and A2DP when I listen? E.g. as a push-to-talk.

Ubuntu 17.10, no sound customization IIRC, everything latest.

My output:

$ pactl list cards
Card #0
        Name: alsa_card.pci-0000_00_03.0

Card #4
        Name: bluez_card.00_19_5D_25_6F_6C
        Driver: module-bluez5-device.c
        Owner Module: 30
                device.description = "F5A"
                device.string = "00:19:5D:25:6F:6C"
                device.api = "bluez"
                device.class = "sound"
                device.bus = "bluetooth"
                device.form_factor = "headset"
                bluez.path = "/org/bluez/hci0/dev_00_19_5D_25_6F_6C"
                bluez.class = "0x240404"
                bluez.alias = "F5A"
                device.icon_name = "audio-headset-bluetooth"
                device.intended_roles = "phone"
                a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 10, available: yes)
                headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 20, available: yes)
                off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
        Active Profile: a2dp_sink
                headset-output: Headset (priority: 0, latency offset: 0 usec, available)
                        Part of profile(s): a2dp_sink, headset_head_unit
                headset-input: Headset (priority: 0, latency offset: 0 usec)
                        Part of profile(s): headset_head_unit

The problem here is not that the microphone does not work, but rather that the audio quality worsens when it is activated.


7 Answers 7


Ondra, there is a very long pulse audio merge request discussion that contains most of the information.

tl;dr; to get things working pulse audio, bluez and kernel need to be updated (not trivially). As well a separate daemon hsphfpd is necessary.

Kernel updates are not progressing and user input to maintainers would be helpful in pushing things forward. Think about providing such. See here.

Without the kernel patches, using headphones' mic leads to terrible audio quality (HSP/HFP mode of operation).

But there is chance that only Pulse patches (and support from your headphones) can enable A2DP bi-directional audio which should be alright for most purposes.

And that patch is progressing well at the moment. More feedback on it shouldn't hurt.

Update: THings in above mentioned pull request escalated very quickly and seems like PulseAudio may never implement proper bluetooth support. Lets hope for Pipewire which already has some patches.

  • 2
    Thanks Alex, nice to meet you here :) Commented Sep 9, 2020 at 0:08
  • 3
    good answer, though reality sucks Commented Feb 2, 2021 at 14:48
  • 1
    I switched from pulseaudio to pipewire and headset is working a lot better. It is auto-switching when browser start using microphone (did not switch in pusleaudio). Also I have aptX support that was missing before. In overall pipewire have superior support for bt headsets.
    – piotrekkr
    Commented Mar 15, 2023 at 10:17

I was about to return the headset and wait for Bluetooth 5.0 headset, but then realized, that's the best functionality I can get with my BT 4.0 laptop. So I kept them.

Still, listening to a French guy over 16 bit 8000 Hz audio wasn't really the right way to have a meeting. For few days, I was switching between the two modes using Ubuntu's sound settings dialog, but that's really, really annoying as you can imagine.

So I wrote this script leveraging pacmd which toggles between the 2 modes:

  • Crappy audio, microphone on
  • Near-CD quality audio, microphone off

It is not polished, has some dead code, and I use my own phones ID's, but it may be an inspiration for your own script. Latest version here.


####  Restart Bluetooth
if [ "$1" == "resetBT" ] ; then
  sudo rfkill block bluetooth && sleep 0.1 && sudo rfkill unblock bluetooth;

#### Toggle listen/speak
if [ "$1" == "" -o "$1" == "toggle" ] ; then
  LINE=`pacmd list-sinks  | grep '\(name:\|alias\)' | grep -B1 F5A  | head -1`
  if [ "$LINE" == "" ] ; then echo "F5A headset not found"; exit; fi

  if $(echo "$LINE" | grep $SINK_NAME &> /dev/null) ; then
    echo "Detected quality sound output, that means we can't speak; switch that."
    $0 speak;
    echo "Quality sound not found, switch to the good sound."
    $0 listen;

#### Change the output to F5A
if [ "$1" == "listen" ] ; then
  LINE=`pacmd list-sinks  | grep '\(name:\|alias\)' | grep -B1 F5A  | head -1`
  if [ "$LINE" == "" ] ; then echo "F5A phones not found"; exit; fi
  #        name: <bluez_sink.00_19_5D_25_6F_6C.headset_head_unit>

  ## Get what's between <...>
  SINK_NAME=`echo "$LINE" | tr '>' '<' | cut -d'<' -f2`;

  ## The above gives an ID according to the active profile.
  ## To set manually:

  ## Switch the output to that.
  echo "Switching audio output to $SINK_NAME";
  pacmd set-default-sink "$SINK_NAME"

  #### Change profile to quality output + no mic. From `pacmd list-cards`:
  echo "Switching audio profile to $PROFILE";
  pacmd set-card-profile $CARD $PROFILE

#### Input
if [ "$1" == "speak" ] ; then
  ## Change profile to crappy output + mic. From `pacmd list-cards`:
  pacmd set-card-profile $CARD headset_head_unit

  LINE=`pacmd list-sources | grep '\(name:\|alias\)' | grep -B1 F5A  | head -1`
  if [ "$LINE" == "" ] ; then echo "F5A mic not found"; exit; fi
  SOURCE_NAME=`echo "$LINE" | tr '>' '<' | cut -d'<' -f2`;
  echo "Switching audio input to $SOURCE_NAME";
  pacmd set-default-source "$SOURCE_NAME" || echo 'Try `pacmd list-sources`.';

####  Resources:

##  Why this is needed
# https://jimshaver.net/2015/03/31/going-a2dp-only-on-linux/

##  My original question
# https://askubuntu.com/questions/1004712/audio-profile-changes-automatically-to-hsp-bad-quality-when-i-change-input-to/1009156#1009156

##  Script to monitor plugged earphones and switch when unplugged (Ubuntu does that, but nice script):
# https://github.com/freundTech/linux-helper-scripts/blob/master/padevswitch/padevswitch

Hope this helps someone :)

  • awesome! just found and replaced the magic strings and it works with my Srhythm NC-75 Commented Mar 26, 2020 at 12:59
  • I'm tempted to take this one step further and make a sort of "push to talk" feature that would toggle modes only when I want to speak, but I'm way too much of a Linux noob for that still. I'm totally putting it in my "wacky ideas simmering pot" in the back burner though. Commented May 19, 2020 at 16:21
  • I have problem in ubuntu 18.04 when accessing mic of my Bluetooth headset audio automatically changes to HSP/HFP where(path) i need to put this script?
    – Mr. Y
    Commented Jul 28, 2020 at 6:32
  • Could you elaborate on what bluetooth 5 changes please? My headset is 5.0, but the USB adaptor I'm using in my PC is certainly not, perhaps not even 4.0, so your answer seems to suggest I could replace it with a 5.0 adaptor and use the microphone at the same time as higher quality audio? 5 has more bandwidth and supports HFP alongside A2DP (or some new protocol)?
    – OJFord
    Commented Oct 12, 2020 at 18:38
  • 2
    I also found this extension helpful: extensions.gnome.org/extension/906/sound-output-device-chooser Commented Mar 22, 2021 at 10:44

Based on this article I fear that Bluetooth won't give me the pleasure of hearing a quality sound and speak over the headset at the same time. :/

Not accepting this answer though, I am still hoping someone will come up with some way to do so.


The feature you are looking for is available in PipeWire (a replacement for PulseAudio) when using pipewire-media-session or wireplumber as a session manager. The first one is the default and enabling automatic profile switching is achieved by setting

bluez5.autoswitch-profile = true

in ~/.config/pipewire/media-session.d/bluez-monitor.conf

After restarting pipewire-media-session, the A2DP profile is used by default. Only when a sound input is detected, Pipewire will switch to HSP/HFP and back to A2DP when it ends.

This is explained in the Arch Wiki as well as this blog article.


I wrote a simple GUI with a toggle button, to be used together with the one from Ondra Žižka's: https://gist.github.com/weslleyspereira/e8feeb9f1b7008ae1ffad2777e39d0dd

It creates a window with a single button written 'Switch Mic On'. Press it and it will switch to 'Switch Mic Off' and you're now with the headset microphone on and the low-quality audio. Press it again, and you come back to 'Switch Mic On' with high-quality audio but the microphone in the headset is off.

#! /usr/bin/python

''' switchHeadphones.py
Tkinter toggle button to switch microphone On/Off using a script 

Modification of the solution proposed in
for the Mic On/Off script from

# Define the path for the script below, e.g.,
script = "./switchHeadphones.sh"

    # Python2
    import Tkinter as tk
except ImportError:
    # Python3
    import tkinter as tk
import os

__author__ = "Weslley S Pereira"
__email__ = "[email protected]"

def toggle(tog=[0]):
    a list default argument has a fixed address
    tog[0] = not tog[0]
    if tog[0]:
        os.system(script+' speak')
        t_btn.config(text='Switch Mic Off')
        os.system(script+' listen')
        t_btn.config(text='Switch Mic On')

root = tk.Tk()
root.title('Headphone  ')

t_btn = tk.Button(text='Switch Mic On', width=15, command=toggle)

  • What does this script do? Can you explain your work in a little bit more detail? Commented Sep 8, 2020 at 23:35
  • It creates a window with a single button written 'Switch Mic On'. Press it and it will switch to 'Switch Mic Off' and you're now with the headset microphone on and the low-quality audio. Press it again, and you come back to 'Switch Mic On' with high-quality audio but the microphone in the headset is off Commented Sep 16, 2020 at 11:24
  • 2
    improved your script a bit more, and made it easier to use: gist.github.com/JakeTrock/6158cb81117605d75603fa637e72fd66
    – Jake t
    Commented Nov 23, 2020 at 15:24

I came here with the same problem with my Poly Voyager Focus UC. Too bad the support in the bluetooth stack isn't there (yet). The Voyager Focus also comes with a usb dongle which can be used to connect it. With the dongle Linux sees the headset as a sound card, so the Linux BT stack is not involved, and bidirectional sound quality is good. The only minor problem is that if I switch the headset off Linux doesn't see that and doesn't switch audio playback back to the speakers, so I need to select the sound output device manually.

Elsewhere on the interwebs I read people also had succes with such a workaround by using a third party USB Bluetooth audio adapter and connecting their headset to that instead of the system bluetooth. Based on what I could find, for that to work both the headset and the bluetooth audio adapter need to both support "wideband speech" in their HSP (Headset Profile), which is optional. Wideband speech is only 16 kHz / 16 bit, but that's still a big improvement over the 8 kHz standard HSP channel. The Linux bluetooth stack does not yet support wideband audio. What I don't know is if my Voyager Focus dongle uses standard bluetooth with wideband speech, or if it uses some proprietary wireless protocol extension.


Many bluetooth headsets show up as 2 separate devices, one as headphone / speaker (no mic) and one as headset (with mic). Disabling the headset device will force the use of A2DP. This could also be scripted maybe in an easier way than the other examples in this thread.

  • How would I disable the HSP/HFP Headset to force the use of high quality sound with the Headset mic?
    – mondjunge
    Commented Feb 15, 2021 at 8:40
  • Probably you can't. Cuz you do now have A2DP source capability on your headphones. Both WF 1000XM3 and WH 1000XM4 do not have it. Commented Mar 15, 2021 at 12:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .