summaryrefslogtreecommitdiff
path: root/src/modules/bluetooth/backend-ofono.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2017-05-04 13:12:59 +0200
committerGeorg Chini <georg@chini.tk>2017-05-04 13:14:06 +0200
commitf44f2996b4ca3d8dc3b9b8362825aff5a225c221 (patch)
tree97931981005ccb8a4d92118fe383b2ee6d16603a /src/modules/bluetooth/backend-ofono.c
parent826bb358cc818e5687c266becf68d72fb56d08c9 (diff)
downloadpulseaudio-f44f2996b4ca3d8dc3b9b8362825aff5a225c221.tar.gz
bluetooth: ofono: Fix failing to parse valid NewConnection
When suspending due to idle timeout the transport will not change its state, also in case the fd is closed due to POLLERR/POLLHUP events the release shall check if the fd is still set otherwise it will fail to be acquired again.
Diffstat (limited to 'src/modules/bluetooth/backend-ofono.c')
-rw-r--r--src/modules/bluetooth/backend-ofono.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/modules/bluetooth/backend-ofono.c b/src/modules/bluetooth/backend-ofono.c
index c8109d9f9..c39c6ce2e 100644
--- a/src/modules/bluetooth/backend-ofono.c
+++ b/src/modules/bluetooth/backend-ofono.c
@@ -201,14 +201,11 @@ static void hf_audio_agent_transport_release(pa_bluetooth_transport *t) {
pa_assert(card);
- if (t->state <= PA_BLUETOOTH_TRANSPORT_STATE_IDLE) {
+ if (card->fd < 0) {
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);
@@ -546,7 +543,7 @@ static DBusMessage *hf_audio_agent_new_connection(DBusConnection *c, DBusMessage
card->connecting = false;
- if (!card || codec != HFP_AUDIO_CODEC_CVSD || card->transport->state == PA_BLUETOOTH_TRANSPORT_STATE_PLAYING) {
+ if (!card || codec != HFP_AUDIO_CODEC_CVSD || card->fd >= 0) {
pa_log_warn("New audio connection invalid arguments (path=%s fd=%d, codec=%d)", path, fd, codec);
pa_assert_se(r = dbus_message_new_error(m, "org.ofono.Error.InvalidArguments", "Invalid arguments in method call"));
shutdown(fd, SHUT_RDWR);