Message ID | 20250822142153.3404275-1-sjg@u-boot.org |
---|---|
Headers |
Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1755872528; bh=la+5PPtYl8aJpv5kxZptEcLtVCSHpKKQdzqYc9dG16E=; h=From:To:Date:CC:Subject:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=mLKrL/oGPKIYY2VYlrVWF18OVjEoBLtcG4p2IRB8+5HfYTmXoVhS2+1I4pgvV2UBM sBc6xiN+zkyKQfL3OlOEOT4+JhYL79apgwew+7xgyfFMjj8+aCEJGkfoBFDBQz0qp8 MnpRMhnS0Sc67bUtv7G7JFxig45NklLYnb3LuDAjtIEFcDESdVhkNswe/kmgDmre5R DKBCTIJ/Z2viMWRrUnHhMVl/E8f0OBAxjcL9ANhsyHGvh+j3xgh8Oqd89iTS7cqLzh 4NE5oirm/CGWRp2ClFRg1ecCODAfEqCTTj+2qJW6Wui1AL+xtV5B9le53BPhKzL6mX dUYlFIv51WtRA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 31B53674C7 for <u-boot-concept@u-boot.org>; Fri, 22 Aug 2025 08:22:08 -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 K4ATllZhpZpJ for <u-boot-concept@u-boot.org>; Fri, 22 Aug 2025 08:22:08 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755872528; bh=la+5PPtYl8aJpv5kxZptEcLtVCSHpKKQdzqYc9dG16E=; h=From:To:Date:CC:Subject:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=mLKrL/oGPKIYY2VYlrVWF18OVjEoBLtcG4p2IRB8+5HfYTmXoVhS2+1I4pgvV2UBM sBc6xiN+zkyKQfL3OlOEOT4+JhYL79apgwew+7xgyfFMjj8+aCEJGkfoBFDBQz0qp8 MnpRMhnS0Sc67bUtv7G7JFxig45NklLYnb3LuDAjtIEFcDESdVhkNswe/kmgDmre5R DKBCTIJ/Z2viMWRrUnHhMVl/E8f0OBAxjcL9ANhsyHGvh+j3xgh8Oqd89iTS7cqLzh 4NE5oirm/CGWRp2ClFRg1ecCODAfEqCTTj+2qJW6Wui1AL+xtV5B9le53BPhKzL6mX dUYlFIv51WtRA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1DC2E67660 for <u-boot-concept@u-boot.org>; Fri, 22 Aug 2025 08:22:08 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755872523; bh=j8aFXJaNrhF2tGwdFx2t5Cd6//3OJ4S+nvgBvUR9jDg=; h=From:To:Cc:Subject:Date:From; b=cG0vnssGazFw5BQEEDFcqQI5oc9okX1vscp5aONJVUcHDrbrnoMU92iGJ48K43oyF 3upmN3rLVfRaYn6l6a9Fr59zEZHQxCEGPDrRVaBzAIu67IQJaI2RWVZRrmVewKCnJj CkkkSBeloXMvno6acrKdc3RTfyNwXzPYiB1C7QcYeAfOauyWR9jxjjsgZEPfAKVKGQ KHgPfB2XQaAGoEiuMBC96gGxUVISVDLqkiVxodj0w2GgvYPl5ZhyxC5bWhuWPctYRG yr9hzpCwj54aQRh695a9x7a+ofD0T6PU8D6RKZCkK29LfMBxls+BGxY6xIlLyrwlXj FGx9bmhC/ZBrQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AD8A1676BE; Fri, 22 Aug 2025 08:22:03 -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 AzpUKDY3MmUO; Fri, 22 Aug 2025 08:22:03 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755872522; bh=arqvIY/xpTvpWkPrfLLeacxc5wkq6tyJKgaltYPmIOA=; h=From:To:Cc:Subject:Date:From; b=gF6p3miJBlVynCrbXIu/RAmlWFe/Xr/0CB1M4FfQJ7em8uDiEXmN+hsKSVNKerxcB umOItAG1XaN9SKFmUedR+yiiotVBbHBJ1oI1peLA/VtRsxiNNHl1WmtvLMSUmiDK2E UMuI9T3iWfri3e0wSLlmybA9vjCf1XmE4nhiiVFeMsXXxDzRtnMXAPHH7LIMOQ6A/o zxdtMnW/UoOLodE/WAgnW/PzkZtv6d2P1HWHWxgw2vMwnVSmV/9+o1LbDsSPYTEVVW smjCylJTqu4kpBQZFgA6Ol4q/qQirHkMXydzJJD1wBSOsuLxZm/lWQi7FUxdCbjl0f Ug3WJqqyPGGTA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 59014674C7; Fri, 22 Aug 2025 08:22:02 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 22 Aug 2025 08:21:31 -0600 Message-ID: <20250822142153.3404275-1-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Message-ID-Hash: 4PJU3S3ADV7Z2GB6DK7S3MCVY27SKITJ X-Message-ID-Hash: 4PJU3S3ADV7Z2GB6DK7S3MCVY27SKITJ 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: Simon Glass <sjg@chromium.org> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 00/16] Introduce a pager for the console List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/4PJU3S3ADV7Z2GB6DK7S3MCVY27SKITJ/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit |
Series |
Introduce a pager for the console
|
|
Message
Simon Glass
Aug. 22, 2025, 2:21 p.m. UTC
From: Simon Glass <sjg@chromium.org>
Some U-Boot commands can produce a lot of output and this can run off
top of the display. This series introduces a simple pager feature, to
allow the output to be read, before pressing SPACE to continue.
A fixed buffer size (4K) is used, which sets a limit on the permmited
output before paging fails and the output is simply written all in one
lot. In most cases this is plenty, but 'env print' does print the whole
environment as one string, so if the legacy distro-boot scripts are used
it could happen.
The default number of visible lines is set with a Kconfig option. Where
a video terminal is being used, the page size is set to match that. In
general U-Boot cannot guess the number of visible lines, since a serial
terminal may be in use.
There is also a 'pager' environment variable which can override any
detected value.
This initial series only counts newlines. It has no support for counting
characters so the result will be sub-optimal if very long lines are
written. This could be addressed in a future patch.
Future work may detect the terminal size by sending an ANSI sequence.
Simon Glass (16):
console: Add the basic pager implementation
console: Add tests for the basic functionality
console: Provide a way to output without the pager
console: Rename console-put functions to prepare for pager
console: Plumb in the pager
console: test: Allow tests to bypass the pager
console: Support paging with single characters
console: Add a few more paging tests
console: Reset the pager when entering a new command
console: Implement an environment var to control the pager
console: Get the pager lines from the vidconsole
efi: Enable the console pager for the app
doc: Remove obsolete text in README.console
doc: Move console docs to rST
doc: Tidy up the console docs a little
pager: doc: Add mention of the pager feature
common/Kconfig | 20 ++
common/Makefile | 2 +
common/cli_readline.c | 13 +-
common/console.c | 99 +++--
common/pager.c | 208 +++++++++++
doc/README.console | 100 ------
doc/usage/console.rst | 78 ++++
doc/usage/environment.rst | 8 +
doc/usage/index.rst | 1 +
include/asm-generic/global_data.h | 11 +
include/env_callback.h | 7 +
include/pager.h | 178 +++++++++
lib/efi_client/Kconfig | 1 +
test/common/Makefile | 1 +
test/common/pager.c | 576 ++++++++++++++++++++++++++++++
test/test-main.c | 3 +
16 files changed, 1183 insertions(+), 123 deletions(-)
create mode 100644 common/pager.c
delete mode 100644 doc/README.console
create mode 100644 doc/usage/console.rst
create mode 100644 include/pager.h
create mode 100644 test/common/pager.c