Hello everyone,

While working on porting DOOM to NuttX with keyboard input, I got confused
by the keyboard codec NuttX uses.

The entire codec is defined using an enum for just "special keys", like
arrow keys and print-screen, etc. There are no definitions for
letter/number keys, which leads me to believe that the ASCII code is just
used for these (which tracks with my experimentation of `/dev/kbd` on sim).
However, the entire enum itself starts at KEYCODE_NORMAL = 0.

This means that the keyboard codec is in conflict with ASCII characters.
When I went to extend it and add buttons like CTRL and ALT, I noticed that
pressing the spacebar no longer worked due to conflict with the keyboard
codec.

As far as I can tell from the code, the keyboard codec translators I've
seen don't rely on the enum starting at 0. I would like to change it to
start at 128, so that it doesn't conflict with any ASCII characters, but I
don't trust my understanding of the keyboard input system enough to
guarantee I'm not breaking anything.

Is there anyone more familiar with this part of NuttX who can tell me what
the rationale for the keyboard codec starting at 0 is, and how it's
supposed to work/be dealt with from userspace?

Thanks,
Matteo

Reply via email to