[Concept,05/16] expo: Wire up putch callback for textline editing
Commit Message
From: Simon Glass <simon.glass@canonical.com>
Add a scene_textline_putch() callback that outputs characters to the
vidconsole using vidconsole_put_char(). Set this callback in
scene_textline_open() so that CLI line editing output goes to the
correct vidconsole rather than the default console.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
boot/scene_textline.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
@@ -213,6 +213,22 @@ int scene_textline_render_deps(struct scene *scn,
return 0;
}
+/**
+ * scene_textline_putch() - Output a character to the vidconsole
+ *
+ * This is used as the putch callback for CLI line editing, so that characters
+ * are sent to the correct vidconsole.
+ *
+ * @cls: CLI line state
+ * @ch: Character to output
+ */
+static void scene_textline_putch(struct cli_line_state *cls, int ch)
+{
+ struct scene *scn = container_of(cls, struct scene, cls);
+
+ vidconsole_put_char(scn->expo->cons, ch);
+}
+
int scene_textline_open(struct scene *scn, struct scene_obj_textline *tline)
{
struct udevice *cons = scn->expo->cons;
@@ -232,6 +248,7 @@ int scene_textline_open(struct scene *scn, struct scene_obj_textline *tline)
vidconsole_entry_start(cons);
cli_cread_init(&scn->cls, abuf_data(&tline->buf), tline->max_chars);
scn->cls.insert = true;
+ scn->cls.putch = scene_textline_putch;
ret = vidconsole_entry_save(cons, &scn->entry_save);
if (ret)
return log_msg_ret("sav", ret);