JorgeGzm commented on code in PR #19586: URL: https://github.com/apache/nuttx/pull/19586#discussion_r3687723614
########## drivers/input/keyboard_upper.c: ########## @@ -384,6 +395,74 @@ int keyboard_unregister(FAR struct keyboard_lowerhalf_s *lower, return 0; } +/**************************************************************************** + * Name: keyboard_encode + * + * Description: + * Render one keyboard event as the byte stream that the keyboard codec + * defines, for applications that consume characters rather than events. + * + * Only the press events are rendered. A byte stream has no way to say + * that a key came up: a normal key contributes its character and nothing Review Comment: The byte stream is the format that `usbhost_hidkbd` delivered before this change, and it never reported key releases either, so nothing that consumes it today expects them. It also cannot gain them without breaking a consumer. `NSH_USBKBD` sets `CONFIG_NSH_ALTSTDIN` to the keyboard device (nshlib/nsh.h:208), so NSH reads it as plain stdin and never calls kbd_decode(). A release would arrive there as the literal escape sequence and be typed into the shell. An application that needs key releases should read struct keyboard_event_s instead, which is the default and reports all four types. `INPUT_KEYBOARD_BYTESTREAM` exists only so that the applications which have not been converted yet keep working, and I would rather it stay a faithful copy of the old behaviour than become a third, slightly different format. I made this explicit in the option help text. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
