From 2a7ea444e301f175646ec707a9df122bac7a55c4 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 2 Jun 2020 10:52:11 +1000 Subject: [PATCH] Ignore key repeat in all backends Since we don't really care about keys in any of these backends and buttons shouldn't autorepeat anyway, this should have no effect on functionality. But it does guard us against potential kernel bugs like this one: https://www.spinics.net/lists/linux-input/msg67653.html See https://gitlab.freedesktop.org/libinput/libinput/-/issues/447#note_468971 Signed-off-by: Peter Hutterer --- src/evdev-mt-touchpad.c | 4 ++++ src/evdev-tablet-pad.c | 4 ++++ src/evdev-tablet.c | 4 ++++ src/evdev-totem.c | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index cc53a434..0030682b 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -748,6 +748,10 @@ tp_process_key(struct tp_dispatch *tp, const struct input_event *e, uint64_t time) { + /* ignore kernel key repeat */ + if (e->value == 2) + return; + switch (e->code) { case BTN_LEFT: case BTN_MIDDLE: diff --git a/src/evdev-tablet-pad.c b/src/evdev-tablet-pad.c index 2ad66abf..c55aafcf 100644 --- a/src/evdev-tablet-pad.c +++ b/src/evdev-tablet-pad.c @@ -332,6 +332,10 @@ pad_process_key(struct pad_dispatch *pad, uint32_t button = e->code; uint32_t is_press = e->value != 0; + /* ignore kernel key repeat */ + if (e->value == 2) + return; + pad_button_set_down(pad, button, is_press); } diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c index 217db3f6..9c66782e 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -812,6 +812,10 @@ tablet_process_key(struct tablet_dispatch *tablet, { enum libinput_tablet_tool_type type; + /* ignore kernel key repeat */ + if (e->value == 2) + return; + switch (e->code) { case BTN_TOOL_FINGER: evdev_log_bug_libinput(device, diff --git a/src/evdev-totem.c b/src/evdev-totem.c index 6f0a851c..f2ddcd04 100644 --- a/src/evdev-totem.c +++ b/src/evdev-totem.c @@ -181,6 +181,10 @@ totem_process_key(struct totem_dispatch *totem, struct input_event *e, uint64_t time) { + /* ignore kernel key repeat */ + if (e->value == 2) + return; + switch(e->code) { case BTN_0: totem->button_state_now = !!e->value;