From patchwork Thu Oct 2 15:45:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 476 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=1759419994; bh=TRc5kOhA5ioT2MigN0XgBMgOAUjj26hZubzTtPlwhNQ=; 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=FvdmHD6LR79kwpLC9i4+yhmoW4zN5sxau7oSLm2voiASfhGsAHyZ9SsevSLdH+okE IXVHZxDoUg6zNYxQCQwYzwVetKBh7z5bvz50RBOiR23nLr4bHhAvsXtxb3d5PKL15m AjGT27wXi02mJG75XL4eF+tDNBjkpU2IjhIamf8J78MXMnaLQe41QXbw/OXB8oneIR qKT82bC1Soyaqq9/TAbF2264HJpIHyz6fgnKdn6us+JQUVpS0cVOXWnZH9F9bkvoFc fXrRjhh6A2SZMOV3b/fdnhX/pEMiBG7Q1WFU2uFugIHe6LaHu/YOE0n63vrmQy/bTU SwpNKIglDaOUQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7ECE567F1D for ; Thu, 2 Oct 2025 09:46:34 -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 m658op3qHJEN for ; Thu, 2 Oct 2025 09:46:34 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419994; bh=TRc5kOhA5ioT2MigN0XgBMgOAUjj26hZubzTtPlwhNQ=; 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=FvdmHD6LR79kwpLC9i4+yhmoW4zN5sxau7oSLm2voiASfhGsAHyZ9SsevSLdH+okE IXVHZxDoUg6zNYxQCQwYzwVetKBh7z5bvz50RBOiR23nLr4bHhAvsXtxb3d5PKL15m AjGT27wXi02mJG75XL4eF+tDNBjkpU2IjhIamf8J78MXMnaLQe41QXbw/OXB8oneIR qKT82bC1Soyaqq9/TAbF2264HJpIHyz6fgnKdn6us+JQUVpS0cVOXWnZH9F9bkvoFc fXrRjhh6A2SZMOV3b/fdnhX/pEMiBG7Q1WFU2uFugIHe6LaHu/YOE0n63vrmQy/bTU SwpNKIglDaOUQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6D81E67F16 for ; Thu, 2 Oct 2025 09:46:34 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419993; bh=N8bWnBFW8qeOeFAGQxXSvZSeBP5Uh4SFTtmyEXaGXXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QGZHJg103MRdJTDSROmWRBjV+OlVejJRn6Xx/bmSOgvtLIJfJYhW6KuIAhdF9p/xn M1r4JRmlJAwOY2b6UMbTuUKeCqKHq2iCRvLJlDYFZACWeYhncRwIzikAOhfWCIvUpT eNNiczx8qgDLYHOqjJ3tctJRmREXkPngDbWAAQc+EIsZua0cfeD8Uelef/fZ2AfhKW P1s4dLAgJYFXDMJFR3jpaNA0n3wflJEgJmu/bZ+ImGFvcZvUs5Bc9y/rPRqjw8AjvP SEx1DwYUOSBbhzPhaBUCsw9oJ1/vTyvki8i6zmS+q+L79Wum2ht17PDw9O6WtF2Cii nEFsbD/M7LgAw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 143D867F15; Thu, 2 Oct 2025 09:46:33 -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 HcJkqk-1_UQb; Thu, 2 Oct 2025 09:46:33 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419985; bh=pYvphHIgGcXcnr+0peDcEtdtEGSiZpQlo6VWa8vrwdg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EhrFmeTwvZ3MzTaHMV9+GluaHgrIKvXb2oCHb3RX1P0m4ufAiFUjHSHLfc2hu4phW ssTxkiJ4Kr4j1EKz5zndh9OKc97bCscI/ie2+EEAjvYkzgFrFdClfTCx2O71muYGfE M1i0bnEU+a1E73EoHBeMAaxNwufm9mnTEQW4MtnIuGKQPc3BObYF081/eT8yVpTk9i KemVPv9g7HannVVtQci2fCznDDvCSQ2dK/iaBdRXHaexsk24cNKFrX4Sob5AyIaw5W w3Z+7/7oQ5bU6/ktiezZDnogOBnTgH2QbD1y59gOR9sM2KdkUuSkd9Wyqkg+95wCb8 SyoCC8UYfzxxQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E51A067EC6; Thu, 2 Oct 2025 09:46:24 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 2 Oct 2025 09:45:44 -0600 Message-ID: <20251002154554.4129220-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251002154554.4129220-1-sjg@u-boot.org> References: <20251002154554.4129220-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 5F363PORNFTSDY33Y2JRBQXZZVECKNG3 X-Message-ID-Hash: 5F363PORNFTSDY33Y2JRBQXZZVECKNG3 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 v2 4/9] 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 --- Changes in v2: - Correct confusing output text which should be 16 instead of 10 - Improve docs for row and col cmd/video.c | 8 +++++ doc/usage/cmd/lcdputs.rst | 1 + doc/usage/cmd/setcurs.rst | 1 + doc/usage/cmd/video.rst | 72 +++++++++++++++++++++++++++++++++++++++ doc/usage/index.rst | 1 + test/dm/video.c | 5 +++ 6 files changed, 88 insertions(+) create mode 100644 doc/usage/cmd/video.rst diff --git a/cmd/video.c b/cmd/video.c index d11472c3ef6..9f3a91959df 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 4619206fb40..aca2fc34e7f 100644 --- a/doc/usage/cmd/setcurs.rst +++ b/doc/usage/cmd/setcurs.rst @@ -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 diff --git a/doc/usage/cmd/video.rst b/doc/usage/cmd/video.rst new file mode 100644 index 00000000000..1e7c7f0c050 --- /dev/null +++ b/doc/usage/cmd/video.rst @@ -0,0 +1,72 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +.. 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 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 + +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. 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 847342891fd..af305e60268 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(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);