Skip to content

lib: term: fix fbconsole cursor desynchronization

Ahmad Fatoum barebox 1 version Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 1 replyApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/9lib: term: avoid printing NUL with new new console_puts APIlib/term.c+1 -10 replies
2/9lib: term: return error code from term_getsize()include/term.h lib/term.c+20 -140 replies
3/9lib: term: add per-console terminal response parserlib/term.c+66 -300 replies
4/9lib: term: factor out single cdev handling from term_getsizeinclude/term.h lib/term.c+32 -150 replies
5/9lib: term: fix term_getsize cursor restorelib/term.c+4 -20 replies
6/9console: add get_size callback for direct size reportinginclude/console.h lib/term.c+7 -20 replies
7/9video: fbconsole: implement get_sizedrivers/video/fbconsole.c+10 -00 replies
8/9console: add per-console terminal.size parametercommon/console.c include/console.h+20 -00 replies
9/9efi: reimplement query_console_serial using term_getsizeefi/loader/protocols/console.c+2 -1170 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/9] lib: term: fix fbconsole cursor desynchronization

term_getsize() was added as a common helper to compute the minimum terminal size across all enabled stdout consoles.

Since then, the EFI loader support added the same functionality again in open-coded form.

Both suffer from the same underlying issue: They emit some control characters on all enabled stdout consoles without the regard for the individual size and capabilities of the terminals they are connected to.

This can lead to the cursor to end up at odd places on some consoles, but not others as can be seen here on this video of the barebox framebuffer console on a device without a terminal connected to the serial port:

https://fosstodon.org/@[email protected]/116229733790452489

The <blue>OTICE</blue> is due to the framebuffer console cursor being placed at the very end of the previous line. Then N is printed and the rest at the line after it.

This series fixes term_getsize() to correctly account for differences between the framebuffer and "regular" consoles and then switches off the UEFI loader console support to make use of it.

This fixes the display of the OpenBSD bootloader when run under QEMU.

There's still some more improvements to be made to the GOP support, but they do not preclude actual use: To have the OpenBSD installer automatically use the console, simple-framebuffer ought to be used instead of the GOP anyway.

Ahmad Fatoum (9):
lib: term: avoid printing NUL with new new console_puts API
lib: term: return error code from term_getsize()
lib: term: add per-console terminal response parser
lib: term: factor out single cdev handling from term_getsize
lib: term: fix term_getsize cursor restore
console: add get_size callback for direct size reporting
video: fbconsole: implement get_size
console: add per-console terminal.size parameter
efi: reimplement query_console_serial using term_getsize

 common/console.c               |  18 ++++
 drivers/video/fbconsole.c      |  10 +++
 efi/loader/protocols/console.c | 119 +------------------------
 include/console.h              |   3 +
 include/term.h                 |   7 +-
 lib/term.c                     | 158 +++++++++++++++++++++++----------
 6 files changed, 148 insertions(+), 167 deletions(-)
Signature · 1 line
2.47.3