mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
renamed otg key to usb key
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user