aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-06-26 09:37:29 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-06-29 14:40:18 +1000
commitb07ab6ea97b779b26e7ae8326528c262cc9907a1 (patch)
treeeddcc954383fcbee47b099cb67afe457c7d0acc8
parentFix wrong axis label index causing OOB reads/writes. (diff)
downloadxf86-input-evdev-b07ab6ea97b779b26e7ae8326528c262cc9907a1.tar.gz
xf86-input-evdev-b07ab6ea97b779b26e7ae8326528c262cc9907a1.tar.bz2
xf86-input-evdev-b07ab6ea97b779b26e7ae8326528c262cc9907a1.zip
If a device fails to initialize relative axes, init the abs. axes instead.
Some devices have relative axes that don't count (scroll wheels). In this case, don't claim we've initialized relative axes, continue with the absolute axes instead. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/evdev.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 12c3e0d..a74a72d 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1096,6 +1096,9 @@ EvdevAddRelClass(DeviceIntPtr device)
if (TestBit(REL_DIAL, pEvdev->rel_bitmask))
num_axes--;
+ if (num_axes <= 0)
+ return !Success;
+
pEvdev->num_vals = num_axes;
memset(pEvdev->vals, 0, num_axes * sizeof(int));
atoms = xalloc(pEvdev->num_vals * sizeof(Atom));
@@ -1251,12 +1254,17 @@ EvdevInit(DeviceIntPtr device)
FIXME: somebody volunteer to fix this.
*/
if (pEvdev->flags & EVDEV_RELATIVE_EVENTS) {
- EvdevAddRelClass(device);
- 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)
+ if (EvdevAddRelClass(device) == Success)
+ {
+ 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
+ pEvdev->flags &= ~EVDEV_RELATIVE_EVENTS;
+ }
+
+ if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)
EvdevAddAbsClass(device);
#ifdef HAVE_PROPERTIES