Audio not switched when headset disabled via bluetooth on/off

Bug #1396973 reported by Jonathan Cave
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Canonical System Image
Confirmed
Undecided
Unassigned
bluez (Ubuntu)
Won't Fix
Undecided
Unassigned

Bug Description

Version: ubuntu-touch/ubuntu-rtm/14.09-proposed r169 krillin

Steps to reproduce:
 * Pair krillin with BT Headset (Sony MDR-10RBT used in test)
 * Call the handset
 * Answer call
 * Check headset input/output
 * Disable Bluetooth on the krillin
 * Audio routed to phone speaker/mic
 * Re-enable Bluetooth

Expected result:
 - Bluetooth re-connects to headset audio routed back to headset input/output

Actual result:
 - Audio seems to be routed badly - no audio on call at all from krillin

Jonathan Cave (jocave)
Changed in barajas:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Pat McGowan (pat-mcgowan)
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Tested with my headset (Jabra HALO) and wasn't able to reproduce the issue (the audio was automatically routed to the headset after enabling bluetooth again).

From your results, it seems that the device got in a weird half-connected state, which I saw as well before.

Would you mind providing more info? Please extract the following:
* After pairing and after re-enabling bluetooth $ pactl list

Please also provide your syslog. If you're always able to reproduce the issue, would you mind enabling debug on pulse and then extracting the syslog again?

You can enable debug on pulse by calling the following (and rebooting): $ sudo sed -i 's/--start/--start --log-level=debug/g' /usr/share/upstart/sessions/pulseaudio.conf

Changed in barajas:
assignee: Pat McGowan (pat-mcgowan) → Ricardo Salveti (rsalveti)
status: Confirmed → Incomplete
Jonathan Cave (jocave)
Changed in barajas:
assignee: Ricardo Salveti (rsalveti) → Jonathan Cave (jocave)
Revision history for this message
Jonathan Cave (jocave) wrote :
Revision history for this message
Jonathan Cave (jocave) wrote :
Changed in barajas:
assignee: Jonathan Cave (jocave) → Ricardo Salveti (rsalveti)
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

From your logs it seems everything is fine from pulse's perspective.

Now wonder if tp-ofono is doing the right thing. Also, mind sharing the screenshot when the audio gets in such unknown state? There should be an icon in the phone-app indicating the current available modes.

Now to extract the tp-ofono logs, please do the following:
1 - Disconnect the bt device, make sure there is no active call in place;
2 - As phablet: $ pkill telepathy-ofono; /usr/lib/telepathy/telepathy-ofono
3 - connect your bt device;
4 - initialize a voicecall;
5 - Disable bluetooth from the indicator;
6 - Enable bluetooth from system-settings;
7 - Hangup the call;

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Logs from tp-ofono: http://paste.ubuntu.com/9348090/

From the logs itself it seems that everything is working as expected (at least how it should be):

Before starting the call:
Notified about card (bluez_card.57_D3_98_0A_B3_79) add event from PulseAudio
Notified about card (bluez_card.57_D3_98_0A_B3_79) changes event from PulseAudio

When starting the call:
Setting up pulseaudio for voice call
Recorded default sink: bluez_sink.57_D3_98_0A_B3_79 default source: source.primary
Found card that supports voicecall: 'droid_card.primary'
Found card that supports hsp and a2dp: 'bluez_card.57_D3_98_0A_B3_79'
Setting PulseAudio card 'bluez_card.57_D3_98_0A_B3_79' profile 'hsp'
Setting PulseAudio default sink to 'sink.primary'
PulseAudio available audio modes changed
PulseAudio available audio modes changed
Setting PulseAudio source 'source.primary' muted '0'
Setting PulseAudio card 'droid_card.primary' profile 'voicecall'
Setting PulseAudio default sink to 'sink.primary'
Setting PulseAudio sink 'sink.primary' port 'output-bluetooth_sco'
Setting PulseAudio source 'source.primary' port 'input-bluetooth_sco_headset'
PulseAudio audio mode changed: 0x8
PulseAudio audio mode changed: 0x8
Setting PulseAudio source 'source.primary' muted '0'
Notified about card (droid_card.primary) changes event from PulseAudio

After disabling bt:
Notifying about BT-HSP card removal
Setting up pulseaudio for voice call
Recorded default sink: sink.primary default source: source.primary
Found card that supports voicecall: 'droid_card.primary'
Setting PulseAudio sink 'sink.primary' port 'output-earpiece'
Setting PulseAudio source 'source.primary' port 'input-builtin_mic'

After enabling bt again:
Adding new BT-HSP capable device
Setting up pulseaudio for voice call
Recorded default sink: bluez_sink.57_D3_98_0A_B3_79 default source: source.primary
Found card that supports voicecall: 'droid_card.primary'
Found card that supports hsp and a2dp: 'bluez_card.57_D3_98_0A_B3_79'
Setting PulseAudio card 'bluez_card.57_D3_98_0A_B3_79' profile 'hsp'
Setting PulseAudio default sink to 'sink.primary'
Setting PulseAudio sink 'sink.primary' port 'output-bluetooth_sco'
Setting PulseAudio source 'source.primary' port 'input-bluetooth_sco_headset'

After terminating the call:
disconnected
onCallChannelClosed()
call channel closed
onCallChannelDestroyed()
call channel closed for number "/ril_0/voicecall01"
Restoring PulseAudio card 'droid_card.primary' to profile 'primary-primary'
Setting PulseAudio default sink to 'sink.primary'
Setting PulseAudio sink 'sink.primary' port 'output-speaker'
Setting PulseAudio source 'source.primary' port 'input-builtin_mic'
PulseAudio audio mode changed: 0x4
PulseAudio audio mode changed: 0x4
Restoring pulseaudio previous state
Restoring PulseAudio card 'bluez_card.57_D3_98_0A_B3_79' to profile 'a2dp'
Restoring PulseAudio default sink to 'bluez_sink.57_D3_98_0A_B3_79'
Restoring PulseAudio default source to 'source.primary'
Notified about card (droid_card.primary) changes event from PulseAudio

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

<joc> rsalveti: got the audio source button show up
<rsalveti> joc: which options?
<joc> ubuntu phone, phone speaker, bluetooth device
<rsalveti> joc: does it work when you change to speaker?
<rsalveti> bt -> speaker -> bt
<rsalveti> see if that makes any difference
<joc> rsalveti: sound went to speaker but not to bt
<rsalveti> joc: hm, something is not right with your bt device

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

One other test would be to start a voice call and turn on the bt device while the call is in progress, just to know if the issue is happening when shutting down bt or when connecting and trying to use hsp right away.

Changed in barajas:
assignee: Ricardo Salveti (rsalveti) → Jonathan Cave (jocave)
Revision history for this message
Jonathan Cave (jocave) wrote :

Version: ubuntu-touch/ubuntu-rtm/14.09-proposed r180 krillin

Tested as per comment #7

Paired before call then turned off the headset. Initiated the call then turned headset back on. The connection between the phone and headset was established automatically and the audio routed to the headset correctly.

Changed in barajas:
assignee: Jonathan Cave (jocave) → Ricardo Salveti (rsalveti)
Changed in barajas:
milestone: none → ww05-2015
Changed in barajas:
status: Incomplete → Confirmed
Changed in barajas:
milestone: ww05-2015 → ww07-2015
Revision history for this message
John McAleely (john.mcaleely) wrote :

As described, still repros on -225 proposed.

summary: - Audio not switched back to BT Headset during call
+ Audio not switched when headset disabled via bluetooth on/off
Revision history for this message
John McAleely (john.mcaleely) wrote :

Use case is people using a bluetooth car hifi as headset, and wishing to take a more private segment of a call.

Changed in barajas:
milestone: ww07-2015 → ww09-2015
Changed in barajas:
milestone: ww09-2015 → ww11-2015
Revision history for this message
Alex Kaluzhny (alex-kaluzhny) wrote :

I can reproduce this about 50% of the time with KRILIN01A-S15A_BQ_L100EN_2019_150209.
BT Headset: Rocketfish RF-MAB2
Car kit: Steamboat One MPOW.

The only way for user to recover from this and get audio back is to reboot the phone.
I can argue it has to be set to Critical, because it stops user from being able to make or receive calls.

Changed in barajas:
importance: High → Critical
Revision history for this message
Alex Kaluzhny (alex-kaluzhny) wrote :

One (a bit funny) observation, as a result of me accidentally forgetting to stop music player.
- Pair with BT car kit (Steamboat One MPOW)
- Play music using Music Player via BT
- turn-off BT car kit (cut the power by shutting down a car engine)
- Music will NOT be routed to the phone speaker. No sound was heard.
- make a phone call (surprisingly, this time audio was working fine).
- hang-up the call.
- music started playing via phone's speaker.
Produced twice.

Changed in barajas:
milestone: ww11-2015 → ww13-2015
Changed in barajas:
milestone: temp-placeholder → ww13-ota
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

The music issue described by comment #12 is known, and to be fixed in media-hub (need to find the bug number though).

Alex, the issue here is that the user the user is unable use the bt device for voice calls (HFP/HSP) after disabling/enabling it again (sounds like it's muted). Disabling bluetooth or disconnecting the device should be enough for the audio to go back to the phone (and a working aound).

Can you please explain better what is the exact issue you're having with your devices?

Jonathan, can you also reproduce this issue by disabling/enabling bt without doing voicecalls? Just to see if the sound (A2DP) is working every time you disconnect/connect your bt device.

Changed in barajas:
status: Confirmed → Incomplete
Changed in barajas:
milestone: ww13-ota → ww13-2015
Revision history for this message
John McAleely (john.mcaleely) wrote :

over to you joc, to comment on #13, and confirm on recent builds.

Note vivid target.

Changed in barajas:
assignee: Ricardo Salveti (rsalveti) → Jonathan Cave (jocave)
Revision history for this message
Jonathan Cave (jocave) wrote :

Don't seem to be able to reliably turn on/off bluetooth or other settings on vivid yet.

Revision history for this message
Noemí (noemi-gallego) wrote :

This has been reproduced too on Vegeta 5HD using artica headsets.

tags: added: bluetooth
Changed in barajas:
milestone: ww13-2015 → ww15-2015
Revision history for this message
Jonathan Cave (jocave) wrote :

Version: ubuntu-touch/devel-proposed/krillin.en r69 krillin

The phone call scenario from this description still applies on this version of vivid with my headset.

When playing back music and switch on and off bluetooth the music is rerouted back to the headset correctly. Hence, appears A2DP is being re-established but not HFP/HSP.

Changed in barajas:
assignee: Jonathan Cave (jocave) → Ricardo Salveti (rsalveti)
Changed in barajas:
milestone: ww18-2015 → ww22-2015
Revision history for this message
John McAleely (john.mcaleely) wrote :

@rsalveti, has this been addressed in any recent changes, do you think?

Revision history for this message
Jonathan Cave (jocave) wrote :

Version: ubuntu-touch/rc/bq-aquaris.en r1 vegetahd

Tested again with my Sony headset and still behaving as per the description. A2DP switching on/off working ok.

Revision history for this message
Alex Kaluzhny (alex-kaluzhny) wrote :

Tested with BT Headset: Rocketfish RF-MAB2
Version: ubuntu-touch/rc/bq-aquaris.en r9 Krillin (vivid)
- Pair krillin to BT Headset.
- Make a phone call.
- confirmed audio worked via BT headset.
- Turn BT headset phone off
- Audio was switched to phone's speaker / microphone.
- Turned BT Headset on.
- Audio was switched to BT headset.
- Repeated 6 times.
I got a mixed result using HFP/HSP. It worked well about 50% of the time.
It could switch back in forth about 3-4 cycles and then may fail.

Revision history for this message
Alex Kaluzhny (alex-kaluzhny) wrote :

Correction to comment#20:
Version: ubuntu-touch/rc-proposed/bq-aquaris.en r9

Revision history for this message
Alex Kaluzhny (alex-kaluzhny) wrote :

Version: ubuntu-touch/rc-proposed/bq-aquaris.en r10
Repeated test following exact sequence of steps as in bug description:
 * Pair krillin with BT Headset (Rocketfish RF-MAB2)
 * Call the handset
 * Answer call
 * Check headset input/output
 * Disable Bluetooth on the krillin
 * Audio routed to phone speaker/mic
Confirmed that this worked: Audio was routed to phone speaker/mic
However, audio was not routed to BT Headset when Bluetooth was re-enabled in Settings.

Revision history for this message
Jonathan Cave (jocave) wrote :

@Alex this is exactly as per the bug description

Changed in barajas:
status: Incomplete → Confirmed
importance: Critical → High
milestone: ww22-2015 → ww24-2015
Changed in barajas:
assignee: Ricardo Salveti (rsalveti) → John McAleely (john.mcaleely)
Changed in barajas:
milestone: ww28-2015 → none
Revision history for this message
Noemí (noemi-gallego) wrote :

Any update?

Revision history for this message
John McAleely (john.mcaleely) wrote :

Same as for other BT bugs - we hope to have resources on this soon.

Simon Fels (morphis)
Changed in barajas:
assignee: John McAleely (john.mcaleely) → Simon Busch (morphis)
Revision history for this message
Simon Fels (morphis) wrote :

Couldn't reproduce this yet with my Loco bluetooth headset by following the steps Alex has written down in comment #22

@Alex, @John: Would it be possible that you reproduce this with bluetooth relevant logging enabled and attach /var/log/syslog here? You will find the necessary steps here https://wiki.ubuntu.com/Process/Merges/TestPlan/ubuntu-system-settings#Bluetooth-1

Revision history for this message
Simon Fels (morphis) wrote :
Download full text (4.2 KiB)

I tested with an NGS Artica Pro Foldable headset today and experience some behavior which seems to be what people are reporting here. I followed the steps Alex reported in comment #22.

From the logs I recored it looks a bit like an ongoing service discovery comes in between an disconnects the headset (which starts as soon as the settings app is open):

Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: message repeated 9 times: [ audio/telephony.c:handle_network_property_changed() in handle_registration_property_changed(), the property is Strength]
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: plugins/mgmtops.c:mgmt_set_discoverable() index 0 discoverable 1 timeout 180
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: src/adapter.c:set_mode() discoverable
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: src/adapter.c:session_ref() 0xb8271d48: ref=1
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: plugins/mgmtops.c:mgmt_event() cond 1
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: plugins/mgmtops.c:mgmt_event() Received 13 bytes from management socket
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: plugins/mgmtops.c:mgmt_cmd_complete()
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: plugins/mgmtops.c:mgmt_new_settings() hci0 new settings
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: src/adapter.c:adapter_mode_changed() old 0x00 new 0x03
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: src/adapter.c:set_mode_complete()
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: src/adapter.c:set_mode_complete() discoverable
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: src/adapter.c:session_unref() 0xb8271d48: ref=0
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: src/adapter.c:register_agent() Agent registered for hci0 at :1.128:/com/canonical/SettingsBluetoothAgent/adapteragent

Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: plugins/mgmtops.c:mgmt_set_io_capability() hci0 io_capability 0x01
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: plugins/mgmtops.c:mgmt_event() cond 1
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: plugins/mgmtops.c:mgmt_event() Received 9 bytes from management socket
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: plugins/mgmtops.c:mgmt_cmd_complete()
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: plugins/mgmtops.c:mgmt_cmd_complete() set_io_capability complete
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: src/device.c:btd_device_ref() 0xb826cc18: ref=4
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: src/device.c:device_remove_drivers() Removing drivers for 26:03:01:00:02:00
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: src/device.c:device_remove_drivers() UUID 0000111e-0000-1000-8000-00805f9b34fb was removed from device 26:03:01:00:02:00
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: audio/unix.c:unix_device_removed() unix_device_removed(0xb82778d0)
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: audio/headset.c:path_unregister() Headset unregistered while device was connected!
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: audio/telephony.c:telephony_device_disconnected() telephony-ofono: device 0xb82778d0 disconnected
Aug 5 08:47:26 ubuntu-phablet bluetoothd[875]: audio/headset.c:headset_set_state() State changed /o...

Read more...

Revision history for this message
Simon Fels (morphis) wrote :

The problem we have here is that one side needs to initiate the connection to the other side. When disabling/enabling bluetooth BlueZ doesn't seem to do this on its own until it sees the device with a discovery run. The Headset might try this on it's own too but that depends a lot on the type of headset used.

Revision history for this message
Simon Fels (morphis) wrote :

Another case to reproduce this problem is this:

1. Pair headset with the device
- That will create the bonding between both and directly connect the headset on Audio/Headset profiles.
2. Leave settings app and close it
3. Turn off headset
- Make sure it isn't connected anymore by running
  $ /usr/bin/bluez-list-devices
4. Enable headset again and verify with
  $ /usr/bin/bluez-list-devices
    that it got connected again
5. Verify with
  $ gdbus call -y -d org.bluez -o /org/bluez/861/hci0/dev_26_03_01_00_02_00 -m org.bluez.Headset.GetProperties
    and
  $ gdbus call -y -d org.bluez -o /org/bluez/861/hci0/dev_26_03_01_00_02_00 -m org.bluez.Audio.GetProperties
   that the headset isn't connected on both profiles.
5. Call the phone from another phone and accept the call.

The dialer-app now automatically shows the button to switch to bluetooth headset but both profiles get never connected due to this again.

Revision history for this message
Julia Palandri (julia-palandri) wrote :

@noemi are you still able to repro this one?

Revision history for this message
Konrad Zapałowicz (kzapalowicz) wrote :

Tested with krillin (r351) and Sony SBG52 headset. I can confirm that once the headset is reconnected [after bt off/on combo] the audio input/output are completely wrong on krillin.

information type: Embargoed → Proprietary
Revision history for this message
Julia Palandri (julia-palandri) wrote :

@konrad, can you please list steps to reproduce so I test on turbo? Thanks

Revision history for this message
Konrad Zapałowicz (kzapalowicz) wrote :

@Julia:

This is how I tested this:

Steps to reproduce:
 * Pair krillin with BT Headset
 * Make an incoming call
 * Answer call
 * Disable Bluetooth on the krillin
 * Audio routed to phone speaker/mic
 * Re-enable Bluetooth

Revision history for this message
Julia Palandri (julia-palandri) wrote :

Ok, I can confirm audio doesn't get routed back to BT in turbo w/ image r104

information type: Proprietary → Embargoed
information type: Embargoed → Proprietary
affects: barajas → avila-private
affects: avila-private → avila
information type: Proprietary → Public
no longer affects: avila
Changed in canonical-devices-system-image:
assignee: nobody → John McAleely (john.mcaleely)
status: New → Confirmed
Changed in canonical-devices-system-image:
assignee: John McAleely (john.mcaleely) → nobody
tags: added: bluez-touch
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Ubuntu Touch is no longer supported.

Changed in bluez (Ubuntu):
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.