summaryrefslogtreecommitdiffstats
path: root/src/modules/bluetooth/bluetooth-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/bluetooth/bluetooth-util.c')
-rw-r--r--src/modules/bluetooth/bluetooth-util.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index dfd3a306..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);
@@ -604,7 +603,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
pa_bluetooth_device_free(d);
}
- return DBUS_HANDLER_RESULT_HANDLED;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} else if (dbus_message_is_signal(m, "org.bluez.Adapter", "DeviceCreated")) {
const char *path;
@@ -617,7 +616,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
pa_log_debug("Device %s created", path);
found_device(y, path);
- return DBUS_HANDLER_RESULT_HANDLED;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} else if (dbus_message_is_signal(m, "org.bluez.Manager", "AdapterAdded")) {
const char *path;
@@ -630,7 +629,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
pa_log_debug("Adapter %s created", path);
found_adapter(y, path);
- return DBUS_HANDLER_RESULT_HANDLED;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} else if (dbus_message_is_signal(m, "org.bluez.Headset", "PropertyChanged") ||
dbus_message_is_signal(m, "org.bluez.AudioSink", "PropertyChanged") ||
@@ -653,17 +652,19 @@ 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);
run_callback(y, d, TRUE);
}
- return DBUS_HANDLER_RESULT_HANDLED;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
fail: