summaryrefslogtreecommitdiff
path: root/kvmd/plugins/hid/ch9329/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'kvmd/plugins/hid/ch9329/__init__.py')
-rw-r--r--kvmd/plugins/hid/ch9329/__init__.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/kvmd/plugins/hid/ch9329/__init__.py b/kvmd/plugins/hid/ch9329/__init__.py
index e7f518d5..7f846b2f 100644
--- a/kvmd/plugins/hid/ch9329/__init__.py
+++ b/kvmd/plugins/hid/ch9329/__init__.py
@@ -58,6 +58,7 @@ class Plugin(BaseHid, multiprocessing.Process): # pylint: disable=too-many-inst
read_timeout: float,
) -> None:
+ BaseHid.__init__(self)
multiprocessing.Process.__init__(self, daemon=True)
self.__device_path = device_path
@@ -112,6 +113,7 @@ class Plugin(BaseHid, multiprocessing.Process): # pylint: disable=too-many-inst
"active": ("usb" if absolute else "usb_rel"),
},
},
+ "jiggler": self._get_jiggler_state(),
}
async def poll_state(self) -> AsyncGenerator[dict, None]:
@@ -139,23 +141,40 @@ class Plugin(BaseHid, multiprocessing.Process): # pylint: disable=too-many-inst
def send_key_events(self, keys: Iterable[tuple[str, bool]]) -> None:
for (key, state) in keys:
self.__queue_cmd(self.__keyboard.process_key(key, state))
+ self._bump_activity()
def send_mouse_button_event(self, button: str, state: bool) -> None:
self.__queue_cmd(self.__mouse.process_button(button, state))
+ self._bump_activity()
def send_mouse_move_event(self, to_x: int, to_y: int) -> None:
self.__queue_cmd(self.__mouse.process_move(to_x, to_y))
+ self._bump_activity()
def send_mouse_wheel_event(self, delta_x: int, delta_y: int) -> None:
self.__queue_cmd(self.__mouse.process_wheel(delta_x, delta_y))
+ self._bump_activity()
def send_mouse_relative_event(self, delta_x: int, delta_y: int) -> None:
self.__queue_cmd(self.__mouse.process_relative(delta_x, delta_y))
+ self._bump_activity()
- def set_params(self, keyboard_output: (str | None)=None, mouse_output: (str | None)=None) -> None:
+ def set_params(
+ self,
+ keyboard_output: (str | None)=None,
+ mouse_output: (str | None)=None,
+ jiggler: (bool | None)=None,
+ ) -> None:
+
+ _ = keyboard_output
if mouse_output is not None:
get_logger(0).info("HID : mouse output = %s", mouse_output)
- self.__mouse.set_absolute(mouse_output == "usb")
+ absolute = (mouse_output == "usb")
+ self.__mouse.set_absolute(absolute)
+ self._set_jiggler_absolute(absolute)
+ self.__notifier.notify()
+ if jiggler is not None:
+ self._set_jiggler_enabled(jiggler)
self.__notifier.notify()
def set_connected(self, connected: bool) -> None: