From 6e21fed525c2879aca92925de7ed6015eeaa9a77 Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Tue, 10 Nov 2020 18:28:30 +0800 Subject: [PATCH] tune --- src/ial/singletouchkey.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/ial/singletouchkey.c b/src/ial/singletouchkey.c index cda411f0..e6f2156d 100644 --- a/src/ial/singletouchkey.c +++ b/src/ial/singletouchkey.c @@ -74,8 +74,18 @@ static int get_touch_data (short *x, short *y, short *button) while (read (sg_tp_event_fd, &data, sizeof (data)) == sizeof (data)) { - if (data.type == EV_SYN && data.code == SYN_REPORT) { - /* return for end of touch data sequece. */ + /* return for end of touch data sequece. */ + if (data.type == EV_SYN) { + switch (data.code) { + case SYN_REPORT: + case SYN_MT_REPORT: + break; + case SYN_DROPPED: + default: + /* do not update */ + return -1; + } + return 0; } @@ -98,6 +108,14 @@ static int get_touch_data (short *x, short *y, short *button) } else if (data.type == EV_ABS) { switch (data.code) { + case ABS_X: + *x = data.value; + break; + + case ABS_Y: + *y = data.value; + break; + case ABS_MT_POSITION_X: *x = data.value; break; @@ -117,7 +135,7 @@ static int get_touch_data (short *x, short *y, short *button) default: _WRN_PRINTF ("unknow event code for EV_ABS event: %x, %x.\n", data.code, data.value); - return -1; + break; } } }