summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Upham <sand@blarg.net>2009-05-21 00:15:28 -0700
committerPeter Hutterer <peter.hutterer@who-t.net>2009-07-30 09:44:33 +1000
commit4dda242d56a7830d5b44d7e58cf6a95f62a617ce (patch)
tree3c5ba30447f77833e77dfa9b82113d597a993af7
parent4efe0d272ed6ef7bda4cc005ad6033f2b1916fdc (diff)
evdev: Prevent driver from processing motion events that it has not configured. #21832
The current implementation initializes itself to support relative motion events, or absolute motion events, or neither. But the event-handling code attempts to process all events, no matter what the initialization was. This patch reproduces the flag tests found during init, to skip events that the driver doesn't support. Signed-off-by: Derek Upham <sand@blarg.net> Signed-off-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 0a3657d2ee62f4086e9687218cb33835ba61a0b3)
-rw-r--r--src/evdev.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 3a9fb0e..490fa44 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -362,6 +362,10 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
362 362
363 switch (ev->type) { 363 switch (ev->type) {
364 case EV_REL: 364 case EV_REL:
365 /* Ignore EV_REL events if we never set up for them. */
366 if (!(pEvdev->flags & EVDEV_RELATIVE_EVENTS))
367 break;
368
365 /* Handle mouse wheel emulation */ 369 /* Handle mouse wheel emulation */
366 if (EvdevWheelEmuFilterMotion(pInfo, ev)) 370 if (EvdevWheelEmuFilterMotion(pInfo, ev))
367 break; 371 break;
@@ -392,6 +396,10 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
392 break; 396 break;
393 397
394 case EV_ABS: 398 case EV_ABS:
399 /* Ignore EV_ABS events if we never set up for them. */
400 if (!(pEvdev->flags & EVDEV_ABSOLUTE_EVENTS))
401 break;
402
395 if (ev->code > ABS_MAX) 403 if (ev->code > ABS_MAX)
396 break; 404 break;
397 pEvdev->vals[pEvdev->axis_map[ev->code]] = value; 405 pEvdev->vals[pEvdev->axis_map[ev->code]] = value;
@@ -1179,9 +1187,13 @@ EvdevInit(DeviceIntPtr device)
1179 1187
1180 FIXME: somebody volunteer to fix this. 1188 FIXME: somebody volunteer to fix this.
1181 */ 1189 */
1182 if (pEvdev->flags & EVDEV_RELATIVE_EVENTS) 1190 if (pEvdev->flags & EVDEV_RELATIVE_EVENTS) {
1183 EvdevAddRelClass(device); 1191 EvdevAddRelClass(device);
1184 else if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS) 1192 if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)
1193 xf86Msg(X_INFO,"%s: relative axes found, ignoring absolute "
1194 "axes.\n", device->name);
1195 pEvdev->flags &= ~EVDEV_ABSOLUTE_EVENTS;
1196 } else if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)
1185 EvdevAddAbsClass(device); 1197 EvdevAddAbsClass(device);
1186 1198
1187#ifdef HAVE_PROPERTIES 1199#ifdef HAVE_PROPERTIES