From 5ad960b37e35d1f6cfa9a24d56632823438e6357 Mon Sep 17 00:00:00 2001 From: Derek Upham Date: Thu, 21 May 2009 00:15:28 -0700 Subject: [PATCH] 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 --- src/evdev.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index 7d30a64..85feefd 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,12 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev) break; case EV_ABS: + /* Ignore EV_ABS events if we never set up for them + (which can happen for either of these two reasons). */ + if ((pEvdev->flags & EVDEV_RELATIVE_EVENTS) || + !(pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)) + break; + if (ev->code > ABS_MAX) break; pEvdev->vals[pEvdev->axis_map[ev->code]] = value; -- 1.6.3