[PATCH] fastboot: avoid console_countdown_abort for getvar request

Marco Felsch m.felsch at pengutronix.de
Wed Apr 5 02:50:36 PDT 2023


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 at pengutronix.de>
Signed-off-by: Marco Felsch <m.felsch at 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




More information about the barebox mailing list