From a62364082aeec7602401c4cf34011ad8b7402f6a Mon Sep 17 00:00:00 2001 From: Amy Bowersox Date: Wed, 11 Dec 2019 12:31:32 -0700 Subject: [PATCH] try to fix the coordinates returned by touch events --- src/sysinput.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/sysinput.c b/src/sysinput.c index a616063..cdc0d01 100644 --- a/src/sysinput.c +++ b/src/sysinput.c @@ -11,6 +11,7 @@ #include "log.h" #include "msg_queue.h" #include "gpio.h" +#include "fbinit.h" #include "time_func.h" #define INPUT_EVENT_BATCH 16 /* number of events to retrieve from touchscreen at once */ @@ -130,10 +131,12 @@ static BOOL poll_touchscreen(void) break; case EV_ABS: + /* Note that the touchscreen driver assumes the screen is "vertical," so swap the x and y axes */ + /* Also it thinks origin is lower left with up = +y */ if (buffer[i].code == ABS_X) - touch_x = buffer[i].value; + touch_y = Fb_Info->height - buffer[i].value; else if (buffer[i].code == ABS_Y) - touch_y = buffer[i].value; + touch_x = buffer[i].value; break; case EV_KEY: