[RFC next v4 04/16] bluetooth: Support Properties.PropertiesChanged signal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Tanu,

On Thu, May 9, 2013 at 10:30 AM, Tanu Kaskinen <tanu.kaskinen at intel.com> wrote:
> On Mon, 2013-04-29 at 18:28 +0200, Mikel Astiz wrote:
>> From: Mikel Astiz <mikel.astiz at bmw-carit.de>
>>
>> Install matches for signal Properties.PropertiesChanged and process the
>> properties corresponding to the tracked devices.
>> ---
>>  src/modules/bluetooth/bluetooth-util.c | 29 +++++++++++++++++++++++++++++
>>  1 file changed, 29 insertions(+)
>>
>> diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
>> index c60f3ff..cd72ffd 100644
>> --- a/src/modules/bluetooth/bluetooth-util.c
>> +++ b/src/modules/bluetooth/bluetooth-util.c
>> @@ -1263,6 +1263,33 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
>>          }
>>
>>          return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
>> +    } else if (dbus_message_is_signal(m, "org.freedesktop.DBus.Properties", "PropertiesChanged")) {
>> +        DBusMessageIter arg_i;
>> +        const char *interface;
>> +
>> +        if (y->version != BLUEZ_VERSION_5)
>> +            return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; /* No reply received yet from GetManagedObjects */
>> +
>> +        if (!dbus_message_iter_init(m, &arg_i) || !pa_streq(dbus_message_get_signature(m), "sa{sv}as")) {
>> +            pa_log("Invalid signature found in PropertiesChanged");
>> +            goto fail;
>> +        }
>> +
>> +        dbus_message_iter_get_basic(&arg_i, &interface);
>> +
>> +        pa_assert_se(dbus_message_iter_next(&arg_i));
>> +        pa_assert(dbus_message_iter_get_arg_type(&arg_i) == DBUS_TYPE_ARRAY);
>> +
>> +        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 */
>
> Can it really happen that a device is not being tracked? If not, a
> warning or error should be logged.

Current approach should track all devices and mark device_info_valid
== -1 in case some inconsistency is found. I believe this error-case
is only possible if BlueZ is misbehaving or we have a bug in
PulseAudio, so a warning sounds fine to me.

Cheers,
Mikel


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux