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 <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2015-06-29 14:20:20 +10:00
parent e5fe164bcf
commit 2776581d08

View file

@ -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,