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.
This commit is contained in:
Richard Hughes 2022-07-08 17:00:02 +01:00
parent 60a34af164
commit f8932b0162
3 changed files with 12 additions and 30 deletions

View File

@ -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

View File

@ -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

View File

@ -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