diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2014-07-27 13:55:10 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2014-07-27 13:55:10 +0200 |
commit | f203b1bf00f6dbf37d6fb11be869ecdfcd4f7397 (patch) | |
tree | d9f2628daaa079e04284cd75dd965468ed361b4f | |
parent | 0284daf87e8f0ba780a4dcbe4741713cb3c779eb (diff) |
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.
-rw-r--r-- | src/mm-plugin.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/mm-plugin.c b/src/mm-plugin.c index 1e9512af..cbdf06d0 100644 --- a/src/mm-plugin.c +++ b/src/mm-plugin.c @@ -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; |