bluez5: Do not suspend on no -> unknown profile transitions

In case a transport is currently disconnected and transitions to
idle, that should not count as a "remote hang up" event.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
David Henningsson 2014-12-19 10:24:47 +01:00
parent 6027cb52d9
commit de1e78a47c

View file

@ -1968,11 +1968,13 @@ static void handle_transport_state_change(struct userdata *u, struct pa_bluetoot
bool release = false; bool release = false;
pa_card_profile *cp; pa_card_profile *cp;
pa_device_port *port; pa_device_port *port;
pa_available_t oldavail;
pa_assert(u); pa_assert(u);
pa_assert(t); pa_assert(t);
pa_assert_se(cp = pa_hashmap_get(u->card->profiles, pa_bluetooth_profile_to_string(t->profile))); pa_assert_se(cp = pa_hashmap_get(u->card->profiles, pa_bluetooth_profile_to_string(t->profile)));
oldavail = cp->available;
pa_card_profile_set_available(cp, transport_state_to_availability(t->state)); pa_card_profile_set_available(cp, transport_state_to_availability(t->state));
/* Update port availability */ /* Update port availability */
@ -1983,7 +1985,7 @@ static void handle_transport_state_change(struct userdata *u, struct pa_bluetoot
/* Acquire or release transport as needed */ /* Acquire or release transport as needed */
acquire = (t->state == PA_BLUETOOTH_TRANSPORT_STATE_PLAYING && u->profile == t->profile); acquire = (t->state == PA_BLUETOOTH_TRANSPORT_STATE_PLAYING && u->profile == t->profile);
release = (t->state != PA_BLUETOOTH_TRANSPORT_STATE_PLAYING && u->profile == t->profile); release = (oldavail != PA_AVAILABLE_NO && t->state != PA_BLUETOOTH_TRANSPORT_STATE_PLAYING && u->profile == t->profile);
if (acquire && transport_acquire(u, true) >= 0) { if (acquire && transport_acquire(u, true) >= 0) {
if (u->source) { if (u->source) {