aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2015-03-11 14:58:04 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2015-03-11 15:21:09 +1000
commit38e107a39fb4a0b630ee5adb5870c91dbc27abde (patch)
tree0df1533ebf8ada59373e7df6567da369f08932d0
parentInvert two conditions to reduce nesting (diff)
downloadxf86-input-evdev-38e107a39fb4a0b630ee5adb5870c91dbc27abde.tar.gz
xf86-input-evdev-38e107a39fb4a0b630ee5adb5870c91dbc27abde.tar.bz2
xf86-input-evdev-38e107a39fb4a0b630ee5adb5870c91dbc27abde.zip
Disable axis faking and MT event processing on fake MT devices
This effectively disables all axes >= ABS_MT_SLOT on those devices. But at least the device comes up without an error and it didn't work correctly beforehand anyway. https://bugs.freedesktop.org/show_bug.cgi?id=89473 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--src/evdev.c15
-rw-r--r--src/evdev.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 7ce7405..639e4a1 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -696,6 +696,9 @@ EvdevProcessTouchEvent(InputInfoPtr pInfo, struct input_event *ev)
!libevdev_has_event_code(pEvdev->dev, EV_ABS, ABS_MT_SLOT))
return;
+ if (pEvdev->fake_mt)
+ return;
+
if (ev->code == ABS_MT_SLOT) {
EvdevProcessTouch(pInfo);
if (ev->value >= num_slots(pEvdev) ) {
@@ -1174,6 +1177,9 @@ EvdevAddFakeSingleTouchAxes(InputInfoPtr pInfo)
int num_axes = 0;
int i;
+ if (pEvdev->fake_mt)
+ return 0;
+
/* Android drivers often have ABS_MT_POSITION_X but not ABS_X.
Loop over the MT->legacy axis table and add fake axes. */
for (i = 0; i < ArrayLength(mt_axis_mappings); i++)
@@ -1207,6 +1213,9 @@ EvdevCountMTAxes(EvdevPtr pEvdev, int *num_mt_axes_total,
{
int axis;
+ if (pEvdev->fake_mt)
+ return;
+
/* Absolute multitouch axes: adjust mapping and axes counts. */
for (axis = ABS_MT_SLOT; axis < ABS_MAX; axis++)
{
@@ -2199,6 +2208,10 @@ EvdevProbe(InputInfoPtr pInfo)
}
}
+ if (libevdev_has_event_code(pEvdev->dev, EV_ABS, ABS_MT_SLOT) &&
+ libevdev_get_num_slots(pEvdev->dev) == -1)
+ pEvdev->fake_mt = TRUE;
+
if (ignore_abs && has_abs_axes)
{
xf86IDrvMsg(pInfo, X_INFO, "Absolute axes present but ignored.\n");
@@ -2220,6 +2233,8 @@ EvdevProbe(InputInfoPtr pInfo)
pEvdev->flags |= EVDEV_BUTTON_EVENTS;
}
}
+ if (pEvdev->fake_mt)
+ xf86IDrvMsg(pInfo, X_PROBED, "Fake MT device detected\n");
}
if ((libevdev_has_event_code(pEvdev->dev, EV_ABS, ABS_X) &&
diff --git a/src/evdev.h b/src/evdev.h
index 4aa7652..0f71d78 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -161,6 +161,7 @@ typedef struct {
enum SlotState state;
} *slots;
struct mtdev *mtdev;
+ BOOL fake_mt;
int flags;
int in_proximity; /* device in proximity */