summaryrefslogtreecommitdiff
path: root/kvmd/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'kvmd/plugins')
-rw-r--r--kvmd/plugins/hid/otg/keyboard.py13
-rw-r--r--kvmd/plugins/hid/serial.py7
2 files changed, 11 insertions, 9 deletions
diff --git a/kvmd/plugins/hid/otg/keyboard.py b/kvmd/plugins/hid/otg/keyboard.py
index cb83232b..63c15889 100644
--- a/kvmd/plugins/hid/otg/keyboard.py
+++ b/kvmd/plugins/hid/otg/keyboard.py
@@ -29,7 +29,8 @@ from typing import Any
from ....logging import get_logger
-from .... import keymap
+from ....keyboard.mappings import OtgKey
+from ....keyboard.mappings import KEYMAP
from .device import BaseEvent
from .device import BaseDeviceProcess
@@ -46,7 +47,7 @@ class _ResetEvent(BaseEvent):
@dataclasses.dataclass(frozen=True)
class _ModifierEvent(BaseEvent):
- modifier: keymap.OtgKey
+ modifier: OtgKey
state: bool
def __post_init__(self) -> None:
@@ -55,7 +56,7 @@ class _ModifierEvent(BaseEvent):
@dataclasses.dataclass(frozen=True)
class _KeyEvent(BaseEvent):
- key: keymap.OtgKey
+ key: OtgKey
state: bool
def __post_init__(self) -> None:
@@ -72,8 +73,8 @@ class KeyboardProcess(BaseDeviceProcess):
**kwargs,
)
- self.__pressed_modifiers: Set[keymap.OtgKey] = set()
- self.__pressed_keys: List[Optional[keymap.OtgKey]] = [None] * 6
+ self.__pressed_modifiers: Set[OtgKey] = set()
+ self.__pressed_keys: List[Optional[OtgKey]] = [None] * 6
def cleanup(self) -> None:
self._stop()
@@ -89,7 +90,7 @@ class KeyboardProcess(BaseDeviceProcess):
self._queue_event(_ResetEvent())
def send_key_event(self, key: str, state: bool) -> None:
- otg_key = keymap.KEYMAP[key].otg
+ otg_key = KEYMAP[key].otg
if otg_key.is_modifier:
self._queue_event(_ModifierEvent(otg_key, state))
else:
diff --git a/kvmd/plugins/hid/serial.py b/kvmd/plugins/hid/serial.py
index f2ece19d..c41c762c 100644
--- a/kvmd/plugins/hid/serial.py
+++ b/kvmd/plugins/hid/serial.py
@@ -39,10 +39,11 @@ import setproctitle
from ...logging import get_logger
+from ...keyboard.mappings import KEYMAP
+
from ... import aiotools
from ... import aiomulti
from ... import gpio
-from ... import keymap
from ...yamlconf import Option
@@ -75,10 +76,10 @@ class _KeyEvent(_BaseEvent):
state: bool
def __post_init__(self) -> None:
- assert self.name in keymap.KEYMAP
+ assert self.name in KEYMAP
def make_command(self) -> bytes:
- code = keymap.KEYMAP[self.name].serial.code
+ code = KEYMAP[self.name].serial.code
return struct.pack(">BBBxx", 0x11, code, int(self.state))