sim/keyboard: Translate X11 key codes to NuttX codec#18949
Merged
Conversation
The previous implementation just passed X11 key codes to the NuttX keyboard driver, which only really worked correctly for the letter keys. Now, special keys are translated into the NuttX codec (like Enter, arrow keys, etc.) so that they can be used properly by NuttX applications relying on keyboard input. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
48141cd to
8d888a1
Compare
simbit18
approved these changes
May 24, 2026
acassis
approved these changes
May 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The previous implementation just passed X11 key codes to the NuttX keyboard driver, which only really worked correctly for the letter keys. Now, special keys are translated into the NuttX codec (like Enter, arrow keys, etc.) so that they can be used properly by NuttX applications relying on keyboard input.
Tangentially related to GSoC #18507, the milestone including user applications like DOOM.
Impact
Keyboard device on the Simulator works like expected now.
Testing
Tested while porting DOOM (https://github.com/linguini1/NXDoom) and adding
keyboard input.
Before: Keys like Enter had codes like
65307, and my switch case using theNuttX key coded could not handle this.
After:
Enter appears as
KEYCODE_ENTERand my input to DOOM works as expected. Here'sa screenshot of the game play:
Question:
Does anyone know if the NuttX keyboard codec has support for the ESCAPE key, or if I can add it? Right now there's no way for me to exit the menus in DOOM once I'm in them :)
Also, is there a rationale for not having things like shift, left and right control, etc. represented?