[pulseaudio-discuss] [RFC next v5 00/11] bluetooth: BlueZ 5 development patches

Mikel Astiz mikel.astiz.oss at gmail.com
Fri May 10 01:30:41 PDT 2013


From: Mikel Astiz <mikel.astiz at bmw-carit.de>

Sending v5 with the following changes:
- Leaked D-Bus matches removed as pointed out by João Paulo.
- Several warning messages added as suggested by Tanu.
- Minor code refactoring in pa_bluetooth_transport_release().

Again, the last 5 patches are sent for completeness despite the general consensus not to merge them.

The patchset is very similar to v4 as you can see in the following diff:

diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index a7b146d..27af48a 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -1385,8 +1385,10 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
             if (pa_streq(interface, "org.bluez.Device1")) {
                 pa_bluetooth_device *d;
 
-                if ((d = pa_hashmap_remove(y->devices, path))) {
-                    pa_log_debug("Device %s removed", d->path);
+                if (!(d = pa_hashmap_remove(y->devices, path)))
+                    pa_log_warn("Unknown device removed %s", path);
+                else {
+                    pa_log_debug("Device %s removed", path);
                     run_callback(d, true);
                     device_free(d);
                 }
@@ -1416,8 +1418,10 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
         if (pa_streq(interface, "org.bluez.Device1")) {
             pa_bluetooth_device *d;
 
-            if (!(d = pa_hashmap_get(y->devices, dbus_message_get_path(m))))
-                return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; /* Device not being tracked */
+            if (!(d = pa_hashmap_get(y->devices, dbus_message_get_path(m)))) {
+                pa_log_warn("Property change in unknown device %s", dbus_message_get_path(m));
+                return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+            }
 
             parse_device_properties(d, &arg_i, true);
         } else if (pa_streq(interface, "org.bluez.MediaTransport1")) {
@@ -1586,11 +1590,14 @@ void pa_bluetooth_transport_release(pa_bluetooth_transport *t) {
 
         pa_assert_se(m = dbus_message_new_method_call(t->owner, t->path, "org.bluez.MediaTransport", "Release"));
         pa_assert_se(dbus_message_append_args(m, DBUS_TYPE_STRING, &accesstype, DBUS_TYPE_INVALID));
-    } else if (t->state <= PA_BLUETOOTH_TRANSPORT_STATE_IDLE) {
-        pa_log_info("Transport %s auto-released by BlueZ or already released", t->path);
-        return;
     } else {
         pa_assert(t->device->discovery->version == BLUEZ_VERSION_5);
+
+        if (t->state <= PA_BLUETOOTH_TRANSPORT_STATE_IDLE) {
+            pa_log_info("Transport %s auto-released by BlueZ or already released", t->path);
+            return;
+        }
+
         pa_assert_se(m = dbus_message_new_method_call(t->owner, t->path, "org.bluez.MediaTransport1", "Release"));
     }
 
@@ -2245,6 +2252,10 @@ void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y) {
             "type='signal',sender='org.bluez',interface='org.bluez.MediaTransport',member='PropertyChanged'",
             "type='signal',sender='org.bluez',interface='org.freedesktop.DBus.ObjectManager',member='InterfacesAdded'",
             "type='signal',sender='org.bluez',interface='org.freedesktop.DBus.ObjectManager',member='InterfacesRemoved'",
+            "type='signal',sender='org.bluez',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged'"
+            ",arg0='org.bluez.Device1'",
+            "type='signal',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged'"
+            ",arg0='org.bluez.MediaTransport1'",
             NULL);
 
         if (y->filter_added)

Mikel Astiz (10):
  bluetooth: Support ObjectManager interface add/remove
  bluetooth: Support Properties.PropertiesChanged signal
  bluetooth: Parse media transport's properties
  bluetooth: Support media transport's State property
  bluetooth: Update to new BlueZ 5 transport acquire/release API
  bluetooth: Support transport auto-release
  bluetooth: Register HSP/HFP endpoints in BlueZ 5 Media API
  bluetooth: Handle transports configured before UUID received
  bluetooth: Update to new property setter API in BlueZ 5
  bluetooth: Update to volume control in BlueZ 5

Vinicius Costa Gomes (1):
  bluetooth: Add HFP 1.6 codec ID

 src/modules/bluetooth/bluetooth-util.c          | 359 +++++++++++++++++++++---
 src/modules/bluetooth/module-bluetooth-device.c |   8 +-
 2 files changed, 327 insertions(+), 40 deletions(-)

-- 
1.8.1.4



More information about the pulseaudio-discuss mailing list