console: Recheck the page length when stdout device changes

It is annoying to have the pager use the line count from the display
when console output is actually using serial. Check this when stdio
changes and recaculate as needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-08-22 07:06:52 -06:00
parent ca37f12368
commit 4aefafb381

View File

@@ -1185,6 +1185,15 @@ static int on_console(const char *name, const char *value, enum env_op op,
break;
}
if (IS_ENABLED(CONFIG_CONSOLE_PAGER) && console == stdout) {
int lines = calc_check_console_lines();
/* Set bypass mode if not connected to a terminal */
pager_set_bypass(gd_pager(), lines != 0);
if (lines)
pager_set_page_len(gd_pager(), lines);
}
return result;
}
U_BOOT_ENV_CALLBACK(console, on_console);