mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] fastboot: avoid console_countdown_abort for getvar request
Date: Wed,  5 Apr 2023 11:50:36 +0200	[thread overview]
Message-ID: <20230405095036.2864517-1-m.felsch@pengutronix.de> (raw)

Don't abort the console countdown in case of 'fastboot getvar' requests.
Most the time the host just want to query information but don't want to
abort the boot. Therefore skip the abort in case of getvar requests and
abort it in all other cases.

Suggested-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 common/fastboot.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/common/fastboot.c b/common/fastboot.c
index ae7f132444..6c58195395 100644
--- a/common/fastboot.c
+++ b/common/fastboot.c
@@ -772,6 +772,11 @@ static void cb_erase(struct fastboot *fb, const char *cmd)
 		fastboot_tx_print(fb, FASTBOOT_MSG_OKAY, "");
 }
 
+static bool fastboot_cmd_abort_allowed(const char *cmdbuf)
+{
+	return strcmp_l1("getvar:", cmdbuf) == 0 ? false : true;
+}
+
 struct cmd_dispatch_info {
 	char *cmd;
 	void (*cb)(struct fastboot *fb, const char *opt);
@@ -783,7 +788,8 @@ static void fb_run_command(struct fastboot *fb, const char *cmdbuf,
 	const struct cmd_dispatch_info *cmd;
 	int i;
 
-	console_countdown_abort();
+	if (fastboot_cmd_abort_allowed(cmdbuf))
+		console_countdown_abort();
 
 	for (i = 0; i < num_commands; i++) {
 		cmd = &cmds[i];
-- 
2.39.2




             reply	other threads:[~2023-04-05  9:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-05  9:50 Marco Felsch [this message]
2023-06-22 16:53 ` Marco Felsch

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=20230405095036.2864517-1-m.felsch@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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