mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-17 08:56:49 -05:00
bluez5: backend-native: Only use first modem found
Some device may have multiple modems, we should only used one, the first found and manage changes only for this one.
This commit is contained in:
parent
47700a2214
commit
c4addb102b
1 changed files with 28 additions and 7 deletions
|
|
@ -380,17 +380,27 @@ static DBusHandlerResult mm_parse_interfaces(struct impl *this, DBusMessageIter
|
||||||
dbus_message_iter_recurse(&iface_i, &props_i);
|
dbus_message_iter_recurse(&iface_i, &props_i);
|
||||||
|
|
||||||
if (spa_streq(interface, MM_DBUS_INTERFACE_MODEM)) {
|
if (spa_streq(interface, MM_DBUS_INTERFACE_MODEM)) {
|
||||||
this->modem.path = strdup(path);
|
|
||||||
spa_log_debug(this->log, "Found Modem interface %s, path %s", interface, path);
|
spa_log_debug(this->log, "Found Modem interface %s, path %s", interface, path);
|
||||||
|
if (this->modem.path == NULL) {
|
||||||
|
this->modem.path = strdup(path);
|
||||||
|
} else if (!spa_streq(this->modem.path, path)) {
|
||||||
|
spa_log_debug(this->log, "A modem is already registered");
|
||||||
|
goto next;
|
||||||
|
}
|
||||||
mm_parse_modem_properties(this, &props_i);
|
mm_parse_modem_properties(this, &props_i);
|
||||||
} else if (spa_streq(interface, MM_DBUS_INTERFACE_MODEM_MODEM3GPP)) {
|
} else if (spa_streq(interface, MM_DBUS_INTERFACE_MODEM_MODEM3GPP)) {
|
||||||
|
if (spa_streq(this->modem.path, path)) {
|
||||||
spa_log_debug(this->log, "Found Modem3GPP interface %s, path %s", interface, path);
|
spa_log_debug(this->log, "Found Modem3GPP interface %s, path %s", interface, path);
|
||||||
mm_parse_modem3gpp_properties(this, &props_i);
|
mm_parse_modem3gpp_properties(this, &props_i);
|
||||||
|
}
|
||||||
} else if (spa_streq(interface, MM_DBUS_INTERFACE_MODEM_VOICE)) {
|
} else if (spa_streq(interface, MM_DBUS_INTERFACE_MODEM_VOICE)) {
|
||||||
|
if (spa_streq(this->modem.path, path)) {
|
||||||
spa_log_debug(this->log, "Found Voice interface %s, path %s", interface, path);
|
spa_log_debug(this->log, "Found Voice interface %s, path %s", interface, path);
|
||||||
mm_parse_voice_properties(this, &props_i);
|
mm_parse_voice_properties(this, &props_i);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
next:
|
||||||
dbus_message_iter_next(&element_i);
|
dbus_message_iter_next(&element_i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -542,6 +552,9 @@ static DBusHandlerResult mm_filter_cb(DBusConnection *bus, DBusMessage *m, void
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_message_iter_get_basic(&arg_i, &path);
|
dbus_message_iter_get_basic(&arg_i, &path);
|
||||||
|
if (!spa_streq(this->modem.path, path))
|
||||||
|
goto finish;
|
||||||
|
|
||||||
dbus_message_iter_next(&arg_i);
|
dbus_message_iter_next(&arg_i);
|
||||||
dbus_message_iter_recurse(&arg_i, &element_i);
|
dbus_message_iter_recurse(&arg_i, &element_i);
|
||||||
|
|
||||||
|
|
@ -569,6 +582,10 @@ static DBusHandlerResult mm_filter_cb(DBusConnection *bus, DBusMessage *m, void
|
||||||
DBusMessageIter iface_i, props_i;
|
DBusMessageIter iface_i, props_i;
|
||||||
const char *interface;
|
const char *interface;
|
||||||
|
|
||||||
|
path = dbus_message_get_path(m);
|
||||||
|
if (!spa_streq(this->modem.path, path))
|
||||||
|
goto finish;
|
||||||
|
|
||||||
if (!dbus_message_iter_init(m, &iface_i) || !spa_streq(dbus_message_get_signature(m), "sa{sv}as")) {
|
if (!dbus_message_iter_init(m, &iface_i) || !spa_streq(dbus_message_get_signature(m), "sa{sv}as")) {
|
||||||
spa_log_error(this->log, "Invalid signature found in PropertiesChanged");
|
spa_log_error(this->log, "Invalid signature found in PropertiesChanged");
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
@ -580,8 +597,6 @@ static DBusHandlerResult mm_filter_cb(DBusConnection *bus, DBusMessage *m, void
|
||||||
|
|
||||||
dbus_message_iter_recurse(&iface_i, &props_i);
|
dbus_message_iter_recurse(&iface_i, &props_i);
|
||||||
|
|
||||||
path = dbus_message_get_path(m);
|
|
||||||
|
|
||||||
if (spa_streq(interface, MM_DBUS_INTERFACE_MODEM)) {
|
if (spa_streq(interface, MM_DBUS_INTERFACE_MODEM)) {
|
||||||
spa_log_debug(this->log, "Properties changed on %s", path);
|
spa_log_debug(this->log, "Properties changed on %s", path);
|
||||||
mm_parse_modem_properties(this, &props_i);
|
mm_parse_modem_properties(this, &props_i);
|
||||||
|
|
@ -598,6 +613,9 @@ static DBusHandlerResult mm_filter_cb(DBusConnection *bus, DBusMessage *m, void
|
||||||
struct call *call_object;
|
struct call *call_object;
|
||||||
const char *mm_call_interface = MM_DBUS_INTERFACE_CALL;
|
const char *mm_call_interface = MM_DBUS_INTERFACE_CALL;
|
||||||
|
|
||||||
|
if (!spa_streq(this->modem.path, dbus_message_get_path(m)))
|
||||||
|
goto finish;
|
||||||
|
|
||||||
if (!dbus_message_iter_init(m, &iface_i) || !spa_streq(dbus_message_get_signature(m), "o")) {
|
if (!dbus_message_iter_init(m, &iface_i) || !spa_streq(dbus_message_get_signature(m), "o")) {
|
||||||
spa_log_error(this->log, "Invalid signature found in %s", MM_MODEM_VOICE_SIGNAL_CALLADDED);
|
spa_log_error(this->log, "Invalid signature found in %s", MM_MODEM_VOICE_SIGNAL_CALLADDED);
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
@ -627,6 +645,9 @@ static DBusHandlerResult mm_filter_cb(DBusConnection *bus, DBusMessage *m, void
|
||||||
DBusMessageIter iface_i;
|
DBusMessageIter iface_i;
|
||||||
struct call *call, *call_tmp;
|
struct call *call, *call_tmp;
|
||||||
|
|
||||||
|
if (!spa_streq(this->modem.path, dbus_message_get_path(m)))
|
||||||
|
goto finish;
|
||||||
|
|
||||||
if (!dbus_message_iter_init(m, &iface_i) || !spa_streq(dbus_message_get_signature(m), "o")) {
|
if (!dbus_message_iter_init(m, &iface_i) || !spa_streq(dbus_message_get_signature(m), "o")) {
|
||||||
spa_log_error(this->log, "Invalid signature found in %s", MM_MODEM_VOICE_SIGNAL_CALLDELETED);
|
spa_log_error(this->log, "Invalid signature found in %s", MM_MODEM_VOICE_SIGNAL_CALLDELETED);
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue