diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-08-04 16:32:49 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-08-26 09:25:15 +1000 |
commit | db7b76a8aa677e8f26902d3d6def80a39b1da8fb (patch) | |
tree | 06d58b476d7f9e75c64e17a5db36503620f91285 | |
parent | 76ae794b4fe85e820b7548f2d0dd3498c86556ce (diff) |
synaptics: Modify the event sequence a bit for wider testing.
-rw-r--r-- | src/synaptics.c | 86 |
1 files changed, 65 insertions, 21 deletions
diff --git a/src/synaptics.c b/src/synaptics.c index 54271cb..056657c 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -79,37 +79,81 @@ error: return -1; } +static void touch(int fd) +{ + send_event(fd, EV_KEY, BTN_TOOL_FINGER, 1); + send_event(fd, EV_KEY, BTN_TOUCH, 1); + send_event(fd, EV_ABS, ABS_PRESSURE, 75); +} +static void release(int fd) +{ + send_event(fd, EV_KEY, BTN_TOOL_FINGER, 0); + send_event(fd, EV_KEY, BTN_TOUCH, 0); + send_event(fd, EV_ABS, ABS_PRESSURE, 0); + send_event(fd, EV_SYN, SYN_REPORT, 0); +} +static void scroll(int fd, int x[3], int y[3]) +{ + touch(fd); + absmove(fd, x[0], y[0]); + usleep(2000); + absmove(fd, x[1], y[1]); + usleep(2000); + absmove(fd, x[2], y[2]); + usleep(2000); + release(fd); + usleep(2000); +} + static int synaptics_run(int fd) { #define xmin 2000 -#define xmax 5000 +#define xmax 8000 #define ymin 2000 -#define ymax 4000 +#define ymax 8000 + static int once = 0; - static int x = xmin, y = ymin, direction = 10; + int x[3] = { 6210, 6220, 6200}, + y[3] = { 2000, 2200, 2300}; - send_event(fd, EV_KEY, BTN_TOOL_FINGER, 1); - send_event(fd, EV_KEY, BTN_TOUCH, 1); - send_event(fd, EV_ABS, ABS_PRESSURE, 75); - absmove(fd, x, y); - while(x >= xmin && x <= xmax && y >= ymin && y <= ymax) + if (!once) { - x += direction; - y += direction; - absmove(fd, x, y); - usleep(200); + once++; + + x[0] -= 1000; + x[1] -= 1000; + x[2] -= 1000; + scroll(fd, x, y); + x[0] += 1000; + x[1] += 1000; + x[2] += 1000; + + + { + static int x = xmin, y = ymin, direction = 10; + + touch(fd); + absmove(fd, 5210, 2000); + sleep(1); + + absmove(fd, x, y); + + while(x >= xmin && x <= xmax && y >= ymin && y <= ymax) + { + x += direction; + /*y += direction;*/ + absmove(fd, x, y); + usleep(200); + } + + x -= direction * 2; + y -= direction * 2; + release(fd); + } } - x -= direction * 2; - y -= direction * 2; - - direction *= -1; - - send_event(fd, EV_KEY, BTN_TOOL_FINGER, 0); - send_event(fd, EV_KEY, BTN_TOUCH, 0); - send_event(fd, EV_ABS, ABS_PRESSURE, 0); - send_event(fd, EV_SYN, SYN_REPORT, 0); + scroll(fd, x, y); sleep(1); return 0; |