mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
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.
This commit is contained in:
parent
956e72135e
commit
69c212f8c1
1 changed files with 7 additions and 1 deletions
|
|
@ -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)
|
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);
|
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);
|
handle_transport_state_change(u, t);
|
||||||
|
}
|
||||||
|
|
||||||
return PA_HOOK_OK;
|
return PA_HOOK_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue