| Message ID | 20261002-b4-fastboot-dot-width-v1-1-93bb3cb13179@protonmail.com |
|---|---|
| State | Accepted |
| Delegated to: | Mattijs Korpershoek |
| Headers | show |
| Series | fastboot: scale download progress dots to video console width | expand |
Hi Petr, Thank you for the patch. On Fri, Oct 02, 2026 at 22:52, Petr Hodina via B4 Relay <devnull+petr.hodina.protonmail.com@kernel.org> wrote: > From: Petr Hodina <petr.hodina@protonmail.com> > > 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. > > Signed-off-by: Petr Hodina <petr.hodina@protonmail.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Hi, On Fri, 02 Oct 2026 22:52:57 +0200, Petr Hodina wrote: > 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
diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c index 18d86988f4c..e6a5f9b840c 100644 --- a/drivers/fastboot/fb_command.c +++ b/drivers/fastboot/fb_command.c @@ -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';