summaryrefslogtreecommitdiff
path: root/kvmd/plugins
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2019-09-30 00:43:35 +0300
committerDevaev Maxim <[email protected]>2019-09-30 00:43:35 +0300
commita089334371c13bd9ece2f04b8122204e14ee3661 (patch)
tree6cc1395cd6b2fb3c7d3493aeff4593e2374d3705 /kvmd/plugins
parenta60e4142b88f22e0de4d0d74b279754f7a3ea365 (diff)
separate keyboard and mouse statuses
Diffstat (limited to 'kvmd/plugins')
-rw-r--r--kvmd/plugins/hid/serial.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/kvmd/plugins/hid/serial.py b/kvmd/plugins/hid/serial.py
index 5edf50a8..31ba0fd6 100644
--- a/kvmd/plugins/hid/serial.py
+++ b/kvmd/plugins/hid/serial.py
@@ -118,7 +118,7 @@ class _MouseButtonEvent(_BoolEvent):
class _MouseWheelEvent(_IntEvent):
def __post_init__(self) -> None:
assert self.x == 0 # Горизонтальная прокрутка пока не поддерживается
- assert -128 <= self.y <= 127
+ assert -127 <= self.y <= 127
def make_command(self) -> bytes:
return b"\x14\x00" + struct.pack(">b", self.y) + b"\x00\x00"
@@ -188,7 +188,12 @@ class Plugin(BaseHid, multiprocessing.Process): # pylint: disable=too-many-inst
multiprocessing.Process.start(self)
def get_state(self) -> Dict:
- return {"online": bool(self.__online_shared.value)}
+ online = bool(self.__online_shared.value)
+ return {
+ "online": online,
+ "keyboard": {"online": online},
+ "mouse": {"online": online},
+ }
async def poll_state(self) -> AsyncGenerator[Dict, None]:
prev_state: Dict = {}