[Concept,v2,2/9] doc: video: Add docs for video commands

Message ID 20251002154554.4129220-3-sjg@u-boot.org
State New
Headers
Series video: Tidy up embedded graphical images |

Commit Message

Simon Glass Oct. 2, 2025, 3:45 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

Add documentation and a simple test for the setcurs and lcdputs
commands.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

---

Changes in v2:
- Split out docs into its own patch; use video: tag

 doc/usage/cmd/lcdputs.rst | 57 +++++++++++++++++++++++++++++++++++++++
 doc/usage/cmd/setcurs.rst | 56 ++++++++++++++++++++++++++++++++++++++
 doc/usage/index.rst       |  2 ++
 3 files changed, 115 insertions(+)
 create mode 100644 doc/usage/cmd/lcdputs.rst
 create mode 100644 doc/usage/cmd/setcurs.rst
  

Patch

diff --git a/doc/usage/cmd/lcdputs.rst b/doc/usage/cmd/lcdputs.rst
new file mode 100644
index 00000000000..f34dbb3e3f1
--- /dev/null
+++ b/doc/usage/cmd/lcdputs.rst
@@ -0,0 +1,57 @@ 
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+.. index::
+   single: lcdputs (command)
+
+lcdputs command
+===============
+
+Synopsis
+--------
+
+::
+
+    lcdputs <string>
+
+Description
+-----------
+
+The lcdputs command prints a string to the video framebuffer at the current
+cursor position.
+
+string
+    Text string to display on the video console
+
+Examples
+--------
+
+Print a simple string::
+
+    => lcdputs "Hello World"
+
+Combine with setcurs to position text::
+
+    => setcurs 10 5
+    => lcdputs "Positioned text"
+
+Print multiple lines::
+
+    => setcurs 0 0
+    => lcdputs "Line 1"
+    => setcurs 0 1
+    => lcdputs "Line 2"
+
+Configuration
+-------------
+
+The lcdputs command is available if CONFIG_CMD_VIDEO=y.
+
+See also
+--------
+
+* :doc:`setcurs` - set cursor position
+
+Return value
+------------
+
+The return value $? is 0 (true) on success, 1 (false) on failure.
diff --git a/doc/usage/cmd/setcurs.rst b/doc/usage/cmd/setcurs.rst
new file mode 100644
index 00000000000..4619206fb40
--- /dev/null
+++ b/doc/usage/cmd/setcurs.rst
@@ -0,0 +1,56 @@ 
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+.. index::
+   single: setcurs (command)
+
+setcurs command
+===============
+
+Synopsis
+--------
+
+::
+
+    setcurs <col> <row>
+
+Description
+-----------
+
+The setcurs command sets 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.
+
+
+Examples
+--------
+
+Set cursor to column 0x10, row 5::
+
+    => setcurs 10 5
+
+Move cursor to top left::
+
+    => setcurs 0 0
+
+Configuration
+-------------
+
+The setcurs command is available if CONFIG_CMD_VIDEO=y.
+
+See also
+--------
+
+* :doc:`lcdputs` - print string on video framebuffer
+
+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 21d6d120e7c..0f271c1280d 100644
--- a/doc/usage/index.rst
+++ b/doc/usage/index.rst
@@ -85,6 +85,7 @@  Shell commands
    cmd/if
    cmd/itest
    cmd/imxtract
+   cmd/lcdputs
    cmd/load
    cmd/loadb
    cmd/loadm
@@ -117,6 +118,7 @@  Shell commands
    cmd/scmi
    cmd/scp03
    cmd/seama
+   cmd/setcurs
    cmd/setexpr
    cmd/sf
    cmd/shim