
From: Simon Glass <sjg@chromium.org> Add a new 'video' command with 'setcursor' and 'puts' subcommands that provide an alternative interface to the existing setcurs and lcdputs commands. Update the test is updated to test both the legacy commands and the new 'video' command. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <sjg@chromium.org> --- cmd/video.c | 8 +++++ doc/usage/cmd/lcdputs.rst | 1 + doc/usage/cmd/setcurs.rst | 1 + doc/usage/cmd/video.rst | 66 +++++++++++++++++++++++++++++++++++++++ doc/usage/index.rst | 1 + test/dm/video.c | 5 +++ 6 files changed, 82 insertions(+) create mode 100644 doc/usage/cmd/video.rst diff --git a/cmd/video.c b/cmd/video.c index 91bd6de14dc..c9f2d91a0ba 100644 --- a/cmd/video.c +++ b/cmd/video.c @@ -58,3 +58,11 @@ U_BOOT_CMD( "print string on video framebuffer", " <string>" ); + +U_BOOT_LONGHELP(video, + "setcursor <col> <row> - Set cursor position\n" + "video puts <string> - Write string at current position"); + +U_BOOT_CMD_WITH_SUBCMDS(video, "Video commands", video_help_text, + U_BOOT_SUBCMD_MKENT(setcursor, 3, 1, do_video_setcursor), + U_BOOT_SUBCMD_MKENT(puts, 2, 1, do_video_puts)); diff --git a/doc/usage/cmd/lcdputs.rst b/doc/usage/cmd/lcdputs.rst index f34dbb3e3f1..26e777970d5 100644 --- a/doc/usage/cmd/lcdputs.rst +++ b/doc/usage/cmd/lcdputs.rst @@ -49,6 +49,7 @@ The lcdputs command is available if CONFIG_CMD_VIDEO=y. See also -------- +* :doc:`video` - video command with subcommands * :doc:`setcurs` - set cursor position Return value diff --git a/doc/usage/cmd/setcurs.rst b/doc/usage/cmd/setcurs.rst index 7aa2a4f454d..76a8438afd5 100644 --- a/doc/usage/cmd/setcurs.rst +++ b/doc/usage/cmd/setcurs.rst @@ -44,6 +44,7 @@ The setcurs command is available if CONFIG_CMD_VIDEO=y. See also -------- +* :doc:`video` - video command with subcommands * :doc:`lcdputs` - print string on video framebuffer Return value diff --git a/doc/usage/cmd/video.rst b/doc/usage/cmd/video.rst new file mode 100644 index 00000000000..139f90bd3ff --- /dev/null +++ b/doc/usage/cmd/video.rst @@ -0,0 +1,66 @@ +.. index:: + single: video (command) + +video command +============= + +Synopsis +-------- + +:: + + video setcursor <col> <row> + video puts <string> + +Description +----------- + +The video command provides access to the video-console subsystem. + +video setcursor +~~~~~~~~~~~~~~~ + + video setcursor <col> <row> + +Set the cursor position on the video console. + +col + Column position in pixels (0-based) + +row + Row position in pixels (0-based) + +video puts +~~~~~~~~~~ + + video puts <string> + +Write a string to the video console at the current cursor position. + +string + Text string to display + +Examples +-------- + +Set cursor and print text:: + + => video setcursor 10 5 + => video puts "Hello World" + +Print at different positions:: + + => video setcursor 0 0 + => video puts "Top left" + => video setcursor 0 10 + => video puts "Line 10" + +Configuration +------------- + +The video command is available if CONFIG_CMD_VIDEO=y. + +Return value +------------ + +The return value $? is 0 (true) on success, 1 (false) on failure. diff --git a/doc/usage/index.rst b/doc/usage/index.rst index 0f271c1280d..d1887f7d26a 100644 --- a/doc/usage/index.rst +++ b/doc/usage/index.rst @@ -137,6 +137,7 @@ Shell commands cmd/ums cmd/unbind cmd/ut + cmd/video cmd/virtio cmd/wdt cmd/wget diff --git a/test/dm/video.c b/test/dm/video.c index 287ba24eb6a..98bb0057b18 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -1097,6 +1097,11 @@ static int dm_test_video_cmd(struct unit_test_state *uts) ut_asserteq(188, video_compress_fb(uts, dev, false)); ut_assertok(video_check_copy_fb(uts, dev)); + ut_assertok(run_command("video setcursor 0 0", 0)); + ut_assertok(run_command("video puts \"Top left\"", 0)); + ut_asserteq(272, video_compress_fb(uts, dev, false)); + ut_assertok(video_check_copy_fb(uts, dev)); + return 0; } DM_TEST(dm_test_video_cmd, UTF_SCAN_PDATA | UTF_SCAN_FDT); -- 2.43.0