plugin: limit cdc-wdm port probing types depending on the available drivers

We'll use the given device drivers as a hint of what we can or should probe.
This commit is contained in:
Aleksander Morgado
2013-04-07 19:51:49 +02:00
parent 00ec505e74
commit 6b379e525d

View File

@@ -628,6 +628,21 @@ 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))); 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 void
mm_plugin_supports_port (MMPlugin *self, mm_plugin_supports_port (MMPlugin *self,
MMDevice *device, MMDevice *device,
@@ -710,9 +725,9 @@ mm_plugin_supports_port (MMPlugin *self,
} else { } else {
/* cdc-wdm ports... */ /* cdc-wdm ports... */
probe_run_flags = MM_PORT_PROBE_NONE; probe_run_flags = MM_PORT_PROBE_NONE;
if (self->priv->qmi) if (self->priv->qmi && find_driver_in_device (device, "qmi_wwan"))
probe_run_flags |= MM_PORT_PROBE_QMI; probe_run_flags |= MM_PORT_PROBE_QMI;
if (self->priv->mbim) if (self->priv->mbim && find_driver_in_device (device, "cdc_mbim"))
probe_run_flags |= MM_PORT_PROBE_MBIM; probe_run_flags |= MM_PORT_PROBE_MBIM;
} }