From 18238ed50ee626bff10aa9dc86e06223a776c255 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Mon, 19 Sep 2011 13:31:47 +0200 Subject: [PATCH] plugin-base: new 'allowed-drivers' property The plugins can set this property to filter support check requests by physical device driver. The value given to the property should be a NULL-terminated array of C strings, e.g.: const gchar *drivers[] = { "qcserial", 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 5820e280..eb5d23ed 100644 --- a/src/mm-plugin-base.c +++ b/src/mm-plugin-base.c @@ -72,6 +72,7 @@ typedef struct { /* Plugin-specific setups */ guint32 capabilities; const gchar **subsystems; + const gchar **drivers; const guint16 *vendor_ids; const guint16 *product_ids; const gchar **vendor_strings; @@ -86,6 +87,7 @@ enum { PROP_NAME, PROP_ALLOWED_CAPABILITIES, PROP_ALLOWED_SUBSYSTEMS, + PROP_ALLOWED_DRIVERS, PROP_ALLOWED_VENDOR_IDS, PROP_ALLOWED_PRODUCT_IDS, PROP_ALLOWED_VENDOR_STRINGS, @@ -1575,6 +1577,10 @@ set_property (GObject *object, guint prop_id, /* Construct only */ priv->subsystems = (const gchar **)g_value_get_pointer (value); break; + case PROP_ALLOWED_DRIVERS: + /* Construct only */ + priv->drivers = (const gchar **)g_value_get_pointer (value); + break; case PROP_ALLOWED_VENDOR_IDS: /* Construct only */ priv->vendor_ids = (const guint16 *)g_value_get_pointer (value); @@ -1629,6 +1635,9 @@ get_property (GObject *object, guint prop_id, case PROP_ALLOWED_SUBSYSTEMS: g_value_set_pointer (value, (gpointer)priv->subsystems); break; + case PROP_ALLOWED_DRIVERS: + g_value_set_pointer (value, (gpointer)priv->drivers); + break; case PROP_ALLOWED_VENDOR_IDS: g_value_set_pointer (value, (gpointer)priv->vendor_ids); break; @@ -1711,6 +1720,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_DRIVERS, + g_param_spec_pointer (MM_PLUGIN_BASE_ALLOWED_DRIVERS, + "Allowed drivers", + "List of drivers this plugin can support, " + "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_VENDOR_IDS, g_param_spec_pointer (MM_PLUGIN_BASE_ALLOWED_VENDOR_IDS, diff --git a/src/mm-plugin-base.h b/src/mm-plugin-base.h index 9e8a07f5..2b9e2f45 100644 --- a/src/mm-plugin-base.h +++ b/src/mm-plugin-base.h @@ -126,6 +126,7 @@ typedef struct { #define MM_PLUGIN_BASE_NAME "name" #define MM_PLUGIN_BASE_ALLOWED_CAPABILITIES "allowed-capabilities" #define MM_PLUGIN_BASE_ALLOWED_SUBSYSTEMS "allowed-subsystems" +#define MM_PLUGIN_BASE_ALLOWED_DRIVERS "allowed-drivers" #define MM_PLUGIN_BASE_ALLOWED_VENDOR_IDS "allowed-vendor-ids" #define MM_PLUGIN_BASE_ALLOWED_PRODUCT_IDS "allowed-product-ids" #define MM_PLUGIN_BASE_ALLOWED_VENDOR_STRINGS "allowed-vendor-strings"