realtek-mst: 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:34 +01:00
parent f8932b0162
commit 85c01e1b5e
3 changed files with 11 additions and 34 deletions

View File

@ -29,11 +29,9 @@ This plugin supports the following protocol ID:
## GUID Generation
Devices use custom DeviceInstanceId values derived from device names
provided by system firmware and read from sysfs, like:
Devices use an extra instance ID derived from SMBIOS, e.g.
* REALTEK-MST\NAME_10EC2142:00
* REALTEK-MST\NAME_10EC2142:00&FAMILY_Google_Hatch
* `I2C\NAME_10EC2142:00&FAMILY_Google_Hatch`
## Quirk Use

View File

@ -385,32 +385,19 @@ fu_realtek_mst_device_probe(FuDevice *device, GError **error)
{
FuRealtekMstDevice *self = FU_REALTEK_MST_DEVICE(device);
FuContext *context = fu_device_get_context(device);
const gchar *quirk_name = NULL;
/* set custom instance ID and load matching quirks */
fu_device_add_instance_str(
device,
"NAME",
fu_udev_device_get_sysfs_attr(FU_UDEV_DEVICE(device), "name", NULL));
if (!fu_device_build_instance_id(device, error, "REALTEK-MST", "NAME", NULL))
/* FuI2cDevice->probe */
if (!FU_DEVICE_CLASS(fu_realtek_mst_device_parent_class)->probe(device, error))
return FALSE;
/* add custom instance ID and load matching quirks */
fu_device_add_instance_str(device,
"FAMILY",
fu_context_get_hwid_value(context, FU_HWIDS_KEY_FAMILY));
fu_device_build_instance_id_quirk(device, NULL, "REALTEK-MST", "NAME", "FAMILY", NULL);
if (!fu_device_build_instance_id_quirk(device, error, "I2C", "NAME", "FAMILY", NULL))
return FALSE;
/* having loaded quirks, check this device is supported */
quirk_name = fu_device_get_name(device);
if (g_strcmp0(quirk_name, "RTD2142") != 0 && g_strcmp0(quirk_name, "RTD2141B") != 0) {
g_set_error(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"device name %s is not supported",
quirk_name);
return FALSE;
}
if (self->dp_aux_dev_name != NULL) {
if (!fu_realtek_mst_device_use_aux_dev(self, error))
return FALSE;
@ -428,10 +415,6 @@ fu_realtek_mst_device_probe(FuDevice *device, GError **error)
/* locate its sibling i2c device and use that instead */
/* FuI2cDevice */
if (!FU_DEVICE_CLASS(fu_realtek_mst_device_parent_class)->probe(device, error))
return FALSE;
/* success */
return TRUE;
}

View File

@ -1,15 +1,11 @@
# match all devices with this udev subsystem
[I2C]
Plugin = realtek_mst
[REALTEK-MST\NAME_10EC2142:00]
[I2C\NAME_10EC2142:00]
Name = RTD2142
[REALTEK-MST\NAME_10EC2142:00&FAMILY_Google_Hatch]
[I2C\NAME_10EC2142:00&FAMILY_Google_Hatch]
RealtekMstDpAuxName = DPDDC-C
[REALTEK-MST\NAME_10EC2141:00]
[I2C\NAME_10EC2141:00]
Name = RTD2141B
[REALTEK-MST\NAME_10EC2141:00&FAMILY_Google_Zork]
[I2C\NAME_10EC2141:00&FAMILY_Google_Zork]
RealtekMstDrmCardKernelName = card0-DP-1