From 3460e0a5edc33e67491d4598be6cf92d90918881 Mon Sep 17 00:00:00 2001 From: Jingle Wu Date: Sat, 24 Oct 2020 02:31:18 +0800 Subject: [PATCH] elantp: Modify the correct input for the iap reg. 1. Modify the correct input for the iap reg (byte -> word). 2. Add new HWID for ThinkPad X1 Carbon Gen 9. --- plugins/elantp/elantp.quirk | 4 ++++ plugins/elantp/fu-elantp-hid-device.c | 4 ++-- plugins/elantp/fu-elantp-i2c-device.c | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/elantp/elantp.quirk b/plugins/elantp/elantp.quirk index 82f253ca4..40ce25c96 100644 --- a/plugins/elantp/elantp.quirk +++ b/plugins/elantp/elantp.quirk @@ -2,6 +2,10 @@ Plugin = elantp GType = FuElantpHidDevice +# ThinkPad X1 Carbon Gen 9 +[HwId=6c87726f-b545-549e-840a-189422ea21d0] +Flags = elantp-recovery + # Lenovo X1 Nano Gen1 [HwId=4c20262a-aee0-5d6e-ba72-6d29b23fe350] Flags = elantp-recovery diff --git a/plugins/elantp/fu-elantp-hid-device.c b/plugins/elantp/fu-elantp-hid-device.c index 168255024..809cd24cb 100644 --- a/plugins/elantp/fu-elantp-hid-device.c +++ b/plugins/elantp/fu-elantp-hid-device.c @@ -426,7 +426,7 @@ fu_elantp_hid_device_detach (FuDevice *device, GError **error) if (!fu_elantp_hid_device_write_cmd (self, ETP_CMD_I2C_IAP_TYPE, - self->fw_page_size, + self->fw_page_size / 2, error)) return FALSE; if (!fu_elantp_hid_device_read_cmd (self, ETP_CMD_I2C_IAP_TYPE, @@ -435,7 +435,7 @@ fu_elantp_hid_device_detach (FuDevice *device, GError **error) return FALSE; } self->iap_type = fu_common_read_uint16 (buf, G_LITTLE_ENDIAN); - if (self->iap_type != self->fw_page_size) { + if (self->iap_type != self->fw_page_size / 2) { g_set_error_literal (error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED, diff --git a/plugins/elantp/fu-elantp-i2c-device.c b/plugins/elantp/fu-elantp-i2c-device.c index c3123f0b8..362f46136 100644 --- a/plugins/elantp/fu-elantp-i2c-device.c +++ b/plugins/elantp/fu-elantp-i2c-device.c @@ -454,7 +454,7 @@ fu_elantp_i2c_device_detach (FuDevice *device, GError **error) /* set the IAP type, presumably some kind of ABI */ if (!fu_elantp_i2c_device_write_cmd (self, ETP_CMD_I2C_IAP_TYPE, - self->fw_page_size , + self->fw_page_size / 2, error)) return FALSE; if (!fu_elantp_i2c_device_read_cmd (self, ETP_CMD_I2C_IAP_TYPE , @@ -463,7 +463,7 @@ fu_elantp_i2c_device_detach (FuDevice *device, GError **error) return FALSE; } self->iap_type = fu_common_read_uint16 (buf, G_LITTLE_ENDIAN); - if (self->iap_type != self->fw_page_size) { + if (self->iap_type != self->fw_page_size / 2) { g_set_error_literal (error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED,