1 This patch adds support for "EVIOCGRAB" on the input device, which
2 tells the kernel _not_ to deliver events of the touchscreen to
5 This is probably what most people want, since unprocessed raw touchscreen
6 events should not be converted to emulated PS/2 mouse movements.
8 Signed-off-by: Harald Welte <laforge@openmoko.org>
10 Index: a/plugins/input-raw.c
11 ===================================================================
12 --- a/plugins/input-raw.c (revision 49)
13 +++ b/plugins/input-raw.c (working copy)
24 #include "tslib-private.h"
26 +#define GRAB_EVENTS_WANTED 1
27 +#define GRAB_EVENTS_ACTIVE 2
30 struct tslib_module_info module;
39 static int check_fd(struct tslib_input *i)
42 if (bit & (1 << EV_SYN))
45 + if (i->grab_events == GRAB_EVENTS_WANTED) {
46 + if (ioctl(ts->fd, EVIOCGRAB, (void *)1)) {
47 + fprintf(stderr, "Unable to grab selected input device\n");
50 + i->grab_events = GRAB_EVENTS_ACTIVE;
57 static int ts_input_fini(struct tslib_module_info *inf)
59 + struct tslib_input *i = (struct tslib_input *)inf;
60 + struct tsdev *ts = inf->dev;
62 + if (i->grab_events == GRAB_EVENTS_ACTIVE) {
63 + if (ioctl(ts->fd, EVIOCGRAB, (void *)0)) {
64 + fprintf(stderr, "Unable to un-grab selected input device\n");
72 .fini = ts_input_fini,
75 +static int parse_raw_grab(struct tslib_module_info *inf, char *str, void *data)
77 + struct tslib_input *i = (struct tslib_input *)inf;
81 + v = strtoul(str, NULL, 0);
83 + if (v == ULONG_MAX && errno == ERANGE)
87 + switch ((int)data) {
90 + i->grab_events = GRAB_EVENTS_WANTED;
98 +static const struct tslib_vars raw_vars[] =
100 + { "grab_events", (void *)1, parse_raw_grab },
103 +#define NR_VARS (sizeof(raw_vars) / sizeof(raw_vars[0]))
105 TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
107 struct tslib_input *i;
112 + i->grab_events = 0;
114 + if (tslib_parse_vars(&i->module, raw_vars, NR_VARS, params)) {