From 736a56ccee60368d5d909980592e7e66dc602bf2 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Thu, 30 Dec 2021 10:51:53 +0000 Subject: [PATCH] Use the UDev devtype for quirk matching --- libfwupdplugin/fu-udev-device.c | 9 +++++++++ plugins/thunderbolt/thunderbolt.quirk | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/libfwupdplugin/fu-udev-device.c b/libfwupdplugin/fu-udev-device.c index 35c2db021..6d4e281eb 100644 --- a/libfwupdplugin/fu-udev-device.c +++ b/libfwupdplugin/fu-udev-device.c @@ -509,6 +509,15 @@ fu_udev_device_probe(FuDevice *device, GError **error) fu_device_add_instance_id_full(device, devid, FU_DEVICE_INSTANCE_FLAG_ONLY_QUIRKS); } + /* add devtype */ + tmp = g_udev_device_get_devtype(priv->udev_device); + if (tmp != NULL) { + g_autofree gchar *devtype = g_utf8_strup(tmp, -1); + g_autofree gchar *devid = NULL; + devid = g_strdup_printf("%s\\TYPE_%s", subsystem, devtype); + fu_device_add_instance_id_full(device, devid, FU_DEVICE_INSTANCE_FLAG_ONLY_QUIRKS); + } + /* add the driver */ if (priv->driver != NULL) { g_autofree gchar *devid = NULL; diff --git a/plugins/thunderbolt/thunderbolt.quirk b/plugins/thunderbolt/thunderbolt.quirk index af3348ca2..b66e9bcf7 100644 --- a/plugins/thunderbolt/thunderbolt.quirk +++ b/plugins/thunderbolt/thunderbolt.quirk @@ -1,3 +1,5 @@ -# match all devices with this udev subsystem -[THUNDERBOLT] +[THUNDERBOLT\TYPE_THUNDERBOLT_DEVICE] +Plugin = thunderbolt + +[THUNDERBOLT\TYPE_THUNDERBOLT_RETIMER] Plugin = thunderbolt