
From: Simon Glass <sjg@chromium.org> The cursor should only be enabled if the user is entering something. This can be at the CLI or in an expo. Provide a flag to track it, which we can (later) use to determine whether or not to draw the cursor. Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/video/vidconsole-uclass.c | 10 +++++++++- include/video_console.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 9d161f4688e..9ab331af68a 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -919,12 +919,20 @@ void vidconsole_readline_start(bool indent) struct vidconsole_priv *priv = dev_get_uclass_priv(dev); priv->curs.indent = indent; + priv->curs.enabled = true; vidconsole_mark_start(dev); } } void vidconsole_readline_end(void) { - /* TODO: mark the end */ + struct uclass *uc; + struct udevice *dev; + + uclass_id_foreach_dev(UCLASS_VIDEO_CONSOLE, dev, uc) { + struct vidconsole_priv *priv = dev_get_uclass_priv(dev); + + priv->curs.enabled = false; + } } #endif /* CURSOR */ diff --git a/include/video_console.h b/include/video_console.h index c5450f70c4d..af2b8499bb4 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -29,6 +29,7 @@ enum { * The cursor is set up and maintained by the vidconsole. It is a simple * vertical bar of width VIDCONSOLE_CURSOR_WIDTH shown in the foreground colour. * + * @enabled: cursor is active (e.g. during readline) * @visible: cursor is currently visible * @indent: indent subsequent lines to the same position as the first line * @x: cursor left X position in pixels @@ -37,6 +38,7 @@ enum { * @index: cursor index within the CLI or field being edited */ struct vidconsole_cursor { + bool enabled; bool visible; bool indent; -- 2.43.0