Introduce new environment variable, 'gzwrite_quiet', which disables the progress indicator during decompress-write. This is mainly meant to prevent disturbing unit test which responds badly to the in-place progress update and reduce UART traffic. By default, the indicator is left enabled.
Signed-off-by: Marek Vasut <[email protected]> --- Cc: Alexander Graf <[email protected]> Cc: Heinrich Schuchardt <[email protected]> Cc: Ilias Apalodimas <[email protected]> Cc: Jerome Forissier <[email protected]> Cc: Mattijs Korpershoek <[email protected]> Cc: Neil Armstrong <[email protected]> Cc: Peng Fan <[email protected]> Cc: Quentin Schulz <[email protected]> Cc: Simon Glass <[email protected]> Cc: Tom Rini <[email protected]> Cc: Yuya Hamamachi <[email protected]> Cc: [email protected] --- lib/gunzip.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/gunzip.c b/lib/gunzip.c index 040450c0e79..d31bbb2ba03 100644 --- a/lib/gunzip.c +++ b/lib/gunzip.c @@ -83,10 +83,15 @@ __rcode int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *len } #ifdef CONFIG_CMD_UNZIP +static bool quiet; + __weak void gzwrite_progress_init(ulong expectedsize) { - putc('\n'); + quiet = env_get_yesno("gzwrite_quiet") == 1; + + if (!quiet) + putc('\n'); } __weak @@ -94,7 +99,7 @@ void gzwrite_progress(int iteration, ulong bytes_written, ulong total_bytes) { - if (0 == (iteration & 3)) + if (!quiet && !(iteration & 3)) printf("%lu/%lu\r", bytes_written, total_bytes); } -- 2.51.0

