summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWei-Han Chen <stimim@google.com>2018-07-04 14:26:21 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-07-04 09:09:06 -0700
commit2a4590d2aa85a31c4a5bf5c535584c82ed98349a (patch)
treefbf0ff488659065abae816862f54206d65ac0f33
parent925798c329cd6780663144ca9d90dbfa90560b1b (diff)
downloadchrome-ec-2a4590d2aa85a31c4a5bf5c535584c82ed98349a.tar.gz
whiskers touchpad: adjust value range
1. In usb_hid_touchpad.h, `pressure` is defined as unsigned:10, while in touchpad_st.h, `z` is defined as unsigned:8, scale it up to match size of `pressure`. 3. Scale up `width` and `height` for similar reason. 2. Update physical dimension, so it match the real device. With this change, I can use EC touchpad on my Linux machine. BRANCH=none BUG=b:70482333 TEST=tested on Linux Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I651f2345ea48c7c9ed495e9684b762bde167092e Reviewed-on: https://chromium-review.googlesource.com/1125652 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
-rw-r--r--board/hammer/board.h4
-rw-r--r--driver/touchpad_st.c8
2 files changed, 7 insertions, 5 deletions
diff --git a/board/hammer/board.h b/board/hammer/board.h
index aa5678f5d2..0eb75112fb 100644
--- a/board/hammer/board.h
+++ b/board/hammer/board.h
@@ -203,8 +203,8 @@
#elif defined(BOARD_WHISKERS)
#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_X 2160
#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_Y 1080
-#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X 1000 /* tenth of mm */
-#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y 500 /* tenth of mm */
+#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X 1030 /* tenth of mm */
+#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y 750 /* tenth of mm */
#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (128*1024)
#else
#error "No touchpad information for board."
diff --git a/driver/touchpad_st.c b/driver/touchpad_st.c
index 2be3c51a6b..ac47d081d4 100644
--- a/driver/touchpad_st.c
+++ b/driver/touchpad_st.c
@@ -107,11 +107,13 @@ static int st_tp_parse_finger(struct usb_hid_touchpad_report *report,
report->finger[i].tip = 1;
report->finger[i].inrange = 1;
report->finger[i].id = event->finger.touch_id;
- report->finger[i].pressure = event->finger.z;
+ /* z is 8 bit uint, while pressure is 10 bits. */
+ report->finger[i].pressure = event->finger.z << 2;
+ /* width and height are 12 bits, ST only reports 6 bits */
report->finger[i].width = (event->finger.minor |
- (event->minor_high << 4));
+ (event->minor_high << 4)) << 6;
report->finger[i].height = (event->finger.major |
- (event->major_high << 4));
+ (event->major_high << 4)) << 6;
report->finger[i].x = (CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_X -
event->finger.x);
report->finger[i].y = (CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_Y -