diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2017-11-09 16:35:53 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-11-14 03:22:31 -0800 |
commit | 7fdcb8bf869b59396b8e2c0844c31fefd4c22500 (patch) | |
tree | 40ca79851751dfadde6bbf0ab747073b7fba4cc3 /common/usb_update.c | |
parent | b3c99868026675a619ba1d323bc06ea2b5141674 (diff) | |
download | chrome-ec-7fdcb8bf869b59396b8e2c0844c31fefd4c22500.tar.gz |
usb_update: Add support for touchpad debugging feature
We support touchpad-specific debugging feature over the USB update
protocol. This will be used to fetch raw data from the sensor,
without requiring to remove the write-protect screw.
BRANCH=none
BUG=b:63993891
TEST=./usb_updater2 -g 00 -d 18d1:502b
Change-Id: I46dfd97aaa17b73a5893fe1e8c62327a302f829b
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/763574
Reviewed-by: Chun-ta Lin <itspeter@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common/usb_update.c')
-rw-r--r-- | common/usb_update.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/common/usb_update.c b/common/usb_update.c index c73459126c..a97541dd9c 100644 --- a/common/usb_update.c +++ b/common/usb_update.c @@ -326,6 +326,31 @@ static int try_vendor_command(struct consumer const *consumer, size_t count) &tp, response_size); return 1; } + case UPDATE_EXTRA_CMD_TOUCHPAD_DEBUG: { + uint8_t *data = NULL; + unsigned int write_count = 0; + + /* + * Let the touchpad driver decide what it wants to do + * with the payload data, and put the response in data. + */ + response = touchpad_debug(buffer + header_size, + data_count, &data, &write_count); + + /* + * On error, or if there is no data to write back, just + * write back response. + */ + if (response != EC_RES_SUCCESS || write_count == 0) + break; + + /* Check that we can write all the data to the queue. */ + if (write_count > queue_space(&update_to_usb)) + return EC_RES_BUSY; + + QUEUE_ADD_UNITS(&update_to_usb, data, write_count); + return 1; + } #endif default: response = EC_RES_INVALID_COMMAND; |