[Concept,38/42] video: Show the cursor when idle

Message ID 20250919201507.4024144-39-sjg@u-boot.org
State New
Headers
Series video: Support a cursor more generally |

Commit Message

Simon Glass Sept. 19, 2025, 8:14 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

When the console is idle and at the CLI, ensure the cursor is visible.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/video/vidconsole-uclass.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
  

Patch

diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c
index 3621714c742..52a51b5e1c1 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -931,6 +931,18 @@  void vidconsole_set_bitmap_font(struct udevice *dev,
 
 void vidconsole_idle(struct udevice *dev)
 {
+	struct vidconsole_priv *priv = dev_get_uclass_priv(dev);
+	struct vidconsole_cursor *curs = &priv->curs;
+
+	/* Only handle cursor if it's enabled */
+	if (curs->enabled && !curs->visible) {
+		/*
+		 * TODO(sjg@chromium.org): We are using a saved position here,
+		 * but vidconsole_show_cursor() calls get_cursor_info() to
+		 * recalc the position anyway.
+		 */
+		vidconsole_show_cursor(dev);
+	}
 }
 
 #ifdef CONFIG_CURSOR