[pulseaudio-commits] src/modules

Tanu Kaskinen tanuk at kemper.freedesktop.org
Thu Oct 25 03:22:53 PDT 2012


 src/modules/bluetooth/bluetooth-util.c |    8 ++++++++
 src/modules/bluetooth/bluetooth-util.h |    1 +
 2 files changed, 9 insertions(+)

New commits:
commit d0be10191ef492d13b014b9cf2ffad054cd034bf
Author: Mikel Astiz <mikel.astiz at bmw-carit.de>
Date:   Tue Oct 23 16:41:59 2012 +0200

    bluetooth: Add hook to announce late UUIDs
    
    UUIDs might be announced at any time, so a hook is needed to notify any
    interested module. In practice, the UUIDs are quite stable with the
    exception of the pairing procedure, where the UUIDs are reported by
    BlueZ as soon as they are discovered.

diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 1e81864..272b6ce 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -383,9 +383,17 @@ static int parse_device_property(pa_bluetooth_discovery *y, pa_bluetooth_device
                     const char *value;
 
                     dbus_message_iter_get_basic(&ai, &value);
+
+                    if (pa_bluetooth_uuid_has(d->uuids, value)) {
+                        dbus_message_iter_next(&ai);
+                        continue;
+                    }
+
                     node = uuid_new(value);
                     PA_LLIST_PREPEND(pa_bluetooth_uuid, d->uuids, node);
 
+                    pa_hook_fire(&d->hooks[PA_BLUETOOTH_DEVICE_HOOK_UUID_ADDED], (char *) value);
+
                     /* Vudentz said the interfaces are here when the UUIDs are announced */
                     if (strcasecmp(HSP_AG_UUID, value) == 0 || strcasecmp(HFP_AG_UUID, value) == 0) {
                         pa_assert_se(m = dbus_message_new_method_call("org.bluez", d->path, "org.bluez.HandsfreeGateway", "GetProperties"));
diff --git a/src/modules/bluetooth/bluetooth-util.h b/src/modules/bluetooth/bluetooth-util.h
index 4e3b5f0..8a3f2ad 100644
--- a/src/modules/bluetooth/bluetooth-util.h
+++ b/src/modules/bluetooth/bluetooth-util.h
@@ -94,6 +94,7 @@ typedef enum pa_bt_audio_state {
 /* Hook data: pa_bluetooth_device pointer. */
 typedef enum pa_bluetooth_device_hook {
     PA_BLUETOOTH_DEVICE_HOOK_REMOVED, /* Call data: NULL. */
+    PA_BLUETOOTH_DEVICE_HOOK_UUID_ADDED, /* Call data: const char *uuid. */
     PA_BLUETOOTH_DEVICE_HOOK_MAX
 } pa_bluetooth_device_hook_t;
 



More information about the pulseaudio-commits mailing list