This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 093937a988f6340f0e65bd3f114c19c87be05a47
Author: Jorge Guzman <[email protected]>
AuthorDate: Thu Jul 30 17:50:29 2026 -0300

    boards/arm/stm32h7/linum-stm32h753bi: drive lvglterm from the serial console
    
    The terminal reads a keyboard device and does not care which one, so it
    can be driven with no keyboard plugged in at all.  Enable UINPUT_KEYBOARD
    and system/kbd so that the configuration can do it out of the box, and
    document how, including how to have the USB keyboard and the console feed
    the terminal at the same time.
    
    The terminal no longer has a USB specific input source either, so the
    device path has to be spelled out:  the USB HID driver names its devices
    /dev/kbda onwards while the option defaults to /dev/kbd0.
    
    INPUT_KEYBOARD_BYTESTREAM is not needed here.  The terminal reads events
    now, and this configuration has no other keyboard consumer.
    
    UINPUT_KEYBOARD_BUFNUMBER is raised to 128.  It counts events rather than
    keys, so the default of eight holds four keystrokes, and a console hands
    over a whole line at once.  The upper half overwrites the oldest event
    when the buffer is full, so a typed line arrived with its beginning
    silently missing.
    
    HIDKBD_NOGETREPORT is enabled as well.  Sampling the keyboard over the
    control pipe every 40 ms loses any key pressed and released between two
    samples, which on this board meant most of them.
    
    Signed-off-by: Jorge Guzman <[email protected]>
---
 .../arm/stm32h7/boards/linum-stm32h753bi/index.rst | 31 ++++++++++++++++++++++
 .../configs/lvglterm_kbda/defconfig                |  8 +++++-
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git 
a/Documentation/platforms/arm/stm32h7/boards/linum-stm32h753bi/index.rst 
b/Documentation/platforms/arm/stm32h7/boards/linum-stm32h753bi/index.rst
index 3e2c85d0d9c..65d38f22a9a 100644
--- a/Documentation/platforms/arm/stm32h7/boards/linum-stm32h753bi/index.rst
+++ b/Documentation/platforms/arm/stm32h7/boards/linum-stm32h753bi/index.rst
@@ -1087,6 +1087,37 @@ that the USB host and the SDMMC peripheral coexist::
   nsh> mount -t vfat /dev/mmcsd0 /data
   nsh> ls /data
 
+**Typing from the serial console instead.** The terminal reads a keyboard
+device, and it does not care which one, so it can be driven from the serial
+console with no keyboard plugged in at all. This configuration enables
+``UINPUT_KEYBOARD``, which registers a virtual keyboard on
+``/dev/ukeyboard``, and ``system/kbd``, which injects into it.
+
+Point the terminal at the virtual keyboard and bridge the console into it::
+
+  nsh> lvglterm /dev/ukeyboard &
+  nsh> kbd -i /dev/ukeyboard
+
+Everything typed on the serial console from that point on appears on the
+display. This is how to work on the terminal without the keyboard at hand,
+and how to reach the board over a serial link from another machine.
+
+To use both at once, forward the USB keyboard into the same virtual
+keyboard before starting the terminal::
+
+  nsh> kbd -i /dev/ukeyboard /dev/kbda &
+  nsh> lvglterm /dev/ukeyboard &
+  nsh> kbd -i /dev/ukeyboard
+
+The USB keyboard and the serial console now feed the same terminal, which
+an application cannot do on its own since it opens a single device.
+
+``UINPUT_KEYBOARD_BUFNUMBER`` is raised to 128 here. It counts events
+rather than keys, so the default of eight holds four keystrokes, and a
+console hands over a whole line at once. The keyboard upper half overwrites
+the oldest event when the buffer is full, so a line typed at the console
+would arrive with its beginning silently missing.
+
 tone
 ----
 
diff --git 
a/boards/arm/stm32h7/linum-stm32h753bi/configs/lvglterm_kbda/defconfig 
b/boards/arm/stm32h7/linum-stm32h753bi/configs/lvglterm_kbda/defconfig
index 490dc686d07..60c8ff2e28e 100644
--- a/boards/arm/stm32h7/linum-stm32h753bi/configs/lvglterm_kbda/defconfig
+++ b/boards/arm/stm32h7/linum-stm32h753bi/configs/lvglterm_kbda/defconfig
@@ -30,7 +30,8 @@ CONFIG_DEBUG_FEATURES=y
 CONFIG_DEBUG_SYMBOLS=y
 CONFIG_DRIVERS_VIDEO=y
 CONFIG_EXAMPLES_LVGLTERM=y
-CONFIG_EXAMPLES_LVGLTERM_INPUT_KBD_USB=y
+CONFIG_EXAMPLES_LVGLTERM_INPUT_KBD=y
+CONFIG_EXAMPLES_LVGLTERM_KBD_DEV="/dev/kbda"
 CONFIG_FAT_DMAMEMORY=y
 CONFIG_FAT_LCNAMES=y
 CONFIG_FAT_LFN=y
@@ -40,6 +41,7 @@ CONFIG_FS_PROCFS=y
 CONFIG_GRAN=y
 CONFIG_GRAN_INTR=y
 CONFIG_GRAPHICS_LVGL=y
+CONFIG_HIDKBD_NOGETREPORT=y
 CONFIG_INIT_ENTRYPOINT="nsh_main"
 CONFIG_INTELHEX_BINARY=y
 CONFIG_LIBC_EXECFUNCS=y
@@ -81,11 +83,15 @@ CONFIG_STM32_PWR=y
 CONFIG_STM32_RTC=y
 CONFIG_STM32_SDMMC1=y
 CONFIG_STM32_USART1=y
+CONFIG_SYSTEM_KBD=y
 CONFIG_SYSTEM_NSH=y
 CONFIG_TASK_NAME_SIZE=0
 CONFIG_TESTING_RAMTEST=y
+CONFIG_UINPUT_KEYBOARD=y
+CONFIG_UINPUT_KEYBOARD_BUFNUMBER=128
 CONFIG_USART1_SERIAL_CONSOLE=y
 CONFIG_USBHOST=y
+CONFIG_USBHOST_ASYNCH=y
 CONFIG_USBHOST_HIDKBD=y
 CONFIG_USEC_PER_TICK=1000
 CONFIG_VIDEO_FB=y

Reply via email to