summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2014-12-19 10:24:47 +0100
committerDavid Henningsson <david.henningsson@canonical.com>2014-12-19 11:50:28 +0100
commitde1e78a47cd13496c38f627d56944045a629053e (patch)
tree6f2652b76b81ea29c21be5411c99c93d28e438c2
parent6027cb52d9d0e0dd1fa6699a43fc7952f6ae4415 (diff)
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>
-rw-r--r--src/modules/bluetooth/module-bluez5-device.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c
index e6a8071d7..995e55004 100644
--- a/src/modules/bluetooth/module-bluez5-device.c
+++ b/src/modules/bluetooth/module-bluez5-device.c
@@ -1968,11 +1968,13 @@ static void handle_transport_state_change(struct userdata *u, struct pa_bluetoot
bool release = false;
pa_card_profile *cp;
pa_device_port *port;
+ pa_available_t oldavail;
pa_assert(u);
pa_assert(t);
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));
/* 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 = (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 (u->source) {