summaryrefslogtreecommitdiff
path: root/libevdev/libevdev.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2013-11-20 11:58:08 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2013-12-10 19:39:47 +1000
commit546efc783c7b952db1ebe6f10430ed7d73a2cb81 (patch)
treedbe47f19c6dfc9ce799dffc41abba7fc626756b6 /libevdev/libevdev.c
parent714c2ffa9e5891fe423212f623572c5dd6b7a04b (diff)
downloadlibevdev-546efc783c7b952db1ebe6f10430ed7d73a2cb81.tar.gz
Don't treat devices with (ABS_MT_SLOT - 1) as multitouch devices
Some devices (PS3 sixaxis controller) merely have a bunch of axes, without the semantic information that linux/input.h requires. For those, the ABS_MT range may be merely another axis, not the special range that we need to treat it with. Use a simple heuristic: if ABS_MT_SLOT - 1 is enabled, don't treat ABS_MT as multitouch axes. The ABS_MT_SLOT - 1 axis is not used for a real axis. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Diffstat (limited to 'libevdev/libevdev.c')
-rw-r--r--libevdev/libevdev.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
index 60bbbfc..8a37204 100644
--- a/libevdev/libevdev.c
+++ b/libevdev/libevdev.c
@@ -333,7 +333,12 @@ libevdev_set_fd(struct libevdev* dev, int fd)
goto out;
dev->abs_info[i] = abs_info;
- if (i == ABS_MT_SLOT) {
+
+ /* devices with ABS_MT_SLOT - 1 aren't MT devices,
+ see the documentation for multitouch-related
+ functions for more details */
+ if (i == ABS_MT_SLOT &&
+ !libevdev_has_event_code(dev, EV_ABS, ABS_MT_SLOT - 1)) {
dev->num_slots = abs_info.maximum + 1;
dev->current_slot = abs_info.value;
}
@@ -627,7 +632,7 @@ update_key_state(struct libevdev *dev, const struct input_event *e)
static int
update_mt_state(struct libevdev *dev, const struct input_event *e)
{
- if (e->code == ABS_MT_SLOT) {
+ if (e->code == ABS_MT_SLOT && dev->num_slots > -1) {
int i;
dev->current_slot = e->value;
/* sync abs_info with the current slot values */