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: