kbdscan is a program to set the FreeBSD console keyboard in raw scancode mode and show scancodes of keys pressed and released.
Five seconds of inactivity resets the console to the original mode and quits the program.
Please note that kbdscan is meant to use directly in the FreeBSD console. It won't work in a terminal emulator in X, for instance.
Available as misc/kbdscan in FreeBSD.