summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2026-07-03 22:57:25 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2026-10-14 09:57:27 -0700
commitcf92023f517dcfa1fa4365a09f2ec941ce2b997e (patch)
tree2cba8b9e9705f0abd3f85194bbe11481eec80636
parent41363c27b8509bd4efcba244803edac9ba25d1b5 (diff)
downloadlinux-next-cf92023f517dcfa1fa4365a09f2ec941ce2b997e.tar.gz
linux-next-cf92023f517dcfa1fa4365a09f2ec941ce2b997e.zip
Input: maple_keyb - fix key press detection
The key press detection logic was using ptr instead of !ptr (where ptr is the result of memchr searching for the new key in the old keys). If ptr is not NULL, it means the key was already pressed in the previous report, so it is not a new press. If ptr is NULL, it means the key was not pressed before, so it is a new press. Using ptr instead of !ptr caused new presses to be ignored in the first poll cycle (only reported in the second cycle if still held, because then it was in 'old'), and caused redundant press events to be sent on every subsequent poll while the key was held. Fix this by using !ptr for press detection, matching the release detection logic. Fixes: b11d2127c489 ("Input: add support for SEGA Dreamcast keyboard") Assisted-by: Antigravity:gemini-3.5-flash Tested-by: Florian Fuchs <fuchsfl@gmail.com> Link: https://patch.msgid.link/20260703-b4-maple-cleanup-v1-2-41e424964da5@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/keyboard/maple_keyb.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/input/keyboard/maple_keyb.c b/drivers/input/keyboard/maple_keyb.c
index 3d5538dd4f23..623d7951405b 100644
--- a/drivers/input/keyboard/maple_keyb.c
+++ b/drivers/input/keyboard/maple_keyb.c
@@ -107,7 +107,7 @@ static void dc_scan_kbd(struct dc_kbd *kbd)
}
ptr = memchr(kbd->old + 2, kbd->new[i], 6);
code = kbd->new[i];
- if (code > 3 && ptr) {
+ if (code > 3 && !ptr) {
keycode = kbd->keycode[code];
if (keycode) {
input_event(dev, EV_MSC, MSC_SCAN, code);