Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Linux keycode to USB HID translation table (see https://alba.sh/keycodes)
// Based on "usb_kbd_keycode" from drivers/hid/usbhid/usbkbd.c @ 1a59d1b
// Maps KEY_BACKSLASH into 0x31 (not 0x32)
static const int linux_to_hid[256] = {
0, 41, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 45, 46, 42, 43,
20, 26, 8, 21, 23, 28, 24, 12, 18, 19, 47, 48, 40,224, 4, 22,
7, 9, 10, 11, 13, 14, 15, 51, 52, 53,225, 49, 29, 27, 6, 25,
5, 17, 16, 54, 55, 56,229, 85,226, 44, 57, 58, 59, 60, 61, 62,
63, 64, 65, 66, 67, 83, 71, 95, 96, 97, 86, 92, 93, 94, 87, 89,
90, 91, 98, 99, 0,148,100, 68, 69,135,146,147,138,136,139,140,
88,228, 84, 70,230, 0, 74, 82, 75, 80, 79, 77, 81, 78, 73, 76,
0,127,129,128,102,103, 0, 72, 0,133,144,145,137,227,231,101,
120,121,118,122,119,124,116,125,126,123,117, 0,251, 0,248, 0,
0, 0, 0, 0, 0, 0,240, 0,249, 0, 0, 0, 0, 0,241,242,
0,236, 0,235,232,234,233, 0, 0, 0, 0, 0, 0,250, 0, 0,
247,245,246, 0, 0, 0, 0,104,105,106,107,108,109,110,111,112,
113,114,115
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment