Commit Graph

9 Commits

Author SHA1 Message Date
Simon Glass
dd80fd963c console: Add a way to quit pager with no further output
Add support for pressing 'q' to throw away any further output until the
prompt is reached.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-22 11:23:04 -06:00
Simon Glass
c7ba355d1f console: Add bypass keypress to disable paging
Add support for pressing 'Q' to put the pager into bypass mode,disabling
further paging for the current session.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-22 11:23:04 -06:00
Simon Glass
e617ccfc40 console: Correct condition for setting enabled pager bypass
The pager should be bypassed if the terminal was not detected. Fix the
condition which actually says the opposite.

Also fix a long line in pager_post()

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-22 11:23:04 -06:00
Simon Glass
731ee5ebfb console: Implement an environment var to control the pager
The 'pager' environment variable can be used to set the number of lines
on the display. Provide a callback for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 14:36:07 -06:00
Simon Glass
5d26e9dc1c console: Reset the pager when entering a new command
We don't want the pager appearing when entering commands, so add a way
to bypass it. Reset the line count to zero before executing the command.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 14:36:07 -06:00
Simon Glass
3b30dd23bd console: Support a bypass state
Allow the pager to be put in a bypass state, e.g. if not connected to
a terminal.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 14:36:07 -06:00
Simon Glass
cad364dd79 console: test: Allow tests to bypass the pager
We generally don't want the pager to be active when running tests,
since U-Boot appears to hang forever. Perhaps we could detect when the
tests are being run interactively and use the pager in that case. But
for now, just bypass it.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 14:36:07 -06:00
Simon Glass
984b363d02 console: Provide a way to output without the pager
Sometimes output should be sent ignoring the pager, such as when it is
a message related to paging. Add a parameter to support this.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 14:36:06 -06:00
Simon Glass
8a18343bdc console: Add the basic pager implementation
Add an implementation of the pager. It has quite a simple API:

  - call pager_post() to send some output, which returns what should
    actually be sent to the console devices
  - then call pager_next() repeatedly, outputting what it returns,
    until it returns NULL

There is one special case: pager_next() returns PAGER_WAITING if it is
waiting for the user to press a key. In that case, the caller should
read a key and then pass it to the next pager_next() call.

Internally, there is a simple state machine to cope with hitting the
limit (and outputing a prompt), waiting for the user and the clearing
the prompt, before continuing in the normal PAGEST_OK state.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-26 14:36:06 -06:00