Skip to content

examples/lvglterm: support physical keyboard input#3582

Merged
acassis merged 1 commit into
apache:masterfrom
JorgeGzm:feature/lvglterm-input-variants
Jul 3, 2026
Merged

examples/lvglterm: support physical keyboard input#3582
acassis merged 1 commit into
apache:masterfrom
JorgeGzm:feature/lvglterm-input-variants

Conversation

@JorgeGzm

@JorgeGzm JorgeGzm commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Refactor apps/examples/lvglterm so the LVGL terminal can take its input either from an on-screen touch keyboard (as before) or from a physical keyboard. Shared code (NSH over pipes, output rendering) lives in lvglterm.c; lvglterm_touch.c and lvglterm_kbd.c implement the two variants, selected by a Kconfig choice (touch by default).

Impact

Default behaviour unchanged (touch), so existing users (e.g. PinePhone) are unaffected. Boards with a physical keyboard (/dev/kbdN) can now run the same terminal via the keyboard variant. Device is configurable (CONFIG_EXAMPLES_LVGLTERM_KBD_DEV, default /dev/kbd0, overridable by argument) and a smaller UNSCII 8 font can be selected for low-resolution displays.

Testing

Built and flashed on two boards (companion nuttx PR): M5Stack Cardputer (physical keyboard) and Linum-STM32H753BI (touch). Both render NSH output and echo the typed command inline. The default touch variant keeps its original behaviour.

@JorgeGzm

JorgeGzm commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

This example was tested by the companion nuttx PR apache/nuttx#19279, built and flashed on two boards:

M5Stack Cardputer — physical matrix keyboard variant;
Linum-STM32H753BI — on-screen touch keyboard variant.

image-cardputer image-linum

@cederom cederom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @JorgeGzm amazing work!! =)

Maybe we could put this lvglterm in the apps/system or apps/graphics so its more visible and not only and example but already fully featured application? More and more people would need and use it :-)

Comment thread examples/lvglterm/lvglterm.c
Comment thread examples/lvglterm/lvglterm.c
Refactor the LVGL terminal into a shared core (lvglterm.c) plus two
selectable input variants: the existing on-screen touch keyboard
(lvglterm_touch.c) and a new physical keyboard variant (lvglterm_kbd.c) that
reads key events from a /dev/kbdN device and streams them to the shell.

The input source is chosen with a Kconfig choice (touch by default, keeping
the previous behaviour).  The keyboard variant reads its device from
CONFIG_EXAMPLES_LVGLTERM_KBD_DEV (default /dev/kbd0), overridable by the first
command-line argument, and scrolls the output with the Fn cursor keys.  A font
choice (UNSCII 8 or 16) is added for low-resolution displays.

Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
@JorgeGzm JorgeGzm force-pushed the feature/lvglterm-input-variants branch from 14abf8c to f865bc0 Compare July 2, 2026 19:02
@JorgeGzm

JorgeGzm commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Thank you @JorgeGzm amazing work!! =)

Maybe we could put this lvglterm in the apps/system or apps/graphics so its more visible and not only and example but already fully featured application? More and more people would need and use it :-)

@cederom My only concern is potentially breaking applications that already rely on lvglterm. That said, I really like your idea, and I think we could explore defining a standard approach for handling cases like this.

@cederom

cederom commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Allright we may keep is as an example.. but one day it surely deserves a graduation :D

@acassis acassis merged commit 59d3a0d into apache:master Jul 3, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants