Bug 93898

Summary: Refused to switch profile to headset_head_unit when trying to use bluetooth headset microphone
Product: PulseAudio Reporter: Yajo <yajo.sk8>
Component: coreAssignee: pulseaudio-bugs
Status: RESOLVED MOVED QA Contact: pulseaudio-bugs
Severity: normal    
Priority: medium CC: belegdol, bugzilla, dhitchcock.freedesktop, github, gschriss, joakim.tjernlund, lennart, shawnboy99, yajo.sk8
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Android Bluetooth capture, single packet

Description Yajo 2016-01-28 07:46:31 UTC
I have 2 bluetooth headsets. With the first one I can connect "without problems"[1], and enable HSP/HFP flawlessly[1] from GNOME sound settings. Its info:

Device 00:00:00:00:36:59
	Name: BT-H06
	Alias: BT-H06
	Class: 0x240404
	Icon: audio-card
	Paired: yes
	Trusted: yes
	Blocked: no
	Connected: yes
	LegacyPairing: no
	UUID: Serial Port               (00001101-0000-1000-8000-00805f9b34fb)
	UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
	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)


The second device works fine in A2DP mode, but when switching to HSP/HFP from the same place it logs this:

[pulseaudio] module-bluez5-device.c: Refused to switch profile to headset_head_unit: Not connected

The device:

Device 7F:65:1D:43:BB:EC
	Name: Mini503-TF
	Alias: Mini503-TF
	Class: 0x240404
	Icon: audio-card
	Paired: yes
	Trusted: yes
	Blocked: no
	Connected: yes
	LegacyPairing: yes
	UUID: Serial Port               (00001101-0000-1000-8000-00805f9b34fb)
	UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
	UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)

I see some differences between them, but both work fine with my Android phone so I guess it must be a PA/Bluez/oFono problem.

[1] Well, not exactly without problems. I had to apply workaround from https://bugs.freedesktop.org/show_bug.cgi?id=73325#c50 (downgrade to bluez 5.35) to make it work. But I'm not sure if both bugs are the same, because with bluez 5.36 the logs show the same message you have above for both headsets. Should I open a new bug for that?
Comment 1 Tanu Kaskinen 2016-03-26 10:42:37 UTC
This bug was again brought up on the mailing list, and as I re-read your report, I noticed an important difference between the two devices: the working one has both "Headset" (HSP) and "Handsfree" (HFP) profiles, but the broken one only has "Handsfree".

The native backend in PulseAudio only supports HSP, so if the headset only supports HFP, that's not going to work.

Should we implement HFP in PulseAudio? I'm not sure. It was debated a lot whether it makes architectural sense to even implement HSP in an audio server, and HFP is an even more complicated protocol than HSP. In any case, I'm not volunteering to do the implementation. One possibility would be to tell everybody to use oFono, but at least when PulseAudio 6.0 was released, the oFono backend didn't support headsets (it only supported the scenario where PulseAudio is on the headset/handsfree device, i.e. wrong direction). I don't remember if the lack of headset support with oFono was due to lacking functionality in oFono or PulseAudio or both, and if it was due to lacking functionality in oFono, I don't know if the missing stuff has been implemented since then.
Comment 2 Yajo 2016-03-29 07:47:55 UTC
I have tried unsuccessfully to find the oFono docs, so I cannot help you in that (besides, I'm not involved in any of these projects except for wanting to be a happy user).

Also I had to return those headsets because the problematic one was not working and the working one had such a low quality audio that was not really usable. I learned that it's inherent to the HSP/HFP protocols, so I had to go back to wired headsets. However the quality drop does not seem that much in Android, I don't know if it's their implementation or just my personal perception.

I was willing to get rid of some wires, but seems like either it's not the time for that, or Bluetooth is not the technology for that; not sure.

A shame, after all.
Comment 3 Anthony Suvorov 2016-04-20 02:02:37 UTC
Same bug with this device:

Device 00:11:67:C4:B9:E2
        Name: B801
        Alias: B801
        Class: 0x240404
        Icon: audio-card
        Paired: yes
        Trusted: yes
        Blocked: no
        Connected: yes
        LegacyPairing: no
        UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
        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)
        UUID: Phonebook Access Client   (0000112e-0000-1000-8000-00805f9b34fb)
        UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
        Modalias: bluetooth:v0039p13A4d0104

A2DP works fine, but switching to HSP/HFP getting this in syslog:

[pulseaudio] module-bluez5-device.c: Refused to switch profile to headset_head_unit: Not connected

software versions:
* bluez-5.39
* ofono-1.17
* pulseaudio-8.0
Comment 4 Bastien Nocera 2016-05-20 14:02:46 UTC
There's a possible work-around in bug 73325 comment 52. Is ofono required to make the HSP/HFP mode work? Is "auto" not the default "headset" mode?
Comment 5 Tanu Kaskinen 2016-05-20 14:28:56 UTC
(In reply to Bastien Nocera from comment #4)
> There's a possible work-around in bug 73325 comment 52. Is ofono required to
> make the HSP/HFP mode work? Is "auto" not the default "headset" mode?

The oFono backend is required for HFP, the native backend is required for HSP. The default backend is not "auto". The default backend is "native" when the native backend is enabled at build time, otherwise it's "ofono". I don't remember why "auto" is not the default.

The comment you refer to implies that "auto" is required to have both A2DP and HSP/HFP working. I don't know what's going on there. A2DP should be always supported.
Comment 6 Josh Audette 2016-05-26 01:23:39 UTC
I have the same issue.

Two headsets:

[bluetooth]# info 30:A8:DB:77:29:B6
Device 30:A8:DB:77:29:B6
        Name: SBH52
        Alias: SBH52
        Class: 0x240404
        Icon: audio-card
        Paired: yes
        Trusted: yes
        Blocked: no
        Connected: no
        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)
        UUID: Vendor specific           (8e780623-3c51-11e1-8d8d-001cc4d601d8)
[bluetooth]# info 94:35:0A:99:CA:CF
Device 94:35:0A:99:CA:CF
        Name: HS3000
        Alias: HS3000
        Class: 0x240404
        Icon: audio-card
        Paired: yes
        Trusted: yes
        Blocked: no
        Connected: no
        LegacyPairing: no
        UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
        UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
        UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)

Both devices give the same error when trying to switch to HSP/HFP:

W: [pulseaudio] module-bluez5-device.c: Refused to switch profile to headset_head_unit: Not connected

Both devices show the profile is not available:

        Profiles:
                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: no)
                off: Off (sinks: 0, sources: 0, priority: 0, available: yes)

I don't know where to go from here.

Bluez 5.36
PulseAudio 8.0

I have also built and installed Bluez 5.39 but it didn't help.

Additional information:

This laptop (Lenovo X260) is running Debian stretch.  No GDM, I just run startx
after logging in, pulseaudio runs as my user account. (I saw some other bugreports where GDM runs pulseaudio as a different user and that causes issues)

This laptop will replace my old Lenovo T420 which runs Debian wheezy(?) and on
which both of these headsets work in both A2DP and HSP/HFP.

I use a softphone (linphone) with these bluetooth headsets all the time for my
work -- I do software demos and webinars by phone a few times a day.  So I have been trying to get this to work for the last couple of days as I prepare this new laptop to replace my old one, but I don't know what else to try.
Comment 7 Josh Audette 2016-05-26 17:47:00 UTC
> I don't know where to go from here.
> 
> Bluez 5.36
> PulseAudio 8.0
> 
> I have also built and installed Bluez 5.39 but it didn't help.

Built/installed PulseAudio 8.0 from Debian's source but that didn't help either.  Mainly just wanted to see how Debian built it (config options, etc.) and then try it on the off chance it might help.

Also note that I saw https://bugs.freedesktop.org/show_bug.cgi?id=73325#c52 and I have tried installing the oFono package and setting default.pa load-module module-bluetooth-discover headset=ofono (and headset=auto).  Neither helped.  I think this is for using your PC as a headset, but I wasn't sure so I tried it... no luck.  

Just cannot get headsets to do HSP/HFP.  For the record A2DPSink works fine, as do other bluetooth devices (keyboard, mouse, etc.).
Comment 8 Josh Audette 2016-06-13 13:56:19 UTC
I have been able to get one of my headsets to do both A2DP and HSP/HFP!

I have installed Bluez 5.40 from source.  However, I believe what finally did it was simply removing the device and re-pairing it.

Now I for the HS300 (which shows): 
        UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
        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)


... I see this:
        Profiles:
                headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 20, available: yes)
                a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 10, available: yes)
                off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
        Active Profile: off

The other headset, SBH52, shows:

        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)
        UUID: Vendor specific           (8e780623-3c51-11e1-8d8d-001cc4d601d8)

... and for this one headset_head_unit shows available: no.

I believe this is expected, though, for devices that only have Handsfree and not Headset.

So, in the end, I believe I have HSP working now.
Comment 9 gschriss@gmail.com 2016-07-17 03:56:36 UTC
I have a SOAIY-H2 headset that matches the behavior in this thread:

Device 00:33:8B:00:8A:9D
    Name: SOAIY-H2
    Alias: SOAIY-H2
    Class: 0x240404
    Icon: audio-card
    Paired: yes
    Trusted: no
    Blocked: no
    Connected: yes
    LegacyPairing: no
    UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
    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)

There's no obvious fix even after changing the values of 'headset=' in PA; I'm on Debian sid.  A2DP works fine.
Comment 10 gschriss@gmail.com 2016-07-17 06:04:51 UTC
Created attachment 125117 [details]
Android Bluetooth capture, single packet
Comment 11 gschriss@gmail.com 2016-07-17 06:06:19 UTC
The SOAIY-H2 is a Handsfree 1.6-compatible device with the following features:
 EC and/or Nr Function
 Call Waiting or Three Way Calling
 CLI Presentation Capability
 Voice Recognition Activation
 Remote Volume Control
 Wide Band Speech (aka "HD Voice")
A captured Bluetooth packet initiating the HFS profile between the headset and my Moto G (3rd. gen., running Marshmallow) uploaded as an attachment for reference.

Has wide band speech been implemented in Blue5/PA?
Comment 12 gschriss@gmail.com 2016-07-27 01:21:27 UTC
OK, so found a work-around as follows:

Create '~/.config/pulse/client.conf' with the following line:
autospawn = no

Comment 'load-module module-bluetooth-discover headset=auto' from '/etc/pulse/default.pa'

Launch pulseaudio manually from the command line:
pulseaudio --load="module-bluetooth-discover headset=native"

Re-pair bluetooth device as 'Headset' device then it should appear in pavucontrol as usual.
Comment 13 Joakim Tjernlund 2017-03-01 19:53:29 UTC
I have the same problem with 
module-bluez5-device.c: Refused to switch profile to headset_head_unit: Not connected

[HS6000]# info 41:00:00:00:22:DA
Device 41:00:00:00:22:DA
	Name: HS6000
	Alias: HS6000
	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: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
	UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
	UUID: Headset HS                (00001131-0000-1000-8000-00805f9b34fb)
	UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
	Modalias: bluetooth:v000Fp0000d0000

When I pair I can see,in blueman: Headset, Handsfree, Audio Sink and Serial Port
But on I try connecting to any of the, HeadSet and Serial Port are gone and only
Handsfree and Audio Sink are selecatble

bluez: 5.44
pulseaudio: 10.0
Comment 14 Joakim Tjernlund 2017-03-01 19:59:35 UTC
Debug from pulse when headset goes away:

D: [pulseaudio] bluez5-util.c: Alias: HS6000
D: [pulseaudio] bluez5-util.c: Class: 2360324
D: [pulseaudio] bluez5-util.c: UUIDs: 00001108-0000-1000-8000-00805f9b34fb
D: [pulseaudio] bluez5-util.c: UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
D: [pulseaudio] bluez5-util.c: UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
D: [pulseaudio] bluez5-util.c: UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
D: [pulseaudio] bluez5-util.c: UUIDs: 00001101-0000-1000-8000-00805f9b34fb
D: [pulseaudio] bluez5-util.c: Adapter: /org/bluez/hci0
D: [pulseaudio] bluez5-util.c: Unknown interface org.freedesktop.DBus.Properties found, skipping
D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_41_00_00_00_22_DA
D: [pulseaudio] bluez5-util.c: Properties changed in adapter /org/bluez/hci0
D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_41_00_00_00_22_DA
D: [pulseaudio] bluez5-util.c: Unknown interface org.bluez.MediaControl1 found, skipping
D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_41_00_00_00_22_DA
D: [pulseaudio] bluez5-util.c: UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
D: [pulseaudio] bluez5-util.c: UUIDs: 00001131-0000-1000-8000-00805f9b34fb
D: [pulseaudio] bluez5-util.c: UUIDs: 00001200-0000-1000-8000-00805f9b34fb
D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_41_00_00_00_22_DA
D: [pulseaudio] bluez5-util.c: Unknown interface org.freedesktop.DBus.Introspectable found, skipping
D: [pulseaudio] bluez5-util.c: Unknown interface org.bluez.MediaTransport1 found, skipping
D: [pulseaudio] bluez5-util.c: Unknown interface org.freedesktop.DBus.Properties found, skipping
Comment 15 Joakim Tjernlund 2017-08-22 20:05:53 UTC
I have
 UUID: Headset HS                (00001131-0000-1000-8000-00805f9b34fb)
which seems to be some variation of Headset. Would it be possible to 
include Headset HS support in PA?
Can I do some tweaks to get this working? I can patch patch code
Comment 16 Tanu Kaskinen 2017-09-02 11:41:48 UTC
I don't know what variation that is. I sent a question to the bluez mailing list:
https://marc.info/?l=linux-bluetooth&m=150435231102147&w=2

If you replace

#define PA_BLUETOOTH_UUID_HSP_HS      "00001108-0000-1000-8000-00805f9b34fb"

with

#define PA_BLUETOOTH_UUID_HSP_HS      "00001131-0000-1000-8000-00805f9b34fb"

in src/modules/bluetooth/bluez5-util.h, does that make HSP work?
Comment 17 Tanu Kaskinen 2017-09-02 12:05:05 UTC
It seems that the two uuids mean the same thing, so PulseAudio should be modified so that both uuids are recognized.
Comment 18 Tanu Kaskinen 2017-09-02 12:45:52 UTC
I sent a patch to the mailing list:
https://patchwork.freedesktop.org/patch/174918/

Could you test it?
Comment 19 Joakim Tjernlund 2017-09-11 18:54:19 UTC
(In reply to Tanu Kaskinen from comment #18)
> I sent a patch to the mailing list:
> https://patchwork.freedesktop.org/patch/174918/
> 
> Could you test it?

I just saw this bug again and built PA from git.
Now I can see a HSP headset and connect to it.
However, sound applet show:
  HS6000 1 Output/2 Inputs
but when trying to test "speakers" there is just one Mono speaker
and no sound.
The microphone does not work either.
Comment 20 Joakim Tjernlund 2017-09-11 18:56:24 UTC
(In reply to Joakim Tjernlund from comment #19)
> (In reply to Tanu Kaskinen from comment #18)
> > I sent a patch to the mailing list:
> > https://patchwork.freedesktop.org/patch/174918/
> > 
> > Could you test it?
> 
> I just saw this bug again and built PA from git.
> Now I can see a HSP headset and connect to it.
> However, sound applet show:
>   HS6000 1 Output/2 Inputs
> but when trying to test "speakers" there is just one Mono speaker
> and no sound.
> The microphone does not work either.

I also see a bunch of these in my syslog:
Sep 11 20:55:16 jocke kernel: Bluetooth: hci0 urb ffff88017ea30e00 submission failed (28)
Sep 11 20:55:16 jocke kernel: Bluetooth: hci0 urb ffff88020c660c00 submission failed (28)
Sep 11 20:55:16 jocke kernel: Bluetooth: hci0 sending frame failed (-28)
Sep 11 20:55:16 jocke kernel: Bluetooth: hci0 urb ffff88017ea30e00 submission failed (28)
Sep 11 20:55:16 jocke kernel: Bluetooth: hci0 sending frame failed (-28)
Sep 11 20:55:26 jocke kernel: Bluetooth: hci0 urb ffff88017ea35800 submission failed (28)
Sep 11 20:55:27 jocke kernel: Bluetooth: hci0 urb ffff8801d3193c00 submission failed (28)
Comment 21 Joakim Tjernlund 2017-09-13 19:52:34 UTC
(In reply to Tanu Kaskinen from comment #18)
> I sent a patch to the mailing list:
> https://patchwork.freedesktop.org/patch/174918/
> 
> Could you test it?

I was too quick saying it semi worked. I had had this applied:
--- a/lib/uuid.h.org	2017-08-22 22:19:36.605402339 +0200
+++ b/lib/uuid.h	2017-08-22 22:20:36.405090959 +0200
@@ -38,6 +38,7 @@
 
 #define HFP_HS_UUID		"0000111e-0000-1000-8000-00805f9b34fb"
 #define HFP_AG_UUID		"0000111f-0000-1000-8000-00805f9b34fb"
+#define HEADSET_HS_UUID		"00001131-0000-1000-8000-00805f9b34fb"
 
 #define ADVANCED_AUDIO_UUID	"0000110d-0000-1000-8000-00805f9b34fb"
 
--- a/src/device.c.org	2017-08-22 22:20:02.015269784 +0200
+++ b/src/device.c	2017-08-22 22:21:52.014699899 +0200
@@ -4392,6 +4392,18 @@
 			continue;
 		}
 
+		/* Fix devices that report HEADSET_HS_UUID before HSP_HS_UUID,
+		 * contrary to what Erratum #3507 says.
+		 */
+		if ((bt_uuid_strcmp(profile_uuid, HEADSET_HS_UUID) == 0)) {
+			free(profile_uuid);
+			profile_uuid = g_strdup(HSP_HS_UUID);
+			if (!profile_uuid) {
+				sdp_list_free(svcclass, free);
+				continue;
+			}
+		}
+

With the removed, PA went back to earlier non working state. This can from the log though:

( 256.400|   0.000) D: [pulseaudio] bluez5-util.c: Alias: HS6000
( 256.400|   0.000) D: [pulseaudio] bluez5-util.c: Class: 2360324
( 256.400|   0.000) D: [pulseaudio] bluez5-util.c: UUIDs: 00001108-0000-1000-8000-00805f9b34fb
( 256.400|   0.000) D: [pulseaudio] bluez5-util.c: UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
( 256.400|   0.000) D: [pulseaudio] bluez5-util.c: UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
( 256.400|   0.000) D: [pulseaudio] bluez5-util.c: UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
( 256.400|   0.000) D: [pulseaudio] bluez5-util.c: UUIDs: 00001101-0000-1000-8000-00805f9b34fb
( 256.400|   0.000) D: [pulseaudio] bluez5-util.c: Adapter: /org/bluez/hci0
( 256.400|   0.000) D: [pulseaudio] bluez5-util.c: Unknown interface org.freedesktop.DBus.Properties found, skipping
( 256.856|   0.456) D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_C4_73_1E_60_0E_78
( 257.697|   0.840) D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_41_00_00_00_22_DA
( 259.104|   1.406) D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_41_00_00_00_22_DA
( 260.019|   0.915) D: [pulseaudio] bluez5-util.c: Unknown interface org.bluez.MediaControl1 found, skipping
( 260.019|   0.000) D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_41_00_00_00_22_DA
( 260.020|   0.000) D: [pulseaudio] bluez5-util.c: UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
( 260.020|   0.000) D: [pulseaudio] bluez5-util.c: UUIDs: 00001131-0000-1000-8000-00805f9b34fb
( 260.020|   0.000) D: [pulseaudio] bluez5-util.c: UUIDs: 00001200-0000-1000-8000-00805f9b34fb
( 264.127|   4.107) D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_C4_73_1E_60_0E_78
( 264.127|   0.000) D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_41_00_00_00_22_DA
( 264.128|   0.000) D: [pulseaudio] bluez5-util.c: Properties changed in adapter /org/bluez/hci0
( 264.181|   0.053) D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_41_00_00_00_22_DA
( 301.822|  37.641) D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_41_00_00_00_22_DA
( 310.271|   8.448) D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_41_00_00_00_22_DA
( 310.344|   0.073) D: [pulseaudio] bluez5-util.c: dbus: path=/MediaEndpoint/A2DPSource, interface=org.bluez.MediaEndpoint1, member=SelectConfiguration
( 310.351|   0.006) D: [pulseaudio] bluez5-util.c: Unknown interface org.freedesktop.DBus.Introspectable found, skipping
( 310.351|   0.000) D: [pulseaudio] bluez5-util.c: Unknown interface org.bluez.MediaTransport1 found, skipping
( 310.351|   0.000) D: [pulseaudio] bluez5-util.c: Unknown interface org.freedesktop.DBus.Properties found, skipping
( 310.351|   0.000) D: [pulseaudio] bluez5-util.c: dbus: path=/MediaEndpoint/A2DPSource, interface=org.bluez.MediaEndpoint1, member=SetConfiguration
( 310.351|   0.000) D: [pulseaudio] bluez5-util.c: Transport /org/bluez/hci0/dev_41_00_00_00_22_DA/fd0 state: disconnected -> idle
( 310.351|   0.000) D: [pulseaudio] bluez5-util.c: Transport /org/bluez/hci0/dev_41_00_00_00_22_DA/fd0 available for profile a2dp_sink
( 310.490|   0.139) D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_41_00_00_00_22_DA

PA still announces UUIDs: 00001108-0000-1000-8000-00805f9b34fb
Comment 22 Enzo Laroche 2017-09-18 09:26:56 UTC
(In reply to Tanu Kaskinen from comment #18)
> I sent a patch to the mailing list:
> https://patchwork.freedesktop.org/patch/174918/
> 
> Could you test it?

Tested with pulseaudio-11 and bluez-5.47-r1 on Gentoo x64
Headset 1: Parrot Zik v2.05
Headset 2: Android Virtual HSP Gateway


Same behaviour (headset_head_unit: Not connected). Do you need some debug infos ?
Comment 23 Enzo Laroche 2017-09-18 14:24:59 UTC
By the way, can someone look at this patch and tell me if it's relevant to our current situation ? I just stumbled upon it.

https://patchwork.freedesktop.org/patch/106453/
Comment 24 Tanu Kaskinen 2017-09-18 20:42:46 UTC
(In reply to Joakim Tjernlund from comment #21)
> With the removed, PA went back to earlier non working state. This can from
> the log though:

It looks like you dropped some word(s) from your sentence. Was there something in the log you wanted to highlight? From the log it looks like the UUIDs changed all of a sudden, which would be weird, but maybe that's happening because this was the first time trying with a new version of bluetoothd that doesn't any more modify the UUID list from the device, and the old UUIDs were from some database of bluetoothd that still contained the UUIDs from the old bluetoothd version.

Otherwise I don't see anything strange in the log.

> PA still announces UUIDs: 00001108-0000-1000-8000-00805f9b34fb

What do you mean by that?


(In reply to Enzo Laroche from comment #22)
> Same behaviour (headset_head_unit: Not connected). Do you need some debug
> infos ?

You could attach the verbose log from the pulseaudio daemon.


(In reply to Enzo Laroche from comment #23)
> By the way, can someone look at this patch and tell me if it's relevant to
> our current situation ? I just stumbled upon it.
> 
> https://patchwork.freedesktop.org/patch/106453/

That patch is a part of a series. The patches are relevant if you have an HFP-only headset. The patches shouldn't be needed if the headset supports HSP.

The patches probably won't apply cleanly to the current master. Somebody tried it once, and after it failed, I made a git branch available with the patches applied here: https://cgit.freedesktop.org/~tanuk/pulseaudio/ (branch "hfp").

The patches have been reviewed, but not applied upstream, because they had issues. The original author never sent an updated version of the patches. If someone would like to finish the work, you can see the review feedback in patchwork:
https://patchwork.freedesktop.org/patch/106452/
https://patchwork.freedesktop.org/patch/106453/
https://patchwork.freedesktop.org/patch/106454/
Comment 25 Enzo Laroche 2017-09-20 13:08:30 UTC
(In reply to Tanu Kaskinen from comment #24)
> You could attach the verbose log from the pulseaudio daemon.
https://gist.github.com/NainKult/b3557abb1274ce0b45c4a905b43a30b4#file-gistfile1-txt-L86

(In reply to Tanu Kaskinen from comment #24)
> That patch is a part of a series. The patches are relevant if you have an
> HFP-only headset. The patches shouldn't be needed if the headset supports
> HSP.
It think it does support both HSP/HFP
backend-native.c: Registering Profile /Profile/HSPHSProfile 00001108-0000-1000-8000-00805f9b34fb
Comment 26 Joakim Tjernlund 2017-09-20 20:16:13 UTC
(In reply to Tanu Kaskinen from comment #24)
> (In reply to Joakim Tjernlund from comment #21)
> > With the removed, PA went back to earlier non working state. This can from
> > the log though:
> 
> It looks like you dropped some word(s) from your sentence. Was there
> something in the log you wanted to highlight? From the log it looks like the
> UUIDs changed all of a sudden, which would be weird, but maybe that's
> happening because this was the first time trying with a new version of
> bluetoothd that doesn't any more modify the UUID list from the device, and
> the old UUIDs were from some database of bluetoothd that still contained the
> UUIDs from the old bluetoothd version.
> 
> Otherwise I don't see anything strange in the log.
> 
> > PA still announces UUIDs: 00001108-0000-1000-8000-00805f9b34fb
> 
> What do you mean by that?

Lets forget about that ATM, it is a bit confusing now with several things moving

> (In reply to Enzo Laroche from comment #23)
> > By the way, can someone look at this patch and tell me if it's relevant to
> > our current situation ? I just stumbled upon it.
> > 
> > https://patchwork.freedesktop.org/patch/106453/
> 
> That patch is a part of a series. The patches are relevant if you have an
> HFP-only headset. The patches shouldn't be needed if the headset supports
> HSP.
> 
> The patches probably won't apply cleanly to the current master. Somebody
> tried it once, and after it failed, I made a git branch available with the
> patches applied here: https://cgit.freedesktop.org/~tanuk/pulseaudio/
> (branch "hfp").
> 
> The patches have been reviewed, but not applied upstream, because they had
> issues. The original author never sent an updated version of the patches. If
> someone would like to finish the work, you can see the review feedback in
> patchwork:
> https://patchwork.freedesktop.org/patch/106452/
> https://patchwork.freedesktop.org/patch/106453/
> https://patchwork.freedesktop.org/patch/106454/

I have these ported on top of current master, the last path (RFCOMM) needs
a total rewrite though as it was a mess to begin with.

I does not work yet, but HSP isn't either so I think I have a bug elsewhere.
The few times I got HSP profile to stick, it it only showed Mono output and
no sound at all. Is the Mono stuff really expected,if not, where to look?
Comment 27 Tanu Kaskinen 2017-09-21 17:17:30 UTC
(In reply to Enzo Laroche from comment #25)
> https://gist.github.com/NainKult/b3557abb1274ce0b45c4a905b43a30b4#file-
> gistfile1-txt-L86

I'm not sure that log contains everything from the point where you connect the headset. When you connect the headset, bluetoothd should send a NewConnection dbus message to pulseaudio, and that will be visible in the pulseaudio log. Your log doesn't show that. If a more complete log doesn't show that either, then bluetoothd apparently doesn't send the message, which is why in pulseaudio's opinion HSP isn't available.

> It think it does support both HSP/HFP
> backend-native.c: Registering Profile /Profile/HSPHSProfile
> 00001108-0000-1000-8000-00805f9b34fb

That log message only tells that pulseaudio registered itself to bluetoothd as a HSP implementation. It doesn't tell anything about what your headset supports.

You can use bluetoothctl to query the features of the headset. Run "bluetoothctl" and then in the prompt enter "info A0:14:3D:1F:09:17".
Comment 28 Tanu Kaskinen 2017-09-21 17:24:04 UTC
(In reply to Joakim Tjernlund from comment #26)
> I have these ported on top of current master, the last path (RFCOMM) needs
> a total rewrite though as it was a mess to begin with.

James sent a new version of the patch set:
https://patchwork.freedesktop.org/patch/177864/
https://patchwork.freedesktop.org/patch/177863/
https://patchwork.freedesktop.org/patch/177865/

> I does not work yet, but HSP isn't either so I think I have a bug elsewhere.
> The few times I got HSP profile to stick, it it only showed Mono output and
> no sound at all. Is the Mono stuff really expected,if not, where to look?

HSP is mono output and input, A2DP is stereo output only.

If you manage to make the HSP sink and source appear, but get no audio with them, you can start from the troubleshooting section on this page:
https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Bluetooth/

That's off-topic for this bug, so further debugging is best done elsewhere.
Comment 29 Joakim Tjernlund 2017-09-21 20:24:27 UTC
(In reply to Tanu Kaskinen from comment #28)
> (In reply to Joakim Tjernlund from comment #26)
> > I have these ported on top of current master, the last path (RFCOMM) needs
> > a total rewrite though as it was a mess to begin with.
> 
> James sent a new version of the patch set:
> https://patchwork.freedesktop.org/patch/177864/
> https://patchwork.freedesktop.org/patch/177863/
> https://patchwork.freedesktop.org/patch/177865/

Nice! I will check them out

> 
> > I does not work yet, but HSP isn't either so I think I have a bug elsewhere.
> > The few times I got HSP profile to stick, it it only showed Mono output and
> > no sound at all. Is the Mono stuff really expected,if not, where to look?
> 
> HSP is mono output and input, A2DP is stereo output only.

I see, but I presume HFP is stereo too?

> 
> If you manage to make the HSP sink and source appear, but get no audio with
> them, you can start from the troubleshooting section on this page:
> https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/
> Bluetooth/

Thanks
Comment 30 Joakim Tjernlund 2017-09-21 20:44:24 UTC
(In reply to Joakim Tjernlund from comment #29)
> (In reply to Tanu Kaskinen from comment #28)
> > (In reply to Joakim Tjernlund from comment #26)
> > > I have these ported on top of current master, the last path (RFCOMM) needs
> > > a total rewrite though as it was a mess to begin with.
> > 
> > James sent a new version of the patch set:
> > https://patchwork.freedesktop.org/patch/177864/
> > https://patchwork.freedesktop.org/patch/177863/
> > https://patchwork.freedesktop.org/patch/177865/
> 
> Nice! I will check them out

ehh, even though I joined patchwork, I cannot comment on them.
I must be missing something ?
Comment 31 Enzo Laroche 2017-09-21 22:35:15 UTC
(In reply to Tanu Kaskinen from comment #27)
> I'm not sure that log contains everything from the point where you connect
> the headset. When you connect the headset, bluetoothd should send a
> NewConnection dbus message to pulseaudio, and that will be visible in the
> pulseaudio log. Your log doesn't show that. If a more complete log doesn't
> show that either, then bluetoothd apparently doesn't send the message, which
> is why in pulseaudio's opinion HSP isn't available.
It is truncated but show the bluetooth pairing. Line 1 is my pulseaudio doing nothing and between line 1 and 2 is where I switch my headset on and it pair.

(In reply to Tanu Kaskinen from comment #27)
> That log message only tells that pulseaudio registered itself to bluetoothd
> as a HSP implementation. It doesn't tell anything about what your headset
> supports.
My bad. had a brainfart on this one :P

(In reply to Tanu Kaskinen from comment #27)
> You can use bluetoothctl to query the features of the headset. Run
> "bluetoothctl" and then in the prompt enter "info A0:14:3D:1F:09:17".
Device A0:14:3D:1F:09:17
        Name: metalheadset V2.05
        Alias: metalheadset V2.05
        Class: 0x00240408
        Icon: audio-card
        Paired: yes
        Trusted: yes
        Blocked: no
        Connected: no
        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)
        UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
        UUID: Vendor specific           (8b6814d3-6ce7-4498-9700-9312c1711f63)
        Modalias: bluetooth:v0043pA003d0000

(In reply to Tanu Kaskinen from comment #28)
> James sent a new version of the patch set:
> https://patchwork.freedesktop.org/patch/177864/
> https://patchwork.freedesktop.org/patch/177863/
> https://patchwork.freedesktop.org/patch/177865/
Seems like an awful lot of work to get it to merge with the master branch :(

(In reply to Tanu Kaskinen from comment #28)
> 
> HSP is mono output and input, A2DP is stereo output only.
> 
Can confirm that, my headset switch to mono whenever I receive a call on my phone.
Comment 32 Joakim Tjernlund 2017-09-22 01:12:39 UTC
On Thu, 2017-09-21 at 22:35 +0000, bugzilla-daemon@freedesktop.org wrote:

Comment # 31<https://bugs.freedesktop.org/show_bug.cgi?id=93898#c31> on bug 93898<https://bugs.freedesktop.org/show_bug.cgi?id=93898> from Enzo Laroche<mailto:github@laroche.pro>

(In reply to Tanu Kaskinen from comment #27<show_bug.cgi?id=93898#c27>)
> I'm not sure that log contains everything from the point where you connect
> the headset. When you connect the headset, bluetoothd should send a
> NewConnection dbus message to pulseaudio, and that will be visible in the
> pulseaudio log. Your log doesn't show that. If a more complete log doesn't
> show that either, then bluetoothd apparently doesn't send the message, which
> is why in pulseaudio's opinion HSP isn't available.
It is truncated but show the bluetooth pairing. Line 1 is my pulseaudio doing
nothing and between line 1 and 2 is where I switch my headset on and it pair.

(In reply to Tanu Kaskinen from comment #27<show_bug.cgi?id=93898#c27>)
> That log message only tells that pulseaudio registered itself to bluetoothd
> as a HSP implementation. It doesn't tell anything about what your headset
> supports.
My bad. had a brainfart on this one :P

(In reply to Tanu Kaskinen from comment #27<show_bug.cgi?id=93898#c27>)
> You can use bluetoothctl to query the features of the headset. Run
> "bluetoothctl" and then in the prompt enter "info A0:14:3D:1F:09:17".
Device A0:14:3D:1F:09:17
        Name: metalheadset V2.05
        Alias: metalheadset V2.05
        Class: 0x00240408
        Icon: audio-card
        Paired: yes
        Trusted: yes
        Blocked: no
        Connected: no
        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)
        UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
        UUID: Vendor specific           (8b6814d3-6ce7-4498-9700-9312c1711f63)
        Modalias: bluetooth:v0043pA003d0000

(In reply to Tanu Kaskinen from comment #28<show_bug.cgi?id=93898#c28>)
> James sent a new version of the patch set:
> https://patchwork.freedesktop.org/patch/177864/
> https://patchwork.freedesktop.org/patch/177863/
> https://patchwork.freedesktop.org/patch/177865/
Seems like an awful lot of work to get it to merge with the master branch :(


Use the new stable-11.x branch instead :)



(In reply to Tanu Kaskinen from comment #28<show_bug.cgi?id=93898#c28>)
>
> HSP is mono output and input, A2DP is stereo output only.
>
Can confirm that, my headset switch to mono whenever I receive a call on my
phone.

HFP Mono too ?


________________________________
You are receiving this mail because:

  *   You are on the CC list for the bug.
Comment 33 Enzo Laroche 2017-09-22 08:41:06 UTC
(In reply to Joakim Tjernlund from comment #32)
> HFP Mono too ?
Don't take my word on it, because I don't have a lot of HFP thingys laying around but I think it is, indeed, mono. Only the quality of the transmission is improved.

I think the major improvement of HFP vs HSP is the support of more AT commands and an increased bitrate.

(In reply to Joakim Tjernlund from comment #32)
> Use the new stable-11.x branch instead :)
It applies on 11.1 tag without a itch. Gonna do some testing.

Preparing source in /var/tmp/portage/media-sound/pulseaudio-9999/work/pulseaudio-9999 ...
 * Applying v4-1-3-bluetooth-use-consistent-profile-names.patch ...                                                                                                                                                                                                     [ ok ]
 * Applying v4-2-3-bluetooth-separate-HSP-and-HFP.patch ...                                                                                                                                                                                                             [ ok ]
 * Applying v4-3-3-bluetooth-add-correct-HFP-rfcomm-negotiation.patch ...                                                                                                                                                                                               [ ok ]
 * User patches applied.
Comment 34 Enzo Laroche 2017-09-22 09:03:54 UTC
(In reply to Tanu Kaskinen from comment #27)
> When you connect the headset, bluetoothd should send a NewConnection dbus
> message to pulseaudio, and that will be visible in the pulseaudio log. 
> Your log doesn't show that. If a more complete log doesn't show that either,
> then bluetoothd apparently doesn't send the message, which is why in 
> pulseaudio's opinion HSP isn't available.
This ?

D: [pulseaudio] backend-native.c: dbus: path=/Profile/HFPAGProfile, interface=org.bluez.Profile1, member=NewConnection
D: [pulseaudio] backend-native.c: dbus: NewConnection path=/org/bluez/hci0/dev_A0_14_3D_1F_09_17, fd=29, profile headset_handsfree
I: [pulseaudio] backend-native.c: doing listen

Had to pair/unpair/pair to get it !
Comment 35 Enzo Laroche 2017-09-22 12:10:31 UTC
(In reply to Enzo Laroche from comment #33)
> It applies on 11.1 tag without a itch. Gonna do some testing.
We're getting there but it's not working for me (yet).

Got "HFP negotiation failed in state 2 with inbound AT+BRSF=61"
with my Parrot Zik v2 (2.05)
https://gist.github.com/NainKult/43dbcbc307e399759d17077dbf1366c1#file-pulseaudio-log-L1995-L2037
Comment 36 Joakim Tjernlund 2017-09-22 18:47:36 UTC
(In reply to Tanu Kaskinen from comment #18)
> I sent a patch to the mailing list:
> https://patchwork.freedesktop.org/patch/174918/
> 
> Could you test it?

This works , it is just my bad BT chip in my desktop making trouble.
I think you should add this to stable 11.x until we have HFP
Comment 37 Tanu Kaskinen 2017-10-08 18:41:23 UTC
(In reply to Joakim Tjernlund from comment #30)
> ehh, even though I joined patchwork, I cannot comment on them.
> I must be missing something ?

It's not possible to comment on patchwork. Patchwork only forwards comments from the mailing list to the web service, not the other way around. If you want to comment, send email to pulseaudio-discuss@lists.freedesktop.org, but please first subscribe to the mailing list here:
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

By the way, v5 of the patch set has been submitted:
https://patchwork.freedesktop.org/patch/178198/
https://patchwork.freedesktop.org/patch/178199/
https://patchwork.freedesktop.org/patch/178200/
https://patchwork.freedesktop.org/patch/178201/
Comment 38 Marc Alexandre 2017-10-21 19:15:34 UTC
Hi,

Maybe I'm not posting on the right place, let me know if it's the case.

I tried to apply the patches on the master branch to test it with my bluetooth speaker. As usual, I can connect in A2DP without any problems, but HFP is unavailable, and I want to make call conference with this speaker (the Bose Soundlink Color II to be precise).

When I apply the patches, with the mbox containing the 4 patches (git am), I get this :

Applying: bluetooth: use consistent profile names
error: patch failed: src/modules/bluetooth/bluez5-util.c:174
error: src/modules/bluetooth/bluez5-util.c: patch does not apply
error: patch failed: src/modules/bluetooth/module-bluez5-device.c:1873
error: src/modules/bluetooth/module-bluez5-device.c: patch does not apply
Patch failed at 0001 bluetooth: use consistent profile names


I'm kinda new to this, and just wanted to get my feedback after testing. What am I doing wrong?
Comment 39 Marc Alexandre 2017-10-21 21:05:23 UTC
Sorry for my last message, I just needed to update the patches regarding the last code changes. I compiled & install pulseaudio with those patches from the master, and everything is working well. I can chose HFP or A2DP. Of course, the quality on HFP drops significantly, but at least the microphone works. Now I'll need to test if skype or any other call app is able to switch the profile automatically. But thanks for the patches.

To give my config briefly :
Arch Linux from the latest official release on an XPS 13 (i7 8th gen, everything from the basic config from Dell.com), and the Bose Soundlink Color II. I have ofono installed since everyone of my search would ask me to install it, and I have 'headphone=auto' in my /etc/pulse/default.pa, and this in my /etc/bluetooth/audio.conf:

[General]
Enable=Gateway,Source,Socket
Master=true
HFP=true
Comment 40 GitLab Migration User 2018-07-30 09:40:24 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/84.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.