Skip to contentSkip to conversation

fastboot: scale download progress dots to video console width

PATCH In review Petr Hodina 2 participants 3 messages Oct 2 – Oct 13

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fastboot: scale download progress dots to video console width

The download progress indicator wraps to a new line every 74 dots. On boards with a video console the row is usually a different width, so query the active video console's column count and use that instead, falling back to the old default when no video console is probed.

---
Found while testing fastboot flashing on a device using the on-screen video console. The fixed 74-column dot-wrap assumed a serial terminal and looked broken on the panel's actual row width.

---
 drivers/fastboot/fb_command.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
drivers/fastboot/fb_command.c +25 -1
index 18d86988f4c..e6a5f9b840c 100644
@@ -5,6 +5,7 @@
 
 #include <command.h>
 #include <console.h>
+#include <dm.h>
 #include <env.h>
 #include <fastboot.h>
 #include <fastboot-internal.h>
@@ -14,9 +15,12 @@
 #include <fb_spi_flash.h>
 #include <part.h>
 #include <stdlib.h>
+#include <video_console.h>
 #include <vsprintf.h>
 #include <linux/printk.h>
 
+#define FASTBOOT_DOT_LINE_WIDTH_DEFAULT	74
+
 /**
  * image_size - final fastboot image size
  */
@@ -266,6 +270,26 @@ u32 fastboot_data_remaining(void)
 	return fastboot_bytes_expected - fastboot_bytes_received;
 }
 
+/**
+ * fastboot_dot_line_width() - number of dot columns to print per line
+ *
+ * Return: number of dot columns per line
+ */
+static int fastboot_dot_line_width(void)
+{
+	struct udevice *dev;
+	struct vidconsole_priv *priv;
+
+	if (IS_ENABLED(CONFIG_VIDEO) &&
+	    !uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev)) {
+		priv = dev_get_uclass_priv(dev);
+		if (priv->cols > 0)
+			return priv->cols;
+	}
+
+	return FASTBOOT_DOT_LINE_WIDTH_DEFAULT;
+}
+
 /**
  * fastboot_data_download() - Copy image data to fastboot_buf_addr.
  *
@@ -304,7 +328,7 @@ void fastboot_data_download(const void *fastboot_data,
 
 	if (pre_dot_num != now_dot_num) {
 		putc('.');
-		if (!(now_dot_num % 74))
+		if (!(now_dot_num % fastboot_dot_line_width()))
 			putc('\n');
 	}
 	*response = '\0';

---
base-commit: ece349ade2973e220f524ce59e59711cc919263f
change-id: 20261002-b4-fastboot-dot-width-f56e91316650

Best regards,

Signature · 1 line
Petr Hodina <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw

Hi Petr,

Thank you for the patch.

Quoted 8 lines · On Fri, Oct 02, 2026 at 22:52, Petr Hodina via B4 Relay…

From: Petr Hodina <[email protected]>

The download progress indicator wraps to a new line every 74 dots. On boards with a video console the row is usually a different width, so query the active video console's column count and use that instead, falling back to the old default when no video console is probed.

#2 lore raw
In reply to Petr Hodina

Hi,

Quoted 6 lines · Petr Hodina

The download progress indicator wraps to a new line every 74 dots. On boards with a video console the row is usually a different width, so query the active video console's column count and use that instead, falling back to the old default when no video console is probed.

Thanks, Applied to https://git.u-boot-project.org/u-boot/custodians/u-boot-dfu (u-boot-dfu)

[1/1] fastboot: scale download progress dots to video console width

      https://git.u-boot-project.org/u-boot/custodians/u-boot-dfu/-/commit/21604de81a0ca9f8427214384ef0575e9ce1a6ec

--
Mattijs