mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: lgo@pengutronix.de, Ahmad Fatoum <a.fatoum@pengutronix.de>,
	Jonas Martin <j.martin@pengutronix.de>
Subject: [PATCH 3/3] fastboot: avoid console_countdown_abort for getvar request
Date: Fri,  9 Aug 2024 16:19:59 +0200	[thread overview]
Message-ID: <20240809141959.313914-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20240809141959.313914-1-a.fatoum@pengutronix.de>

We currently abort boot countdown on any fastboot communication at all
as we have the expectation that this is what the user wants.

This doesn't hold true on systems with fwupd: The fastboot plugin probes
connected devices:

  getvar:product
  getvar:version
  getvar:version-bootloader
  getvar:serialno
  getvar:secure

to determine whether an update is in-order. The first getvar will
automatically abort barebox boot up, which is likely not what the user
intended.

Therefore, let's abort console countdown only for non-getvar: requests.

Reported-by: Jonas Martin <j.martin@pengutronix.de>
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Cc: lgo@pengutronix.de
Cc: jlu@pengutronix.de
v1 -> v2:
  - add rationale for the change (fwupd)
  - use strstarts instead of strcmp_l1 removed in earlier patch
---
 common/fastboot.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/common/fastboot.c b/common/fastboot.c
index dc66d7123b02..66b59ab9b0d7 100644
--- a/common/fastboot.c
+++ b/common/fastboot.c
@@ -794,6 +794,11 @@ static void cb_erase(struct fastboot *fb, const char *cmd)
 		fastboot_tx_print(fb, FASTBOOT_MSG_OKAY, "");
 }
 
+static bool fastboot_cmd_should_abort(const char *cmdbuf)
+{
+	return !strstarts(cmdbuf, "getvar:");
+}
+
 struct cmd_dispatch_info {
 	char *cmd;
 	void (*cb)(struct fastboot *fb, const char *opt);
@@ -805,7 +810,8 @@ static void fb_run_command(struct fastboot *fb, const char *cmdbuf,
 	const struct cmd_dispatch_info *cmd;
 	int i;
 
-	console_countdown_abort("fastboot");
+	if (fastboot_cmd_should_abort(cmdbuf))
+		console_countdown_abort("fastboot");
 
 	for (i = 0; i < num_commands; i++) {
 		size_t cmdlen;
-- 
2.39.2




  parent reply	other threads:[~2024-08-09 14:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-09 14:19 [PATCH 1/3] fastboot: print all variables only on getvar:all and not its prefixes Ahmad Fatoum
2024-08-09 14:19 ` [PATCH 2/3] fastboot: retire strcmp_l1 in favor of str_has_prefix Ahmad Fatoum
2024-08-09 14:19 ` Ahmad Fatoum [this message]
2024-08-14  8:53 ` [PATCH 1/3] fastboot: print all variables only on getvar:all and not its prefixes 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=20240809141959.313914-3-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=j.martin@pengutronix.de \
    --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