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:
Aleksander Morgado
2012-10-09 16:29:37 +02:00
parent f1bcc531a3
commit caefbcfbd9

View File

@@ -655,12 +655,24 @@ mm_base_modem_peek_port_qmi_for_data (MMBaseModem *self,
g_object_unref (client); g_object_unref (client);
if (!found) { if (!found) {
g_set_error (error, /* For the case where we have only 1 data port and 1 QMI port and they
MM_CORE_ERROR, * don't match with the previous rules (e.g. in some Huawei modems),
MM_CORE_ERROR_NOT_FOUND, * just return the found one */
"Couldn't find associated QMI port for 'net/%s'", 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)); mm_port_get_device (data));
return NULL; found = MM_QMI_PORT (self->priv->qmi->data);
} else {
g_set_error (error,
MM_CORE_ERROR,
MM_CORE_ERROR_NOT_FOUND,
"Couldn't find associated QMI port for 'net/%s'",
mm_port_get_device (data));
return NULL;
}
} }
return found; return found;