feat(input): map the keypad (numpad) keys

VMCTL_KEYS carried only NumLock, not the keypad block — so any keypad evdev
code sent in CMD_INPUT{KEY} was dropped on both paths: uinput device A never
declared the keybit, and the QMP qcode lookup returned NULL.

Add the full keypad in sorted evdev positions (the table is bsearch'd):
kp_0..kp_9, kp_add/subtract/multiply/divide, kp_enter, kp_decimal, kp_equals,
kp_comma. Both the uinput keybits and the QMP qcodes derive from this one
table, so both paths pick the keys up.

Add test_keymap pinning the strictly-ascending-by-evdev invariant (bsearch
precondition + no duplicates) and the keypad lookup.

Bump 0.3.13.
This commit is contained in:
2026-06-26 02:10:58 +03:00
parent bcf5d4f824
commit 17ad439b9b
3 changed files with 81 additions and 1 deletions
+8 -1
View File
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.16)
# Single source of truth for the version: CI passes -DVMSIG_VERSION=${TAG#v}, so the project
# version (-> libvgpu-perception SONAME/.so version) and the .deb version come from one tag.
set(VMSIG_VERSION "0.3.12" CACHE STRING "Release version (MAJOR.MINOR.PATCH); CI passes the tag")
set(VMSIG_VERSION "0.3.13" CACHE STRING "Release version (MAJOR.MINOR.PATCH); CI passes the tag")
project(vmsig VERSION ${VMSIG_VERSION} LANGUAGES C)
set(CMAKE_C_STANDARD 17)
@@ -276,6 +276,13 @@ target_include_directories(vmsig_uinputlayouttest PRIVATE
target_compile_options(vmsig_uinputlayouttest PRIVATE -Wall -Wextra)
add_test(NAME uinputlayout COMMAND vmsig_uinputlayouttest)
add_executable(vmsig_keymaptest src/test/test_keymap.c)
target_link_libraries(vmsig_keymaptest PRIVATE vmsig)
target_include_directories(vmsig_keymaptest PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/si/input/include)
target_compile_options(vmsig_keymaptest PRIVATE -Wall -Wextra)
add_test(NAME keymap COMMAND vmsig_keymaptest)
add_executable(vmsig_memwritetest src/test/test_memwrite.c)
target_link_libraries(vmsig_memwritetest PRIVATE vmsig Threads::Threads)
target_include_directories(vmsig_memwritetest PRIVATE