[pulseaudio-discuss] [PATCH] bluetooth: Check if BlueZ tries to set the configuration twice for the same transport.

Tanu Kaskinen tanuk at iki.fi
Wed Dec 5 20:51:04 PST 2012


---
 src/modules/bluetooth/bluetooth-util.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 0daf1c9..39c5c5e 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -1178,6 +1178,11 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
     if (!d)
         goto fail;
 
+    if (pa_hashmap_get(d->transports, path)) {
+        pa_log("org.bluez.MediaEndpoint.SetConfiguration: Device %s already has transport %s.", d->path, path);
+        goto fail;
+    }
+
     if (dbus_message_has_path(m, HFP_AG_ENDPOINT))
         p = PROFILE_HSP;
     else if (dbus_message_has_path(m, HFP_HS_ENDPOINT))
@@ -1192,7 +1197,7 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
     t = transport_new(d, sender, path, p, config, size);
     if (nrec)
         t->nrec = nrec;
-    pa_hashmap_put(d->transports, t->path, t);
+    pa_assert_se(pa_hashmap_put(d->transports, t->path, t) >= 0);
 
     pa_log_debug("Transport %s profile %d available", t->path, t->profile);
 
-- 
1.7.10.4



More information about the pulseaudio-discuss mailing list