diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2013-03-27 17:00:08 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2013-03-28 17:33:08 +0100 |
commit | d6ac6508d95aeab49f7ed9a5fe225c7685107f73 (patch) | |
tree | 378e56357682db454fef373e12bf80fe51d6a7cc /src | |
parent | b76dc134bf6bed78c0a83fdc12d2e1f66821148c (diff) |
plugin: explicitly request QMI probing
Plugins which may support QMI ports need to explicitly request QMI probing
in cdc-wdm devices. This should also avoid probing cdc-wdm ports when we know
that the plugin doesn't support them (e.g. with Ericsson MBM devices).
https://bugzilla.gnome.org/show_bug.cgi?id=696701
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-plugin.c | 29 | ||||
-rw-r--r-- | src/mm-plugin.h | 1 |
2 files changed, 28 insertions, 2 deletions
diff --git a/src/mm-plugin.c b/src/mm-plugin.c index 55bee783..4b1ae8b0 100644 --- a/src/mm-plugin.c +++ b/src/mm-plugin.c @@ -76,6 +76,7 @@ struct _MMPluginPrivate { gboolean at; gboolean single_at; gboolean qcdm; + gboolean qmi; gboolean icera_probe; MMPortProbeAtCommand *custom_at_probe; guint64 send_delay; @@ -103,6 +104,7 @@ enum { PROP_ALLOWED_AT, PROP_ALLOWED_SINGLE_AT, PROP_ALLOWED_QCDM, + PROP_ALLOWED_QMI, PROP_ICERA_PROBE, PROP_ALLOWED_ICERA, PROP_FORBIDDEN_ICERA, @@ -703,10 +705,18 @@ mm_plugin_supports_port (MMPlugin *self, probe_run_flags |= (MM_PORT_PROBE_AT | MM_PORT_PROBE_AT_ICERA); } else { /* cdc-wdm ports... */ - probe_run_flags = MM_PORT_PROBE_QMI; + probe_run_flags = self->priv->qmi ? MM_PORT_PROBE_QMI : MM_PORT_PROBE_NONE; } - g_assert (probe_run_flags != MM_PORT_PROBE_NONE); + /* If no explicit probing was required, just request to grab it without probing anything. + * This may happen, e.g. with cdc-wdm ports which do not need QMI probing. */ + if (probe_run_flags == MM_PORT_PROBE_NONE) { + g_simple_async_result_set_op_res_gpointer (async_result, + GUINT_TO_POINTER (MM_PLUGIN_SUPPORTS_PORT_DEFER_UNTIL_SUGGESTED), + NULL); + g_simple_async_result_complete_in_idle (async_result); + goto out; + } /* If a modem is already available and the plugin says that only one AT port is * expected, check if we alredy got the single AT port. And if so, we know this @@ -945,6 +955,10 @@ set_property (GObject *object, /* Construct only */ self->priv->qcdm = g_value_get_boolean (value); break; + case PROP_ALLOWED_QMI: + /* Construct only */ + self->priv->qmi = g_value_get_boolean (value); + break; case PROP_ICERA_PROBE: /* Construct only */ self->priv->icera_probe = g_value_get_boolean (value); @@ -1027,6 +1041,9 @@ get_property (GObject *object, case PROP_ALLOWED_QCDM: g_value_set_boolean (value, self->priv->qcdm); break; + case PROP_ALLOWED_QMI: + g_value_set_boolean (value, self->priv->qmi); + break; case PROP_ALLOWED_UDEV_TAGS: g_value_set_boxed (value, self->priv->udev_tags); break; @@ -1219,6 +1236,14 @@ mm_plugin_class_init (MMPluginClass *klass) G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property + (object_class, PROP_ALLOWED_QMI, + g_param_spec_boolean (MM_PLUGIN_ALLOWED_QMI, + "Allowed QMI", + "Whether QMI ports are allowed in this plugin", + FALSE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property (object_class, PROP_ICERA_PROBE, g_param_spec_boolean (MM_PLUGIN_ICERA_PROBE, "Icera probe", diff --git a/src/mm-plugin.h b/src/mm-plugin.h index a423ceb0..37cac68d 100644 --- a/src/mm-plugin.h +++ b/src/mm-plugin.h @@ -52,6 +52,7 @@ #define MM_PLUGIN_ALLOWED_AT "allowed-at" #define MM_PLUGIN_ALLOWED_SINGLE_AT "allowed-single-at" #define MM_PLUGIN_ALLOWED_QCDM "allowed-qcdm" +#define MM_PLUGIN_ALLOWED_QMI "allowed-qmi" #define MM_PLUGIN_ICERA_PROBE "icera-probe" #define MM_PLUGIN_ALLOWED_ICERA "allowed-icera" #define MM_PLUGIN_FORBIDDEN_ICERA "forbidden-icera" |