diff options
author | Devaev Maxim <[email protected]> | 2020-06-03 02:01:04 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-06-03 02:01:04 +0300 |
commit | b6d463f8143aea7c946ae2b33cf97fe06d01a28a (patch) | |
tree | fd9ebe4b1c452f802d9fdc003ce85abaabd0814e | |
parent | 54f0e1990beb18be2ee9483ba6a727a8a22a0fa6 (diff) |
numpad supported
-rw-r--r-- | hid/src/keymap.h | 16 | ||||
-rw-r--r-- | keymap.in | 34 | ||||
-rw-r--r-- | kvmd/keyboard/mappings.py | 48 |
3 files changed, 81 insertions, 17 deletions
diff --git a/hid/src/keymap.h b/hid/src/keymap.h index c66a454d..d34dd9bd 100644 --- a/hid/src/keymap.h +++ b/hid/src/keymap.h @@ -29,6 +29,22 @@ INLINE KeyboardKeycode keymap(uint8_t code) { switch(code) { + case 103: return KEYPAD_0; + case 94: return KEYPAD_1; + case 95: return KEYPAD_2; + case 96: return KEYPAD_3; + case 97: return KEYPAD_4; + case 98: return KEYPAD_5; + case 99: return KEYPAD_6; + case 100: return KEYPAD_7; + case 101: return KEYPAD_8; + case 102: return KEYPAD_9; + case 92: return KEYPAD_ADD; + case 104: return KEYPAD_DECIMAL; + case 89: return KEYPAD_DIVIDE; + case 93: return KEYPAD_ENTER; + case 90: return KEYPAD_MULTIPLY; + case 91: return KEYPAD_SUBTRACT; case 36: return KEY_0; case 27: return KEY_1; case 28: return KEY_2; @@ -116,21 +116,21 @@ Pause 85 KEY_PAUSE 0x48 0xe046 XK_Pause ScrollLock 86 KEY_SCROLL_LOCK 0x47 0x46 XK_Scroll_Lock NumLock 87 KEY_NUM_LOCK 0x53 0x45 XK_Num_Lock ContextMenu 88 KEY_MENU 0x65 0xe05d XK_Menu -# KEY_NON_US_NUM -# KEYPAD_DIVIDE -# KEYPAD_MULTIPLY -# KEYPAD_SUBTRACT -# KEYPAD_ADD -# KEYPAD_ENTER -# KEYPAD_1 -# KEYPAD_2 -# KEYPAD_3 -# KEYPAD_4 -# KEYPAD_5 -# KEYPAD_6 -# KEYPAD_7 -# KEYPAD_8 -# KEYPAD_9 -# KEYPAD_0 -# KEYPAD_DOT +NumpadDivide 89 KEYPAD_DIVIDE 0x54 0xe035 XK_KP_Divide +NumpadMultiply 90 KEYPAD_MULTIPLY 0x55 0x37 XK_multiply +NumpadSubtract 91 KEYPAD_SUBTRACT 0x56 0x4a XK_KP_Subtract +NumpadAdd 92 KEYPAD_ADD 0x57 0x4e XK_KP_Add +NumpadEnter 93 KEYPAD_ENTER 0x58 0xe01c XK_KP_Enter +Numpad1 94 KEYPAD_1 0x59 0x4f XK_KP_1 +Numpad2 95 KEYPAD_2 0x5a 0x50 XK_KP_2 +Numpad3 96 KEYPAD_3 0x5b 0x51 XK_KP_3 +Numpad4 97 KEYPAD_4 0x5c 0x4b XK_KP_4 +Numpad5 98 KEYPAD_5 0x5d 0x4c XK_KP_5 +Numpad6 99 KEYPAD_6 0x5e 0x4d XK_KP_6 +Numpad7 100 KEYPAD_7 0x5f 0x47 XK_KP_7 +Numpad8 101 KEYPAD_8 0x60 0x48 XK_KP_8 +Numpad9 102 KEYPAD_9 0x61 0x49 XK_KP_9 +Numpad0 103 KEYPAD_0 0x62 0x52 XK_KP_0 +NumpadDecimal 104 KEYPAD_DECIMAL 0x63 0x53 XK_KP_Decimal # KEY_NON_US +# KEY_NON_US_NUM diff --git a/kvmd/keyboard/mappings.py b/kvmd/keyboard/mappings.py index 8ac60166..ec90700c 100644 --- a/kvmd/keyboard/mappings.py +++ b/kvmd/keyboard/mappings.py @@ -132,6 +132,22 @@ KEYMAP: Dict[str, Key] = { "ScrollLock": Key(serial=SerialKey(code=86), otg=OtgKey(code=71, is_modifier=False)), "NumLock": Key(serial=SerialKey(code=87), otg=OtgKey(code=83, is_modifier=False)), "ContextMenu": Key(serial=SerialKey(code=88), otg=OtgKey(code=101, is_modifier=False)), + "NumpadDivide": Key(serial=SerialKey(code=89), otg=OtgKey(code=84, is_modifier=False)), + "NumpadMultiply": Key(serial=SerialKey(code=90), otg=OtgKey(code=85, is_modifier=False)), + "NumpadSubtract": Key(serial=SerialKey(code=91), otg=OtgKey(code=86, is_modifier=False)), + "NumpadAdd": Key(serial=SerialKey(code=92), otg=OtgKey(code=87, is_modifier=False)), + "NumpadEnter": Key(serial=SerialKey(code=93), otg=OtgKey(code=88, is_modifier=False)), + "Numpad1": Key(serial=SerialKey(code=94), otg=OtgKey(code=89, is_modifier=False)), + "Numpad2": Key(serial=SerialKey(code=95), otg=OtgKey(code=90, is_modifier=False)), + "Numpad3": Key(serial=SerialKey(code=96), otg=OtgKey(code=91, is_modifier=False)), + "Numpad4": Key(serial=SerialKey(code=97), otg=OtgKey(code=92, is_modifier=False)), + "Numpad5": Key(serial=SerialKey(code=98), otg=OtgKey(code=93, is_modifier=False)), + "Numpad6": Key(serial=SerialKey(code=99), otg=OtgKey(code=94, is_modifier=False)), + "Numpad7": Key(serial=SerialKey(code=100), otg=OtgKey(code=95, is_modifier=False)), + "Numpad8": Key(serial=SerialKey(code=101), otg=OtgKey(code=96, is_modifier=False)), + "Numpad9": Key(serial=SerialKey(code=102), otg=OtgKey(code=97, is_modifier=False)), + "Numpad0": Key(serial=SerialKey(code=103), otg=OtgKey(code=98, is_modifier=False)), + "NumpadDecimal": Key(serial=SerialKey(code=104), otg=OtgKey(code=99, is_modifier=False)), } @@ -246,6 +262,7 @@ X11_TO_AT1 = { 47: At1Key(code=53, shift=False), # XK_slash 63: At1Key(code=53, shift=True), # XK_question 65506: At1Key(code=54, shift=False), # XK_Shift_R + 215: At1Key(code=55, shift=False), # XK_multiply 65513: At1Key(code=56, shift=False), # XK_Alt_L 32: At1Key(code=57, shift=False), # XK_space 65509: At1Key(code=58, shift=False), # XK_Caps_Lock @@ -261,10 +278,25 @@ X11_TO_AT1 = { 65479: At1Key(code=68, shift=False), # XK_F10 65407: At1Key(code=69, shift=False), # XK_Num_Lock 65300: At1Key(code=70, shift=False), # XK_Scroll_Lock + 65463: At1Key(code=71, shift=False), # XK_KP_7 + 65464: At1Key(code=72, shift=False), # XK_KP_8 + 65465: At1Key(code=73, shift=False), # XK_KP_9 + 65453: At1Key(code=74, shift=False), # XK_KP_Subtract + 65460: At1Key(code=75, shift=False), # XK_KP_4 + 65461: At1Key(code=76, shift=False), # XK_KP_5 + 65462: At1Key(code=77, shift=False), # XK_KP_6 + 65451: At1Key(code=78, shift=False), # XK_KP_Add + 65457: At1Key(code=79, shift=False), # XK_KP_1 + 65458: At1Key(code=80, shift=False), # XK_KP_2 + 65459: At1Key(code=81, shift=False), # XK_KP_3 + 65456: At1Key(code=82, shift=False), # XK_KP_0 + 65454: At1Key(code=83, shift=False), # XK_KP_Decimal 65301: At1Key(code=84, shift=False), # XK_Sys_Req 65480: At1Key(code=87, shift=False), # XK_F11 65481: At1Key(code=88, shift=False), # XK_F12 + 65421: At1Key(code=57372, shift=False), # XK_KP_Enter 65508: At1Key(code=57373, shift=False), # XK_Control_R + 65455: At1Key(code=57397, shift=False), # XK_KP_Divide 65514: At1Key(code=57400, shift=False), # XK_Alt_R 65299: At1Key(code=57414, shift=False), # XK_Pause 65360: At1Key(code=57415, shift=False), # XK_Home @@ -338,6 +370,7 @@ AT1_TO_WEB = { 52: "Period", 53: "Slash", 54: "ShiftRight", + 55: "NumpadMultiply", 56: "AltLeft", 57: "Space", 58: "CapsLock", @@ -353,10 +386,25 @@ AT1_TO_WEB = { 68: "F10", 69: "NumLock", 70: "ScrollLock", + 71: "Numpad7", + 72: "Numpad8", + 73: "Numpad9", + 74: "NumpadSubtract", + 75: "Numpad4", + 76: "Numpad5", + 77: "Numpad6", + 78: "NumpadAdd", + 79: "Numpad1", + 80: "Numpad2", + 81: "Numpad3", + 82: "Numpad0", + 83: "NumpadDecimal", 84: "PrintScreen", 87: "F11", 88: "F12", + 57372: "NumpadEnter", 57373: "ControlRight", + 57397: "NumpadDivide", 57400: "AltRight", 57414: "Pause", 57415: "Home", |