[pulseaudio-discuss] [PATCH v2 07/14] bluetooth: Implement transport release for hf_audio_agent transports
Luiz Augusto von Dentz
luiz.dentz at gmail.com
Wed Sep 10 02:48:30 PDT 2014
From: João Paulo Rechi Vita <jprvita at openbossa.org>
---
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
More information about the pulseaudio-discuss
mailing list