diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2017-05-04 12:58:54 +0200 |
---|---|---|
committer | Georg Chini <georg@chini.tk> | 2017-05-04 12:59:48 +0200 |
commit | 69c212f8c13794f70899d1fe6baec1b6e3c92032 (patch) | |
tree | 831e73582a2a8ed6a7d8e9743af676a4cd98cf77 | |
parent | 956e72135e9ed67a010399761b379c23e81ec3ea (diff) | |
download | pulseaudio-69c212f8c13794f70899d1fe6baec1b6e3c92032.tar.gz |
bluetooth: Auto recover if profile is 'off'
This means something went wrong, which in case of ofono backend it is
probably due to the profile not connecting immediately, but it can be
safely restored in that case the transport is playing which means the
profile has recovered connectivity.
-rw-r--r-- | src/modules/bluetooth/module-bluez5-device.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c index a96da17d9..2f0ec9762 100644 --- a/src/modules/bluetooth/module-bluez5-device.c +++ b/src/modules/bluetooth/module-bluez5-device.c @@ -2060,8 +2060,14 @@ static pa_hook_result_t transport_state_changed_cb(pa_bluetooth_discovery *y, pa if (t == u->transport && t->state <= PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED) pa_assert_se(pa_card_set_profile(u->card, pa_hashmap_get(u->card->profiles, "off"), false) >= 0); - if (t->device == u->device) + if (t->device == u->device) { + /* Auto recover from errors causing the profile to be set to off */ + if (u->profile == PA_BLUETOOTH_PROFILE_OFF && t->state == PA_BLUETOOTH_TRANSPORT_STATE_PLAYING) { + pa_log_debug("Switching to profile %s", pa_bluetooth_profile_to_string(t->profile)); + pa_assert_se(pa_card_set_profile(u->card, pa_hashmap_get(u->card->profiles, pa_bluetooth_profile_to_string(t->profile)), false) >= 0); + } handle_transport_state_change(u, t); + } return PA_HOOK_OK; } |