diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2019-09-08 22:22:37 +0200 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2019-09-11 18:01:50 +0000 |
commit | 51c4626471ce5ddf9035b0c7570141b12929a52d (patch) | |
tree | 365db9ce9a6bb9b68962571b02f428ab281eb667 /src/mm-plugin-manager.c | |
parent | 0e02771e5cb185d8939930e65cc6e63ca226b6f7 (diff) |
filter: update plugin whitelist logic to use 'allowed product ids'
Several plugins define the specific device vid:pid pairs they
support. Let's use this information as a direct indication that
ModemManager can probe the devices.
Diffstat (limited to 'src/mm-plugin-manager.c')
-rw-r--r-- | src/mm-plugin-manager.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/mm-plugin-manager.c b/src/mm-plugin-manager.c index 557c2d5d..f0045af7 100644 --- a/src/mm-plugin-manager.c +++ b/src/mm-plugin-manager.c @@ -1511,6 +1511,21 @@ register_plugin_whitelist_tags (MMPluginManager *self, mm_filter_register_plugin_whitelist_tag (self->priv->filter, tags[i]); } +static void +register_plugin_whitelist_product_ids (MMPluginManager *self, + MMPlugin *plugin) +{ + const mm_uint16_pair *product_ids; + guint i; + + if (!mm_filter_check_rule_enabled (self->priv->filter, MM_FILTER_RULE_PLUGIN_WHITELIST)) + return; + + product_ids = mm_plugin_get_allowed_product_ids (plugin); + for (i = 0; product_ids && product_ids[i].l; i++) + mm_filter_register_plugin_whitelist_product_id (self->priv->filter, product_ids[i].l, product_ids[i].r); +} + static MMPlugin * load_plugin (const gchar *path) { @@ -1625,8 +1640,9 @@ load_plugins (MMPluginManager *self, /* Vendor specific plugin */ self->priv->plugins = g_list_append (self->priv->plugins, plugin); - /* Register plugin whitelist tags in filter, if any */ + /* Register plugin whitelist rules in filter, if any */ register_plugin_whitelist_tags (self, plugin); + register_plugin_whitelist_product_ids (self, plugin); } /* Check the generic plugin once all looped */ |