From fe3175748af2b2d7c6aced04d9565afafe8ff270 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 27 May 2024 14:25:17 +1000 Subject: [PATCH] evdev: don't return a size for 0-1 axes Tablet pads historically need to have ABS_X/Y to be detected as tablets but their min/max values are 0 and 1. Let's not return a size for those. Part-of: --- src/evdev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/evdev.c b/src/evdev.c index 7ed3eab8..cd920672 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -2725,6 +2725,10 @@ evdev_device_get_size(const struct evdev_device *device, x = libevdev_get_abs_info(device->evdev, ABS_X); y = libevdev_get_abs_info(device->evdev, ABS_Y); + if ((x && x->minimum == 0 && x->maximum == 1) || + (y && y->minimum == 0 && y->maximum == 1)) + return -1; + if (!x || !y || device->abs.is_fake_resolution || !x->resolution || !y->resolution) return -1;