diff options
author | Daniele Palmas <dnlplm@gmail.com> | 2022-05-04 13:52:59 +0200 |
---|---|---|
committer | Daniele Palmas <dnlplm@gmail.com> | 2022-05-24 09:22:06 +0200 |
commit | ce71b580fc1e722d93c09cefaaeaf41e4ec6e545 (patch) | |
tree | 59430123a4a1e5372e41e980bb486c3351e1e536 /src/mm-plugin-manager.c | |
parent | 654c5f5014f90df7eb239b83ac88a1065e169731 (diff) |
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.
Diffstat (limited to 'src/mm-plugin-manager.c')
-rw-r--r-- | src/mm-plugin-manager.c | 22 |
1 files changed, 19 insertions, 3 deletions
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 */ |