From 37c10c62aaba6d6aee6e050416a7ce7deb8c8685 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 12 Sep 2017 10:05:10 +1000 Subject: [PATCH libinput] evdev: only pair a keyboard with a lid switch when it looks like a qwerty We only pair with one keyboard at a time, make sure the one we pair with is one that looks like an actual keyboard. The Razer Blade Stealth keyboard exposes multiple keyboard event nodes and they all get tagged as internal. The one we end up pairing with is a special keys one, not the real one. https://bugs.freedesktop.org/show_bug.cgi?id=102039 Signed-off-by: Peter Hutterer --- src/evdev.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index 63cad8a9..1b059a8b 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1686,12 +1686,16 @@ fallback_lid_pair_keyboard(struct evdev_device *lid_switch, if (dispatch->lid.keyboard) return; - if (keyboard->tags & EVDEV_TAG_INTERNAL_KEYBOARD) { + if (keyboard->tags & EVDEV_TAG_INTERNAL_KEYBOARD && + libevdev_has_event_code(keyboard->evdev, EV_KEY, KEY_Q) && + libevdev_has_event_code(keyboard->evdev, EV_KEY, KEY_A) && + libevdev_has_event_code(keyboard->evdev, EV_KEY, KEY_Z)) { dispatch->lid.keyboard = keyboard; evdev_log_debug(lid_switch, - "lid: keyboard paired with %s<->%s\n", + "lid: keyboard paired with %s<->%s (%s)\n", lid_switch->devname, - keyboard->devname); + keyboard->devname, + evdev_device_get_sysname(keyboard)); /* We need to init the event listener now only if the reported state * is closed. */ -- 2.13.5