From patchwork Wed Oct 1 23:05:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 468 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759359961; bh=0N5rUxJ0zdAtLODZAciafooTMRzW7KcCa7SyqdtpT4E=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=IVRPpG2HiCwABzdOvs8ElOaUVC6FLOF83bbCitg7iIrTrU7NzFXpflPy+jHr65flT gxQU9vKCfLOBj/8Gcdmv50zUssrGPCxTRR3cH5RMGCXTi7oMVGxSesf+kpDXx+XSqw aWAXCPDcOC+aFZE7qKvUR9R90oF/tU9zRDAbfmpGLNrblDHlyuj8ySsR9EmvhQsWxL RDdmYgppLg5mGW58ut9TpSSXn64f6JrZP/uZasVS8va4mwDjuGHzcBKHeA4j2V7XyC C6P8ZdDwkOtbXZlJJhSmv3j5cN2C69TWPzNvveyeObjjtDvUpCQnpPjHzPbU67OFpX 9kIYK3DN0Tm1g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BC80E67EE8 for ; Wed, 1 Oct 2025 17:06:01 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id MkHQBrjcJ935 for ; Wed, 1 Oct 2025 17:06:01 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759359961; bh=0N5rUxJ0zdAtLODZAciafooTMRzW7KcCa7SyqdtpT4E=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=IVRPpG2HiCwABzdOvs8ElOaUVC6FLOF83bbCitg7iIrTrU7NzFXpflPy+jHr65flT gxQU9vKCfLOBj/8Gcdmv50zUssrGPCxTRR3cH5RMGCXTi7oMVGxSesf+kpDXx+XSqw aWAXCPDcOC+aFZE7qKvUR9R90oF/tU9zRDAbfmpGLNrblDHlyuj8ySsR9EmvhQsWxL RDdmYgppLg5mGW58ut9TpSSXn64f6JrZP/uZasVS8va4mwDjuGHzcBKHeA4j2V7XyC C6P8ZdDwkOtbXZlJJhSmv3j5cN2C69TWPzNvveyeObjjtDvUpCQnpPjHzPbU67OFpX 9kIYK3DN0Tm1g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id ABA9467E4B for ; Wed, 1 Oct 2025 17:06:01 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759359959; bh=Uy6ummKZ8Jd+Hhd4oZWMCYr2T86K7G619KqpnNtOhoY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MLccU+21XtoQR2zQdfsVMfFfmS1lVg2h8rE8aA5v8S7IUQbPqsXQ9Ckuh2ZZiwXaW p7h4AyYRj5S3g03B4w1052LNDOQnYSs7pkap0vsh+FwsPCjXjPEheM25wX4ecQSXuG bdnXSIcSt0+NwvaI2dTaP+hnvto2Xb52JBHu8M+mMFdyJTSwacoHWgYG1XlbD7OnlN tj8lLCFLH5k2j//mN+8Zama60+b87TI623HYNBlmBSc7xy9dkPsZL8nybVb093kOov vkl7zW/92DjICyRGdWhbuFOcdU40Ydzsvl+tBxTLKqc6IzQaayAnE8UqaU8LxY41k2 9Z21bSB9Xkjaw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id ADCFF67E4B; Wed, 1 Oct 2025 17:05:59 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id MenbLQDpflFp; Wed, 1 Oct 2025 17:05:59 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759359956; bh=Nuw9CQn7zSN1AjsYqnmlhj2YpcMwD9bypIBzAS/Ljd0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hzvnbZZhdTfe8Alxroh7FqZtI4RZ6X1fQz2Llk/mRq319A6v8shHDFw6Hg6pFd0+w wmhn5Dv6qIyQ8PDGPG/h+IVNdj4dCZgt+ZUE1e2FXpCqFfQ2CHPXUyg5h5gAmePd5p vaA0nL2FRNFJp+8ZkMMcMIr71re3qOj5tclRA4LJ4qk+HOUTKvpTgPxjREvcbxZKDZ 4ajve1LK0aWMYDdQp9aJFqoc33SN7+3kCBktlvZvgRMpA508R+hbACyEJ4QSYSkHYI mMG+AMFSBh7DWFzaj/eTdTW8bMeylLYIh87r56zP9aJxb4Z1Hx3DXOTKWPeJAeKZX1 uO9SbMRgNp+WQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id CE9D167D8D; Wed, 1 Oct 2025 17:05:55 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Wed, 1 Oct 2025 17:05:28 -0600 Message-ID: <20251001230537.3324058-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251001230537.3324058-1-sjg@u-boot.org> References: <20251001230537.3324058-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 7GZRPKONCLLI5OKSDVGYYZIDVWAR5L22 X-Message-ID-Hash: 7GZRPKONCLLI5OKSDVGYYZIDVWAR5L22 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 2/6] video: Add video command with subcommands List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass 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 Signed-off-by: Simon Glass --- 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", " " ); + +U_BOOT_LONGHELP(video, + "setcursor - Set cursor position\n" + "video puts - 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 + video puts + +Description +----------- + +The video command provides access to the video-console subsystem. + +video setcursor +~~~~~~~~~~~~~~~ + + video setcursor + +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 + +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);