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>
master
Peter Hutterer 17 years ago
parent 2144f7d834
commit 941391ca34
  1. 11
      man/evdev.man
  2. 31
      src/evdev.c

@ -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.

@ -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;

Loading…
Cancel
Save