From f8932b0162f2f40c7ab0d8b7860321737bae2f5b Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 8 Jul 2022 17:00:02 +0100 Subject: [PATCH] parade-lspcon: Simply quirk matching Existing firmware is being deployed using 'fwupdtool install-blob' and so changing the instance ID to be more standard is fine. --- plugins/parade-lspcon/README.md | 6 ++--- .../parade-lspcon/fu-parade-lspcon-device.c | 27 +++++-------------- plugins/parade-lspcon/parade-lspcon.quirk | 9 +++---- 3 files changed, 12 insertions(+), 30 deletions(-) diff --git a/plugins/parade-lspcon/README.md b/plugins/parade-lspcon/README.md index b7f048ae1..6372f941a 100644 --- a/plugins/parade-lspcon/README.md +++ b/plugins/parade-lspcon/README.md @@ -26,11 +26,9 @@ This plugin supports the following protocol ID: ## GUID Generation -The plugin uses a custom DeviceInstanceId value derived from the device name -provided by system firmware and read from sysfs, such as: +Devices use an extra instance ID derived from SMBIOS, e.g. -* `PARADE-LSPCON\NAME_1AF80175:00` -* `PARADE-LSPCON\NAME_1AF80175:00&FAMILY_Google_Hatch` +* `I2C\NAME_1AF80175:00:00&FAMILY_Google_Hatch` ## Quirk Use diff --git a/plugins/parade-lspcon/fu-parade-lspcon-device.c b/plugins/parade-lspcon/fu-parade-lspcon-device.c index 05eb0026d..02b416d11 100644 --- a/plugins/parade-lspcon/fu-parade-lspcon-device.c +++ b/plugins/parade-lspcon/fu-parade-lspcon-device.c @@ -121,30 +121,17 @@ fu_parade_lspcon_device_probe(FuDevice *device, GError **error) { FuParadeLspconDevice *self = FU_PARADE_LSPCON_DEVICE(device); FuContext *context = fu_device_get_context(device); - FuUdevDevice *udev_device = FU_UDEV_DEVICE(device); - const gchar *device_name; + + /* FuI2cDevice->probe */ + if (!FU_DEVICE_CLASS(fu_parade_lspcon_device_parent_class)->probe(device, error)) + return FALSE; /* custom instance IDs to get device quirks */ - fu_device_add_instance_str(device, - "NAME", - fu_udev_device_get_sysfs_attr(udev_device, "name", NULL)); fu_device_add_instance_str(device, "FAMILY", fu_context_get_hwid_value(context, FU_HWIDS_KEY_FAMILY)); - if (!fu_device_build_instance_id(device, error, "PARADE-LSPCON", "NAME", NULL)) + if (!fu_device_build_instance_id_quirk(device, error, "I2C", "NAME", "FAMILY", NULL)) return FALSE; - fu_device_build_instance_id_quirk(device, NULL, "PARADE-LSPCON", "NAME", "FAMILY", NULL); - - /* probably set from quirk */ - device_name = fu_device_get_name(device); - if (g_strcmp0(device_name, "PS175") != 0) { - g_set_error(error, - FWUPD_ERROR, - FWUPD_ERROR_NOT_SUPPORTED, - "device name %s is not supported by this plugin", - device_name); - return FALSE; - } /* should know which aux device over which we read DPCD version */ if (self->aux_device_name == NULL) { @@ -155,8 +142,8 @@ fu_parade_lspcon_device_probe(FuDevice *device, GError **error) return FALSE; } - /* FuI2cDevice->probe */ - return FU_DEVICE_CLASS(fu_parade_lspcon_device_parent_class)->probe(device, error); + /* success */ + return TRUE; } static gboolean diff --git a/plugins/parade-lspcon/parade-lspcon.quirk b/plugins/parade-lspcon/parade-lspcon.quirk index 9bf8fa949..2c112e5b8 100644 --- a/plugins/parade-lspcon/parade-lspcon.quirk +++ b/plugins/parade-lspcon/parade-lspcon.quirk @@ -1,11 +1,8 @@ -# match all devices with this udev subsystem -[I2C] -Plugin = parade_lspcon - # Parade PS175 -[PARADE-LSPCON\NAME_1AF80175:00] +[I2C\NAME_1AF80175:00] +Plugin = parade_lspcon Name = PS175 # "Puff" Chromeboxes -[PARADE-LSPCON\NAME_1AF80175:00&FAMILY_Google_Hatch] +[I2C\NAME_1AF80175:00&FAMILY_Google_Hatch] ParadeLspconAuxDeviceName = DPDDC-B