Written so I could test macbook keyboards before sending back to clients after a board repair or similar service.
Works on keyboard scancodes, not keycodes, so will work with all keyboards but you'll be left with varying levels of keys that aren't "pressed".
Requires SDL2 and SDL2_ttf
linux
apt install libsdl2-dev
macOS
brew install libsdl2 libsd2_ttf
make
keyboard-tester [--dl <lower bound ms>] [--dh <upper bound ms>] [-m <mapfile>] [-c] [--dpi <dpi>] [--fs <pts>]
--dl <time (20 ms default)> : Set acceptable lower limit of key down time
--dh <time (200 ms default)> : Set acceptable upper limit of key down time
-m <mapfile> : Set keyboard map to use, limits keys and sets names to test
-c : Close tester when all keys have been pressed
--dpi <dpi> : Force screen DPI
--fs <pts> : Set font size in pts
ALT/OPT-Q: exit/quit
ALT/OPT-M: Save current pressed keyset to mapfile
alt-q / opt-q : quit
alt-m / opt-m : Save currently pressed keys array to map file