From b3e56d049645a6cc148ff0670b525e29b3b553bc Mon Sep 17 00:00:00 2001 From: Harry Cutts Date: Wed, 18 Sep 2019 17:57:20 -0700 Subject: touchpad_gt7288: support touch width and height GT7288 firmware version 4 supports these dimensions. BRANCH=none BUG=none TEST=check output of `gt7288_rep` command, comparing palms and fingers. Change-Id: I9094d8f86f34e4f319a9743c246461853d0382cf Signed-off-by: Harry Cutts Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1815403 Reviewed-by: Daisuke Nojiri --- driver/touchpad_gt7288.c | 9 ++++++--- driver/touchpad_gt7288.h | 4 ++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/driver/touchpad_gt7288.c b/driver/touchpad_gt7288.c index 0b04cfbf5c..945f35c0d4 100644 --- a/driver/touchpad_gt7288.c +++ b/driver/touchpad_gt7288.c @@ -87,6 +87,8 @@ static void gt7288_translate_contact(const uint8_t *data, contact->confidence = data[3] & BIT(0); contact->x = UINT16_FROM_BYTE_ARRAY_LE(data, 4); contact->y = UINT16_FROM_BYTE_ARRAY_LE(data, 6); + contact->width = data[12]; + contact->height = data[13]; } static int gt7288_read(uint8_t *data, size_t max_length) @@ -214,12 +216,13 @@ static int command_gt7288_report(int argc, char **argv) if (report.num_contacts == 0) return EC_SUCCESS; - ccprintf("ID, X, Y, tip, confidence\n"); + ccprintf("ID, X, Y, width, height, tip, confidence\n"); for (i = 0; i < report.num_contacts; i++) { struct gt7288_contact *contact = &report.contacts[i]; - ccprintf("%2d, %4d, %4d, %3d, %10d\n", contact->id, contact->x, - contact->y, contact->tip, contact->confidence); + ccprintf("%2d, %4d, %4d, %5d, %6d, %3d, %10d\n", contact->id, + contact->x, contact->y, contact->width, + contact->height, contact->tip, contact->confidence); } return EC_SUCCESS; diff --git a/driver/touchpad_gt7288.h b/driver/touchpad_gt7288.h index 28a2e37d73..f3a8642fc3 100644 --- a/driver/touchpad_gt7288.h +++ b/driver/touchpad_gt7288.h @@ -38,6 +38,8 @@ int gt7288_get_version_info(struct gt7288_version_info *info); * @id: a 4-bit ID that uniquely identifies the contact during its lifecycle. * @x: the absolute X coordinate. * @y: the absolute Y coordinate. + * @width: the width of the contact (with firmware version 0x0004 or greater). + * @height: the height of the contact (with firmware version 0x0004 or greater). * @tip: whether the fingertip is touching the pad. (Currently always true.) * @confidence: whether the controller considers the touch a finger (true) or * palm (false). @@ -46,6 +48,8 @@ struct gt7288_contact { uint8_t id; uint16_t x; uint16_t y; + uint8_t width; + uint8_t height; bool tip; bool confidence; }; -- cgit v1.2.1