Bug 1311238

Summary: Refused to switch profile to headset_head_unit (Not able to use microphone with bluetooth headset)
Product: [Fedora] Fedora Reporter: pavel.nedr
Component: pulseaudioAssignee: Lennart Poettering <lpoetter>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: 34CC: 0x62696e61746f7279, andreas.kohn, bparees, brian, christopher.markieta, clarkaddison, daniel.morlock+redhat, dfediuck, djuran, dwlegg, elia.f.geretto, es, gernot, ggrasza, gpborges, grpiedade, inigoserna, james, jcoscia, jimis, kxra, lbalhar, lpoetter, lyarwood, marko.bevc, mbocek, mike, mmccune, myeservices+fedoraproject.org, pablodav, pasik, pavel.nedr, ra, rbost, rdieter, redhat-bugzilla, redhat, redhat, robin, rpbikker, rtalur, sgraf, stanley.king, stephenfin, timur.kristof, tomek, travier, trees, tselios.petros, wtaymans, zarrro
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-19 02:20:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to make HFP work none

Description pavel.nedr 2016-02-23 17:01:17 UTC
Description of problem:
HSP/HFP profiles doesn't work with pulseaudio on my Fedora 22 and Fedora 23 installations.
I've tried to use it with both default settings and with ofono (enabling ofono with systemctl and using "load-module module-bluetooth-discover headset=ofono" in /etc/pulse/default.pa and system.pa), but it doesn't solve problem.

I have that problems with 3 different devices from Sony, Jabra and Logitech.

This bug may be related with #1305453 which is with High severity

Version-Release number of selected component (if applicable):
pulseaudio-7.1-1.fc23.x86_64
bluez-5.36-1.fc23.x86_64

How reproducible:
Always


Steps to Reproduce:
1. Connect and pair Bluetooth headset
2. Go to System Settings -> Multimedia -> Audio and Video -> Audio Hardware Setup
3. Select your device in Sound Card field,
4. Select profile "Head Set Unit (HSP/HFP)", click "Apply"

Actual results:
- If you reload this settings page, you'll see A2DP Sink profile again
- In log you can see "pulseaudio[11942]: [pulseaudio] module-bluez5-device.c: Refused to switch profile to headset_head_unit: Not connected" message
- You can't see any bluetooth input devices in pavucontrol Input Devices section (excepting monitor)


Expected results:
Voice recording should work with HSP/HFP profile as, say, in Android

Comment 1 Brian J. Murrell 2016-04-15 14:45:19 UTC
Sigh.  Bluetooth headset problems on Fedora again (still?).

I am also seeing this.

What needs to happen to have this fixed?  It's been probably a year or more since I have been able to use my B/T headset on Fedora.

Comment 2 Erwan Legrand 2016-07-13 13:14:18 UTC
This is possibly related to Bug 1356136, although in my case HSP/HFP is always activated and I can't switch to A2DP. I wonder whether the workaround I described in Bug 1356136 works for this bug.

Comment 3 Fedora End Of Life 2016-11-24 15:43:35 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 4 Brian J. Murrell 2016-11-24 16:21:10 UTC
This needs to have it's Version: updated to 24 as this still issue still exists in F24.  Can somebody with permission please make the change?

Comment 5 Brian J. Murrell 2016-11-24 17:28:04 UTC
New information!  With some help from https://bugzilla.freedesktop.org/show_bug.cgi?id=97064 I added "headset=auto" to the "load-module module-bluetooth-discover" line in /etc/pulse/default.pa (and restart pulseaudio of course) and it now works!

Comment 6 Gabriel 2017-04-13 00:20:40 UTC
I'm facing the same issue under on a Lenovo T460 and RHEL 7.3.

$ rpm -qa | grep bluetooth
gnome-bluetooth-3.14.1-1.el7.x86_64
pulseaudio-module-bluetooth-6.0-8.el7.x86_64
gnome-bluetooth-libs-3.14.1-1.el7.x86_64

$ dmesg | grep Bluetooth
[   15.319094] Bluetooth: Core ver 2.21
[   15.319110] Bluetooth: HCI device and connection manager initialized
[   15.319114] Bluetooth: HCI socket layer initialized
[   15.319116] Bluetooth: L2CAP socket layer initialized
[   15.319121] Bluetooth: SCO socket layer initialized
[   15.337397] Bluetooth: hci0: Firmware revision 0.0 build 30 week 18 2016
[   16.887770] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   16.887773] Bluetooth: BNEP filters: protocol multicast
[   16.887778] Bluetooth: BNEP socket layer initialized
[   36.300269] Bluetooth: RFCOMM TTY layer initialized
[   36.300278] Bluetooth: RFCOMM socket layer initialized
[   36.300372] Bluetooth: RFCOMM ver 1.11


Headset is a Logitech H800 and the pairing works smoothly. I can also see the HSP/HFP profile. However, the mic is not recognized.

gpborges@gpborges:~$ bluetoothctl
[NEW] Controller A4:34:D9:83:10:9D gpborges.br.ibm.com [default]
[NEW] Device 00:0D:44:DE:83:86 H800 Logitech Headset
[H800 Logitech Headset]# info 
Device 00:0D:44:DE:83:86
	Name: H800 Logitech Headset
	Alias: H800 Logitech Headset
	Class: 0x240404
	Icon: audio-card
	Paired: yes
	Trusted: yes
	Blocked: no
	Connected: yes
	LegacyPairing: no
	UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
	UUID: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
	UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
[H800 Logitech Headset]# 

It would be great if we see this bug fixed.

Thanks in advance!

Comment 7 Gabriel 2017-05-26 21:42:27 UTC
I just installed kernel 4.11.3 (4.11.3-1.el7.elrepo.x86_64) in my RHEL 7.3 and the mic is still not working for my Logitech H800. :-( I am using Cinnamon and I used bluebuerry (GUI) to pair it. Same thing as with kernel 3.10. It lists the HFP but no mic is displayed to be selected. Tried from default sound settings and also pauvcontrol.

Comment 8 Fedora End Of Life 2017-07-25 20:15:09 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 9 Richard Allen 2017-07-30 16:21:43 UTC
Still present in Fedora 26

Comment 10 Brian J. Murrell 2017-07-31 11:25:30 UTC
Given comment #9, can somebody who has permission please update the Version: field of this ticket?

Comment 11 Timur Kristóf 2018-03-11 20:21:25 UTC
Same issue reproduced on Fedora 27 with Sennheiser HD 4.50 BTNC headset.

Relevant package versions:
kernel 4.15.6-300.fc27.x86_64
pulseaudio-11.1-7.fc27.x86_64
bluez-5.48-3.fc27.x86_64
gnome-bluetooth-3.26.1-1.fc27.x86_64
(not sure which of these is actually responsible for the problem)

Comment 12 Brian J. Murrell 2018-03-14 18:17:27 UTC
I take back what I said in comment #5.  I still need to always disconnect and reconnect a headset after initially connecting it to have functioning HFP.

To be honest, I've completely given up on Bluetooth headsets in Fedora.  It's never worked and obviously of no priority.

Comment 13 Ben Cotton 2018-11-27 14:00:05 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora  'version' of '27'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 27 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 14 Brian J. Murrell 2018-11-27 16:45:16 UTC
Frankly, I have given up on Bluetooth headsets and Fedora.  It's something that I have no hope whatsoever that will actually get fixed.  Maybe that's an upstream issue or not.  I don't know.  But a package maintainer ought to at least work with upstream to try to get it fixed.

Comment 15 Ben Cotton 2018-11-30 20:14:42 UTC
Fedora 27 changed to end-of-life (EOL) status on 2018-11-30. Fedora 27 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 16 pavel.nedr 2018-12-01 10:44:09 UTC
The bug is still exists on current Fedora

Comment 17 Svetlozar Argirov 2019-01-06 12:45:49 UTC
Can confirm happening for me on Fedora 29.

The output from pacmd :

    index: 1
	name: <bluez_card.8B_1B_43_E1_F5_48>
	driver: <module-bluez5-device.c>
	owner module: 26
	properties:
		device.description = "AUSDOM M09"
		device.string = "8B:1B:43:E1:F5:48"
		device.api = "bluez"
		device.class = "sound"
		device.bus = "bluetooth"
		device.form_factor = "hands-free"
		bluez.path = "/org/bluez/hci0/dev_8B_1B_43_E1_F5_48"
		bluez.class = "0x240408"
		bluez.alias = "AUSDOM M09"
		device.icon_name = "audio-handsfree-bluetooth"
		device.intended_roles = "phone"
	profiles:
		a2dp_sink: High Fidelity Playback (A2DP Sink) (priority 40, available: unknown)
		headset_head_unit: Headset Head Unit (HSP/HFP) (priority 30, available: no)
		off: Off (priority 0, available: yes)
	active profile: <a2dp_sink>
	sinks:
		bluez_sink.8B_1B_43_E1_F5_48.a2dp_sink/#2: AUSDOM M09
	sources:
		bluez_sink.8B_1B_43_E1_F5_48.a2dp_sink.monitor/#3: Monitor of AUSDOM M09
	ports:
		handsfree-output: Handsfree (priority 0, latency offset 0 usec, available: unknown)
			properties:
				
		handsfree-input: Handsfree (priority 0, latency offset 0 usec, available: no)
			properties:

When I try to switch the profile :
 pacmd set-card-profile 1 headset_head_unit
Failed to set card profile to 'headset_head_unit'.

and in the syslog I see :
Jan 06 14:44:22 mi pulseaudio[1597]: W: [pulseaudio] module-bluez5-device.c: Refused to switch profile to headset_head_unit: Not connected

THe headset is connected and working w/o issues for playback.

Comment 18 evanslify 2019-02-28 08:13:24 UTC
Try disabling ofono backend by `systemctl stop ofono.service` and restart pulseaudio to see if problem persists?

Comment 19 Brian J. Murrell 2019-03-04 12:50:28 UTC
I don't have ofono.service running.

But seriously folks.  Given that I have to do the same thing every single time I turn on my BT headset, which is to go into the Bluetooth settings in control panel and disable the headset and then enable it to get a working HFP profile, surely this is something that is fixable.

Every single time.  100% reproducibility.

Comment 20 Gabriel P 2019-03-07 13:43:28 UTC
I'm now able to switch profile to headset_handsfree on Fedora 29 an HFP-only bluetooth headset (Bluedio TN2 - also known as: T Energy 2).

James's and Rodrigo's PulseAudio patches worked for me. More information about the patches:
https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Bluetooth/#index3h2
https://patchwork.freedesktop.org/series/30716/

-----

For those interested, here are the detailed steps to apply the patches to PulseAudio source and build it:

Install libs needed for build:
sudo dnf install make gettext-devel gettext-common-devel gettext-devel autoconf automake intltool perl-XML-Parser libtool libtool-ltdl-devel libsndfile-devel libcap-devel speexdsp-devel dbus-devel cmake-filesystem bluez-libs-devel sbc-devel alsa-lib-devel systemd-devel

mkdir PulseAudio-build ; cd PulseAudio-build

Download PulseAudio 11.1 source:
wget https://freedesktop.org/software/pulseaudio/releases/pulseaudio-11.1.tar.xz
tar -xvf pulseaudio-11.1.tar.xz

Download the patches:
wget https://patchwork.freedesktop.org/patch/178198/raw/ -O v5-1-4-bluetooth-use-consistent-profile-names-James.Bottomley.patch
wget https://patchwork.freedesktop.org/patch/178199/raw/ -O v5-2-4-bluetooth-separate-HSP-and-HFP-James.Bottomley.patch
wget https://patchwork.freedesktop.org/patch/178200/raw/ -O v5-3-4-bluetooth-add-correct-HFP-rfcomm-negotiation-James.Bottomley.patch
wget https://patchwork.freedesktop.org/patch/178201/raw/ -O v5-4-4-bluetooth-make-native-the-default-backend-James.Bottomley.patch
wget https://patchwork.freedesktop.org/patch/180058/raw/ -O v5-2-4-bluetooth-separate-HSP-and-HFP-Rodrigo.Araujo.patch
wget https://bugs.freedesktop.org/attachment.cgi?id=136927 -O memfd-wrappers-only-define-memfd_create-if-not-alrea.patch

Apply the patches:
cd pulseaudio-11.1
patch -p1 < ../v5-1-4-bluetooth-use-consistent-profile-names-James.Bottomley.patch
patch -p1 < ../v5-2-4-bluetooth-separate-HSP-and-HFP-James.Bottomley.patch
patch -p1 < ../v5-3-4-bluetooth-add-correct-HFP-rfcomm-negotiation-James.Bottomley.patch
patch -p1 < ../v5-4-4-bluetooth-make-native-the-default-backend-James.Bottomley.patch
patch -p1 < ../v5-2-4-bluetooth-separate-HSP-and-HFP-Rodrigo.Araujo.patch
patch -p1 < ../memfd-wrappers-only-define-memfd_create-if-not-alrea.patch

Build the patched PulseAudio:
./bootstrap.sh
CFLAGS="$CFLAGS -g -O0" ./configure --sysconfdir=/etc --localstatedir=/var --enable-force-preopen --enable-bluez5=yes --enable-alsa=yes --enable-bluez5-native-headset=yes --enable-bluez5-ofono-headset=no --enable-bluez4=no
make

Install:
sudo make install
It should be working fine after reboot.

-----

BACKOUT - to revert back to the distribution version:
sudo make uninstall
sudo dnf reinstall pulseaudio

Comment 21 Brian J. Murrell 2019-03-07 14:47:29 UTC
Why are you building pulseaudio 11.1 when what's in F29 is pulseaudio-12.2-1.fc29.x86_64?

Surely you want to start with at least that, yes?

Comment 22 Gabriel P 2019-03-07 15:04:01 UTC
(In reply to Brian J. Murrell from comment #21)
> Why are you building pulseaudio 11.1 when what's in F29 is
> pulseaudio-12.2-1.fc29.x86_64?
> 
> Surely you want to start with at least that, yes?

Brian, those patches will apply fine only to v11.1, which was the current version at the time they were written by James and Rodrigo (more than a year ago).
For newer versions, one would need to apply manually and/or rewrite the patches. If you or someone else wants to do that, you are welcome to do so.
I just wanted to share the straightforward steps that solved my problem (the same as originally reported in this thread) as I now can make full use of my HFP-only headset on Fedora 29.

Comment 23 Brian J. Murrell 2019-03-07 17:08:35 UTC
I rebased the patches on 12.2 and while they do separate the HFP and HSP profiles, they do not solve my problem.

I still need to disconnect and reconnect my headset after it's automatically connected on power-on before I see the headset as a device I can choose to Record from.  Before the disconnect/reconnect I only see a Monitor option for it in the recording menu selection.

Comment 24 Ben Cotton 2019-10-31 18:57:21 UTC
This message is a reminder that Fedora 29 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 29 on 2019-11-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '29'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 29 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 25 Brian J. Murrell 2019-11-05 21:35:26 UTC
Please move this to F30.  This problem still exists there.

Comment 26 Timothy Rees 2019-11-05 22:26:58 UTC
This is a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=1508807

Comment 27 Timothy Rees 2019-11-05 22:30:43 UTC
I can confirm the patches made available on the branch here [1] resolve this issue for me.  I have Apple Powerbeats Pro which only have a HFP profile, when I compile and use the jejb-v13 branch on Fedora 31 I can select HFP and use the Powerbeats Pro as a headset.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/jejb/pulseaudio.git/?h=jejb-v13

Comment 28 Brian J. Murrell 2019-11-06 03:38:40 UTC
> I can confirm the patches made available on the branch here

There are over 400 commits on that jejb-v13 branch that are not on stable-12.x.

Comment 29 Brian J. Murrell 2019-11-06 03:45:07 UTC
> There are over 400 commits on that jejb-v13 branch that are not on stable-12.x.

In reference to F30 that is.  The news for F31 is much better:

* bb98ebd44 - (jejb/jejb-v13) bluetooth: make native the default backend (7 weeks ago) <James Bottomley>
* 17b7a980b - bluetooth: add correct HFP rfcomm negotiation (7 weeks ago) <James Bottomley>
* c6eff88ee - bluetooth: separate HSP and HFP (7 weeks ago) <James Bottomley>
* 0cc93ebc2 - bluetooth: use consistent profile names (7 weeks ago) <James Bottomley>

But I am reluctant to update the F30 machine where I would use my BT headset to F31 given the issues (gnome-shell segfaulting!) I have had there on another machine.  :-(

Comment 30 Brian J. Murrell 2019-11-06 05:12:28 UTC
> This is a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=1508807

I don't think it is.  I have built and installed https://git.kernel.org/pub/scm/linux/kernel/git/jejb/pulseaudio.git/?h=jejb-v13 on my system and still see the same issue:

    index: 2
	name: <bluez_card.50_C9_71_83_EC_70>
	driver: <module-bluez5-device.c>
	owner module: 23
	properties:
		device.description = "Jabra EXTREME2 v4.14.0"
		device.string = "50:C9:71:83:EC:70"
		device.api = "bluez"
		device.class = "sound"
		device.bus = "bluetooth"
		device.form_factor = "headset"
		bluez.path = "/org/bluez/hci0/dev_50_C9_71_83_EC_70"
		bluez.class = "0x240404"
		bluez.alias = "Jabra EXTREME2 v4.14.0"
		device.icon_name = "audio-headset-bluetooth"
		device.intended_roles = "phone"
	profiles:
		a2dp_sink: High Fidelity Playback (A2DP Sink) (priority 40, available: yes)
		headset_handsfree: Headset Handsfree (HFP) (priority 30, available: no)
		off: Off (priority 0, available: yes)
	active profile: <a2dp_sink>
	sinks:
		bluez_sink.50_C9_71_83_EC_70.a2dp_sink/#2: Jabra EXTREME2 v4.14.0
	sources:
		bluez_sink.50_C9_71_83_EC_70.a2dp_sink.monitor/#4: Monitor of Jabra EXTREME2 v4.14.0
	ports:
		headset-output: Headset (priority 0, latency offset 0 usec, available: yes)
			properties:
				
		headset-input: Headset (priority 0, latency offset 0 usec, available: no)
			properties:

Comment 31 Ben Cotton 2019-11-27 18:13:28 UTC
Fedora 29 changed to end-of-life (EOL) status on 2019-11-26. Fedora 29 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 32 Peter Tselios 2019-12-11 09:54:02 UTC
I can confirm that the issue still exists on Fedora 30. 
I just upgraded from 29 and I use KDE with PhononGStreamer as a backend. 

I have a Lenove X230 and a Logitech H800. 

pactl list cardsCard #9
        Name: bluez_card.00_0D_44_31_DF_CB
        Driver: module-bluez5-device.c
        Owner Module: 39
        Properties:
                device.description = "H800 Logitech Headset"
...

        Profiles:
                headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 30, available: no)
                a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 40, available: yes)
                off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
---


pacmd set-card-profile 9 headset_head_unit
Failed to set card profile to 'headset_head_unit'.

---
/var/log/messages:
Dec 11 11:52:05 lenovo pulseaudio[1887]: W: [pulseaudio] module-bluez5-device.c: Refused to switch profile to headset_head_unit: Not connected


Disconnecting and reconnecting doesn't change anything.

Comment 33 Ben Parees 2019-12-25 04:07:40 UTC
building the branch from https://bugzilla.redhat.com/show_bug.cgi?id=1311238#c27 and running it seems to have worked for me with the Beats Studio Pro3.  (and the explanation makes sense:  devices that only report HFP and not HSP don't work without the patch)

thanks Tim!

Hopefully there are plans to include that patch in an upcoming PulseAudio release + fedora package.

Comment 34 Marko Bevc 2020-04-10 19:55:06 UTC
I can confirm this on F31 and Lenovo T490s with:
Card #2
	Driver: module-bluez5-device.c
	Owner Module: 22
	Properties:
		device.description = "JBL CLUB700BT"
		device.api = "bluez"
		device.class = "sound"
		device.bus = "bluetooth"
		device.form_factor = "headset"
		bluez.class = "0x240404"
		bluez.alias = "JBL CLUB700BT"
		device.icon_name = "audio-headset-bluetooth"
		device.intended_roles = "phone"
	Profiles:
		a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 40, available: yes)
		headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 30, available: no)
		off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
	Active Profile: a2dp_sink
	Ports:
		headset-output: Headset (priority: 0, latency offset: 0 usec)
			Part of profile(s): a2dp_sink, headset_head_unit
		headset-input: Headset (priority: 0, latency offset: 0 usec, not available)
			Part of profile(s): headset_head_unit

Comment 35 Mike Goodwin 2020-04-17 19:33:06 UTC
❯ cat /usr/lib/fedora-release 
Fedora release 31 (Thirty One)

❯ rpm -q bluez pulseaudio            
bluez-5.54-1.fc31.x86_64
pulseaudio-13.99.1-3.fc31.x86_64

---

Same with these:
Card #6
	Name: bluez_card.E8_07_BF_95_24_C8
	Driver: module-bluez5-device.c
	Owner Module: 27
	Properties:
		device.description = "Soundcore Life P2"
		device.string = "E8:07:BF:95:24:C8"
		device.api = "bluez"
		device.class = "sound"
		device.bus = "bluetooth"
		device.form_factor = "headset"
		bluez.path = "/org/bluez/hci0/dev_E8_07_BF_95_24_C8"
		bluez.class = "0x240404"
		bluez.alias = "Soundcore Life P2"
		device.icon_name = "audio-headset-bluetooth"
		device.intended_roles = "phone"
	Profiles:
		a2dp_source_sbc: High Fidelity Capture (A2DP Source: SBC) (sinks: 0, sources: 1, priority: 20, available: yes)
		a2dp_source_aac: High Fidelity Capture (A2DP Source: AAC) (sinks: 0, sources: 1, priority: 20, available: no)
		a2dp_source_aptx: High Fidelity Capture (A2DP Source: APTX) (sinks: 0, sources: 1, priority: 20, available: no)
		a2dp_source_aptx_hd: High Fidelity Capture (A2DP Source: aptX HD) (sinks: 0, sources: 1, priority: 20, available: no)
		a2dp_sink_sbc: High Fidelity Playback (A2DP Sink: SBC) (sinks: 1, sources: 0, priority: 40, available: yes)
		a2dp_sink_aac: High Fidelity Playback (A2DP Sink: AAC) (sinks: 1, sources: 0, priority: 40, available: yes)
		a2dp_sink_aptx: High Fidelity Playback (A2DP Sink: aptX) (sinks: 1, sources: 0, priority: 40, available: yes)
		a2dp_sink_aptx_hd: High Fidelity Playback (A2DP Sink: aptX HD) (sinks: 1, sources: 0, priority: 40, available: no)
		a2dp_sink_ldac: High Fidelity Playback (A2DP Sink: LDAC) (sinks: 1, sources: 0, priority: 40, available: no)
		headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 30, available: no)
		off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
	Active Profile: a2dp_sink_aac
	Ports:
		headset-output: Headset (priority: 0, latency offset: 0 usec, available)
			Part of profile(s): a2dp_sink_sbc, a2dp_sink_aac, a2dp_sink_aptx, a2dp_sink_aptx_hd, a2dp_sink_ldac, headset_head_unit
		headset-input: Headset (priority: 0, latency offset: 0 usec, not available)
			Part of profile(s): a2dp_source_sbc, a2dp_source_aac, a2dp_source_aptx, a2dp_source_aptx_hd, headset_head_unit

Comment 36 Pablo Estigarribia 2020-04-18 12:50:28 UTC
I can confirm still valid on fedora 32

I think this is something with high impact for every linux users, and more for newcomers as bluetooth headset are very common today days and more common to use for videoconferences.

$ pactl list

Placa #2
	Nombre: bluez_card.7B_ED_7B_BF_B3_00
	Controlador: module-bluez5-device.c
	Módulo dueño: 23
	Propiedades:
		device.description = "KHS-620"
		device.string = "7B:ED:7B:BF:B3:00"
		device.api = "bluez"
		device.class = "sound"
		device.bus = "bluetooth"
		device.form_factor = "headset"
		bluez.path = "/org/bluez/hci0/dev_7B_ED_7B_BF_B3_00"
		bluez.class = "0x240404"
		bluez.alias = "KHS-620"
		device.icon_name = "audio-headset-bluetooth"
		device.intended_roles = "phone"
	Perfiles:
		a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 40, available: yes)
		headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 30, available: yes)
		off: Apagado (sinks: 0, sources: 0, priority: 0, available: yes)
	Perfil Activo: a2dp_sink
	Puertos:
		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


$ pacmd set-card-profile 2 headset_head_unit
Failed to set card profile to 'headset_head_unit'.


Tried also with ofono, but didn't work.

Also tried changing line at /etc/pulse/default.pa:

load-module module-bluetooth-discover headset=native

but didn't work.

Hope we can get some fix soon, as it is a usability impact for big amount of users.

Comment 37 Brian J. Murrell 2020-04-18 13:40:54 UTC
FWIW, I do have a working HFP setup on my Fedora 30 machine.  It requires the addition of the attached patch.

It comes from https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/84.

Comment 38 Brian J. Murrell 2020-04-18 13:42:29 UTC
Created attachment 1679825 [details]
Patch to make HFP work

Comment 39 Lumír Balhar 2020-04-24 12:07:12 UTC
Hello.

I don't understand the technical details here but I'm gonna try to build a new pulseaudio RPM for Fedora with the patch from comment#38. It seems that we have the same version in Fedora 31, 32, and rawhide so I'll do it in COPR and everybody can help with testing it.

Comment 40 Lumír Balhar 2020-04-24 12:56:45 UTC
Builds are ready here: https://copr.fedorainfracloud.org/coprs/lbalhar/pulseaudio/

Comment 41 Lumír Balhar 2020-04-25 13:04:59 UTC
Ok, I can confirm that the patch included in my build of pulseaudio (COPR, see above) works, but with one disadvantage. When I switch a profile (in pavucontrol) from "High Fidelity Playback (A2DP Sink: SBC)" to new "Headset Head Unit (HSP/HFP)" the sound coming from PC to my Sony WH-CH700N headphones starts to sound like from a tunnel. On the other hand, a new input device (headset mic) appears in "Input devices" tab and it seems to work. It might be a solution for conference calls but it needs some improvements for music.

Comment 42 Gernot Nusshall 2020-04-27 10:44:21 UTC
Unfortunately the patch and the COPR build do not work in my setup (Fedora 31 Workstation, Sony WH-1000XM3, Bluetooth Chip: Intel Corporation Wireless-AC 9260. The mic of the headset is not added as input/recording device.
Regarding sound quality, it seems that there are some issues around HSP/HFP in the pulseaudio upstream: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/776

Comment 43 Andreas Kohn 2020-05-05 07:45:09 UTC
(In reply to Lumír Balhar from comment #40)
> Builds are ready here:
> https://copr.fedorainfracloud.org/coprs/lbalhar/pulseaudio/

I can confirm that this helped me getting my PowerBeats pro to work as microphone on Fedora 31. Indeed though the output quality with HFP is considerable reduced compared to A2DP. Still ... Thanks a lot, my use case is video conferencing, and it'll work for that!

Comment 44 nguyen 2020-06-11 10:27:54 UTC
(In reply to Gabriel P from comment #20)
> I'm now able to switch profile to headset_handsfree on Fedora 29 an HFP-only
> bluetooth headset (Bluedio TN2 - also known as: T Energy 2).
> 
> James's and Rodrigo's PulseAudio patches worked for me. More information
> about the patches:
> https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/
> Bluetooth/#index3h2
> https://patchwork.freedesktop.org/series/30716/
> 
> -----
> 
> For those interested, here are the detailed steps to apply the patches to
> PulseAudio source and build it:
> 
> Install libs needed for build:
> sudo dnf install make gettext-devel gettext-common-devel gettext-devel
> autoconf automake intltool perl-XML-Parser libtool libtool-ltdl-devel
> libsndfile-devel libcap-devel speexdsp-devel dbus-devel cmake-filesystem
> bluez-libs-devel sbc-devel alsa-lib-devel systemd-devel
> 
> mkdir PulseAudio-build ; cd PulseAudio-build
> 
> Download PulseAudio 11.1 source:
> wget
> https://freedesktop.org/software/pulseaudio/releases/pulseaudio-11.1.tar.xz
> tar -xvf pulseaudio-11.1.tar.xz
> 
> Download the patches:
> wget https://patchwork.freedesktop.org/patch/178198/raw/ -O
> v5-1-4-bluetooth-use-consistent-profile-names-James.Bottomley.patch
> wget https://patchwork.freedesktop.org/patch/178199/raw/ -O
> v5-2-4-bluetooth-separate-HSP-and-HFP-James.Bottomley.patch
> wget https://patchwork.freedesktop.org/patch/178200/raw/ -O
> v5-3-4-bluetooth-add-correct-HFP-rfcomm-negotiation-James.Bottomley.patch
> wget https://patchwork.freedesktop.org/patch/178201/raw/ -O
> v5-4-4-bluetooth-make-native-the-default-backend-James.Bottomley.patch
> wget https://patchwork.freedesktop.org/patch/180058/raw/ -O
> v5-2-4-bluetooth-separate-HSP-and-HFP-Rodrigo.Araujo.patch
> wget https://bugs.freedesktop.org/attachment.cgi?id=136927 -O
> memfd-wrappers-only-define-memfd_create-if-not-alrea.patch
> 
> Apply the patches:
> cd pulseaudio-11.1
> patch -p1 <
> ../v5-1-4-bluetooth-use-consistent-profile-names-James.Bottomley.patch
> patch -p1 < ../v5-2-4-bluetooth-separate-HSP-and-HFP-James.Bottomley.patch
> patch -p1 <
> ../v5-3-4-bluetooth-add-correct-HFP-rfcomm-negotiation-James.Bottomley.patch
> patch -p1 <
> ../v5-4-4-bluetooth-make-native-the-default-backend-James.Bottomley.patch
> patch -p1 < ../v5-2-4-bluetooth-separate-HSP-and-HFP-Rodrigo.Araujo.patch
> patch -p1 < ../memfd-wrappers-only-define-memfd_create-if-not-alrea.patch
> 
> Build the patched PulseAudio:
> ./bootstrap.sh
> CFLAGS="$CFLAGS -g -O0" ./configure --sysconfdir=/etc --localstatedir=/var
> --enable-force-preopen --enable-bluez5=yes --enable-alsa=yes
> --enable-bluez5-native-headset=yes --enable-bluez5-ofono-headset=no
> --enable-bluez4=no
> make
> 
> Install:
> sudo make install
> It should be working fine after reboot.
> 
> -----
> 
> BACKOUT - to revert back to the distribution version:
> sudo make uninstall
> sudo dnf reinstall pulseaudio

I just want to confirm that these patches work !
I came here from the internet, searching for a fix to activate HFP on my Airpods and PA 11.1 (though my OS is Ubuntu 18.04 but it doesn't matter, the real problem is PA) and luckily I found it! Thank you Gabriel!

Comment 45 Marko Bevc 2020-06-11 11:05:53 UTC
Cool, it would be good if we could get this backported to distro package as well

Comment 46 Lumír Balhar 2020-06-11 11:17:36 UTC
(In reply to Marko Bevc from comment #45)
> Cool, it would be good if we could get this backported to distro package as
> well

Given the fact I basically did it in COPR and it works for multiple people, I can open a PR to include the patch to Fedora repositories. Do you think I should even the quality of the new profile is not perfect?

Comment 47 Ben Parees 2020-06-11 11:58:47 UTC
> Given the fact I basically did it in COPR and it works for multiple people, I can open a PR to include the patch to Fedora repositories. Do you think I should even the quality of the new profile is not perfect?

I was not able to get the COPR version working but I did get a locally built patched version working(I didn't spend much time investigating my problems w/ the COPR distro since i had a workaround).  My impression is that the quality is exactly what you'd expect for a headset/mic bluetooth profile (the audio quality drops because it's not A2DP) and has nothing to do w/ the patch itself, so I would say yes.

If someone else has a different headset that works both with and without the patch who can confirm that indeed the patch behavior is just "par for the course for a headset/handsfree profile on bluetooth" that would be great, though.

Comment 48 Lumír Balhar 2020-06-15 07:38:45 UTC
PR to include the patch in the official Fedora packages: https://src.fedoraproject.org/rpms/pulseaudio/pull-request/5

Rawhide scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=45736697

Comment 49 kxra 2020-06-24 23:04:42 UTC
Many have experienced an issue where both bluetooth profiles (A2DP and HSP/HFP) work only when the device is first paired, but after the device is disconnected and reconnected, it becomes impossible to switch. See: https://gist.github.com/egelev/2e6b57d5a8ba62cf6df6fff2878c3fd4#gistcomment-3353482 

Will this patch solve that issue? Is there a relevant upstream discussion on the bluez/linux-bluetooth developers mailing list that someone has a link to?

Comment 50 Lumír Balhar 2020-06-25 04:27:26 UTC
> Will this patch solve that issue? Is there a relevant upstream discussion on
> the bluez/linux-bluetooth developers mailing list that someone has a link to?

You can try it and tell us. It works well for me.

The patch probably won't be included in Fedora before it's merged upstream, see https://src.fedoraproject.org/rpms/pulseaudio/pull-request/5

There is also a new merge request: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/288

Comment 51 James 2020-06-25 10:20:12 UTC
(In reply to Lumír Balhar from comment #50)
> > Will this patch solve that issue? Is there a relevant upstream discussion on
> > the bluez/linux-bluetooth developers mailing list that someone has a link to?
> 
> You can try it and tell us. It works well for me.
> 
> The patch probably won't be included in Fedora before it's merged upstream,
> see https://src.fedoraproject.org/rpms/pulseaudio/pull-request/5

I tried the COPR build pulseaudio-13.99.1-200.fc32.x86_64 but when attempting to use my bluetooth headset microphone, Pulseaudio seemed to hang. I'll investigate a bit later.

Comment 52 Doron Fediuck 2020-09-02 09:07:04 UTC
(In reply to Lumír Balhar from comment #50)
> > Will this patch solve that issue? Is there a relevant upstream discussion on
> > the bluez/linux-bluetooth developers mailing list that someone has a link to?
> 
> You can try it and tell us. It works well for me.
> 
> The patch probably won't be included in Fedora before it's merged upstream,
> see https://src.fedoraproject.org/rpms/pulseaudio/pull-request/5
> 
> There is also a new merge request:
> https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/288

Hey Lumír, 
thanks for handling this. Please note that I just installed your COPR build
and it doesn't work.

~ # rpm -qa | grep pulseaudio
alsa-plugins-pulseaudio-1.2.2-1.fc32.x86_64
pulseaudio-module-gsettings-13.99.1-200.fc32.x86_64
pulseaudio-module-x11-13.99.1-200.fc32.x86_64
pulseaudio-libs-13.99.1-200.fc32.x86_64
pulseaudio-13.99.1-200.fc32.x86_64
pulseaudio-libs-glib2-13.99.1-200.fc32.x86_64
pulseaudio-module-bluetooth-13.99.1-200.fc32.x86_64
pulseaudio-module-gconf-13.99.1-200.fc32.x86_64
pulseaudio-utils-13.99.1-200.fc32.x86_64
kde-settings-pulseaudio-32.0-3.fc32.noarch

Kernel:
kernel-5.7.17-200.fc32.x86_64

pacmd:
        name: <bluez_card.A4_77_58_83_3A_73>
        driver: <module-bluez5-device.c>
        owner module: 27
        properties:
                device.description = "Philips BH305"
                device.string = "A4:77:58:83:3A:73"
                device.api = "bluez"
                device.class = "sound"
                device.bus = "bluetooth"
                device.form_factor = "headset"
                bluez.path = "/org/bluez/hci0/dev_A4_77_58_83_3A_73"
                bluez.class = "0x240404"
                bluez.alias = "Philips BH305"
                device.icon_name = "audio-headset-bluetooth"
                device.intended_roles = "phone"
        profiles:
                a2dp_sink: High Fidelity Playback (A2DP Sink) (priority 40, available: yes)
                headset_handsfree: Headset Handsfree (HFP) (priority 30, available: no)
                off: Off (priority 0, available: yes)
        active profile: <a2dp_sink>
        sinks:
                bluez_sink.A4_77_58_83_3A_73.a2dp_sink/#3: Philips BH305
        sources:
                bluez_sink.A4_77_58_83_3A_73.a2dp_sink.monitor/#5: Monitor of Philips BH305
        ports:
                headset-output: Headset (priority 0, latency offset 0 usec, available: yes)
                        properties:

                headset-input: Headset (priority 0, latency offset 0 usec, available: no)
                        properties:

Comment 53 Pablo Estigarribia 2020-09-04 23:44:04 UTC
I have read this article:

https://blogs.gnome.org/uraeus/2020/09/04/pipewire-late-summer-update-2020/

Looks like pipewire is now the focus and promises a lot! could it bring the solution to this issue in the near future too?

Comment 54 Pablo Estigarribia 2020-09-04 23:45:54 UTC
Looks like there is also some work done here:

https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/227

Comment 55 Christopher Markieta 2020-11-28 03:58:28 UTC
Confirming the COPR build fixed it for me.

Monster Isport Champion
ThinkPad X1 Carbon Gen 6 (2018)
Intel Corporation Wireless 8265 / 8275
Fedora 32

Thanks Lumír!

Comment 56 Christopher Markieta 2020-11-28 23:19:14 UTC
The sound quality is substantially lower in HFP than it should be, but I'm not sure if that's due to the patch or an existing issue with PulseAudio.

I have tested with the same hardware in Windows 10 (as well as Android) and the sound quality in HFP (input and output) is superb.

Comment 57 Pablo Estigarribia 2021-01-23 20:02:42 UTC
Could you test with pipewire-pulseaudio? It is now working for me with soundcore life q20.

today I tested pipewire-pulseaudio 3.20 and looks like everything is resolved for bluetooth support.

Attached screenshot.

So if everything goes well and Fedora replaces pulseaudio with pipewire: we can consider this as resolved.

https://pagure.io/fedora-docs/release-notes/issue/611
https://bugzilla.redhat.com/show_bug.cgi?id=1906086
https://fedoraproject.org/wiki/Changes/DefaultPipeWire

https://gitlab.freedesktop.org/pipewire/pipewire/-/tags/0.3.20

Comment 58 Brian J. Murrell 2021-01-25 13:38:16 UTC
Unfortunately pipewire-pulsaudio is too unstable for me.  It crashes when I try to use my B/T headset.

https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/619

Back to PA I guess.  It's flaky there, but at least doesn't crash.

Comment 59 Pablo Estigarribia 2021-01-26 01:15:10 UTC
Try with fedora 33, there some others components updated.

It's pretty easy to perfom in-place upgrade of fedora.

Comment 60 Pablo Estigarribia 2021-03-23 23:53:54 UTC
I see it working properly on all my testings in fedora 34 with pipewire

Comment 61 Reinier Bikker 2021-05-22 21:50:54 UTC
Another positive experience here with pipewire-pulseaudio-0.3.26-2.fc33.x86_64 in combination with Soundcore Life P2. Both HSP/HFP and A2DP work as expected. Pulseaudio 14.0 only supported A2DP.

Comment 62 Ben Cotton 2022-05-12 16:57:38 UTC
This message is a reminder that Fedora Linux 34 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 34 on 2022-06-07.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '34'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 34 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 63 Pablo Estigarribia 2022-05-19 02:20:30 UTC
Since pipewire replaced pulseaudio, all this issues were fixed for me.