summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2022-07-22 04:36:54 +0300
committerMaxim Devaev <[email protected]>2022-07-22 04:36:54 +0300
commit867412a6cdc91f997baa42cee92df2b466dfdc75 (patch)
treedbb0da45518763f2b211cee3f90f963b9957a254
parent249098b41c2372052ff90d017f18f30772d1f839 (diff)
renamed otg key to usb key
-rwxr-xr-xgenmap.py12
-rw-r--r--keymap.csv2
-rw-r--r--kvmd/keyboard/mappings.py218
-rw-r--r--kvmd/keyboard/mappings.py.mako6
-rw-r--r--kvmd/plugins/hid/bt/server.py6
-rw-r--r--kvmd/plugins/hid/otg/events.py18
-rw-r--r--kvmd/plugins/hid/otg/keyboard.py6
-rw-r--r--testenv/linters/vulture-wl.py2
8 files changed, 135 insertions, 135 deletions
diff --git a/genmap.py b/genmap.py
index 3e1b5497..35c87dab 100755
--- a/genmap.py
+++ b/genmap.py
@@ -40,7 +40,7 @@ import mako.template
# =====
@dataclasses.dataclass(frozen=True)
-class _OtgKey:
+class _UsbKey:
code: int
is_modifier: bool
@@ -63,7 +63,7 @@ class _KeyMapping:
web_name: str
mcu_code: int
arduino_name: str
- otg_key: _OtgKey
+ usb_key: _UsbKey
ps2_key: _Ps2Key
at1_code: int
x11_keys: Set[_X11Key]
@@ -94,10 +94,10 @@ def _parse_x11_names(names: str) -> Set[_X11Key]:
return keys
-def _parse_otg_key(key: str) -> _OtgKey:
+def _parse_usb_key(key: str) -> _UsbKey:
is_modifier = key.startswith("^")
code = int((key[1:] if is_modifier else key), 16)
- return _OtgKey(code, is_modifier)
+ return _UsbKey(code, is_modifier)
def _parse_ps2_key(key: str) -> _Ps2Key:
@@ -117,7 +117,7 @@ def _read_keymap_csv(path: str) -> List[_KeyMapping]:
web_name=row["web_name"],
mcu_code=int(row["mcu_code"]),
arduino_name=row["arduino_name"],
- otg_key=_parse_otg_key(row["otg_key"]),
+ usb_key=_parse_usb_key(row["usb_key"]),
ps2_key=_parse_ps2_key(row["ps2_key"]),
at1_code=int(row["at1_code"], 16),
x11_keys=_parse_x11_names(row["x11_names"] or ""),
@@ -146,7 +146,7 @@ def main() -> None:
# - Web
# - MCU code
# - Arduino name
- # - OTG code (^ for mod)
+ # - USB code (^ for mod mask)
# - PS/2 key
# - AT set1
# - X11 keysyms (^ for shift)
diff --git a/keymap.csv b/keymap.csv
index d32d5022..30354898 100644
--- a/keymap.csv
+++ b/keymap.csv
@@ -1,4 +1,4 @@
-web_name,mcu_code,arduino_name,otg_key,ps2_key,at1_code,x11_names
+web_name,mcu_code,arduino_name,usb_key,ps2_key,at1_code,x11_names
KeyA,1,KEY_A,0x04,reg:0x1c,0x1e,"^XK_A,XK_a"
KeyB,2,KEY_B,0x05,reg:0x32,0x30,"^XK_B,XK_b"
KeyC,3,KEY_C,0x06,reg:0x21,0x2e,"^XK_C,XK_c"
diff --git a/kvmd/keyboard/mappings.py b/kvmd/keyboard/mappings.py
index a1e3b31e..01a538b8 100644
--- a/kvmd/keyboard/mappings.py
+++ b/kvmd/keyboard/mappings.py
@@ -32,7 +32,7 @@ class McuKey:
@dataclasses.dataclass(frozen=True)
-class OtgKey:
+class UsbKey:
code: int
is_modifier: bool
@@ -40,117 +40,117 @@ class OtgKey:
@dataclasses.dataclass(frozen=True)
class Key:
mcu: McuKey
- otg: OtgKey
+ usb: UsbKey
KEYMAP: Dict[str, Key] = {
- "KeyA": Key(mcu=McuKey(code=1), otg=OtgKey(code=4, is_modifier=False)),
- "KeyB": Key(mcu=McuKey(code=2), otg=OtgKey(code=5, is_modifier=False)),
- "KeyC": Key(mcu=McuKey(code=3), otg=OtgKey(code=6, is_modifier=False)),
- "KeyD": Key(mcu=McuKey(code=4), otg=OtgKey(code=7, is_modifier=False)),
- "KeyE": Key(mcu=McuKey(code=5), otg=OtgKey(code=8, is_modifier=False)),
- "KeyF": Key(mcu=McuKey(code=6), otg=OtgKey(code=9, is_modifier=False)),
- "KeyG": Key(mcu=McuKey(code=7), otg=OtgKey(code=10, is_modifier=False)),
- "KeyH": Key(mcu=McuKey(code=8), otg=OtgKey(code=11, is_modifier=False)),
- "KeyI": Key(mcu=McuKey(code=9), otg=OtgKey(code=12, is_modifier=False)),
- "KeyJ": Key(mcu=McuKey(code=10), otg=OtgKey(code=13, is_modifier=False)),
- "KeyK": Key(mcu=McuKey(code=11), otg=OtgKey(code=14, is_modifier=False)),
- "KeyL": Key(mcu=McuKey(code=12), otg=OtgKey(code=15, is_modifier=False)),
- "KeyM": Key(mcu=McuKey(code=13), otg=OtgKey(code=16, is_modifier=False)),
- "KeyN": Key(mcu=McuKey(code=14), otg=OtgKey(code=17, is_modifier=False)),
- "KeyO": Key(mcu=McuKey(code=15), otg=OtgKey(code=18, is_modifier=False)),
- "KeyP": Key(mcu=McuKey(code=16), otg=OtgKey(code=19, is_modifier=False)),
- "KeyQ": Key(mcu=McuKey(code=17), otg=OtgKey(code=20, is_modifier=False)),
- "KeyR": Key(mcu=McuKey(code=18), otg=OtgKey(code=21, is_modifier=False)),
- "KeyS": Key(mcu=McuKey(code=19), otg=OtgKey(code=22, is_modifier=False)),
- "KeyT": Key(mcu=McuKey(code=20), otg=OtgKey(code=23, is_modifier=False)),
- "KeyU": Key(mcu=McuKey(code=21), otg=OtgKey(code=24, is_modifier=False)),
- "KeyV": Key(mcu=McuKey(code=22), otg=OtgKey(code=25, is_modifier=False)),
- "KeyW": Key(mcu=McuKey(code=23), otg=OtgKey(code=26, is_modifier=False)),
- "KeyX": Key(mcu=McuKey(code=24), otg=OtgKey(code=27, is_modifier=False)),
- "KeyY": Key(mcu=McuKey(code=25), otg=OtgKey(code=28, is_modifier=False)),
- "KeyZ": Key(mcu=McuKey(code=26), otg=OtgKey(code=29, is_modifier=False)),
- "Digit1": Key(mcu=McuKey(code=27), otg=OtgKey(code=30, is_modifier=False)),
- "Digit2": Key(mcu=McuKey(code=28), otg=OtgKey(code=31, is_modifier=False)),
- "Digit3": Key(mcu=McuKey(code=29), otg=OtgKey(code=32, is_modifier=False)),
- "Digit4": Key(mcu=McuKey(code=30), otg=OtgKey(code=33, is_modifier=False)),
- "Digit5": Key(mcu=McuKey(code=31), otg=OtgKey(code=34, is_modifier=False)),
- "Digit6": Key(mcu=McuKey(code=32), otg=OtgKey(code=35, is_modifier=False)),
- "Digit7": Key(mcu=McuKey(code=33), otg=OtgKey(code=36, is_modifier=False)),
- "Digit8": Key(mcu=McuKey(code=34), otg=OtgKey(code=37, is_modifier=False)),
- "Digit9": Key(mcu=McuKey(code=35), otg=OtgKey(code=38, is_modifier=False)),
- "Digit0": Key(mcu=McuKey(code=36), otg=OtgKey(code=39, is_modifier=False)),
- "Enter": Key(mcu=McuKey(code=37), otg=OtgKey(code=40, is_modifier=False)),
- "Escape": Key(mcu=McuKey(code=38), otg=OtgKey(code=41, is_modifier=False)),
- "Backspace": Key(mcu=McuKey(code=39), otg=OtgKey(code=42, is_modifier=False)),
- "Tab": Key(mcu=McuKey(code=40), otg=OtgKey(code=43, is_modifier=False)),
- "Space": Key(mcu=McuKey(code=41), otg=OtgKey(code=44, is_modifier=False)),
- "Minus": Key(mcu=McuKey(code=42), otg=OtgKey(code=45, is_modifier=False)),
- "Equal": Key(mcu=McuKey(code=43), otg=OtgKey(code=46, is_modifier=False)),
- "BracketLeft": Key(mcu=McuKey(code=44), otg=OtgKey(code=47, is_modifier=False)),
- "BracketRight": Key(mcu=McuKey(code=45), otg=OtgKey(code=48, is_modifier=False)),
- "Backslash": Key(mcu=McuKey(code=46), otg=OtgKey(code=49, is_modifier=False)),
- "Semicolon": Key(mcu=McuKey(code=47), otg=OtgKey(code=51, is_modifier=False)),
- "Quote": Key(mcu=McuKey(code=48), otg=OtgKey(code=52, is_modifier=False)),
- "Backquote": Key(mcu=McuKey(code=49), otg=OtgKey(code=53, is_modifier=False)),
- "Comma": Key(mcu=McuKey(code=50), otg=OtgKey(code=54, is_modifier=False)),
- "Period": Key(mcu=McuKey(code=51), otg=OtgKey(code=55, is_modifier=False)),
- "Slash": Key(mcu=McuKey(code=52), otg=OtgKey(code=56, is_modifier=False)),
- "CapsLock": Key(mcu=McuKey(code=53), otg=OtgKey(code=57, is_modifier=False)),
- "F1": Key(mcu=McuKey(code=54), otg=OtgKey(code=58, is_modifier=False)),
- "F2": Key(mcu=McuKey(code=55), otg=OtgKey(code=59, is_modifier=False)),
- "F3": Key(mcu=McuKey(code=56), otg=OtgKey(code=60, is_modifier=False)),
- "F4": Key(mcu=McuKey(code=57), otg=OtgKey(code=61, is_modifier=False)),
- "F5": Key(mcu=McuKey(code=58), otg=OtgKey(code=62, is_modifier=False)),
- "F6": Key(mcu=McuKey(code=59), otg=OtgKey(code=63, is_modifier=False)),
- "F7": Key(mcu=McuKey(code=60), otg=OtgKey(code=64, is_modifier=False)),
- "F8": Key(mcu=McuKey(code=61), otg=OtgKey(code=65, is_modifier=False)),
- "F9": Key(mcu=McuKey(code=62), otg=OtgKey(code=66, is_modifier=False)),
- "F10": Key(mcu=McuKey(code=63), otg=OtgKey(code=67, is_modifier=False)),
- "F11": Key(mcu=McuKey(code=64), otg=OtgKey(code=68, is_modifier=False)),
- "F12": Key(mcu=McuKey(code=65), otg=OtgKey(code=69, is_modifier=False)),
- "PrintScreen": Key(mcu=McuKey(code=66), otg=OtgKey(code=70, is_modifier=False)),
- "Insert": Key(mcu=McuKey(code=67), otg=OtgKey(code=73, is_modifier=False)),
- "Home": Key(mcu=McuKey(code=68), otg=OtgKey(code=74, is_modifier=False)),
- "PageUp": Key(mcu=McuKey(code=69), otg=OtgKey(code=75, is_modifier=False)),
- "Delete": Key(mcu=McuKey(code=70), otg=OtgKey(code=76, is_modifier=False)),
- "End": Key(mcu=McuKey(code=71), otg=OtgKey(code=77, is_modifier=False)),
- "PageDown": Key(mcu=McuKey(code=72), otg=OtgKey(code=78, is_modifier=False)),
- "ArrowRight": Key(mcu=McuKey(code=73), otg=OtgKey(code=79, is_modifier=False)),
- "ArrowLeft": Key(mcu=McuKey(code=74), otg=OtgKey(code=80, is_modifier=False)),
- "ArrowDown": Key(mcu=McuKey(code=75), otg=OtgKey(code=81, is_modifier=False)),
- "ArrowUp": Key(mcu=McuKey(code=76), otg=OtgKey(code=82, is_modifier=False)),
- "ControlLeft": Key(mcu=McuKey(code=77), otg=OtgKey(code=1, is_modifier=True)),
- "ShiftLeft": Key(mcu=McuKey(code=78), otg=OtgKey(code=2, is_modifier=True)),
- "AltLeft": Key(mcu=McuKey(code=79), otg=OtgKey(code=4, is_modifier=True)),
- "MetaLeft": Key(mcu=McuKey(code=80), otg=OtgKey(code=8, is_modifier=True)),
- "ControlRight": Key(mcu=McuKey(code=81), otg=OtgKey(code=16, is_modifier=True)),
- "ShiftRight": Key(mcu=McuKey(code=82), otg=OtgKey(code=32, is_modifier=True)),
- "AltRight": Key(mcu=McuKey(code=83), otg=OtgKey(code=64, is_modifier=True)),
- "MetaRight": Key(mcu=McuKey(code=84), otg=OtgKey(code=128, is_modifier=True)),
- "Pause": Key(mcu=McuKey(code=85), otg=OtgKey(code=72, is_modifier=False)),
- "ScrollLock": Key(mcu=McuKey(code=86), otg=OtgKey(code=71, is_modifier=False)),
- "NumLock": Key(mcu=McuKey(code=87), otg=OtgKey(code=83, is_modifier=False)),
- "ContextMenu": Key(mcu=McuKey(code=88), otg=OtgKey(code=101, is_modifier=False)),
- "NumpadDivide": Key(mcu=McuKey(code=89), otg=OtgKey(code=84, is_modifier=False)),
- "NumpadMultiply": Key(mcu=McuKey(code=90), otg=OtgKey(code=85, is_modifier=False)),
- "NumpadSubtract": Key(mcu=McuKey(code=91), otg=OtgKey(code=86, is_modifier=False)),
- "NumpadAdd": Key(mcu=McuKey(code=92), otg=OtgKey(code=87, is_modifier=False)),
- "NumpadEnter": Key(mcu=McuKey(code=93), otg=OtgKey(code=88, is_modifier=False)),
- "Numpad1": Key(mcu=McuKey(code=94), otg=OtgKey(code=89, is_modifier=False)),
- "Numpad2": Key(mcu=McuKey(code=95), otg=OtgKey(code=90, is_modifier=False)),
- "Numpad3": Key(mcu=McuKey(code=96), otg=OtgKey(code=91, is_modifier=False)),
- "Numpad4": Key(mcu=McuKey(code=97), otg=OtgKey(code=92, is_modifier=False)),
- "Numpad5": Key(mcu=McuKey(code=98), otg=OtgKey(code=93, is_modifier=False)),
- "Numpad6": Key(mcu=McuKey(code=99), otg=OtgKey(code=94, is_modifier=False)),
- "Numpad7": Key(mcu=McuKey(code=100), otg=OtgKey(code=95, is_modifier=False)),
- "Numpad8": Key(mcu=McuKey(code=101), otg=OtgKey(code=96, is_modifier=False)),
- "Numpad9": Key(mcu=McuKey(code=102), otg=OtgKey(code=97, is_modifier=False)),
- "Numpad0": Key(mcu=McuKey(code=103), otg=OtgKey(code=98, is_modifier=False)),
- "NumpadDecimal": Key(mcu=McuKey(code=104), otg=OtgKey(code=99, is_modifier=False)),
- "Power": Key(mcu=McuKey(code=105), otg=OtgKey(code=102, is_modifier=False)),
- "IntlBackslash": Key(mcu=McuKey(code=106), otg=OtgKey(code=100, is_modifier=False)),
- "IntlYen": Key(mcu=McuKey(code=107), otg=OtgKey(code=137, is_modifier=False)),
+ "KeyA": Key(mcu=McuKey(code=1), usb=UsbKey(code=4, is_modifier=False)),
+ "KeyB": Key(mcu=McuKey(code=2), usb=UsbKey(code=5, is_modifier=False)),
+ "KeyC": Key(mcu=McuKey(code=3), usb=UsbKey(code=6, is_modifier=False)),
+ "KeyD": Key(mcu=McuKey(code=4), usb=UsbKey(code=7, is_modifier=False)),
+ "KeyE": Key(mcu=McuKey(code=5), usb=UsbKey(code=8, is_modifier=False)),
+ "KeyF": Key(mcu=McuKey(code=6), usb=UsbKey(code=9, is_modifier=False)),
+ "KeyG": Key(mcu=McuKey(code=7), usb=UsbKey(code=10, is_modifier=False)),
+ "KeyH": Key(mcu=McuKey(code=8), usb=UsbKey(code=11, is_modifier=False)),
+ "KeyI": Key(mcu=McuKey(code=9), usb=UsbKey(code=12, is_modifier=False)),
+ "KeyJ": Key(mcu=McuKey(code=10), usb=UsbKey(code=13, is_modifier=False)),
+ "KeyK": Key(mcu=McuKey(code=11), usb=UsbKey(code=14, is_modifier=False)),
+ "KeyL": Key(mcu=McuKey(code=12), usb=UsbKey(code=15, is_modifier=False)),
+ "KeyM": Key(mcu=McuKey(code=13), usb=UsbKey(code=16, is_modifier=False)),
+ "KeyN": Key(mcu=McuKey(code=14), usb=UsbKey(code=17, is_modifier=False)),
+ "KeyO": Key(mcu=McuKey(code=15), usb=UsbKey(code=18, is_modifier=False)),
+ "KeyP": Key(mcu=McuKey(code=16), usb=UsbKey(code=19, is_modifier=False)),
+ "KeyQ": Key(mcu=McuKey(code=17), usb=UsbKey(code=20, is_modifier=False)),
+ "KeyR": Key(mcu=McuKey(code=18), usb=UsbKey(code=21, is_modifier=False)),
+ "KeyS": Key(mcu=McuKey(code=19), usb=UsbKey(code=22, is_modifier=False)),
+ "KeyT": Key(mcu=McuKey(code=20), usb=UsbKey(code=23, is_modifier=False)),
+ "KeyU": Key(mcu=McuKey(code=21), usb=UsbKey(code=24, is_modifier=False)),
+ "KeyV": Key(mcu=McuKey(code=22), usb=UsbKey(code=25, is_modifier=False)),
+ "KeyW": Key(mcu=McuKey(code=23), usb=UsbKey(code=26, is_modifier=False)),
+ "KeyX": Key(mcu=McuKey(code=24), usb=UsbKey(code=27, is_modifier=False)),
+ "KeyY": Key(mcu=McuKey(code=25), usb=UsbKey(code=28, is_modifier=False)),
+ "KeyZ": Key(mcu=McuKey(code=26), usb=UsbKey(code=29, is_modifier=False)),
+ "Digit1": Key(mcu=McuKey(code=27), usb=UsbKey(code=30, is_modifier=False)),
+ "Digit2": Key(mcu=McuKey(code=28), usb=UsbKey(code=31, is_modifier=False)),
+ "Digit3": Key(mcu=McuKey(code=29), usb=UsbKey(code=32, is_modifier=False)),
+ "Digit4": Key(mcu=McuKey(code=30), usb=UsbKey(code=33, is_modifier=False)),
+ "Digit5": Key(mcu=McuKey(code=31), usb=UsbKey(code=34, is_modifier=False)),
+ "Digit6": Key(mcu=McuKey(code=32), usb=UsbKey(code=35, is_modifier=False)),
+ "Digit7": Key(mcu=McuKey(code=33), usb=UsbKey(code=36, is_modifier=False)),
+ "Digit8": Key(mcu=McuKey(code=34), usb=UsbKey(code=37, is_modifier=False)),
+ "Digit9": Key(mcu=McuKey(code=35), usb=UsbKey(code=38, is_modifier=False)),
+ "Digit0": Key(mcu=McuKey(code=36), usb=UsbKey(code=39, is_modifier=False)),
+ "Enter": Key(mcu=McuKey(code=37), usb=UsbKey(code=40, is_modifier=False)),
+ "Escape": Key(mcu=McuKey(code=38), usb=UsbKey(code=41, is_modifier=False)),
+ "Backspace": Key(mcu=McuKey(code=39), usb=UsbKey(code=42, is_modifier=False)),
+ "Tab": Key(mcu=McuKey(code=40), usb=UsbKey(code=43, is_modifier=False)),
+ "Space": Key(mcu=McuKey(code=41), usb=UsbKey(code=44, is_modifier=False)),
+ "Minus": Key(mcu=McuKey(code=42), usb=UsbKey(code=45, is_modifier=False)),
+ "Equal": Key(mcu=McuKey(code=43), usb=UsbKey(code=46, is_modifier=False)),
+ "BracketLeft": Key(mcu=McuKey(code=44), usb=UsbKey(code=47, is_modifier=False)),
+ "BracketRight": Key(mcu=McuKey(code=45), usb=UsbKey(code=48, is_modifier=False)),
+ "Backslash": Key(mcu=McuKey(code=46), usb=UsbKey(code=49, is_modifier=False)),
+ "Semicolon": Key(mcu=McuKey(code=47), usb=UsbKey(code=51, is_modifier=False)),
+ "Quote": Key(mcu=McuKey(code=48), usb=UsbKey(code=52, is_modifier=False)),
+ "Backquote": Key(mcu=McuKey(code=49), usb=UsbKey(code=53, is_modifier=False)),
+ "Comma": Key(mcu=McuKey(code=50), usb=UsbKey(code=54, is_modifier=False)),
+ "Period": Key(mcu=McuKey(code=51), usb=UsbKey(code=55, is_modifier=False)),
+ "Slash": Key(mcu=McuKey(code=52), usb=UsbKey(code=56, is_modifier=False)),
+ "CapsLock": Key(mcu=McuKey(code=53), usb=UsbKey(code=57, is_modifier=False)),
+ "F1": Key(mcu=McuKey(code=54), usb=UsbKey(code=58, is_modifier=False)),
+ "F2": Key(mcu=McuKey(code=55), usb=UsbKey(code=59, is_modifier=False)),
+ "F3": Key(mcu=McuKey(code=56), usb=UsbKey(code=60, is_modifier=False)),
+ "F4": Key(mcu=McuKey(code=57), usb=UsbKey(code=61, is_modifier=False)),
+ "F5": Key(mcu=McuKey(code=58), usb=UsbKey(code=62, is_modifier=False)),
+ "F6": Key(mcu=McuKey(code=59), usb=UsbKey(code=63, is_modifier=False)),
+ "F7": Key(mcu=McuKey(code=60), usb=UsbKey(code=64, is_modifier=False)),
+ "F8": Key(mcu=McuKey(code=61), usb=UsbKey(code=65, is_modifier=False)),
+ "F9": Key(mcu=McuKey(code=62), usb=UsbKey(code=66, is_modifier=False)),
+ "F10": Key(mcu=McuKey(code=63), usb=UsbKey(code=67, is_modifier=False)),
+ "F11": Key(mcu=McuKey(code=64), usb=UsbKey(code=68, is_modifier=False)),
+ "F12": Key(mcu=McuKey(code=65), usb=UsbKey(code=69, is_modifier=False)),
+ "PrintScreen": Key(mcu=McuKey(code=66), usb=UsbKey(code=70, is_modifier=False)),
+ "Insert": Key(mcu=McuKey(code=67), usb=UsbKey(code=73, is_modifier=False)),
+ "Home": Key(mcu=McuKey(code=68), usb=UsbKey(code=74, is_modifier=False)),
+ "PageUp": Key(mcu=McuKey(code=69), usb=UsbKey(code=75, is_modifier=False)),
+ "Delete": Key(mcu=McuKey(code=70), usb=UsbKey(code=76, is_modifier=False)),
+ "End": Key(mcu=McuKey(code=71), usb=UsbKey(code=77, is_modifier=False)),
+ "PageDown": Key(mcu=McuKey(code=72), usb=UsbKey(code=78, is_modifier=False)),
+ "ArrowRight": Key(mcu=McuKey(code=73), usb=UsbKey(code=79, is_modifier=False)),
+ "ArrowLeft": Key(mcu=McuKey(code=74), usb=UsbKey(code=80, is_modifier=False)),
+ "ArrowDown": Key(mcu=McuKey(code=75), usb=UsbKey(code=81, is_modifier=False)),
+ "ArrowUp": Key(mcu=McuKey(code=76), usb=UsbKey(code=82, is_modifier=False)),
+ "ControlLeft": Key(mcu=McuKey(code=77), usb=UsbKey(code=1, is_modifier=True)),
+ "ShiftLeft": Key(mcu=McuKey(code=78), usb=UsbKey(code=2, is_modifier=True)),
+ "AltLeft": Key(mcu=McuKey(code=79), usb=UsbKey(code=4, is_modifier=True)),
+ "MetaLeft": Key(mcu=McuKey(code=80), usb=UsbKey(code=8, is_modifier=True)),
+ "ControlRight": Key(mcu=McuKey(code=81), usb=UsbKey(code=16, is_modifier=True)),
+ "ShiftRight": Key(mcu=McuKey(code=82), usb=UsbKey(code=32, is_modifier=True)),
+ "AltRight": Key(mcu=McuKey(code=83), usb=UsbKey(code=64, is_modifier=True)),
+ "MetaRight": Key(mcu=McuKey(code=84), usb=UsbKey(code=128, is_modifier=True)),
+ "Pause": Key(mcu=McuKey(code=85), usb=UsbKey(code=72, is_modifier=False)),
+ "ScrollLock": Key(mcu=McuKey(code=86), usb=UsbKey(code=71, is_modifier=False)),
+ "NumLock": Key(mcu=McuKey(code=87), usb=UsbKey(code=83, is_modifier=False)),
+ "ContextMenu": Key(mcu=McuKey(code=88), usb=UsbKey(code=101, is_modifier=False)),
+ "NumpadDivide": Key(mcu=McuKey(code=89), usb=UsbKey(code=84, is_modifier=False)),
+ "NumpadMultiply": Key(mcu=McuKey(code=90), usb=UsbKey(code=85, is_modifier=False)),
+ "NumpadSubtract": Key(mcu=McuKey(code=91), usb=UsbKey(code=86, is_modifier=False)),
+ "NumpadAdd": Key(mcu=McuKey(code=92), usb=UsbKey(code=87, is_modifier=False)),
+ "NumpadEnter": Key(mcu=McuKey(code=93), usb=UsbKey(code=88, is_modifier=False)),
+ "Numpad1": Key(mcu=McuKey(code=94), usb=UsbKey(code=89, is_modifier=False)),
+ "Numpad2": Key(mcu=McuKey(code=95), usb=UsbKey(code=90, is_modifier=False)),
+ "Numpad3": Key(mcu=McuKey(code=96), usb=UsbKey(code=91, is_modifier=False)),
+ "Numpad4": Key(mcu=McuKey(code=97), usb=UsbKey(code=92, is_modifier=False)),
+ "Numpad5": Key(mcu=McuKey(code=98), usb=UsbKey(code=93, is_modifier=False)),
+ "Numpad6": Key(mcu=McuKey(code=99), usb=UsbKey(code=94, is_modifier=False)),
+ "Numpad7": Key(mcu=McuKey(code=100), usb=UsbKey(code=95, is_modifier=False)),
+ "Numpad8": Key(mcu=McuKey(code=101), usb=UsbKey(code=96, is_modifier=False)),
+ "Numpad9": Key(mcu=McuKey(code=102), usb=UsbKey(code=97, is_modifier=False)),
+ "Numpad0": Key(mcu=McuKey(code=103), usb=UsbKey(code=98, is_modifier=False)),
+ "NumpadDecimal": Key(mcu=McuKey(code=104), usb=UsbKey(code=99, is_modifier=False)),
+ "Power": Key(mcu=McuKey(code=105), usb=UsbKey(code=102, is_modifier=False)),
+ "IntlBackslash": Key(mcu=McuKey(code=106), usb=UsbKey(code=100, is_modifier=False)),
+ "IntlYen": Key(mcu=McuKey(code=107), usb=UsbKey(code=137, is_modifier=False)),
}
diff --git a/kvmd/keyboard/mappings.py.mako b/kvmd/keyboard/mappings.py.mako
index 0cbde02f..91d46297 100644
--- a/kvmd/keyboard/mappings.py.mako
+++ b/kvmd/keyboard/mappings.py.mako
@@ -32,7 +32,7 @@ class McuKey:
@dataclasses.dataclass(frozen=True)
-class OtgKey:
+class UsbKey:
code: int
is_modifier: bool
@@ -40,12 +40,12 @@ class OtgKey:
@dataclasses.dataclass(frozen=True)
class Key:
mcu: McuKey
- otg: OtgKey
+ usb: UsbKey
<%! import operator %>
KEYMAP: Dict[str, Key] = {
% for km in sorted(keymap, key=operator.attrgetter("mcu_code")):
- "${km.web_name}": Key(mcu=McuKey(code=${km.mcu_code}), otg=OtgKey(code=${km.otg_key.code}, is_modifier=${km.otg_key.is_modifier})),
+ "${km.web_name}": Key(mcu=McuKey(code=${km.mcu_code}), usb=UsbKey(code=${km.usb_key.code}, is_modifier=${km.usb_key.is_modifier})),
% endfor
}
diff --git a/kvmd/plugins/hid/bt/server.py b/kvmd/plugins/hid/bt/server.py
index feac5329..9cfbce53 100644
--- a/kvmd/plugins/hid/bt/server.py
+++ b/kvmd/plugins/hid/bt/server.py
@@ -40,7 +40,7 @@ from ....logging import get_logger
from .... import tools
from .... import aiomulti
-from ....keyboard.mappings import OtgKey
+from ....keyboard.mappings import UsbKey
from ..otg.events import BaseEvent
from ..otg.events import ClearEvent
@@ -115,8 +115,8 @@ class BtServer: # pylint: disable=too-many-instance-attributes
"scroll": False,
"num": False,
}, notifier)
- self.__modifiers: Set[OtgKey] = set()
- self.__keys: List[Optional[OtgKey]] = [None] * 6
+ self.__modifiers: Set[UsbKey] = set()
+ self.__keys: List[Optional[UsbKey]] = [None] * 6
self.__mouse_buttons = 0
def run(self) -> None:
diff --git a/kvmd/plugins/hid/otg/events.py b/kvmd/plugins/hid/otg/events.py
index 954a7131..e1f0f35c 100644
--- a/kvmd/plugins/hid/otg/events.py
+++ b/kvmd/plugins/hid/otg/events.py
@@ -28,7 +28,7 @@ from typing import Set
from typing import Optional
from typing import Union
-from ....keyboard.mappings import OtgKey
+from ....keyboard.mappings import UsbKey
from ....keyboard.mappings import KEYMAP
from ....mouse import MouseRange
@@ -50,7 +50,7 @@ class ResetEvent(BaseEvent):
# =====
@dataclasses.dataclass(frozen=True)
class KeyEvent(BaseEvent):
- key: OtgKey
+ key: UsbKey
state: bool
def __post_init__(self) -> None:
@@ -59,7 +59,7 @@ class KeyEvent(BaseEvent):
@dataclasses.dataclass(frozen=True)
class ModifierEvent(BaseEvent):
- modifier: OtgKey
+ modifier: UsbKey
state: bool
def __post_init__(self) -> None:
@@ -67,10 +67,10 @@ class ModifierEvent(BaseEvent):
def make_keyboard_event(key: str, state: bool) -> Union[KeyEvent, ModifierEvent]:
- otg_key = KEYMAP[key].otg
- if otg_key.is_modifier:
- return ModifierEvent(otg_key, state)
- return KeyEvent(otg_key, state)
+ usb_key = KEYMAP[key].usb
+ if usb_key.is_modifier:
+ return ModifierEvent(usb_key, state)
+ return KeyEvent(usb_key, state)
def get_led_caps(flags: int) -> bool:
@@ -87,8 +87,8 @@ def get_led_num(flags: int) -> bool:
def make_keyboard_report(
- pressed_modifiers: Set[OtgKey],
- pressed_keys: List[Optional[OtgKey]],
+ pressed_modifiers: Set[UsbKey],
+ pressed_keys: List[Optional[UsbKey]],
) -> bytes:
modifiers = 0
diff --git a/kvmd/plugins/hid/otg/keyboard.py b/kvmd/plugins/hid/otg/keyboard.py
index 3392e8f9..2403dc2c 100644
--- a/kvmd/plugins/hid/otg/keyboard.py
+++ b/kvmd/plugins/hid/otg/keyboard.py
@@ -30,7 +30,7 @@ from typing import Any
from ....logging import get_logger
-from ....keyboard.mappings import OtgKey
+from ....keyboard.mappings import UsbKey
from .device import BaseDeviceProcess
@@ -56,8 +56,8 @@ class KeyboardProcess(BaseDeviceProcess):
**kwargs,
)
- self.__pressed_modifiers: Set[OtgKey] = set()
- self.__pressed_keys: List[Optional[OtgKey]] = [None] * 6
+ self.__pressed_modifiers: Set[UsbKey] = set()
+ self.__pressed_keys: List[Optional[UsbKey]] = [None] * 6
def cleanup(self) -> None:
self._stop()
diff --git a/testenv/linters/vulture-wl.py b/testenv/linters/vulture-wl.py
index 1700dcc8..7e5a6d6a 100644
--- a/testenv/linters/vulture-wl.py
+++ b/testenv/linters/vulture-wl.py
@@ -27,7 +27,7 @@ _AtxApiPart.switch_power
_KeyMapping.web_name
_KeyMapping.mcu_code
_KeyMapping.arduino_name
-_KeyMapping.otg_key
+_KeyMapping.usb_key
_KeyMapping.ps2_key
_KeyMapping.at1_code
_KeyMapping.x11_keys