video: Provide a way to indicate the start of CLI entry

Add a new mark_start() method for the console, which indicates that the
CLI prompt has been written to the display and any following characters
will be user input.

There are two cases to consider, tracked by an indent flag in
struct vidconsole_cursor:

- normal CLI entry where new lines start at the left of the console
- expo entry where new lines start at the same position as the previous
  line (indent=true)

Record this position in the uclass info, so it is available to console
drivers.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-09-18 07:44:07 -06:00
parent fdfdb84dcc
commit 691e10ead3
3 changed files with 88 additions and 0 deletions

View File

@@ -16,6 +16,7 @@
#include <pager.h>
#include <time.h>
#include <watchdog.h>
#include <video_console.h>
#include <linux/errno.h>
#include <asm/global_data.h>
@@ -676,6 +677,8 @@ int cli_readline_into_buffer(const char *const prompt, char *buffer,
if (prompt)
puts(prompt);
/* tell the vidconsole the cursor is at its start position */
vidconsole_readline_start(false);
rc = cread_line(prompt, p, &len, timeout);
rc = rc < 0 ? rc : len;
@@ -686,5 +689,7 @@ int cli_readline_into_buffer(const char *const prompt, char *buffer,
pager_set_bypass(gd_pager(), old_bypass);
pager_reset(gd_pager());
vidconsole_readline_end();
return rc;
}