mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-13 01:30:30 +01:00
evdev: handle fake MT devices
The kernel requires absolute axes to fit into the semantic ABS_ naming scheme but doesn't provide enough free bits unlabelled axes. Devices with many axes run into the ABS_MT range and look like MT devices when they're not. See http://www.freedesktop.org/software/libevdev/doc/1.3/group__mt.html Affected is e.g. the MS Surface 2 touch cover that has codes [41, 62] set for min/max [-127, 127]. No special handling needed other than forcing has_mt/has_touch to be 0. ABS_MT_* events from non-touch devices are discarded by libinput. The has_mt/has_touch = 0 isn't needed, but looks nicer than an empty if body. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=85836 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
01cc70ff58
commit
f04f58213f
1 changed files with 9 additions and 1 deletions
10
src/evdev.c
10
src/evdev.c
|
|
@ -1095,7 +1095,15 @@ evdev_configure_device(struct evdev_device *device)
|
|||
device->abs.absinfo_y = absinfo;
|
||||
has_abs = 1;
|
||||
}
|
||||
if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X) &&
|
||||
|
||||
/* Fake MT devices have the ABS_MT_SLOT bit set because of
|
||||
the limited ABS_* range - they aren't MT devices, they
|
||||
just have too many ABS_ axes */
|
||||
if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_SLOT) &&
|
||||
libevdev_get_num_slots(evdev) == -1) {
|
||||
has_mt = 0;
|
||||
has_touch = 0;
|
||||
} else if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X) &&
|
||||
libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_Y)) {
|
||||
absinfo = libevdev_get_abs_info(evdev, ABS_MT_POSITION_X);
|
||||
if (evdev_fix_abs_resolution(evdev,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue