1*433d6423SLionel Sambuc /* Scancode conversion tables from PC keyboard scan codes to USB HID codes. */ 2*433d6423SLionel Sambuc /* 3*433d6423SLionel Sambuc * The contents of this file are based on the Microsoft "USB HID to PS/2 Scan 4*433d6423SLionel Sambuc * Code Translation Table" document, of which the purpose is to provide a 5*433d6423SLionel Sambuc * translation the other way around. Therefore, some codes might be missing. 6*433d6423SLionel Sambuc */ 7*433d6423SLionel Sambuc #include <minix/input.h> 8*433d6423SLionel Sambuc 9*433d6423SLionel Sambuc #include "pckbd.h" 10*433d6423SLionel Sambuc 11*433d6423SLionel Sambuc const struct scanmap scanmap_normal[KBD_SCAN_CODES] = { 12*433d6423SLionel Sambuc [0x01] = { INPUT_PAGE_KEY, INPUT_KEY_ESCAPE }, 13*433d6423SLionel Sambuc [0x02] = { INPUT_PAGE_KEY, INPUT_KEY_1 }, 14*433d6423SLionel Sambuc [0x03] = { INPUT_PAGE_KEY, INPUT_KEY_2 }, 15*433d6423SLionel Sambuc [0x04] = { INPUT_PAGE_KEY, INPUT_KEY_3 }, 16*433d6423SLionel Sambuc [0x05] = { INPUT_PAGE_KEY, INPUT_KEY_4 }, 17*433d6423SLionel Sambuc [0x06] = { INPUT_PAGE_KEY, INPUT_KEY_5 }, 18*433d6423SLionel Sambuc [0x07] = { INPUT_PAGE_KEY, INPUT_KEY_6 }, 19*433d6423SLionel Sambuc [0x08] = { INPUT_PAGE_KEY, INPUT_KEY_7 }, 20*433d6423SLionel Sambuc [0x09] = { INPUT_PAGE_KEY, INPUT_KEY_8 }, 21*433d6423SLionel Sambuc [0x0A] = { INPUT_PAGE_KEY, INPUT_KEY_9 }, 22*433d6423SLionel Sambuc [0x0B] = { INPUT_PAGE_KEY, INPUT_KEY_0 }, 23*433d6423SLionel Sambuc [0x0C] = { INPUT_PAGE_KEY, INPUT_KEY_DASH }, 24*433d6423SLionel Sambuc [0x0D] = { INPUT_PAGE_KEY, INPUT_KEY_EQUAL }, 25*433d6423SLionel Sambuc [0x0E] = { INPUT_PAGE_KEY, INPUT_KEY_BACKSPACE }, 26*433d6423SLionel Sambuc [0x0F] = { INPUT_PAGE_KEY, INPUT_KEY_TAB }, 27*433d6423SLionel Sambuc [0x10] = { INPUT_PAGE_KEY, INPUT_KEY_Q }, 28*433d6423SLionel Sambuc [0x11] = { INPUT_PAGE_KEY, INPUT_KEY_W }, 29*433d6423SLionel Sambuc [0x12] = { INPUT_PAGE_KEY, INPUT_KEY_E }, 30*433d6423SLionel Sambuc [0x13] = { INPUT_PAGE_KEY, INPUT_KEY_R }, 31*433d6423SLionel Sambuc [0x14] = { INPUT_PAGE_KEY, INPUT_KEY_T }, 32*433d6423SLionel Sambuc [0x15] = { INPUT_PAGE_KEY, INPUT_KEY_Y }, 33*433d6423SLionel Sambuc [0x16] = { INPUT_PAGE_KEY, INPUT_KEY_U }, 34*433d6423SLionel Sambuc [0x17] = { INPUT_PAGE_KEY, INPUT_KEY_I }, 35*433d6423SLionel Sambuc [0x18] = { INPUT_PAGE_KEY, INPUT_KEY_O }, 36*433d6423SLionel Sambuc [0x19] = { INPUT_PAGE_KEY, INPUT_KEY_P }, 37*433d6423SLionel Sambuc [0x1A] = { INPUT_PAGE_KEY, INPUT_KEY_OPEN_BRACKET }, 38*433d6423SLionel Sambuc [0x1B] = { INPUT_PAGE_KEY, INPUT_KEY_CLOSE_BRACKET }, 39*433d6423SLionel Sambuc [0x1C] = { INPUT_PAGE_KEY, INPUT_KEY_ENTER }, 40*433d6423SLionel Sambuc [0x1D] = { INPUT_PAGE_KEY, INPUT_KEY_LEFT_CTRL }, 41*433d6423SLionel Sambuc [0x1E] = { INPUT_PAGE_KEY, INPUT_KEY_A }, 42*433d6423SLionel Sambuc [0x1F] = { INPUT_PAGE_KEY, INPUT_KEY_S }, 43*433d6423SLionel Sambuc [0x20] = { INPUT_PAGE_KEY, INPUT_KEY_D }, 44*433d6423SLionel Sambuc [0x21] = { INPUT_PAGE_KEY, INPUT_KEY_F }, 45*433d6423SLionel Sambuc [0x22] = { INPUT_PAGE_KEY, INPUT_KEY_G }, 46*433d6423SLionel Sambuc [0x23] = { INPUT_PAGE_KEY, INPUT_KEY_H }, 47*433d6423SLionel Sambuc [0x24] = { INPUT_PAGE_KEY, INPUT_KEY_J }, 48*433d6423SLionel Sambuc [0x25] = { INPUT_PAGE_KEY, INPUT_KEY_K }, 49*433d6423SLionel Sambuc [0x26] = { INPUT_PAGE_KEY, INPUT_KEY_L }, 50*433d6423SLionel Sambuc [0x27] = { INPUT_PAGE_KEY, INPUT_KEY_SEMICOLON }, 51*433d6423SLionel Sambuc [0x28] = { INPUT_PAGE_KEY, INPUT_KEY_APOSTROPH }, 52*433d6423SLionel Sambuc [0x29] = { INPUT_PAGE_KEY, INPUT_KEY_GRAVE_ACCENT }, 53*433d6423SLionel Sambuc [0x2A] = { INPUT_PAGE_KEY, INPUT_KEY_LEFT_SHIFT }, 54*433d6423SLionel Sambuc [0x2B] = { INPUT_PAGE_KEY, INPUT_KEY_BACKSLASH }, 55*433d6423SLionel Sambuc [0x2C] = { INPUT_PAGE_KEY, INPUT_KEY_Z }, 56*433d6423SLionel Sambuc [0x2D] = { INPUT_PAGE_KEY, INPUT_KEY_X }, 57*433d6423SLionel Sambuc [0x2E] = { INPUT_PAGE_KEY, INPUT_KEY_C }, 58*433d6423SLionel Sambuc [0x2F] = { INPUT_PAGE_KEY, INPUT_KEY_V }, 59*433d6423SLionel Sambuc [0x30] = { INPUT_PAGE_KEY, INPUT_KEY_B }, 60*433d6423SLionel Sambuc [0x31] = { INPUT_PAGE_KEY, INPUT_KEY_N }, 61*433d6423SLionel Sambuc [0x32] = { INPUT_PAGE_KEY, INPUT_KEY_M }, 62*433d6423SLionel Sambuc [0x33] = { INPUT_PAGE_KEY, INPUT_KEY_COMMA }, 63*433d6423SLionel Sambuc [0x34] = { INPUT_PAGE_KEY, INPUT_KEY_PERIOD }, 64*433d6423SLionel Sambuc [0x35] = { INPUT_PAGE_KEY, INPUT_KEY_SLASH }, 65*433d6423SLionel Sambuc [0x36] = { INPUT_PAGE_KEY, INPUT_KEY_RIGHT_SHIFT }, 66*433d6423SLionel Sambuc [0x37] = { INPUT_PAGE_KEY, INPUT_KEY_KP_STAR }, 67*433d6423SLionel Sambuc [0x38] = { INPUT_PAGE_KEY, INPUT_KEY_LEFT_ALT }, 68*433d6423SLionel Sambuc [0x39] = { INPUT_PAGE_KEY, INPUT_KEY_SPACEBAR }, 69*433d6423SLionel Sambuc [0x3A] = { INPUT_PAGE_KEY, INPUT_KEY_CAPS_LOCK }, 70*433d6423SLionel Sambuc [0x3B] = { INPUT_PAGE_KEY, INPUT_KEY_F1 }, 71*433d6423SLionel Sambuc [0x3C] = { INPUT_PAGE_KEY, INPUT_KEY_F2 }, 72*433d6423SLionel Sambuc [0x3D] = { INPUT_PAGE_KEY, INPUT_KEY_F3 }, 73*433d6423SLionel Sambuc [0x3E] = { INPUT_PAGE_KEY, INPUT_KEY_F4 }, 74*433d6423SLionel Sambuc [0x3F] = { INPUT_PAGE_KEY, INPUT_KEY_F5 }, 75*433d6423SLionel Sambuc [0x40] = { INPUT_PAGE_KEY, INPUT_KEY_F6 }, 76*433d6423SLionel Sambuc [0x41] = { INPUT_PAGE_KEY, INPUT_KEY_F7 }, 77*433d6423SLionel Sambuc [0x42] = { INPUT_PAGE_KEY, INPUT_KEY_F8 }, 78*433d6423SLionel Sambuc [0x43] = { INPUT_PAGE_KEY, INPUT_KEY_F9 }, 79*433d6423SLionel Sambuc [0x44] = { INPUT_PAGE_KEY, INPUT_KEY_F10 }, 80*433d6423SLionel Sambuc [0x45] = { INPUT_PAGE_KEY, INPUT_KEY_NUM_LOCK }, 81*433d6423SLionel Sambuc [0x46] = { INPUT_PAGE_KEY, INPUT_KEY_SCROLL_LOCK }, 82*433d6423SLionel Sambuc [0x47] = { INPUT_PAGE_KEY, INPUT_KEY_KP_7 }, 83*433d6423SLionel Sambuc [0x48] = { INPUT_PAGE_KEY, INPUT_KEY_KP_8 }, 84*433d6423SLionel Sambuc [0x49] = { INPUT_PAGE_KEY, INPUT_KEY_KP_9 }, 85*433d6423SLionel Sambuc [0x4A] = { INPUT_PAGE_KEY, INPUT_KEY_KP_DASH }, 86*433d6423SLionel Sambuc [0x4B] = { INPUT_PAGE_KEY, INPUT_KEY_KP_4 }, 87*433d6423SLionel Sambuc [0x4C] = { INPUT_PAGE_KEY, INPUT_KEY_KP_5 }, 88*433d6423SLionel Sambuc [0x4D] = { INPUT_PAGE_KEY, INPUT_KEY_KP_6 }, 89*433d6423SLionel Sambuc [0x4E] = { INPUT_PAGE_KEY, INPUT_KEY_KP_PLUS }, 90*433d6423SLionel Sambuc [0x4F] = { INPUT_PAGE_KEY, INPUT_KEY_KP_1 }, 91*433d6423SLionel Sambuc [0x50] = { INPUT_PAGE_KEY, INPUT_KEY_KP_2 }, 92*433d6423SLionel Sambuc [0x51] = { INPUT_PAGE_KEY, INPUT_KEY_KP_3 }, 93*433d6423SLionel Sambuc [0x52] = { INPUT_PAGE_KEY, INPUT_KEY_KP_0 }, 94*433d6423SLionel Sambuc [0x53] = { INPUT_PAGE_KEY, INPUT_KEY_KP_PERIOD }, 95*433d6423SLionel Sambuc [0x54] = { INPUT_PAGE_KEY, INPUT_KEY_SYSREQ }, 96*433d6423SLionel Sambuc [0x56] = { INPUT_PAGE_KEY, INPUT_KEY_EUROPE_2 }, 97*433d6423SLionel Sambuc [0x57] = { INPUT_PAGE_KEY, INPUT_KEY_F11 }, 98*433d6423SLionel Sambuc [0x58] = { INPUT_PAGE_KEY, INPUT_KEY_F12 }, 99*433d6423SLionel Sambuc [0x59] = { INPUT_PAGE_KEY, INPUT_KEY_KP_EQUAL }, 100*433d6423SLionel Sambuc [0x5C] = { INPUT_PAGE_KEY, INPUT_KEY_I10L_6 }, 101*433d6423SLionel Sambuc [0x64] = { INPUT_PAGE_KEY, INPUT_KEY_F13 }, 102*433d6423SLionel Sambuc [0x65] = { INPUT_PAGE_KEY, INPUT_KEY_F14 }, 103*433d6423SLionel Sambuc [0x66] = { INPUT_PAGE_KEY, INPUT_KEY_F15 }, 104*433d6423SLionel Sambuc [0x67] = { INPUT_PAGE_KEY, INPUT_KEY_F16 }, 105*433d6423SLionel Sambuc [0x68] = { INPUT_PAGE_KEY, INPUT_KEY_F17 }, 106*433d6423SLionel Sambuc [0x69] = { INPUT_PAGE_KEY, INPUT_KEY_F18 }, 107*433d6423SLionel Sambuc [0x6A] = { INPUT_PAGE_KEY, INPUT_KEY_F19 }, 108*433d6423SLionel Sambuc [0x6B] = { INPUT_PAGE_KEY, INPUT_KEY_F20 }, 109*433d6423SLionel Sambuc [0x6C] = { INPUT_PAGE_KEY, INPUT_KEY_F21 }, 110*433d6423SLionel Sambuc [0x6D] = { INPUT_PAGE_KEY, INPUT_KEY_F22 }, 111*433d6423SLionel Sambuc [0x6E] = { INPUT_PAGE_KEY, INPUT_KEY_F23 }, 112*433d6423SLionel Sambuc [0x70] = { INPUT_PAGE_KEY, INPUT_KEY_I10L_2 }, 113*433d6423SLionel Sambuc /* The following two keys (0x71, 0x72) are release-only. */ 114*433d6423SLionel Sambuc [0x71] = { INPUT_PAGE_KEY, INPUT_KEY_LANG_2 }, 115*433d6423SLionel Sambuc [0x72] = { INPUT_PAGE_KEY, INPUT_KEY_LANG_1 }, 116*433d6423SLionel Sambuc [0x73] = { INPUT_PAGE_KEY, INPUT_KEY_I10L_1 }, 117*433d6423SLionel Sambuc /* The following key (0x76) can be either F24 or LANG_5. */ 118*433d6423SLionel Sambuc [0x76] = { INPUT_PAGE_KEY, INPUT_KEY_F24 }, 119*433d6423SLionel Sambuc [0x77] = { INPUT_PAGE_KEY, INPUT_KEY_LANG_4 }, 120*433d6423SLionel Sambuc [0x78] = { INPUT_PAGE_KEY, INPUT_KEY_LANG_3 }, 121*433d6423SLionel Sambuc [0x79] = { INPUT_PAGE_KEY, INPUT_KEY_I10L_4 }, 122*433d6423SLionel Sambuc [0x7B] = { INPUT_PAGE_KEY, INPUT_KEY_I10L_5 }, 123*433d6423SLionel Sambuc [0x7D] = { INPUT_PAGE_KEY, INPUT_KEY_I10L_3 }, 124*433d6423SLionel Sambuc [0x7E] = { INPUT_PAGE_KEY, INPUT_KEY_EQUAL_SIGN }, 125*433d6423SLionel Sambuc }; 126*433d6423SLionel Sambuc 127*433d6423SLionel Sambuc const struct scanmap scanmap_escaped[KBD_SCAN_CODES] = { 128*433d6423SLionel Sambuc [0x10] = { INPUT_PAGE_CONS, INPUT_CONS_SCAN_PREVIOUS_TRACK }, 129*433d6423SLionel Sambuc [0x19] = { INPUT_PAGE_CONS, INPUT_CONS_SCAN_NEXT_TRACK }, 130*433d6423SLionel Sambuc [0x1C] = { INPUT_PAGE_KEY, INPUT_KEY_KP_ENTER }, 131*433d6423SLionel Sambuc [0x1D] = { INPUT_PAGE_KEY, INPUT_KEY_RIGHT_CTRL }, 132*433d6423SLionel Sambuc [0x20] = { INPUT_PAGE_CONS, INPUT_CONS_MUTE }, 133*433d6423SLionel Sambuc [0x21] = { INPUT_PAGE_CONS, INPUT_CONS_AL_CALCULATOR }, 134*433d6423SLionel Sambuc [0x22] = { INPUT_PAGE_CONS, INPUT_CONS_PLAY_PAUSE }, 135*433d6423SLionel Sambuc [0x24] = { INPUT_PAGE_CONS, INPUT_CONS_STOP }, 136*433d6423SLionel Sambuc [0x2E] = { INPUT_PAGE_CONS, INPUT_CONS_VOLUME_DOWN }, 137*433d6423SLionel Sambuc [0x30] = { INPUT_PAGE_CONS, INPUT_CONS_VOLUME_UP }, 138*433d6423SLionel Sambuc [0x32] = { INPUT_PAGE_CONS, INPUT_CONS_AC_HOME }, 139*433d6423SLionel Sambuc [0x35] = { INPUT_PAGE_KEY, INPUT_KEY_KP_SLASH }, 140*433d6423SLionel Sambuc [0x37] = { INPUT_PAGE_KEY, INPUT_KEY_PRINT_SCREEN }, 141*433d6423SLionel Sambuc [0x38] = { INPUT_PAGE_KEY, INPUT_KEY_RIGHT_ALT }, 142*433d6423SLionel Sambuc [0x46] = { INPUT_PAGE_KEY, INPUT_KEY_PAUSE }, 143*433d6423SLionel Sambuc [0x47] = { INPUT_PAGE_KEY, INPUT_KEY_HOME }, 144*433d6423SLionel Sambuc [0x48] = { INPUT_PAGE_KEY, INPUT_KEY_UP_ARROW }, 145*433d6423SLionel Sambuc [0x49] = { INPUT_PAGE_KEY, INPUT_KEY_PAGE_UP }, 146*433d6423SLionel Sambuc [0x4B] = { INPUT_PAGE_KEY, INPUT_KEY_LEFT_ARROW }, 147*433d6423SLionel Sambuc [0x4D] = { INPUT_PAGE_KEY, INPUT_KEY_RIGHT_ARROW }, 148*433d6423SLionel Sambuc [0x4F] = { INPUT_PAGE_KEY, INPUT_KEY_END }, 149*433d6423SLionel Sambuc [0x50] = { INPUT_PAGE_KEY, INPUT_KEY_DOWN_ARROW }, 150*433d6423SLionel Sambuc [0x51] = { INPUT_PAGE_KEY, INPUT_KEY_PAGE_DOWN }, 151*433d6423SLionel Sambuc [0x52] = { INPUT_PAGE_KEY, INPUT_KEY_INSERT }, 152*433d6423SLionel Sambuc [0x53] = { INPUT_PAGE_KEY, INPUT_KEY_DELETE }, 153*433d6423SLionel Sambuc [0x5B] = { INPUT_PAGE_KEY, INPUT_KEY_LEFT_GUI }, 154*433d6423SLionel Sambuc [0x5C] = { INPUT_PAGE_KEY, INPUT_KEY_RIGHT_GUI }, 155*433d6423SLionel Sambuc [0x5D] = { INPUT_PAGE_KEY, INPUT_KEY_APPLICATION }, 156*433d6423SLionel Sambuc /* The following extended key (0x5E) may also be INPUT_KEY_POWER. */ 157*433d6423SLionel Sambuc [0x5E] = { INPUT_PAGE_GD, INPUT_GD_SYSTEM_POWER_DOWN }, 158*433d6423SLionel Sambuc [0x5F] = { INPUT_PAGE_GD, INPUT_GD_SYSTEM_SLEEP }, 159*433d6423SLionel Sambuc [0x63] = { INPUT_PAGE_GD, INPUT_GD_SYSTEM_WAKE_UP }, 160*433d6423SLionel Sambuc [0x65] = { INPUT_PAGE_CONS, INPUT_CONS_AC_SEARCH }, 161*433d6423SLionel Sambuc [0x66] = { INPUT_PAGE_CONS, INPUT_CONS_AC_BOOKMARKS }, 162*433d6423SLionel Sambuc [0x67] = { INPUT_PAGE_CONS, INPUT_CONS_AC_REFRESH }, 163*433d6423SLionel Sambuc [0x68] = { INPUT_PAGE_CONS, INPUT_CONS_AC_STOP }, 164*433d6423SLionel Sambuc [0x69] = { INPUT_PAGE_CONS, INPUT_CONS_AC_FORWARD }, 165*433d6423SLionel Sambuc [0x6A] = { INPUT_PAGE_CONS, INPUT_CONS_AC_BACK }, 166*433d6423SLionel Sambuc [0x6B] = { INPUT_PAGE_CONS, INPUT_CONS_AL_LOCAL_BROWSER }, 167*433d6423SLionel Sambuc [0x6C] = { INPUT_PAGE_CONS, INPUT_CONS_AL_EMAIL_READER }, 168*433d6423SLionel Sambuc [0x6D] = { INPUT_PAGE_CONS, INPUT_CONS_AL_MEDIA_SELECT }, 169*433d6423SLionel Sambuc }; 170