From 2776581d0807ab9d75ad6969f76a18158564ea16 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 29 Jun 2015 14:20:20 +1000 Subject: [PATCH] tablet: fix check for rotation axis Only the cursor tool has rotation encoded as tilt, so if we don't have the mouse tool we don't have rotation. We still need to check for ABS_Z separately though. Crashes Waltop tablets that have tilt x/y but no cursor/lens tool. We'd thus never hit the rotation-z condition in tablet_check_notify_axes() and eventually try to dereference a non-existing ABS_Z axis. https://bugs.freedesktop.org/show_bug.cgi?id=90885 Signed-off-by: Peter Hutterer --- src/evdev-tablet.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c index a0ce5091..093c79f6 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -77,11 +77,18 @@ tablet_device_has_axis(struct tablet_dispatch *tablet, if (axis == LIBINPUT_TABLET_AXIS_ROTATION_Z) { has_axis = (libevdev_has_event_code(evdev, + EV_KEY, + BTN_TOOL_MOUSE) && + libevdev_has_event_code(evdev, EV_ABS, ABS_TILT_X) && libevdev_has_event_code(evdev, EV_ABS, ABS_TILT_Y)); + code = axis_to_evcode(axis); + has_axis |= libevdev_has_event_code(evdev, + EV_ABS, + code); } else if (axis == LIBINPUT_TABLET_AXIS_REL_WHEEL) { has_axis = libevdev_has_event_code(evdev, EV_REL,