In order to improve security around the command processing, I plan to
upgrade the communication protocol to use a fixed structure with an
optional payload. As a first pass on this, I added a script to generate
the IDs automatically from the configuration, as well as a script to map
the module names and log levels to integer IDs.
This also replaces the manual lmap_* and array_get_index lookup tables,
so I don't have to always deal with creating an entry in constants.h and
command.c and making sure they are in sync.
This change is an initial step to adding support for profiles in x52d.
This will allow the user to create a keyboard layout in an easy to
read/write text based format, and have it compiled into a flat layout
that's easy for the daemon to parse and load into memory. This layout
can then be used to map a user's action key to the actual input usage
needed. This is necessary, because keyboards don't actually send the
character that is typed, but just the position on the keyboard. For
example, on a French AZERTY keyboard, the A key would actually send the
usage for `Keyboard_q_and_Q`. The OS would translate that into the
letter 'a' (or 'A' if Shift key is held) and pass that to the active
window.
This commit adds the full logic necessary for the layout loading,
validation and compiling, as well as tests for the compiler and loader.