diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-04-24 13:35:52 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-04-24 15:26:46 +0200 |
commit | 7665457d70a37c3187b3dfcc54a7f15058e8acba (patch) | |
tree | ea0869dbc3849a86bb3752dedb31f13615c8b515 /src | |
parent | 1eae0e35655ffddb8a203a51bb1e2aa53928a87e (diff) |
Support 2.6.x kernels.
Diffstat (limited to 'src')
-rw-r--r-- | src/acecad.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/acecad.c b/src/acecad.c index 145bb48..abe8bf8 100644 --- a/src/acecad.c +++ b/src/acecad.c @@ -37,6 +37,10 @@ #ifdef LINUX_INPUT #include <asm/types.h> #include <linux/input.h> +#ifndef EV_SYN +#define EV_SYN EV_RST +#define SYN_REPORT 0 +#endif #ifdef BUS_PCI #undef BUS_PCI #endif @@ -663,6 +667,10 @@ USBReadInput (LocalDevicePtr local) event<(struct input_event *)(eventbuf+len); event++) { switch (event->type) { + case EV_SYN: /* 2.6.x */ + if (event->code != SYN_REPORT) + xf86Msg(X_ERROR, "UNKNOWN EV_SYN code %d\n", event->code); + break; case EV_ABS: switch (event->code) { case ABS_X: @@ -703,12 +711,16 @@ USBReadInput (LocalDevicePtr local) } break; /* EV_KEY */ default: - xf86Msg(X_ERROR, "UNKNOWN event type/code=%d/%d\n", event->type, event->code); + xf86Msg(X_ERROR, "UNKNOWN event type/code %d/%d\n", event->type, event->code); } /* switch event->type */ - /* ABS_MISC is the event terminator */ - if (event->type != EV_ABS || event->code != ABS_MISC) { - continue; + /* Linux Kernel 2.6.x sends EV_SYN/SYN_REPORT as an event terminator, + * whereas 2.4.x sends EV_ABS/ABS_MISC. We have to support both. + */ + if (!( (event->type == EV_SYN && event->code == SYN_REPORT) || + (event->type == EV_ABS && event->code == ABS_MISC) + )) { + continue; } if (prox) |