* [PATCH] input: don't queue keys while the input console isn't stdin
@ 2026-11-08 13:40 Ahmad Fatoum
2026-11-09 9:08 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-11-08 13:40 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Applications like bareDOOM take the keyboard over by registering their
own input notifier and deactivating the input console. The input console
notifier keeps queueing every key press into its FIFO all the same, so
once the application exits and reactivates the console, the shell
receives the last 32 keys pressed during the game.
Let's only queue keys and start the key repeat while the console is
actually active as stdin.
Tested with DOOM on TinyEMU: the shell prompt stays empty after quitting.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/input/input.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 5ee63d94d6f4..b77de20ae975 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -128,7 +128,7 @@ static void input_console_repeat(void *ctx)
{
struct input_console *ic = ctx;
- if (ic->current_key) {
+ if (ic->current_key && (ic->console.f_active & CONSOLE_STDIN)) {
kfifo_putc(ic->fifo, ic->current_key);
poller_call_async(&ic->poller, 40 * MSECOND,
input_console_repeat, ic);
@@ -196,6 +196,9 @@ static void input_console_notify(struct input_notifier *in,
pr_debug("map %02x KEY: 0x%04x code: %d\n", modstate, ascii, ev->code);
if (ev->value) {
+ if (!(ic->console.f_active & CONSOLE_STDIN))
+ return;
+
kfifo_putc(ic->fifo, ascii);
ic->current_key = ascii;
poller_call_async(&ic->poller, 400 * MSECOND,
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-09 9:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-08 13:40 [PATCH] input: don't queue keys while the input console isn't stdin Ahmad Fatoum
2026-11-09 9:08 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox