examples/lvglterm: support physical keyboard input#3582
Conversation
|
This example was tested by the companion nuttx PR apache/nuttx#19279, built and flashed on two boards: M5Stack Cardputer — physical matrix keyboard variant;
|
cederom
left a comment
There was a problem hiding this comment.
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 :-)
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>
14abf8c to
f865bc0
Compare
@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. |
|
Allright we may keep is as an example.. but one day it surely deserves a graduation :D |


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.