From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: lgo@pengutronix.de, Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] console: countdown: report who is interrupting
Date: Tue, 6 Aug 2024 10:12:03 +0200 [thread overview]
Message-ID: <20240806081203.1538702-1-a.fatoum@pengutronix.de> (raw)
Fastboot and RATP automatically abort the boot countdown, so the user
can send more commands.
In cases where services talk either protocol unbeknownst to the user,
this can be very confusing, thus print an info message whenever this
happens.
Notably missing here is a printout when GPIO keys are triggered.
This is more complicated however, because getchar() only returns a
character without indication which console received it.
To debug such issues, the user can set global.autoboot_abort_key to
narrow down the culprit or enable CONFIG_INPUT_EVBUG.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
common/console_countdown.c | 4 +++-
common/fastboot.c | 2 +-
common/ratp/ratp.c | 2 +-
include/console_countdown.h | 2 +-
4 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/common/console_countdown.c b/common/console_countdown.c
index e41641aca23e..17f6fcd7aea7 100644
--- a/common/console_countdown.c
+++ b/common/console_countdown.c
@@ -13,8 +13,10 @@
static bool console_countdown_timeout_abort;
-void console_countdown_abort(void)
+void console_countdown_abort(const char *reason)
{
+ if (reason)
+ pr_info("\nCount down aborted by %s\n", reason);
console_countdown_timeout_abort = true;
}
diff --git a/common/fastboot.c b/common/fastboot.c
index d283fc8fc098..532286703089 100644
--- a/common/fastboot.c
+++ b/common/fastboot.c
@@ -812,7 +812,7 @@ static void fb_run_command(struct fastboot *fb, const char *cmdbuf,
const struct cmd_dispatch_info *cmd;
int i;
- console_countdown_abort();
+ console_countdown_abort("fastboot");
for (i = 0; i < num_commands; i++) {
cmd = &cmds[i];
diff --git a/common/ratp/ratp.c b/common/ratp/ratp.c
index fddb286e01bc..5cbdb8bd5f85 100644
--- a/common/ratp/ratp.c
+++ b/common/ratp/ratp.c
@@ -501,7 +501,7 @@ int barebox_ratp(struct console_device *cdev)
ctx->poller_registered = true;
- console_countdown_abort();
+ console_countdown_abort("RATP");
console_set_active(&ctx->ratp_console, CONSOLE_STDOUT | CONSOLE_STDERR |
CONSOLE_STDIN);
diff --git a/include/console_countdown.h b/include/console_countdown.h
index df8da71e8bee..f4bebf755b44 100644
--- a/include/console_countdown.h
+++ b/include/console_countdown.h
@@ -9,6 +9,6 @@
#define CONSOLE_COUNTDOWN_EXTERN (1 << 5)
int console_countdown(int timeout_s, unsigned flags, const char *keys, char *out_key);
-void console_countdown_abort(void);
+void console_countdown_abort(const char *reason);
#endif /* __CONSOLE_COUNTDOWN_H */
--
2.39.2
next reply other threads:[~2024-08-06 8:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-06 8:12 Ahmad Fatoum [this message]
2024-08-06 8:24 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240806081203.1538702-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=lgo@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox