plugin: improve probing decision logic for QMI and MBIM

So, we may have modems with multiple /dev/cdc-wdm ports, like Ericsson modems,
where only 1 of them is MBIM. With the previous logic, we would probe all
/dev/cdc-wdm ports for MBIM as soon as one of the ports was handled by the
cdc_mbim driver. That is totally not optimal, as we are already know that they
are not MBIM (not handled by cdc_mbim).

Instead, fix the logic to just probe for MBIM or QMI if the actual driver
managing the port is MBIM or QMI.
This commit is contained in:
Aleksander Morgado
2014-07-27 13:55:10 +02:00
parent 0284daf87e
commit f203b1bf00

View File

@@ -632,21 +632,6 @@ mm_plugin_supports_port_finish (MMPlugin *self,
return (MMPluginSupportsResult) GPOINTER_TO_UINT (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (result)));
}
static gboolean
find_driver_in_device (MMDevice *device,
const gchar *driver)
{
const gchar **device_drivers;
guint i;
device_drivers = mm_device_get_drivers (device);
for (i = 0; device_drivers[i]; i++) {
if (g_str_equal (driver, device_drivers[i]))
return TRUE;
}
return FALSE;
}
void
mm_plugin_supports_port (MMPlugin *self,
MMDevice *device,
@@ -723,9 +708,9 @@ mm_plugin_supports_port (MMPlugin *self,
} else {
/* cdc-wdm ports... */
probe_run_flags = MM_PORT_PROBE_NONE;
if (self->priv->qmi && find_driver_in_device (device, "qmi_wwan"))
if (self->priv->qmi && g_str_equal (mm_device_utils_get_port_driver (port), "qmi_wwan"))
probe_run_flags |= MM_PORT_PROBE_QMI;
else if (self->priv->mbim && find_driver_in_device (device, "cdc_mbim"))
else if (self->priv->mbim && g_str_equal (mm_device_utils_get_port_driver (port), "cdc_mbim"))
probe_run_flags |= MM_PORT_PROBE_MBIM;
else
probe_run_flags |= MM_PORT_PROBE_AT;