From ae8cfb4aa919000b283a0fe7db96b1a321a010d3 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Tue, 3 Nov 2026 12:22:03 +0100 Subject: Add multi-row progress display with a global progress bar Replace the single-line progress bar with a terminal renderer that shows one row per active progress tag. The overall restore step (Uploading/Verifying filesystem, Flashing firmware) is a reserved "global" bar that is always drawn first. Per-component bars (e.g. SEP, RestoreRamDisk) appear below it and disappear when finalized. - Redraw in place with ANSI cursor movement; clamp line width to the terminal width (ioctl on Unix, console API on Windows, with virtual terminal mode enabled) - Erase and redraw the bars around logger() output so log lines no longer corrupt the display - Remove the global bar once a different restore step starts - When stdout is not a TTY, skip escape codes and print only the changed bar, once per 1% step - Fix progress throttling: lastprog was an int and was compared after being overwritten, so granularity was never applied - RESTORE_STEP_UPLOAD_IMG no longer drives the global bar; it already has per-component bars --- src/log.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/log.c') diff --git a/src/log.c b/src/log.c index 1238cb4..01c13a4 100644 --- a/src/log.c +++ b/src/log.c @@ -38,6 +38,7 @@ #include #include "log.h" +#include "common.h" static int stderr_enabled = 1; @@ -105,6 +106,7 @@ void logger(enum loglevel level, const char *fmt, ...) return; mutex_lock(&log_mutex); + progress_display_suspend(); size_t fslen = 24 + strlen(fmt); fs = malloc(fslen); @@ -149,6 +151,7 @@ void logger(enum loglevel level, const char *fmt, ...) free(fs); + progress_display_resume(); mutex_unlock(&log_mutex); } -- cgit v1.1-32-gdbae