summaryrefslogtreecommitdiff
path: root/kvmd/plugins
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2019-09-30 07:23:10 +0300
committerDevaev Maxim <[email protected]>2019-09-30 07:23:10 +0300
commiteb445ca45dc6cd002d2d13889000adda0639f81d (patch)
tree30ae3c43f4ca9667dab5a3e204a55f3ccfe9efcc /kvmd/plugins
parentf29c5296cb9b5213574e657fcd151a232f4b2170 (diff)
serial hid: added middle button
Diffstat (limited to 'kvmd/plugins')
-rw-r--r--kvmd/plugins/hid/serial.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/kvmd/plugins/hid/serial.py b/kvmd/plugins/hid/serial.py
index 31ba0fd6..40eb3268 100644
--- a/kvmd/plugins/hid/serial.py
+++ b/kvmd/plugins/hid/serial.py
@@ -102,7 +102,7 @@ class _MouseMoveEvent(_IntEvent):
@dataclasses.dataclass(frozen=True)
class _MouseButtonEvent(_BoolEvent):
def __post_init__(self) -> None:
- assert self.name in ["left", "right"]
+ assert self.name in ["left", "right", "middle"]
def make_command(self) -> bytes:
code = 0
@@ -110,6 +110,8 @@ class _MouseButtonEvent(_BoolEvent):
code = (0b10000000 | (0b00001000 if self.state else 0))
elif self.name == "right":
code = (0b01000000 | (0b00000100 if self.state else 0))
+ elif self.name == "middle":
+ code = (0b00100000 | (0b00000010 if self.state else 0))
assert code, self
return b"\x13" + bytes([code]) + b"\x00\x00\x00"