ABC turbo
[picodrive.git] / platform / gp2x / gp2x.c
index 78e8561..80b0486 100644 (file)
@@ -231,6 +231,7 @@ typedef struct ucb1x00_ts_event
 int gp2x_touchpad_read(int *x, int *y)\r
 {\r
        UCB1X00_TS_EVENT event;\r
+       static int zero_seen = 0;\r
        int retval;\r
 \r
        if (touchdev < 0) return -1;\r
@@ -240,12 +241,14 @@ int gp2x_touchpad_read(int *x, int *y)
                printf("touch read failed %i %i\n", retval, errno);\r
                return -1;\r
        }\r
+       // this is to ignore the messed-up 4.1.x driver\r
+       if (retval == 0) zero_seen = 1;\r
 \r
        if (x) *x = (event.x * touchcal[0] + touchcal[2]) >> 16;\r
        if (y) *y = (event.y * touchcal[4] + touchcal[5]) >> 16;\r
        // printf("read %i %i %i\n", event.pressure, *x, *y);\r
 \r
-       return event.pressure;\r
+       return zero_seen ? event.pressure : 0;\r
 }\r
 \r
 \r