diff options
-rwxr-xr-x | genmap.py | 14 | ||||
-rw-r--r-- | hid/src/keymap.h | 1 | ||||
-rw-r--r-- | keymap.csv | 1 | ||||
-rw-r--r-- | kvmd/keyboard/mappings.py | 3 |
4 files changed, 16 insertions, 3 deletions
@@ -28,9 +28,11 @@ import dataclasses from typing import Set from typing import List +from typing import Optional import Xlib.keysymdef.latin1 import Xlib.keysymdef.miscellany +import Xlib.keysymdef.xf86 import mako.template @@ -60,9 +62,15 @@ class _KeyMapping: def _resolve_keysym(name: str) -> int: - code = getattr(Xlib.keysymdef.latin1, name, None) - if code is None: - code = getattr(Xlib.keysymdef.miscellany, name, None) + code: Optional[int] = None + for module in [ + Xlib.keysymdef.latin1, + Xlib.keysymdef.miscellany, + Xlib.keysymdef.xf86, + ]: + code = getattr(module, name, None) + if code is not None: + break assert code is not None, name return code diff --git a/hid/src/keymap.h b/hid/src/keymap.h index fd74e488..8eeb16db 100644 --- a/hid/src/keymap.h +++ b/hid/src/keymap.h @@ -108,6 +108,7 @@ INLINE KeyboardKeycode keymap(uint8_t code) { case 69: return KEY_PAGE_UP; case 85: return KEY_PAUSE; case 51: return KEY_PERIOD; + case 105: return KEY_POWER; case 66: return KEY_PRINT; case 17: return KEY_Q; case 48: return KEY_QUOTE; @@ -103,3 +103,4 @@ 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_DOT,0x63,0x53,XK_KP_Decimal +Power,105,KEY_POWER,0x66,0xe05e,XK_XF86_Sleep diff --git a/kvmd/keyboard/mappings.py b/kvmd/keyboard/mappings.py index ec90700c..2d6e57c5 100644 --- a/kvmd/keyboard/mappings.py +++ b/kvmd/keyboard/mappings.py @@ -148,6 +148,7 @@ KEYMAP: Dict[str, Key] = { "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)), + "Power": Key(serial=SerialKey(code=105), otg=OtgKey(code=102, is_modifier=False)), } @@ -312,6 +313,7 @@ X11_TO_AT1 = { 65511: At1Key(code=57435, shift=False), # XK_Meta_L 65512: At1Key(code=57436, shift=False), # XK_Meta_R 65383: At1Key(code=57437, shift=False), # XK_Menu + 269025071: At1Key(code=57438, shift=False), # XK_XF86_Sleep } @@ -420,4 +422,5 @@ AT1_TO_WEB = { 57435: "MetaLeft", 57436: "MetaRight", 57437: "ContextMenu", + 57438: "Power", } |