ccgx: Set the device name and summary from quirk files

Based on a patch by Ryan Lee <ryle@cypress.com>, many thanks.
This commit is contained in:
Richard Hughes 2020-04-17 09:49:18 +01:00
parent cacf14e54f
commit da645fe912
2 changed files with 10 additions and 31 deletions

View File

@ -12,6 +12,14 @@ GType = FuCcgxHpiDevice
ImageKind = dual-asymmetric ImageKind = dual-asymmetric
ParentGuid = USB\VID_17EF&PID_A391 ParentGuid = USB\VID_17EF&PID_A391
[DeviceInstanceId=USB\VID_04B4&PID_521A&SID_1F00&APP_6D64&MODE_FW1]
Name = ThinkPad USB-C Dock Gen2 PD Backup Controller
Summary = CCGx Power Delivery Device (Backup Firmware)
[DeviceInstanceId=USB\VID_04B4&PID_521A&SID_1F00&APP_6D64&MODE_FW2]
Name = ThinkPad USB-C Dock Gen2 PD Main Controller
Summary = CCGx Power Delivery Device (Main Firmware)
# Lenovo Hybrid Dock # Lenovo Hybrid Dock
[DeviceInstanceId=USB\VID_17EF&PID_A354] [DeviceInstanceId=USB\VID_17EF&PID_A354]
Plugin = ccgx Plugin = ccgx
@ -28,6 +36,7 @@ Plugin = ccgx
GType = FuCcgxHpiDevice GType = FuCcgxHpiDevice
[DeviceInstanceId=USB\VID_04B4&PID_5218&SID_1F00&APP_6462] [DeviceInstanceId=USB\VID_04B4&PID_5218&SID_1F00&APP_6462]
Name = ThinkPad USB-C Dock Hybrid PD Controller
Summary = CCGx Power Delivery Device
ImageKind = dual-symmetric ImageKind = dual-symmetric
ParentGuid = USB\VID_17EF&PID_1028 ParentGuid = USB\VID_17EF&PID_1028

View File

@ -1239,31 +1239,6 @@ fu_ccgx_hpi_device_set_version_raw (FuCcgxHpiDevice *self, guint32 version_raw)
fu_device_set_version_raw (FU_DEVICE (self), version_raw); fu_device_set_version_raw (FU_DEVICE (self), version_raw);
} }
static const gchar *
fu_ccgx_hpi_device_get_name (FuCcgxHpiDevice *self)
{
/* asymmetric FW1 is a backup bootloader */
if (self->fw_image_type == FW_IMAGE_TYPE_DUAL_ASYMMETRIC ) {
if (self->fw_mode == FW_MODE_BOOT)
return "Boot";
if (self->fw_mode == FW_MODE_FW1)
return "Backup";
if (self->fw_mode == FW_MODE_FW2)
return "Primary";
}
/* symmetric, but still interesting if debugging */
if (self->fw_mode == FW_MODE_BOOT)
return "Boot";
if (self->fw_mode == FW_MODE_FW1)
return "FW1";
if (self->fw_mode == FW_MODE_FW2)
return "FW2";
/* nothing better to return */
return "unknown";
}
static void static void
fu_ccgx_hpi_device_setup_with_fw_mode (FuCcgxHpiDevice *self) fu_ccgx_hpi_device_setup_with_fw_mode (FuCcgxHpiDevice *self)
{ {
@ -1302,7 +1277,6 @@ fu_ccgx_hpi_device_setup (FuDevice *device, GError **error)
CyI2CConfig i2c_config = { 0x0 }; CyI2CConfig i2c_config = { 0x0 };
guint32 hpi_event = 0; guint32 hpi_event = 0;
guint8 mode = 0; guint8 mode = 0;
g_autofree gchar *name = NULL;
g_autoptr(GError) error_local = NULL; g_autoptr(GError) error_local = NULL;
/* set the new config */ /* set the new config */
@ -1379,10 +1353,6 @@ fu_ccgx_hpi_device_setup (FuDevice *device, GError **error)
fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_UPDATABLE); fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_UPDATABLE);
} }
/* set name to be more descriptive */
name = g_strdup_printf ("USB-I2C Bridge (%s)", fu_ccgx_hpi_device_get_name (self));
fu_device_set_name (FU_DEVICE (self), name);
/* if we are coming back from reset, wait for hardware to settle */ /* if we are coming back from reset, wait for hardware to settle */
if (!fu_ccgx_hpi_device_get_event (self, if (!fu_ccgx_hpi_device_get_event (self,
HPI_REG_SECTION_DEV, HPI_REG_SECTION_DEV,