video: Add video command with subcommands
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. Series-changes: 2 - Correct confusing output text which should be 16 instead of 10 - Improve docs for row and col Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -48,6 +48,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
|
||||
|
||||
72
doc/usage/cmd/video.rst
Normal file
72
doc/usage/cmd/video.rst
Normal file
@@ -0,0 +1,72 @@
|
||||
.. SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
.. 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 hex, with 0 being the left side. Note that this is the
|
||||
text-column position, so the number of pixels per position depends on the
|
||||
font size.
|
||||
|
||||
row
|
||||
Row position in hex, with 0 being the top edge. Note that this is the
|
||||
text-row position, so the number of pixels per position depends on the
|
||||
font size.
|
||||
|
||||
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 16"
|
||||
|
||||
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.
|
||||
@@ -137,6 +137,7 @@ Shell commands
|
||||
cmd/ums
|
||||
cmd/unbind
|
||||
cmd/ut
|
||||
cmd/video
|
||||
cmd/virtio
|
||||
cmd/wdt
|
||||
cmd/wget
|
||||
|
||||
@@ -1097,6 +1097,11 @@ static int dm_test_video_cmd(struct unit_test_state *uts)
|
||||
ut_asserteq(187, 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);
|
||||
|
||||
Reference in New Issue
Block a user