From 831e1664d61f80dca149d62d8571fbb7dd47ce8c Mon Sep 17 00:00:00 2001 From: Davide Depau Date: Tue, 17 Apr 2018 15:22:42 +0200 Subject: [PATCH] evdev: don't suspend keyboard on ThinkPad X1 Yoga 1st in tablet mode When the X1 Yoga is in tablet mode, one capacitative touch button (windows key, sends KEY_LEFTMETA) and two side volume buttons are accessible on the front. The key event comes through the internal keyboard that we disabled in tablet mode so it stops working. Luckily the Yoga physically disables the "main" keyboard when in tablet mode, so all we have to do is skip our code to disable the keyboard and the keys are working again. https://bugs.freedesktop.org/show_bug.cgi?id=103749 Signed-off-by: Peter Hutterer (cherry picked from commit 5feaa5f00ce31a927924a6346706bf93451fa704) --- src/evdev-fallback.c | 3 +++ src/evdev.c | 1 + src/evdev.h | 1 + udev/90-libinput-model-quirks.hwdb | 5 +++++ 4 files changed, 10 insertions(+) diff --git a/src/evdev-fallback.c b/src/evdev-fallback.c index 8a11c68a..974fb941 100644 --- a/src/evdev-fallback.c +++ b/src/evdev-fallback.c @@ -1175,6 +1175,9 @@ fallback_keyboard_pair_tablet_mode(struct evdev_device *keyboard, (EVDEV_TAG_TRACKPOINT|EVDEV_TAG_INTERNAL_KEYBOARD)) == 0) return; + if (keyboard->model_flags & EVDEV_MODEL_TABLET_MODE_NO_SUSPEND) + return; + if ((tablet_mode_switch->tags & EVDEV_TAG_TABLET_MODE_SWITCH) == 0) return; diff --git a/src/evdev.c b/src/evdev.c index 13b2b13c..08645ad5 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1272,6 +1272,7 @@ evdev_read_model_flags(struct evdev_device *device) MODEL(LOGITECH_MARBLE_MOUSE), MODEL(TABLET_NO_PROXIMITY_OUT), MODEL(MS_NANO_TRANSCEIVER), + MODEL(TABLET_MODE_NO_SUSPEND), #undef MODEL { "ID_INPUT_TRACKBALL", EVDEV_MODEL_TRACKBALL }, { NULL, EVDEV_MODEL_DEFAULT }, diff --git a/src/evdev.h b/src/evdev.h index 496bea7f..68a331dd 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -126,6 +126,7 @@ enum evdev_device_model { EVDEV_MODEL_LOGITECH_MARBLE_MOUSE = (1 << 26), EVDEV_MODEL_TABLET_NO_PROXIMITY_OUT = (1 << 27), EVDEV_MODEL_MS_NANO_TRANSCEIVER = (1 << 28), + EVDEV_MODEL_TABLET_MODE_NO_SUSPEND = (1 << 30), }; enum evdev_button_scroll_state { diff --git a/udev/90-libinput-model-quirks.hwdb b/udev/90-libinput-model-quirks.hwdb index 66f21301..5f039bfe 100644 --- a/udev/90-libinput-model-quirks.hwdb +++ b/udev/90-libinput-model-quirks.hwdb @@ -234,6 +234,11 @@ libinput:keyboard:input:b0003v17EFp6047* libinput:name:*ALPS TrackPoint*:svnLENOVO:*:pvrThinkPadX280:* LIBINPUT_ATTR_TRACKPOINT_RANGE=70 +# Lenovo Thinkpad X1 Yoga disables the keyboard anyway but has the same device +# use a windows key on the screen and volume rocker on the side (#103749) +libinput:name:AT Translated Set 2 keyboard:dmi:*svnLENOVO:*pvrThinkPadX1Yoga1st:* + LIBINPUT_MODEL_TABLET_MODE_NO_SUSPEND=1 + ########################################## # Logitech ##########################################