From: João Paulo Rechi Vita <[email protected]>

---
 src/modules/bluetooth/backend-ofono.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/modules/bluetooth/backend-ofono.c 
b/src/modules/bluetooth/backend-ofono.c
index 1ba40b1..8b2cea2 100644
--- a/src/modules/bluetooth/backend-ofono.c
+++ b/src/modules/bluetooth/backend-ofono.c
@@ -188,6 +188,22 @@ static int 
hf_audio_agent_transport_acquire(pa_bluetooth_transport *t, bool opti
 }
 
 static void hf_audio_agent_transport_release(pa_bluetooth_transport *t) {
+    struct hf_audio_card *card = t->userdata;
+
+    pa_assert(card);
+
+    if (t->state <= PA_BLUETOOTH_TRANSPORT_STATE_IDLE) {
+        pa_log_info("Transport %s already released", t->path);
+        return;
+    }
+
+    if (card->fd < 0)
+        return;
+
+    /* shutdown to make sure connection is dropped immediately */
+    shutdown(card->fd, SHUT_RDWR);
+    close(card->fd);
+    card->fd = -1;
 }
 
 static void hf_audio_agent_card_found(pa_bluetooth_backend *backend, const 
char *path, DBusMessageIter *props_i) {
-- 
1.9.3

_______________________________________________
pulseaudio-discuss mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to