I was looking for a list of keyboard scancodes in the linux kernel sources, but I did not find anything. Does someone know where to find these? Especially the USB scancodes would be interesting.
The keycodes are in
# Default kernel keymap. This uses 7 modifier combinations. [...]
See also my answer here for ways to view (
dumpkeys) and modify (
loadkeys) the current keymap as it exists in the running kernel.
However, those are a bit higher level than the scancodes sent by the device. Those might be what's in the table at the top of
[src]/drivers/hid/hid-input.c, however, since they come from the device, you don't need the linux kernel source to find out what they are; they are the same regardless of OS.
"HID" == human interface device. The
usbhid subdirectory of
drivers/hid doesn't appear to contain any special codes, since USB keyboards are really regular keyboards.
One difference between keycodes and scancodes is that scancodes are more granular -- notice there's a different signal for the press and release. A keycode corresponds to a key that's down, I believe; so the kernel maps scancode events to a keycode status.