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.
This commit is contained in:
Daniele Palmas
2022-05-24 09:22:06 +02:00
parent 654c5f5014
commit ce71b580fc
5 changed files with 160 additions and 48 deletions
+36 -34
View File
@@ -46,34 +46,35 @@
#define MM_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_PLUGIN))
#define MM_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_PLUGIN, MMPluginClass))
#define MM_PLUGIN_NAME "name"
#define MM_PLUGIN_IS_GENERIC "is-generic"
#define MM_PLUGIN_ALLOWED_SUBSYSTEMS "allowed-subsystems"
#define MM_PLUGIN_ALLOWED_DRIVERS "allowed-drivers"
#define MM_PLUGIN_FORBIDDEN_DRIVERS "forbidden-drivers"
#define MM_PLUGIN_ALLOWED_VENDOR_IDS "allowed-vendor-ids"
#define MM_PLUGIN_ALLOWED_PRODUCT_IDS "allowed-product-ids"
#define MM_PLUGIN_FORBIDDEN_PRODUCT_IDS "forbidden-product-ids"
#define MM_PLUGIN_ALLOWED_VENDOR_STRINGS "allowed-vendor-strings"
#define MM_PLUGIN_ALLOWED_PRODUCT_STRINGS "allowed-product-strings"
#define MM_PLUGIN_FORBIDDEN_PRODUCT_STRINGS "forbidden-product-strings"
#define MM_PLUGIN_ALLOWED_UDEV_TAGS "allowed-udev-tags"
#define MM_PLUGIN_ALLOWED_AT "allowed-at"
#define MM_PLUGIN_ALLOWED_SINGLE_AT "allowed-single-at"
#define MM_PLUGIN_ALLOWED_QCDM "allowed-qcdm"
#define MM_PLUGIN_ALLOWED_QMI "allowed-qmi"
#define MM_PLUGIN_ALLOWED_MBIM "allowed-mbim"
#define MM_PLUGIN_ICERA_PROBE "icera-probe"
#define MM_PLUGIN_ALLOWED_ICERA "allowed-icera"
#define MM_PLUGIN_FORBIDDEN_ICERA "forbidden-icera"
#define MM_PLUGIN_XMM_PROBE "xmm-probe"
#define MM_PLUGIN_ALLOWED_XMM "allowed-xmm"
#define MM_PLUGIN_FORBIDDEN_XMM "forbidden-xmm"
#define MM_PLUGIN_CUSTOM_INIT "custom-init"
#define MM_PLUGIN_CUSTOM_AT_PROBE "custom-at-probe"
#define MM_PLUGIN_SEND_DELAY "send-delay"
#define MM_PLUGIN_REMOVE_ECHO "remove-echo"
#define MM_PLUGIN_SEND_LF "send-lf"
#define MM_PLUGIN_NAME "name"
#define MM_PLUGIN_IS_GENERIC "is-generic"
#define MM_PLUGIN_ALLOWED_SUBSYSTEMS "allowed-subsystems"
#define MM_PLUGIN_ALLOWED_DRIVERS "allowed-drivers"
#define MM_PLUGIN_FORBIDDEN_DRIVERS "forbidden-drivers"
#define MM_PLUGIN_ALLOWED_VENDOR_IDS "allowed-vendor-ids"
#define MM_PLUGIN_ALLOWED_PRODUCT_IDS "allowed-product-ids"
#define MM_PLUGIN_ALLOWED_SUBSYSTEM_VENDOR_IDS "allowed-subsystem-vendor-ids"
#define MM_PLUGIN_FORBIDDEN_PRODUCT_IDS "forbidden-product-ids"
#define MM_PLUGIN_ALLOWED_VENDOR_STRINGS "allowed-vendor-strings"
#define MM_PLUGIN_ALLOWED_PRODUCT_STRINGS "allowed-product-strings"
#define MM_PLUGIN_FORBIDDEN_PRODUCT_STRINGS "forbidden-product-strings"
#define MM_PLUGIN_ALLOWED_UDEV_TAGS "allowed-udev-tags"
#define MM_PLUGIN_ALLOWED_AT "allowed-at"
#define MM_PLUGIN_ALLOWED_SINGLE_AT "allowed-single-at"
#define MM_PLUGIN_ALLOWED_QCDM "allowed-qcdm"
#define MM_PLUGIN_ALLOWED_QMI "allowed-qmi"
#define MM_PLUGIN_ALLOWED_MBIM "allowed-mbim"
#define MM_PLUGIN_ICERA_PROBE "icera-probe"
#define MM_PLUGIN_ALLOWED_ICERA "allowed-icera"
#define MM_PLUGIN_FORBIDDEN_ICERA "forbidden-icera"
#define MM_PLUGIN_XMM_PROBE "xmm-probe"
#define MM_PLUGIN_ALLOWED_XMM "allowed-xmm"
#define MM_PLUGIN_FORBIDDEN_XMM "forbidden-xmm"
#define MM_PLUGIN_CUSTOM_INIT "custom-init"
#define MM_PLUGIN_CUSTOM_AT_PROBE "custom-at-probe"
#define MM_PLUGIN_SEND_DELAY "send-delay"
#define MM_PLUGIN_REMOVE_ECHO "remove-echo"
#define MM_PLUGIN_SEND_LF "send-lf"
typedef enum {
MM_PLUGIN_SUPPORTS_PORT_UNKNOWN = -1,
@@ -126,12 +127,13 @@ struct _MMPluginClass {
GType mm_plugin_get_type (void);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMPlugin, g_object_unref)
const gchar *mm_plugin_get_name (MMPlugin *self);
const gchar **mm_plugin_get_allowed_subsystems (MMPlugin *self);
const gchar **mm_plugin_get_allowed_udev_tags (MMPlugin *self);
const guint16 *mm_plugin_get_allowed_vendor_ids (MMPlugin *self);
const mm_uint16_pair *mm_plugin_get_allowed_product_ids (MMPlugin *self);
gboolean mm_plugin_is_generic (MMPlugin *self);
const gchar *mm_plugin_get_name (MMPlugin *self);
const gchar **mm_plugin_get_allowed_subsystems (MMPlugin *self);
const gchar **mm_plugin_get_allowed_udev_tags (MMPlugin *self);
const guint16 *mm_plugin_get_allowed_vendor_ids (MMPlugin *self);
const mm_uint16_pair *mm_plugin_get_allowed_product_ids (MMPlugin *self);
const mm_uint16_pair *mm_plugin_get_allowed_subsystem_vendor_ids (MMPlugin *self);
gboolean mm_plugin_is_generic (MMPlugin *self);
/* This method will run all pre-probing filters, to see if we can discard this
* plugin from the probing logic as soon as possible. */