touchpad_elan: Discard zero finger clicks

Do not report click events when no finger is present on the touchpad.

BRANCH=none
BUG=b:65098167
TEST=Bend case, hear click, but no event reported in evtest.

Change-Id: I0385213102dab0775e1b6906cb3a45933deac757
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/637288
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Nicolas Boichat
2017-08-28 11:11:39 +08:00
committed by chrome-bot
parent 17bb1fbaa9
commit 72252db342

View File

@@ -154,13 +154,6 @@ static int elan_tp_read_report(void)
touch_info = tp_buf[ETP_TOUCH_INFO_OFFSET];
hover_info = tp_buf[ETP_HOVER_INFO_OFFSET];
if (touch_info & 0x01)
report.button = 1;
if (hover_info & 0x40) {
/* TODO(crosbug.com/p/59083): Report hover event */
CPRINTF("[TP] hover!\n");
}
for (i = 0; i < ETP_MAX_FINGERS; i++) {
int valid = touch_info & (1 << (3+i));
@@ -199,6 +192,17 @@ static int elan_tp_read_report(void)
report.count = ri;
report.timestamp = timestamp;
if (touch_info & 0x01) {
/* Do not report zero-finger click events */
if (report.count > 0)
report.button = 1;
}
if (hover_info & 0x40) {
/* TODO(b/35582031): Report hover event */
CPRINTF("[TP] hover!\n");
}
set_touchpad_report(&report);
return 0;