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 };
This commit is contained in:

committed by
Aleksander Morgado

parent
24ebb00ed2
commit
18238ed50e
@@ -72,6 +72,7 @@ typedef struct {
|
|||||||
/* Plugin-specific setups */
|
/* Plugin-specific setups */
|
||||||
guint32 capabilities;
|
guint32 capabilities;
|
||||||
const gchar **subsystems;
|
const gchar **subsystems;
|
||||||
|
const gchar **drivers;
|
||||||
const guint16 *vendor_ids;
|
const guint16 *vendor_ids;
|
||||||
const guint16 *product_ids;
|
const guint16 *product_ids;
|
||||||
const gchar **vendor_strings;
|
const gchar **vendor_strings;
|
||||||
@@ -86,6 +87,7 @@ enum {
|
|||||||
PROP_NAME,
|
PROP_NAME,
|
||||||
PROP_ALLOWED_CAPABILITIES,
|
PROP_ALLOWED_CAPABILITIES,
|
||||||
PROP_ALLOWED_SUBSYSTEMS,
|
PROP_ALLOWED_SUBSYSTEMS,
|
||||||
|
PROP_ALLOWED_DRIVERS,
|
||||||
PROP_ALLOWED_VENDOR_IDS,
|
PROP_ALLOWED_VENDOR_IDS,
|
||||||
PROP_ALLOWED_PRODUCT_IDS,
|
PROP_ALLOWED_PRODUCT_IDS,
|
||||||
PROP_ALLOWED_VENDOR_STRINGS,
|
PROP_ALLOWED_VENDOR_STRINGS,
|
||||||
@@ -1575,6 +1577,10 @@ set_property (GObject *object, guint prop_id,
|
|||||||
/* Construct only */
|
/* Construct only */
|
||||||
priv->subsystems = (const gchar **)g_value_get_pointer (value);
|
priv->subsystems = (const gchar **)g_value_get_pointer (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_ALLOWED_DRIVERS:
|
||||||
|
/* Construct only */
|
||||||
|
priv->drivers = (const gchar **)g_value_get_pointer (value);
|
||||||
|
break;
|
||||||
case PROP_ALLOWED_VENDOR_IDS:
|
case PROP_ALLOWED_VENDOR_IDS:
|
||||||
/* Construct only */
|
/* Construct only */
|
||||||
priv->vendor_ids = (const guint16 *)g_value_get_pointer (value);
|
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:
|
case PROP_ALLOWED_SUBSYSTEMS:
|
||||||
g_value_set_pointer (value, (gpointer)priv->subsystems);
|
g_value_set_pointer (value, (gpointer)priv->subsystems);
|
||||||
break;
|
break;
|
||||||
|
case PROP_ALLOWED_DRIVERS:
|
||||||
|
g_value_set_pointer (value, (gpointer)priv->drivers);
|
||||||
|
break;
|
||||||
case PROP_ALLOWED_VENDOR_IDS:
|
case PROP_ALLOWED_VENDOR_IDS:
|
||||||
g_value_set_pointer (value, (gpointer)priv->vendor_ids);
|
g_value_set_pointer (value, (gpointer)priv->vendor_ids);
|
||||||
break;
|
break;
|
||||||
@@ -1711,6 +1720,14 @@ mm_plugin_base_class_init (MMPluginBaseClass *klass)
|
|||||||
"should be an array of strings finished with 'NULL'",
|
"should be an array of strings finished with 'NULL'",
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
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
|
g_object_class_install_property
|
||||||
(object_class, PROP_ALLOWED_VENDOR_IDS,
|
(object_class, PROP_ALLOWED_VENDOR_IDS,
|
||||||
g_param_spec_pointer (MM_PLUGIN_BASE_ALLOWED_VENDOR_IDS,
|
g_param_spec_pointer (MM_PLUGIN_BASE_ALLOWED_VENDOR_IDS,
|
||||||
|
@@ -126,6 +126,7 @@ typedef struct {
|
|||||||
#define MM_PLUGIN_BASE_NAME "name"
|
#define MM_PLUGIN_BASE_NAME "name"
|
||||||
#define MM_PLUGIN_BASE_ALLOWED_CAPABILITIES "allowed-capabilities"
|
#define MM_PLUGIN_BASE_ALLOWED_CAPABILITIES "allowed-capabilities"
|
||||||
#define MM_PLUGIN_BASE_ALLOWED_SUBSYSTEMS "allowed-subsystems"
|
#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_VENDOR_IDS "allowed-vendor-ids"
|
||||||
#define MM_PLUGIN_BASE_ALLOWED_PRODUCT_IDS "allowed-product-ids"
|
#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_VENDOR_STRINGS "allowed-vendor-strings"
|
||||||
|
Reference in New Issue
Block a user