Blob Blame History Raw
From fb4643c28261be83afe8f5095fc4f7003615d41f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?= <jprvita@openbossa.org>
Date: Wed, 17 Sep 2014 13:04:59 +0300
Subject: [PATCH 24/31] bluetooth: Switch transport state to idle in case of
 HUP

In case the socket HUP the transport state should be set to idle which
will indicate the profile is no longer available.
---
 src/modules/bluetooth/module-bluez5-device.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c
index fdf4078..48e498b 100644
--- a/src/modules/bluetooth/module-bluez5-device.c
+++ b/src/modules/bluetooth/module-bluez5-device.c
@@ -1980,6 +1980,7 @@ static pa_hook_result_t transport_state_changed_cb(pa_bluetooth_discovery *y, pa
 /* Run from main thread context */
 static int device_process_msg(pa_msgobject *obj, int code, void *data, int64_t offset, pa_memchunk *chunk) {
     struct bluetooth_msg *m = BLUETOOTH_MSG(obj);
+    struct userdata *u = m->card->userdata;
 
     switch (code) {
         case BLUETOOTH_MESSAGE_IO_THREAD_FAILED:
@@ -1990,6 +1991,7 @@ static int device_process_msg(pa_msgobject *obj, int code, void *data, int64_t o
             pa_assert_se(pa_card_set_profile(m->card, pa_hashmap_get(m->card->profiles, "off"), false) >= 0);
             break;
         case BLUETOOTH_MESSAGE_STREAM_FD_HUP:
+            pa_bluetooth_transport_set_state(u->transport, PA_BLUETOOTH_TRANSPORT_STATE_IDLE);
             break;
     }
 
-- 
1.9.3