summaryrefslogtreecommitdiff
path: root/extra/touchpad_updater/touchpad_updater.c
diff options
context:
space:
mode:
authorChun-Ta Lin <itspeter@google.com>2017-11-28 15:16:22 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-12-07 05:09:28 -0800
commitab238235f8f45cb1ba3e26893199c01f4792a8ff (patch)
tree9f89b9428d868a80c5d9c0a5fb9ead38941f7b71 /extra/touchpad_updater/touchpad_updater.c
parent1956a98ad4988305777bbb633fb007cb5f86b89f (diff)
downloadchrome-ec-ab238235f8f45cb1ba3e26893199c01f4792a8ff.tar.gz
i2c: support large reading in i2c_xfer()
There might be more than one place that will use very similar codes in CL:542716 (usb_i2c.c). To avoid unnecessary duplication of code, we fold the logic into i2c_xfer(). With config enabled (illustrated in this CL), i2c_xfer() will support large reading. An early prototype of potential usage is demostrated in CL:781300. BRANCH=none TEST=For CONFIG_I2C_XFER_LARGE_READ: With proprietary software on slave: ./touchpad_updater -d TEST=For usb_i2c regression: ./touchpad_updater still works (where the reading is less than 255) TEST=For generic EC regression test: On poppy EC (With CONFIG_I2C_XFER_LARGE_READ defined) (1) Prevent override of update /usr/share/vboot/bin/set_gbb_flags.sh 0xa39 (2) flashrom -p ec -w ec_binary_contains_this_CL.bin (3) ectool reboot_ec cold (4) "ectool version" verified that both RO/RW/Build info is local. (5) Test with a type-C DP dongle on DELL 2408WFP. (6) Plug-in type-C charger and external display still works. (7) Confirmed that battery is charging. (7) "ectool battery" reads same data (for fixed field) as before. (8) "ectool usbpdpower", confirmed charger info displayed as before. (9) "ectool usbpd 0", confirmed content exactly as before. (10) For Gyro. Verify under Arc++ Using App: com.gamma.bubblelevel, works the same as before. (11) For Accelerometers. Verify under Arc++ Using App: com.innoventions.sensorkinetics, small movement's charts looks as expected. TEST=For generic EC regression test: On Caroline EC (Without CONFIG_I2C_XFER_LARGE_READ defined). Details in CL:810332 BUG=b:63993891 Change-Id: I654868945fa535e784800177d54eb2d9803f5249 Signed-off-by: Chun-Ta Lin <itspeter@google.com> Reviewed-on: https://chromium-review.googlesource.com/788479 Commit-Ready: Chun-ta Lin <itspeter@chromium.org> Tested-by: Chun-ta Lin <itspeter@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'extra/touchpad_updater/touchpad_updater.c')
-rw-r--r--extra/touchpad_updater/touchpad_updater.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/extra/touchpad_updater/touchpad_updater.c b/extra/touchpad_updater/touchpad_updater.c
index 059ddb0933..d09b899a8d 100644
--- a/extra/touchpad_updater/touchpad_updater.c
+++ b/extra/touchpad_updater/touchpad_updater.c
@@ -588,13 +588,16 @@ int main(int argc, char *argv[])
*/
elan_get_fw_info();
+ /* Trigger an I2C transaction of expecting reading of 633 bytes. */
if (extended_i2c_exercise) {
- /*
- * Trigger an I2C transaction of expecting reading > 60 bytes.
- * source: https://goo.gl/pSxESS
- */
- elan_write_and_read(0x0002, rx_buf, 118, 0, 0);
- pretty_print_buffer(rx_buf, 118);
+ tx_buf[0] = 0x05;
+ tx_buf[1] = 0x00;
+ tx_buf[2] = 0x3C;
+ tx_buf[3] = 0x02;
+ tx_buf[4] = 0x06;
+ tx_buf[5] = 0x00;
+ libusb_single_write_and_read(tx_buf, 6, rx_buf, 633);
+ pretty_print_buffer(rx_buf, 637);
}
/* Get the trackpad ready for receiving update */