From patchwork Wed Oct 1 23:05:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 467 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=1759359957; bh=y3OP/berZWbXD0C9YCB7YgeIY7kIo+b/bZAahAD+Auw=; 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=fJoqoGwKErEUENh4ivDIUMDyQKTBpo/YhJ+ynSHwj3/aVr5yQBdzxTrHMI0jTxKjE sbvBX66ot270v7Zo0iFU11bihsvQoJwdHUJxwglq5TRYyDhVBBwnjp4K0McMiqY2fc L9Vv69zQQzuB5DLHSDzkbWdMbDmNcDCddnfgNC3By+tfu99TNZYokFHWMzbTuT2a3R 2BimRSqmurZveA5RgXikBMHC1yidtcOC4AFvQZIyk/edrTROSULLsMFDX4IjPwnHL8 2H0dCRmzwK9HuR2hzLbWINpbB0HRDfU+I/Oe3KsNIFe1+zjNNxkdnfaqxW6qv0RcG3 S/vOTDZccmzQw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4E81A67EEA for ; Wed, 1 Oct 2025 17:05:57 -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 GfiF3ceMvxOV for ; Wed, 1 Oct 2025 17:05:57 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759359957; bh=y3OP/berZWbXD0C9YCB7YgeIY7kIo+b/bZAahAD+Auw=; 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=fJoqoGwKErEUENh4ivDIUMDyQKTBpo/YhJ+ynSHwj3/aVr5yQBdzxTrHMI0jTxKjE sbvBX66ot270v7Zo0iFU11bihsvQoJwdHUJxwglq5TRYyDhVBBwnjp4K0McMiqY2fc L9Vv69zQQzuB5DLHSDzkbWdMbDmNcDCddnfgNC3By+tfu99TNZYokFHWMzbTuT2a3R 2BimRSqmurZveA5RgXikBMHC1yidtcOC4AFvQZIyk/edrTROSULLsMFDX4IjPwnHL8 2H0dCRmzwK9HuR2hzLbWINpbB0HRDfU+I/Oe3KsNIFe1+zjNNxkdnfaqxW6qv0RcG3 S/vOTDZccmzQw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3E20167E4B for ; Wed, 1 Oct 2025 17:05:57 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759359955; bh=uV+baz4K37RQmSzBO9KciTj+jrKBKDJBcVo/3w3HCwE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DBY/bRpOzMN752VwsiRsvkyWPa8eRBsBpvUFlGR0Ry1xO1ZiawtBm1iX7youlV/GV 1HW/n33mwbz/xIeJqV2xoePx802rJPJe5/5ox0cleZYlnPQj6JPx1T746Wx7etpl2e PPfeTFLmCBxhVj8aBDj3Aho3vTTdQ4WJFBAxg9INCz75as5vIk3mGfE6fQ6DXSKa3U sCj7aXeGOn3P27I3xucdrURPgEdEHlVauDssyHORDJaEExsu9Dk0WrOiksACkjWrme MWTGFgWZ2Jg5HEsG/QCcQOeU6uZDNrhR7RzJudSf0drBFlc2knFitbMgl0We64vrcc NCsqDXomPmekw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8AFC367E42; Wed, 1 Oct 2025 17:05:55 -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 r_aFPdz8tT6w; Wed, 1 Oct 2025 17:05:55 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759359951; bh=IBGyW73xyayyUMzjC5XhxPYxXBZb86aR1z/4swt8viY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wbq/lf3hp+9CIyPLQa9nXZHrRWwAU3Um9R1//4uFynf5A/9T557AVe1Ke3dXqr94D Vj4gx/D4oiLz6WPbjy10W7/nsMQCBxUFdSRcm1CvYp5KXWx+Q1C7PWwxJEP2a6BvXF qR3Ey53y660ud1ziDlaImP2YslQ/kJgfZegk7YBaRJAuGEIQaMhLJkfV8SNqmmB34n 9ZZDHjaZ41Z/JMLPZr405CNIofgIyCIjYeF+kgn2kxCRWJClKGNecXYvcIJ3yU3Pxm MscX9rVGdIHlpY09WLuOS2I3UPmh3mOKGAAu7xtM6ltGq5w99HEbZIR3hqZOa43L6+ bTexKfxbvjZkA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2DBBA67D8D; Wed, 1 Oct 2025 17:05:51 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Wed, 1 Oct 2025 17:05:27 -0600 Message-ID: <20251001230537.3324058-2-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: VFGGZUULHRTLNUBYAX5Z2MF6DO7TWZL4 X-Message-ID-Hash: VFGGZUULHRTLNUBYAX5Z2MF6DO7TWZL4 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 1/6] video: doc: Add docs and tests for video commands 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 documentation and a simple test for the setcurs and lcdputs commands. Co-developed-by: Claude Signed-off-by: Simon Glass --- doc/usage/cmd/lcdputs.rst | 57 +++++++++++++++++++++++++++++++++++++++ doc/usage/cmd/setcurs.rst | 52 +++++++++++++++++++++++++++++++++++ doc/usage/index.rst | 2 ++ test/dm/video.c | 20 ++++++++++++++ 4 files changed, 131 insertions(+) create mode 100644 doc/usage/cmd/lcdputs.rst create mode 100644 doc/usage/cmd/setcurs.rst 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 + +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..7aa2a4f454d --- /dev/null +++ b/doc/usage/cmd/setcurs.rst @@ -0,0 +1,52 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +.. index:: + single: setcurs (command) + +setcurs command +=============== + +Synopsis +-------- + +:: + + setcurs + +Description +----------- + +The setcurs command sets the cursor position on the video console. + +col + Column position in pixels (0-based) + +row + Row position in pixels (0-based) + + +Examples +-------- + +Set cursor to column 10, 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 diff --git a/test/dm/video.c b/test/dm/video.c index 702e9854005..287ba24eb6a 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -1080,3 +1080,23 @@ static int dm_test_video_backspace_truetype(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_video_backspace_truetype, UTF_SCAN_PDATA | UTF_SCAN_FDT); + +/* video commands */ +static int dm_test_video_cmd(struct unit_test_state *uts) +{ + struct udevice *dev, *con; + + ut_assertok(select_vidconsole(uts, "vidconsole0")); + ut_assertok(video_get_nologo(uts, &dev)); + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + ut_assertok(vidconsole_select_font(con, "8x16", 0)); + + ut_assertok(run_command("setcurs 10 5", 0)); + + ut_assertok(run_command("lcdputs \"Test string\"", 0)); + ut_asserteq(188, 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);