From ce71b580fc1e722d93c09cefaaeaf41e4ec6e545 Mon Sep 17 00:00:00 2001 From: Daniele Palmas Date: Wed, 4 May 2022 13:52:59 +0200 Subject: filter: add vendor id/subsystem vendor id filter Some PCI modems prefer customizing the subsytem vendor ID, instead of the vendor ID. Add a filter for the couple vendor/subsystem vendor IDs. --- src/mm-plugin-manager.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/mm-plugin-manager.c') diff --git a/src/mm-plugin-manager.c b/src/mm-plugin-manager.c index 8ec85a57..0f454bb7 100644 --- a/src/mm-plugin-manager.c +++ b/src/mm-plugin-manager.c @@ -1666,6 +1666,21 @@ register_plugin_allowlist_product_ids (MMPluginManager *self, mm_filter_register_plugin_allowlist_product_id (self->priv->filter, product_ids[i].l, product_ids[i].r); } +static void +register_plugin_allowlist_subsystem_vendor_ids (MMPluginManager *self, + MMPlugin *plugin) +{ + const mm_uint16_pair *subsystem_vendor_ids; + guint i; + + if (!mm_filter_check_rule_enabled (self->priv->filter, MM_FILTER_RULE_PLUGIN_ALLOWLIST)) + return; + + subsystem_vendor_ids = mm_plugin_get_allowed_subsystem_vendor_ids (plugin); + for (i = 0; subsystem_vendor_ids && subsystem_vendor_ids[i].l; i++) + mm_filter_register_plugin_allowlist_subsystem_vendor_id (self->priv->filter, subsystem_vendor_ids[i].l, subsystem_vendor_ids[i].r); +} + static MMPlugin * load_plugin (MMPluginManager *self, const gchar *path) @@ -1869,9 +1884,10 @@ load_plugins (MMPluginManager *self, } /* Register plugin allowlist rules in filter, if any */ - register_plugin_allowlist_tags (self, plugin); - register_plugin_allowlist_vendor_ids (self, plugin); - register_plugin_allowlist_product_ids (self, plugin); + register_plugin_allowlist_tags (self, plugin); + register_plugin_allowlist_vendor_ids (self, plugin); + register_plugin_allowlist_product_ids (self, plugin); + register_plugin_allowlist_subsystem_vendor_ids (self, plugin); } /* Check the generic plugin once all looped */ -- cgit v1.2.3-70-g09d2