base-modem: new fallback when matching QMI vs data ports
If no matching found, but there is only one QMI port and only one data port, assume that is already a valid match.
This commit is contained in:
@@ -655,6 +655,17 @@ mm_base_modem_peek_port_qmi_for_data (MMBaseModem *self,
|
||||
g_object_unref (client);
|
||||
|
||||
if (!found) {
|
||||
/* For the case where we have only 1 data port and 1 QMI port and they
|
||||
* don't match with the previous rules (e.g. in some Huawei modems),
|
||||
* just return the found one */
|
||||
if (g_list_length (self->priv->data) == 1 &&
|
||||
g_list_length (self->priv->qmi) == 1 &&
|
||||
self->priv->data->data == data) {
|
||||
mm_info ("Assuming QMI port '%s' is associated to net/%s",
|
||||
mm_port_get_device (MM_PORT (self->priv->qmi->data)),
|
||||
mm_port_get_device (data));
|
||||
found = MM_QMI_PORT (self->priv->qmi->data);
|
||||
} else {
|
||||
g_set_error (error,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_NOT_FOUND,
|
||||
@@ -662,6 +673,7 @@ mm_base_modem_peek_port_qmi_for_data (MMBaseModem *self,
|
||||
mm_port_get_device (data));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
Reference in New Issue
Block a user