mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
bluez5: fix connecting device with multiple adapters
This commit is contained in:
parent
cb8e627b1e
commit
389a125488
1 changed files with 11 additions and 5 deletions
|
|
@ -1630,15 +1630,18 @@ static void interfaces_removed(struct spa_bt_monitor *monitor, DBusMessageIter *
|
||||||
|
|
||||||
dbus_message_iter_get_basic(&it, &interface_name);
|
dbus_message_iter_get_basic(&it, &interface_name);
|
||||||
|
|
||||||
|
spa_log_debug(monitor->log, "Found object %s, interface %s", object_path, interface_name);
|
||||||
|
|
||||||
if (strcmp(interface_name, BLUEZ_DEVICE_INTERFACE) == 0) {
|
if (strcmp(interface_name, BLUEZ_DEVICE_INTERFACE) == 0) {
|
||||||
struct spa_bt_device *d;
|
struct spa_bt_device *d;
|
||||||
spa_list_consume(d, &monitor->device_list, link)
|
d = spa_bt_device_find(monitor, object_path);
|
||||||
|
if (d != NULL)
|
||||||
device_free(d);
|
device_free(d);
|
||||||
} else if (strcmp(interface_name, BLUEZ_ADAPTER_INTERFACE) == 0) {
|
} else if (strcmp(interface_name, BLUEZ_ADAPTER_INTERFACE) == 0) {
|
||||||
struct spa_bt_adapter *a;
|
struct spa_bt_adapter *a;
|
||||||
spa_list_consume(a, &monitor->adapter_list, link) {
|
a = adapter_find(monitor, object_path);
|
||||||
|
if (a != NULL)
|
||||||
adapter_free(a);
|
adapter_free(a);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_message_iter_next(&it);
|
dbus_message_iter_next(&it);
|
||||||
|
|
@ -1682,6 +1685,8 @@ static void get_managed_objects_reply(DBusPendingCall *pending, void *user_data)
|
||||||
dbus_message_iter_next(&it[1]);
|
dbus_message_iter_next(&it[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
monitor->objects_listed = true;
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
dbus_message_unref(r);
|
dbus_message_unref(r);
|
||||||
dbus_pending_call_unref(pending);
|
dbus_pending_call_unref(pending);
|
||||||
|
|
@ -1778,6 +1783,9 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
|
||||||
DBusMessageIter it[2];
|
DBusMessageIter it[2];
|
||||||
const char *iface, *path;
|
const char *iface, *path;
|
||||||
|
|
||||||
|
if (!monitor->objects_listed)
|
||||||
|
goto finish;
|
||||||
|
|
||||||
if (!dbus_message_iter_init(m, &it[0]) ||
|
if (!dbus_message_iter_init(m, &it[0]) ||
|
||||||
strcmp(dbus_message_get_signature(m), "sa{sv}as") != 0) {
|
strcmp(dbus_message_get_signature(m), "sa{sv}as") != 0) {
|
||||||
spa_log_error(monitor->log, "Invalid signature found in PropertiesChanged");
|
spa_log_error(monitor->log, "Invalid signature found in PropertiesChanged");
|
||||||
|
|
@ -1897,8 +1905,6 @@ impl_device_add_listener(void *object, struct spa_hook *listener,
|
||||||
add_filters(this);
|
add_filters(this);
|
||||||
get_managed_objects(this);
|
get_managed_objects(this);
|
||||||
|
|
||||||
this->objects_listed = true;
|
|
||||||
|
|
||||||
if (this->backend_ofono)
|
if (this->backend_ofono)
|
||||||
backend_ofono_add_filters(this->backend_ofono);
|
backend_ofono_add_filters(this->backend_ofono);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue