From f1daa282f030e4e2381341e0f65faca47c4b891b Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Thu, 19 Mar 2009 16:55:14 +0200 Subject: bluetooth: mark info_valid when receive Connected Sometime, we receive the connected signal before GetProperties reply. --- src/modules/bluetooth/bluetooth-util.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/modules/bluetooth/bluetooth-util.c') diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c index 9e30f89a..5213ad65 100644 --- a/src/modules/bluetooth/bluetooth-util.c +++ b/src/modules/bluetooth/bluetooth-util.c @@ -653,10 +653,12 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us } else if (dbus_message_has_interface(m, "org.bluez.Headset")) { if (parse_audio_property(y, &d->headset_connected, &arg_i) < 0) goto fail; + d->headset_info_valid = 1; } else if (dbus_message_has_interface(m, "org.bluez.AudioSink")) { if (parse_audio_property(y, &d->audio_sink_connected, &arg_i) < 0) goto fail; + d->audio_sink_info_valid = 1; } pa_assert_se(y->mode == MODE_DISCOVER); -- cgit From e83621724d7939b97b4f01f0d7e965d61ef8e55e Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Thu, 19 Mar 2009 16:48:31 +0200 Subject: bluetooth: rework the info_valid logic to be more tolerant --- src/modules/bluetooth/bluetooth-util.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/modules/bluetooth/bluetooth-util.c') diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c index 5213ad65..912697e6 100644 --- a/src/modules/bluetooth/bluetooth-util.c +++ b/src/modules/bluetooth/bluetooth-util.c @@ -114,15 +114,14 @@ void pa_bluetooth_device_free(pa_bluetooth_device *d) { static pa_bool_t device_is_loaded(pa_bluetooth_device *d) { pa_assert(d); - return d->device_info_valid && d->audio_sink_info_valid && d->headset_info_valid; + return d->device_info_valid && (d->audio_sink_info_valid || d->headset_info_valid); } static pa_bool_t device_is_audio(pa_bluetooth_device *d) { pa_assert(d); pa_assert(d->device_info_valid); - pa_assert(d->audio_sink_info_valid); - pa_assert(d->headset_info_valid); + pa_assert(d->audio_sink_info_valid || d->headset_info_valid); return d->device_info_valid > 0 && (d->audio_sink_info_valid > 0 || d->headset_info_valid > 0); -- cgit