diff options
author | Derek Upham <sand@blarg.net> | 2009-05-21 00:15:28 -0700 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-28 08:53:56 +1000 |
commit | 0a3657d2ee62f4086e9687218cb33835ba61a0b3 (patch) | |
tree | 2a30ebd462a8c0f4e4e64251753a5f285cfcf167 /src | |
parent | dc2191285e799be891787e1f64d10c1cba271240 (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>
Diffstat (limited to 'src')
-rw-r--r-- | src/evdev.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/evdev.c b/src/evdev.c index 7d30a64..e7c3e30 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -363,6 +363,10 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev) switch (ev->type) { case EV_REL: + /* Ignore EV_REL events if we never set up for them. */ + if (!(pEvdev->flags & EVDEV_RELATIVE_EVENTS)) + break; + /* Handle mouse wheel emulation */ if (EvdevWheelEmuFilterMotion(pInfo, ev)) break; @@ -393,6 +397,10 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev) break; case EV_ABS: + /* Ignore EV_ABS events if we never set up for them. */ + if (!(pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)) + break; + if (ev->code > ABS_MAX) break; pEvdev->vals[pEvdev->axis_map[ev->code]] = value; @@ -1199,9 +1207,13 @@ EvdevInit(DeviceIntPtr device) FIXME: somebody volunteer to fix this. */ - if (pEvdev->flags & EVDEV_RELATIVE_EVENTS) + if (pEvdev->flags & EVDEV_RELATIVE_EVENTS) { EvdevAddRelClass(device); - else if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS) + if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS) + xf86Msg(X_INFO,"%s: relative axes found, ignoring absolute " + "axes.\n", device->name); + pEvdev->flags &= ~EVDEV_ABSOLUTE_EVENTS; + } else if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS) EvdevAddAbsClass(device); #ifdef HAVE_PROPERTIES |