Repository navigation
games/NXDoom: Add an option to read the keys from a serial terminal. - #3869
Open
wwlapaki310 wants to merge 2 commits into
Open
wwlapaki310 wants to merge 2 commits into
wwlapaki310 wants to merge 2 commits into
Conversation
This was referenced Oct 18, 2026
Author
|
This will be rebased onto the Kconfig split in #3860 (the option moves to |
linguini1
reviewed
Oct 18, 2026
wwlapaki310
force-pushed
the
nxdoom-uartkbd
branch
3 times, most recently
from
October 19, 2026 15:09
c44ad9f to
24a4c26
Compare
Author
|
Thanks for the review! All comments are addressed, and I tested it again on a Spresense. |
xiaoxiang781216
previously approved these changes
Oct 19, 2026
jerpelea
previously approved these changes
Oct 20, 2026
jerpelea
left a comment
Contributor
There was a problem hiding this comment.
please remove Co-Authored-By: Claude Sonnet 5.5 noreply@anthropic.com
cederom
previously requested changes
Oct 20, 2026
cederom
left a comment
Contributor
There was a problem hiding this comment.
Thank you @wwlapaki310 for the great feature! :-)
Please fix the formatting so that CI pass, see:
wwlapaki310
dismissed stale reviews from jerpelea and xiaoxiang781216
via
October 20, 2026 11:16
548b440
wwlapaki310
force-pushed
the
nxdoom-uartkbd
branch
from
October 20, 2026 11:16
24a4c26 to
548b440
Compare
Author
|
Fixed the failing CI style check: nxstyle |
jerpelea
approved these changes
Oct 20, 2026
jerpelea
previously requested changes
Oct 20, 2026
jerpelea
left a comment
Contributor
There was a problem hiding this comment.
please remove Co-Authored-By: Claude Sonnet 5.5 noreply@anthropic.com
Indent the case labels of the switch statements two columns deeper, as the coding standard and the current nxstyle require. Only the indentation changes. Assisted-by: Claude:claude-sonnet-5-5 Signed-off-by: satoru akita <wwlap24@gmail.com>
NXDoom reads its keys only from a keyboard character driver, so a board without one cannot play it. Some boards, such as the Spresense, have nothing but a serial console. Add GAMES_NXDOOM_UARTKBD, which reads bytes from the tty named by GAMES_NXDOOM_KBDPATH (for example /dev/console) and turns them into keyboard events: * W, A, S, D and the arrow keys move, J fires, K runs, L strafes, E or space uses, and Q or Esc opens the menu. * A terminal reports a key press but never its release, so each press is released again 250 ms after its last byte. The code is in its own file, i_input_uartkbd.c, which is built only when the option is on, so that i_input.c has just one call to it. Also remove the dead "#if 0" block that was left in i_input.c. The option is disabled by default, so existing configurations are not affected. Tested on a Spresense with an ILI9340 display: the menu opens, moves and closes from keys sent over the console. Assisted-by: Claude:claude-sonnet-5-5 Signed-off-by: satoru akita <wwlap24@gmail.com>
wwlapaki310
force-pushed
the
nxdoom-uartkbd
branch
from
October 20, 2026 12:46
548b440 to
c752759
Compare
Author
|
Removed, sorry for the extra trailer. |
xiaoxiang781216
approved these changes
Oct 20, 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
Add
CONFIG_GAMES_NXDOOM_UARTKBD, an option that lets NXDoom read its keys from a serial terminal.NXDoom reads its keys only from a keyboard character driver, so a board without one cannot play it. Some boards, such as the Spresense, have only a serial console. With the option on, NXDoom reads bytes from the tty named by
CONFIG_GAMES_NXDOOM_KBDPATH(for example/dev/console) and turns them into the same keyboard events that the driver path produces:The option is off by default. The code is in its own file,
i_input_uartkbd.c, which is built only when the option is on, soi_input.chas just one call to it; the dead#if 0block ini_input.cis removed. The key handling followstranslate_speckey()in the same file, and the arrow keys are the usual VT100/xterm sequences. No code was copied from another project. Keeping this in the application was the simplest way; a reusable keyboard driver fed from a tty would be another option, and I can move it there if you prefer.This is one of three pull requests that let NXDoom run on the Spresense: the nuttx configuration and documentation (apache/nuttx#20774) and the memory improvements, which include the option to disable the screen wipe (#3860, by another author, already merged). The nuttx one shows how they fit together, so it may help to read it first. This pull request is rebased onto #3860 and should be merged before the nuttx one.
Impact
#ifdef CONFIG_GAMES_NXDOOM_UARTKBD.Testing
Result: the game starts on a Spresense and is controlled with keys sent over the serial console. Demo video: https://youtu.be/ikh1EEGco8Q
Host: Windows 11, build in a Docker container (Ubuntu 24.04),
arm-none-eabi-gcc13.2.1.Board: Spresense main board with the extension board and an ILI9340 display,
spresense:nxdoomfrom the nuttx pull request. To try it before that is merged, use thenxdoom-spresensebranch of https://github.com/wwlapaki310/nuttx together with this pull request.With a one-level IWAD in the flash, the game started and keys sent over the console worked:
qopened the menu, Enter started a new game,wandsmoved,aanddturned,jfired andeused. This was checked on the display.PR verification Self-Check