diff options
author | João Paulo Rechi Vita <jprvita@openbossa.org> | 2014-09-10 11:48:30 +0200 |
---|---|---|
committer | Tanu Kaskinen <tanu.kaskinen@linux.intel.com> | 2014-09-11 14:00:15 +0300 |
commit | c4c4de532d3837fcc42a50536130a14ed48f5153 (patch) | |
tree | 8b564df6160a5f2fe6cbda1fb942a47eb260a8c3 | |
parent | 8dd4aa1f006b31ccee0bf17081e961ae86bb48c6 (diff) |
bluetooth: Implement transport release for hf_audio_agent transports
-rw-r--r-- | src/modules/bluetooth/backend-ofono.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/modules/bluetooth/backend-ofono.c b/src/modules/bluetooth/backend-ofono.c index 518e775db..bc92f4a08 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) { |