From 963eb873e10dd06b17363a08414c278d5e1ba7b3 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Sun, 18 Sep 2011 22:20:11 +0200 Subject: [PATCH] plugin-base: new 'allowed-udev-tags' property The plugins can set this property to filter support check requests by the availability of a given udev tag in the port. The value given to the property should be a NULL-terminated array of C strings, e.g.: const gchar *tags[] = { "ID_MM_X22X_TAGGED", NULL }; --- src/mm-plugin-base.c | 17 +++++++++++++++++ src/mm-plugin-base.h | 1 + 2 files changed, 18 insertions(+) diff --git a/src/mm-plugin-base.c b/src/mm-plugin-base.c index eb5d23ed..78cf9640 100644 --- a/src/mm-plugin-base.c +++ b/src/mm-plugin-base.c @@ -77,6 +77,7 @@ typedef struct { const guint16 *product_ids; const gchar **vendor_strings; const gchar **product_strings; + const gchar **udev_tags; gboolean qcdm; const MMPortProbeAtCommand *custom_init; guint64 send_delay; @@ -92,6 +93,7 @@ enum { PROP_ALLOWED_PRODUCT_IDS, PROP_ALLOWED_VENDOR_STRINGS, PROP_ALLOWED_PRODUCT_STRINGS, + PROP_ALLOWED_UDEV_TAGS, PROP_ALLOWED_QCDM, PROP_CUSTOM_INIT, PROP_SEND_DELAY, @@ -1597,6 +1599,10 @@ set_property (GObject *object, guint prop_id, /* Construct only */ priv->product_strings = (const gchar **)g_value_get_pointer (value); break; + case PROP_ALLOWED_UDEV_TAGS: + /* Construct only */ + priv->udev_tags = (const gchar **)g_value_get_pointer (value); + break; case PROP_ALLOWED_QCDM: /* Construct only */ priv->qcdm = g_value_get_boolean (value); @@ -1653,6 +1659,9 @@ get_property (GObject *object, guint prop_id, case PROP_ALLOWED_QCDM: g_value_set_boolean (value, priv->qcdm); break; + case PROP_ALLOWED_UDEV_TAGS: + g_value_set_pointer (value, (gpointer)priv->udev_tags); + break; case PROP_CUSTOM_INIT: g_value_set_pointer (value, (gpointer)priv->custom_init); break; @@ -1761,6 +1770,14 @@ mm_plugin_base_class_init (MMPluginBaseClass *klass) "should be an array of strings finished with 'NULL'", G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property + (object_class, PROP_ALLOWED_UDEV_TAGS, + g_param_spec_pointer (MM_PLUGIN_BASE_ALLOWED_UDEV_TAGS, + "Allowed Udev tags", + "List of udev tags this plugin may expect, " + "should be an array of strings finished with 'NULL'", + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (object_class, PROP_ALLOWED_QCDM, g_param_spec_boolean (MM_PLUGIN_BASE_ALLOWED_QCDM, diff --git a/src/mm-plugin-base.h b/src/mm-plugin-base.h index 2b9e2f45..82adb643 100644 --- a/src/mm-plugin-base.h +++ b/src/mm-plugin-base.h @@ -131,6 +131,7 @@ typedef struct { #define MM_PLUGIN_BASE_ALLOWED_PRODUCT_IDS "allowed-product-ids" #define MM_PLUGIN_BASE_ALLOWED_VENDOR_STRINGS "allowed-vendor-strings" #define MM_PLUGIN_BASE_ALLOWED_PRODUCT_STRINGS "allowed-product-strings" +#define MM_PLUGIN_BASE_ALLOWED_UDEV_TAGS "allowed-udev-tags" #define MM_PLUGIN_BASE_ALLOWED_QCDM "allowed-qcdm" #define MM_PLUGIN_BASE_CUSTOM_INIT "custom-init" #define MM_PLUGIN_BASE_SEND_DELAY "send-delay"