summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2017-05-22 13:51:11 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2017-05-23 15:10:10 +1000
commit1671c7f4adcf0873c55b21dc3e0578e91c360837 (patch)
tree5453697f489eebfda16f7de4a655e27585e8c6ef
parent1cfa1f64cfd610d97643be32e92c67c0ecee23c8 (diff)
lid: tighten the lid-keyboard pairing
Only pair if the keyboard is either tagged as internal device. This has another (unlikely) behaviour change: previously we would override the paired keyboards with ones that look more accurate (e.g. a usb keyboard paired before a serial would be unpaired and the serial keyboard takes its place). Now we assume there can only be one internal keyboard, once we have it we ignore all others. This shouldn't matter in real life provided the tagging is correct. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/evdev-lid.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/evdev-lid.c b/src/evdev-lid.c
index 9815b8f..8090780 100644
--- a/src/evdev-lid.c
+++ b/src/evdev-lid.c
@@ -202,29 +202,23 @@ lid_switch_pair_keyboard(struct evdev_device *lid_switch,
{
struct lid_switch_dispatch *dispatch =
lid_dispatch(lid_switch->dispatch);
- unsigned int bus_kbd = libevdev_get_id_bustype(keyboard->evdev);
if ((keyboard->tags & EVDEV_TAG_KEYBOARD) == 0)
return;
- /* If we already have a keyboard paired, override it if the new one
- * is a serio device. Otherwise keep the current one */
- if (dispatch->keyboard.keyboard) {
- if (bus_kbd != BUS_I8042)
- return;
-
- libinput_device_remove_event_listener(&dispatch->keyboard.listener);
- libinput_device_init_event_listener(&dispatch->keyboard.listener);
- }
+ if (dispatch->keyboard.keyboard)
+ return;
- dispatch->keyboard.keyboard = keyboard;
- evdev_log_debug(lid_switch,
- "lid: keyboard paired with %s<->%s\n",
- lid_switch->devname,
- keyboard->devname);
+ if (keyboard->tags & EVDEV_TAG_INTERNAL_KEYBOARD) {
+ dispatch->keyboard.keyboard = keyboard;
+ evdev_log_debug(lid_switch,
+ "lid: keyboard paired with %s<->%s\n",
+ lid_switch->devname,
+ keyboard->devname);
- /* We don't init the event listener yet - we don't care about
- * keyboard events until the lid is closed */
+ /* We don't init the event listener yet - we don't care
+ * about keyboard events until the lid is closed */
+ }
}
static void