Bug 90027 - Switching from A2DP to HSP produces noise
Summary: Switching from A2DP to HSP produces noise
Status: RESOLVED MOVED
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: modules (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: pulseaudio-bugs
QA Contact: pulseaudio-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-14 14:57 UTC by Bastien Nocera
Modified: 2018-07-30 10:14 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments
pulseaudio -vvvv log (84.18 KB, text/x-log)
2017-03-02 17:31 UTC, Christian Kellner
Details
bluetoothd log (84.21 KB, text/x-log)
2017-04-20 14:40 UTC, Christian Kellner
Details

Description Bastien Nocera 2015-04-14 14:57:39 UTC
bluez-5.29-2.fc22.x86_64
pulseaudio-module-bluetooth-6.0-2.fc22.x86_64

1. Connect the A2DP headset
2. Start playing music
3. Select the headset as output in GNOME's Sound panel:
Audio plays nicely through the headset
4. Switch the device profile to HSP/HFP:
White noise comes out of the headphones

Trying to switch back to A2DP has no effect and audio doesn't play anymore.
Comment 1 Tanu Kaskinen 2015-04-15 15:06:10 UTC
Could you attach a verbose log that shows what happens when you switch from a2dp to hsp and back? Instructions here: https://wiki.ubuntu.com/PulseAudio/Log
Comment 2 Christian Kellner 2017-03-02 17:31:56 UTC
Created attachment 130036 [details]
pulseaudio -vvvv log

I am having a pair of Bose QC 25 headphones. With the A2DP profile I get sound, but as soon as the HSP/HFP profile is selected (which e.g. happens automatically when the integrated microphone is selected from the "Inputs" tab in GNOME sound preferences) I get quiet noise followed by a truncated message from the headphones "Call from" and more quiet noise. Test Speakers (GNOME sound preferences) produces (louder) white noise.

I am happy to provide more info/debug or even work in the it myself, if needed.
Comment 3 Christian Kellner 2017-03-02 17:41:23 UTC
Info of the headphones:

Device 04:52:C7:60:D8:82
	Name: LE-ck's quiet ears
	Alias: LE-ck's quiet ears
	Class: 0x240418
	Icon: audio-card
	Paired: yes
	Trusted: yes
	Blocked: no
	Connected: yes
	LegacyPairing: no
	UUID: Vendor specific           (00000000-deca-fade-deca-deafdecacaff)
	UUID: Serial Port               (00001101-0000-1000-8000-00805f9b34fb)
	UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
	UUID: Audio Source              (0000110a-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 Server   (0000112f-0000-1000-8000-00805f9b34fb)
	UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
	Modalias: bluetooth:v009Ep400Cd0129
	ManufacturerData Key: 0x0310
	ManufacturerData Value: 0x40
	ManufacturerData Value: 0x0c
	ManufacturerData Value: 0x01
	ManufacturerData Value: 0x51
	ManufacturerData Value: 0x00
	ManufacturerData Value: 0x28
	ManufacturerData Value: 0xf8
	ManufacturerData Value: 0x3a
	ManufacturerData Value: 0xe4
	ManufacturerData Value: 0xee
Comment 4 Oliver Haessler 2017-03-03 13:03:14 UTC
another headphne nearly the same issues as Christian, however the HSP/HFP profile does not produce any sound at all:

Device E3:28:E9:20:72:83
	Name: TaoTronics TT-BH07
	Alias: TaoTronics TT-BH07
	Class: 0x240404
	Icon: audio-card
	Paired: yes
	Trusted: yes
	Blocked: no
	Connected: no
	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: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
	UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
Comment 5 Jaroslav Lichtblau 2017-03-03 13:48:34 UTC
I got the same issue as described by Christian Kellner with my Plantronics BackBeat FIT headphone.

[PLT_BBFIT]# info 
Device 0C:E0:E4:B6:D1:36
	Name: PLT_BBFIT
	Alias: PLT_BBFIT
	Class: 0x240404
	Icon: audio-card
	Paired: yes
	Trusted: yes
	Blocked: no
	Connected: yes
	LegacyPairing: no
	UUID: Vendor specific           (00000000-deca-fade-deca-deafdecacaff)
	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: 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           (82972387-294e-4d62-97b5-2668aa35f618)
	UUID: Vendor specific           (94972387-294e-4d62-97b5-2668aa35f618)
	Modalias: bluetooth:v0055pD005d0705
Comment 6 Tanu Kaskinen 2017-04-19 10:29:53 UTC
If you can switch to HSP, but get silence, does it look like the audio is being played, or does it look like the audio is just stuck? If the audio is stuck, that's a different bug, see bug 97064. I'd like to keep the noise issue as the only topic of this bug.

I would guess that the bluetooth adapter for some reason expects some other audio format than what pulseaudio is sending. The adapter might need some configuration (I have no knowledge of how to configure the adapter, though). If you have a chance to test your headset with a different bluetooth adapter and/or test a different headset with the same adapter, it would be interesting to hear if the behaviour is the same.
Comment 7 Tanu Kaskinen 2017-04-19 11:03:57 UTC
About configuring the adapter, here's some vague advice based on the discussion on bug 97064 and some comments from Luiz in IRC (I'll add Luiz to CC):

PulseAudio requires the adapter to take the SCO audio via the HCI interface (SCO is the audio protocol that is used in HSP). The noise might not be because the adapter expects a different audio format than what pulseaudio sends, but because the adapter's audio routing is wrong, and the audio that it sends to the headset is coming from some interface that isn't connected to any real audio source.

Configuring the adapter's SCO audio routing to use HCI is vendor-specific (and I don't know if it's even possible for all adapters), so I can't give the exact commands to do it. The discussion in bug 97064 may offer some hints. It's also worth checking that there's no missing firmware (again, refer to the discussion in bug 97064).

I'll add here my short discussion with Luiz in IRC:

<tanuk>   vudentz: Do you know what could cause only noise to be played
          when using HSP?
<vudentz> tanuk, nope, perhaps the controller is not really setup for HCI
          routing as PA expects?
<vudentz> SCO setup is quite tricky since no manufacturer really test
          their firmware properly, and on windows they might actually
          have other audio solutions
<tanuk>   vudentz: Based on the comments in another bug (97064), the
          audio routing setup seems to require vendor specific commands,
          so it's hard to give people good advice for how to do it...
<vudentz> tanuk, specially on phones/tablets controllers tend to be
          hardwired the pcm line, USB should normally use HCI but I heard
          about controllers using custom transports that use USB bulk
          endpoint instead of isochronous defined in the spec.
Comment 8 Tanu Kaskinen 2017-04-19 11:08:30 UTC
Forgot to say: if someone manages to solve their noise-with-HSP problem by messing with the adapter configuration or firmware (or in some other way), please tell how exactly you did it.
Comment 9 Georg Chini 2017-04-20 13:04:14 UTC
Possibly the headsets negotiate mSBC codec instead of CVSD, although mSBC should not be supported by HSP. Because mSBC should only work with eSCO, could you try if
"echo 1 > /sys/module/bluetooth/parameters/disable_esco"
reolves the noise issue?
Comment 10 Christian Kellner 2017-04-20 13:57:28 UTC
hcidump log:

HCI sniffer - Bluetooth packet analyzer ver 5.44
device: hci0 snap_len: 1500 filter: 0xffffffffffffffff
> HCI Event: Connect Request (0x04) plen 10
    bdaddr 04:52:C7:60:D8:82 class 0x240418 type ACL
> HCI Event: Command Status (0x0f) plen 4
    Accept Connection Request (0x01|0x0009) status 0x00 ncmd 1
> HCI Event: Connect Complete (0x03) plen 11
    status 0x00 handle 256 bdaddr 04:52:C7:60:D8:82 type ACL encrypt 0x00
> HCI Event: Command Status (0x0f) plen 4
    Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1
> HCI Event: Read Remote Supported Features (0x0b) plen 11
    status 0x00 handle 256
    Features: 0xff 0xff 0x8f 0xfe 0xdb 0xff 0x5b 0x87
> HCI Event: Command Status (0x0f) plen 4
    Read Remote Extended Features (0x01|0x001c) status 0x00 ncmd 1
> HCI Event: Read Remote Extended Features (0x23) plen 13
    status 0x00 handle 256 page 1 max 1
    Features: 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00
> HCI Event: Command Status (0x0f) plen 4
    Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> HCI Event: Command Complete (0x0e) plen 10
    Link Key Request Reply (0x01|0x000b) ncmd 1
    status 0x00 bdaddr 04:52:C7:60:D8:82
> HCI Event: Remote Name Req Complete (0x07) plen 255
    status 0x00 bdaddr 04:52:C7:60:D8:82 name 'ck's quiet ears'
> HCI Event: Encrypt Change (0x08) plen 4
    status 0x00 handle 256 encrypt 0x01
> HCI Event: Command Complete (0x0e) plen 7
    Read Encryption Key Size (0x05|0x0008) ncmd 1
> HCI Event: Command Status (0x0f) plen 4
    Exit Sniff Mode (0x02|0x0004) status 0x00 ncmd 1
> HCI Event: Command Status (0x0f) plen 4
    Setup Synchronous Connection (0x01|0x0028) status 0x00 ncmd 1
> HCI Event: Synchronous Connect Complete (0x2c) plen 17
    status 0x00 handle 258 bdaddr 04:52:C7:60:D8:82 type eSCO
    Air mode: CVSD


The action taken during the logging period was: connect the headphones, switch to them (A2DP profile), test the speaker (successfully) then switch to HSP profile and testing again (blocks the UI).

Other relevant log messages (journal -r):
[... lots more of the following ...]
kernel: Bluetooth: hci0 SCO packet for unknown connection handle 258
kernel: Bluetooth: hci0 SCO packet for unknown connection handle 258
kernel: Bluetooth: hci0 SCO packet for unknown connection handle 258
bluetoothd[10708]: Unable to get io data for Headset Voice gateway: getpeername: Transport endpoint is not connected (1
Comment 11 Christian Kellner 2017-04-20 14:40:58 UTC
Created attachment 130944 [details]
bluetoothd log

bluetoothd log during the same procedure as stated comment #10
Comment 12 Garrett Heaver 2017-04-22 00:19:49 UTC
Just to confirm same issue here. Bose A20 headset. A2DP will work fine playing music but switching to HSP/HFP results in white noise. It seems the microphone is immediately "enabled" and the white noise is perhaps what the mic is picking up. Certainly I can hear the mic picking up my typing. Music won't play at all with HSP enabled (Spotify reports that it cannot play the song so is PA reporting some error?).

Depending on how the headset was connected via BT and sequencing either HSP/HFP is not available or A2DP is listed as not available. Disconnect and reconnect with bluetoothctl or a restart of bluetooth service can reset it back.

pulseaudio 10.0
bluez 5.44

Running the default.pa with no modifications
Comment 13 Tanu Kaskinen 2017-04-22 06:58:01 UTC
It would be good to report not only the headset model, but also the bluetooth adapter model. I'm not sure how to best figure that out, maybe "lsusb | grep -i blue" is good?
Comment 14 Christian Kellner 2017-05-24 19:14:07 UTC
On fedora rawhide, but also on the fedora 25 with all updates this issue is gone for me with my Bose, Oliver's TaoTronics TT-BH07 and also Jaroslavs. I suspect a kernel fix but have not verified that as of yet.
Comment 15 GitLab Migration User 2018-07-30 10:14:26 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/291.


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.