From 91b7f759da0fa6c6a274780502d78eb6b2fa7014 Mon Sep 17 00:00:00 2001 From: Davide Depau Date: Tue, 20 Mar 2018 18:07:08 +0100 Subject: [PATCH] evdev: don't suspend keyboard on the 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 --- src/evdev-fallback.c | 4 +++- src/evdev.c | 1 + src/evdev.h | 3 ++- udev/90-libinput-model-quirks.hwdb | 5 +++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/evdev-fallback.c b/src/evdev-fallback.c index 269b3f5a..af1e117b 100644 --- a/src/evdev-fallback.c +++ b/src/evdev-fallback.c @@ -1151,8 +1151,10 @@ fallback_tablet_mode_switch_event(uint64_t time, swev = libinput_event_get_switch_event(event); if (libinput_event_switch_get_switch(swev) != LIBINPUT_SWITCH_TABLET_MODE) - return; + return; + if (device->model_flags & EVDEV_MODEL_TABLET_MODE_NO_SUSPEND) + return; switch (libinput_event_switch_get_switch_state(swev)) { case LIBINPUT_SWITCH_STATE_OFF: diff --git a/src/evdev.c b/src/evdev.c index b5fedf09..338fcda0 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1272,6 +1272,7 @@ evdev_read_model_flags(struct evdev_device *device) MODEL(TABLET_NO_PROXIMITY_OUT), MODEL(MS_NANO_TRANSCEIVER), MODEL(TABLET_NO_TILT), + 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 be74dfc5..36e6222b 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -126,7 +126,8 @@ 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_NO_TILT = (1 << 28), + EVDEV_MODEL_TABLET_NO_TILT = (1 << 29), + 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 27d3da18..9db09a69 100644 --- a/udev/90-libinput-model-quirks.hwdb +++ b/udev/90-libinput-model-quirks.hwdb @@ -216,6 +216,11 @@ libinput:name:SynPS/2 Synaptics TouchPad:dmi:*svnLENOVO:*:pvrThinkPadX1Carbon3rd libinput:keyboard:input:b0003v17EFp6047* LIBINPUT_ATTR_KEYBOARD_INTEGRATION=external +# 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 ########################################## -- 2.16.2