mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 04:40:25 +01:00
evdev: fix handling of fake MT devices without ABS_X/Y
The previous code didn't handle fake MT devices without ABS_X/Y axes (like the Razer BlackWidow keyboard). Those devices usually start at ABS_MISC and go up to ABS_MAX, thus triggering the Android check. Split the condition up: if the device is not a fake MT device we check for the Android missing axes first and add them. Then we proceed, but now we know that the ABS_X axis must exist on any valid device. https://bugs.freedesktop.org/show_bug.cgi?id=89783 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
67208c0b1a
commit
e2b13e6022
1 changed files with 17 additions and 8 deletions
25
src/evdev.c
25
src/evdev.c
|
|
@ -1431,6 +1431,18 @@ evdev_device_get_udev_tags(struct evdev_device *device,
|
|||
return tags;
|
||||
}
|
||||
|
||||
/* 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 */
|
||||
static inline bool
|
||||
evdev_is_fake_mt_device(struct evdev_device *device)
|
||||
{
|
||||
struct libevdev *evdev = device->evdev;
|
||||
|
||||
return libevdev_has_event_code(evdev, EV_ABS, ABS_MT_SLOT) &&
|
||||
libevdev_get_num_slots(evdev) == -1;
|
||||
}
|
||||
|
||||
static inline void
|
||||
evdev_fix_android_mt(struct evdev_device *device)
|
||||
{
|
||||
|
|
@ -1441,7 +1453,8 @@ evdev_fix_android_mt(struct evdev_device *device)
|
|||
return;
|
||||
|
||||
if (!libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X) ||
|
||||
!libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_Y))
|
||||
!libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_Y) ||
|
||||
evdev_is_fake_mt_device(device))
|
||||
return;
|
||||
|
||||
libevdev_enable_event_code(evdev, EV_ABS, ABS_X,
|
||||
|
|
@ -1611,10 +1624,10 @@ evdev_configure_device(struct evdev_device *device)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (libevdev_has_event_code(evdev, EV_ABS, ABS_X) ||
|
||||
libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X)) {
|
||||
if (!evdev_is_fake_mt_device(device))
|
||||
evdev_fix_android_mt(device);
|
||||
|
||||
if (libevdev_has_event_code(evdev, EV_ABS, ABS_X)) {
|
||||
if (evdev_fix_abs_resolution(device,
|
||||
ABS_X,
|
||||
ABS_Y,
|
||||
|
|
@ -1624,11 +1637,7 @@ evdev_configure_device(struct evdev_device *device)
|
|||
device->abs.absinfo_x = libevdev_get_abs_info(evdev, ABS_X);
|
||||
device->abs.absinfo_y = libevdev_get_abs_info(evdev, ABS_Y);
|
||||
|
||||
/* 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) {
|
||||
if (evdev_is_fake_mt_device(device)) {
|
||||
udev_tags &= ~EVDEV_UDEV_TAG_TOUCHSCREEN;
|
||||
} else if (evdev_configure_mt_device(device) == -1) {
|
||||
return -1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue