mirror of
https://github.com/apache/nuttx.git
synced 2026-08-14 17:03:29 +00:00
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 <jorge.gzm@gmail.com>
This commit is contained in:
parent
da99c2eba5
commit
093937a988
2 changed files with 38 additions and 1 deletions
|
|
@ -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
|
||||
----
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue