X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=gp2x%2Fgp2x.c;fp=gp2x%2Fgp2x.c;h=80b0486c65fbbfdfade08ef3253749ad9ba4217d;hb=6589c840ca686751d15ebb127367af1378dd7de2;hp=78e8561f857034c6a6bf16d7876238bfd3e4d2d9;hpb=1b38d64b02ec1d823c9783b3f12aea6f51565e35;p=libpicofe.git diff --git a/gp2x/gp2x.c b/gp2x/gp2x.c index 78e8561..80b0486 100644 --- a/gp2x/gp2x.c +++ b/gp2x/gp2x.c @@ -231,6 +231,7 @@ typedef struct ucb1x00_ts_event int gp2x_touchpad_read(int *x, int *y) { UCB1X00_TS_EVENT event; + static int zero_seen = 0; int retval; if (touchdev < 0) return -1; @@ -240,12 +241,14 @@ int gp2x_touchpad_read(int *x, int *y) printf("touch read failed %i %i\n", retval, errno); return -1; } + // this is to ignore the messed-up 4.1.x driver + if (retval == 0) zero_seen = 1; if (x) *x = (event.x * touchcal[0] + touchcal[2]) >> 16; if (y) *y = (event.y * touchcal[4] + touchcal[5]) >> 16; // printf("read %i %i %i\n", event.pressure, *x, *y); - return event.pressure; + return zero_seen ? event.pressure : 0; }