[PATCH 02/26] Input: maple_keyb - fix key press detection
Florian Fuchs
fuchsfl at gmail.com
Mon Jul 6 11:08:56 PDT 2026
Hi Dmitry,
On 03 Jul 22:57, Dmitry Torokhov wrote:
> 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
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov at gmail.com>
> ---
> drivers/input/keyboard/maple_keyb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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);
>
> --
> 2.55.0.rc0.799.gd6f94ed593-goog
>
For patches 1-17, 21, 22, 24, 25 you can add:
Tested-by: Florian Fuchs <fuchsfl at gmail.com>
I applied the patches without the mutex-related ones, and dropped
the 18, 19 (the mutex ones) and the depending 20, 23, 26 (as didn't
apply then).
The mouse, keyboard, controller is still detected and working like
expected. All buttons, sticks, wheel and knobs work. Patch 2 seems
indeed to make the keyboard feel more reliable while typing.
Thank you,
Regards
Florian
More information about the linux-mtd
mailing list