diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-07-21 18:07:22 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-08-06 20:07:27 +0200 |
commit | edc9825788bc12d03add9b6fdf83ae2f55886c34 (patch) | |
tree | 0b3e1fd73620bf6a9e53bed023816121bf07f779 /src | |
parent | 0b3eb27856462e232f54762a3ba496bf36e25775 (diff) |
plugin: let plugins request Icera support checks and Icera based filters
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-plugin.c | 69 | ||||
-rw-r--r-- | src/mm-plugin.h | 3 |
2 files changed, 72 insertions, 0 deletions
diff --git a/src/mm-plugin.c b/src/mm-plugin.c index 0e576569..0d7b4fc0 100644 --- a/src/mm-plugin.c +++ b/src/mm-plugin.c @@ -61,6 +61,9 @@ struct _MMPluginPrivate { gboolean at; gboolean single_at; gboolean qcdm; + gboolean icera_probe; + gboolean allowed_icera; + gboolean forbidden_icera; MMPortProbeAtCommand *custom_at_probe; MMAsyncMethod *custom_init; guint64 send_delay; @@ -80,6 +83,9 @@ enum { PROP_ALLOWED_AT, PROP_ALLOWED_SINGLE_AT, PROP_ALLOWED_QCDM, + PROP_ICERA_PROBE, + PROP_ALLOWED_ICERA, + PROP_FORBIDDEN_ICERA, PROP_CUSTOM_AT_PROBE, PROP_CUSTOM_INIT, PROP_SEND_DELAY, @@ -372,6 +378,22 @@ apply_post_probing_filters (MMPlugin *self, return product_filtered; } + /* The plugin may specify that only Icera-based modems are supported. + * If that is the case, filter by allowed Icera support */ + if (self->priv->allowed_icera && + !mm_port_probe_is_icera (probe)) { + /* Unsupported! */ + return TRUE; + } + + /* The plugin may specify that Icera-based modems are NOT supported. + * If that is the case, filter by forbidden Icera support */ + if (self->priv->forbidden_icera && + mm_port_probe_is_icera (probe)) { + /* Unsupported! */ + return TRUE; + } + return FALSE; } @@ -542,6 +564,8 @@ mm_plugin_supports_port (MMPlugin *self, probe_run_flags |= (MM_PORT_PROBE_AT | MM_PORT_PROBE_AT_PRODUCT); if (self->priv->qcdm) probe_run_flags |= MM_PORT_PROBE_QCDM; + if (self->priv->icera_probe || self->priv->allowed_icera || self->priv->forbidden_icera) + probe_run_flags |= (MM_PORT_PROBE_AT | MM_PORT_PROBE_AT_ICERA); g_assert (probe_run_flags != MM_PORT_PROBE_NONE); @@ -714,6 +738,18 @@ set_property (GObject *object, /* Construct only */ self->priv->qcdm = g_value_get_boolean (value); break; + case PROP_ICERA_PROBE: + /* Construct only */ + self->priv->icera_probe = g_value_get_boolean (value); + break; + case PROP_ALLOWED_ICERA: + /* Construct only */ + self->priv->allowed_icera = g_value_get_boolean (value); + break; + case PROP_FORBIDDEN_ICERA: + /* Construct only */ + self->priv->forbidden_icera = g_value_get_boolean (value); + break; case PROP_CUSTOM_AT_PROBE: /* Construct only */ self->priv->custom_at_probe = g_value_dup_boxed (value); @@ -777,6 +813,15 @@ get_property (GObject *object, case PROP_ALLOWED_UDEV_TAGS: g_value_set_boxed (value, self->priv->udev_tags); break; + case PROP_ICERA_PROBE: + g_value_set_boolean (value, self->priv->icera_probe); + break; + case PROP_ALLOWED_ICERA: + g_value_set_boolean (value, self->priv->allowed_icera); + break; + case PROP_FORBIDDEN_ICERA: + g_value_set_boolean (value, self->priv->forbidden_icera); + break; case PROP_CUSTOM_AT_PROBE: g_value_set_boxed (value, self->priv->custom_at_probe); break; @@ -920,6 +965,30 @@ mm_plugin_class_init (MMPluginClass *klass) 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", + "Request to probe for Icera support.", + FALSE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property + (object_class, PROP_ALLOWED_ICERA, + g_param_spec_boolean (MM_PLUGIN_ALLOWED_ICERA, + "Allowed Icera", + "Whether Icera support is allowed in this plugin.", + FALSE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property + (object_class, PROP_FORBIDDEN_ICERA, + g_param_spec_boolean (MM_PLUGIN_FORBIDDEN_ICERA, + "Allowed Icera", + "Whether Icera support is forbidden in this plugin.", + FALSE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property (object_class, PROP_CUSTOM_AT_PROBE, g_param_spec_boxed (MM_PLUGIN_CUSTOM_AT_PROBE, "Custom AT Probe", diff --git a/src/mm-plugin.h b/src/mm-plugin.h index 4af0f14a..32f849e7 100644 --- a/src/mm-plugin.h +++ b/src/mm-plugin.h @@ -50,6 +50,9 @@ #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_ICERA_PROBE "icera-probe" +#define MM_PLUGIN_ALLOWED_ICERA "allowed-icera" +#define MM_PLUGIN_FORBIDDEN_ICERA "forbidden-icera" #define MM_PLUGIN_CUSTOM_INIT "custom-init" #define MM_PLUGIN_CUSTOM_AT_PROBE "custom-at-probe" #define MM_PLUGIN_SEND_DELAY "send-delay" |