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.
This commit is contained in:
Jingle Wu 2020-10-24 02:31:18 +08:00 committed by Richard Hughes
parent e4d52866d1
commit 3460e0a5ed
3 changed files with 8 additions and 4 deletions

View File

@ -2,6 +2,10 @@
Plugin = elantp Plugin = elantp
GType = FuElantpHidDevice GType = FuElantpHidDevice
# ThinkPad X1 Carbon Gen 9
[HwId=6c87726f-b545-549e-840a-189422ea21d0]
Flags = elantp-recovery
# Lenovo X1 Nano Gen1 # Lenovo X1 Nano Gen1
[HwId=4c20262a-aee0-5d6e-ba72-6d29b23fe350] [HwId=4c20262a-aee0-5d6e-ba72-6d29b23fe350]
Flags = elantp-recovery Flags = elantp-recovery

View File

@ -426,7 +426,7 @@ fu_elantp_hid_device_detach (FuDevice *device, GError **error)
if (!fu_elantp_hid_device_write_cmd (self, if (!fu_elantp_hid_device_write_cmd (self,
ETP_CMD_I2C_IAP_TYPE, ETP_CMD_I2C_IAP_TYPE,
self->fw_page_size, self->fw_page_size / 2,
error)) error))
return FALSE; return FALSE;
if (!fu_elantp_hid_device_read_cmd (self, ETP_CMD_I2C_IAP_TYPE, 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; return FALSE;
} }
self->iap_type = fu_common_read_uint16 (buf, G_LITTLE_ENDIAN); 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, g_set_error_literal (error,
FWUPD_ERROR, FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED, FWUPD_ERROR_NOT_SUPPORTED,

View File

@ -454,7 +454,7 @@ fu_elantp_i2c_device_detach (FuDevice *device, GError **error)
/* set the IAP type, presumably some kind of ABI */ /* set the IAP type, presumably some kind of ABI */
if (!fu_elantp_i2c_device_write_cmd (self, if (!fu_elantp_i2c_device_write_cmd (self,
ETP_CMD_I2C_IAP_TYPE, ETP_CMD_I2C_IAP_TYPE,
self->fw_page_size , self->fw_page_size / 2,
error)) error))
return FALSE; return FALSE;
if (!fu_elantp_i2c_device_read_cmd (self, ETP_CMD_I2C_IAP_TYPE , 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; return FALSE;
} }
self->iap_type = fu_common_read_uint16 (buf, G_LITTLE_ENDIAN); 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, g_set_error_literal (error,
FWUPD_ERROR, FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED, FWUPD_ERROR_NOT_SUPPORTED,