summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-09-30 12:05:17 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-10-07 12:55:22 +1000
commit941391ca34a7537542f0bb894fc0f02e200165b4 (patch)
tree577213d3cd91e48eb6207304dc335e5b12cdcdd7
parent2144f7d83426136cc1a9de2fafb302683645c6da (diff)
Add explicit options to ignore relative or absolute axes.
The X server cannot deal with devices that have both relative and absolute axes. Evdev tries to guess wich axes to ignore given the device type and disables absolute axes for mice and relative axes for tablets, touchscreens and touchpad. This guess is sometimes wrong and causes exitus felis domesticae parvulae. Two new configuration options are provided to explicitly allow ignoring an axis. Mouse wheel axes are exempt and will work even if relative axes are ignored. No property, this option must be set in the configuration. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Daniel Stone <daniel@fooishbar.org>
-rw-r--r--man/evdev.man11
-rw-r--r--src/evdev.c31
2 files changed, 34 insertions, 8 deletions
diff --git a/man/evdev.man b/man/evdev.man
index c3c5551..4f15062 100644
--- a/man/evdev.man
+++ b/man/evdev.man
@@ -135,6 +135,17 @@ Default: disabled.
.BI "Option \*qInvertY\*q \*q" Bool \*q
Invert the given axis. Default: off. Property: "Evdev Axis Inversion".
.TP 7
+.BI "Option \*qIgnoreRelativeAxes\*q \*q" Bool \*q
+.TP 7
+.BI "Option \*qIgnoreAbsoluteAxes\*q \*q" Bool \*q
+Ignore the specified type of axis. Default: off. The X server cannot deal
+with devices that have both relative and absolute axes. Evdev tries to guess
+wich axes to ignore given the device type and disables absolute axes for
+mice and relative axes for tablets, touchscreens and touchpad. These options
+allow to forcibly disable an axis type. Mouse wheel axes are exempt and will
+work even if relative axes are ignored. No property, this configuration must
+be set in the configuration.
+.TP 7
.BI "Option \*qReopenAttempts\*q \*q" integer \*q
Number of reopen attempts after a read error occurs on the device (e.g. after
waking up from suspend). In between each attempt is a 100ms wait. Default: 10.
diff --git a/src/evdev.c b/src/evdev.c
index 2b41343..59cdd0d 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1776,6 +1776,7 @@ EvdevProbe(InputInfoPtr pInfo)
{
int i, has_rel_axes, has_abs_axes, has_keys, num_buttons, has_scroll;
int kernel24 = 0;
+ int ignore_rel, ignore_abs;
EvdevPtr pEvdev = pInfo->private;
if (pEvdev->grabDevice && ioctl(pInfo->fd, EVIOCGRAB, (void *)1)) {
@@ -1791,6 +1792,9 @@ EvdevProbe(InputInfoPtr pInfo)
ioctl(pInfo->fd, EVIOCGRAB, (void *)0);
}
+ ignore_rel = xf86SetBoolOption(pInfo->options, "IgnoreRelativeAxes", FALSE);
+ ignore_abs = xf86SetBoolOption(pInfo->options, "IgnoreAbsoluteAxes", FALSE);
+
has_rel_axes = FALSE;
has_abs_axes = FALSE;
has_keys = FALSE;
@@ -1825,13 +1829,6 @@ EvdevProbe(InputInfoPtr pInfo)
}
if (has_rel_axes) {
- xf86Msg(X_INFO, "%s: found relative axes\n", pInfo->name);
- pEvdev->flags |= EVDEV_RELATIVE_EVENTS;
- if (TestBit(REL_X, pEvdev->rel_bitmask) &&
- TestBit(REL_Y, pEvdev->rel_bitmask)) {
- xf86Msg(X_INFO, "%s: Found x and y relative axes\n", pInfo->name);
- }
-
if (TestBit(REL_WHEEL, pEvdev->rel_bitmask) ||
TestBit(REL_HWHEEL, pEvdev->rel_bitmask) ||
TestBit(REL_DIAL, pEvdev->rel_bitmask)) {
@@ -1843,6 +1840,20 @@ EvdevProbe(InputInfoPtr pInfo)
num_buttons = (num_buttons < 3) ? 7 : num_buttons + 4;
pEvdev->num_buttons = num_buttons;
}
+
+ if (!ignore_rel)
+ {
+ xf86Msg(X_INFO, "%s: found relative axes\n", pInfo->name);
+ pEvdev->flags |= EVDEV_RELATIVE_EVENTS;
+
+ if (TestBit(REL_X, pEvdev->rel_bitmask) &&
+ TestBit(REL_Y, pEvdev->rel_bitmask)) {
+ xf86Msg(X_INFO, "%s: Found x and y relative axes\n", pInfo->name);
+ }
+ } else {
+ xf86Msg(X_INFO, "%s: relative axes present but ignored.\n", pInfo->name);
+ has_rel_axes = FALSE;
+ }
}
for (i = 0; i < ABS_MAX; i++) {
@@ -1852,7 +1863,11 @@ EvdevProbe(InputInfoPtr pInfo)
}
}
- if (has_abs_axes) {
+ if (ignore_abs && has_abs_axes)
+ {
+ xf86Msg(X_INFO, "%s: absolute axes present but ignored.\n", pInfo->name);
+ has_abs_axes = FALSE;
+ } else if (has_abs_axes) {
xf86Msg(X_INFO, "%s: found absolute axes\n", pInfo->name);
pEvdev->flags |= EVDEV_ABSOLUTE_EVENTS;