summaryrefslogtreecommitdiff
path: root/kvmd/apps
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2024-12-11 21:09:49 +0200
committerMaxim Devaev <[email protected]>2024-12-11 21:09:49 +0200
commite014cbcedff6d7e96a1d5d6417ed5b9362d927c5 (patch)
treeff050e6b282eb65feebb4ee5cc9d92c9f36f2796 /kvmd/apps
parentadbd4f242b4478dd1a67de1afb3ba799de57f2d5 (diff)
pikvm/pikvm#858, pikvm/pikvm#1249: Added slow typing mode for /api/hid/print
Diffstat (limited to 'kvmd/apps')
-rw-r--r--kvmd/apps/kvmd/api/hid.py5
-rw-r--r--kvmd/apps/kvmd/snapshoter.py2
2 files changed, 4 insertions, 3 deletions
diff --git a/kvmd/apps/kvmd/api/hid.py b/kvmd/apps/kvmd/api/hid.py
index 51b9dc00..5ba22abb 100644
--- a/kvmd/apps/kvmd/api/hid.py
+++ b/kvmd/apps/kvmd/api/hid.py
@@ -123,7 +123,8 @@ class HidApi:
if limit > 0:
text = text[:limit]
symmap = self.__ensure_symmap(req.query.get("keymap", self.__default_keymap_name))
- self.__hid.send_key_events(text_to_web_keys(text, symmap), no_ignore_keys=True)
+ slow = valid_bool(req.query.get("slow", False))
+ await self.__hid.send_key_events(text_to_web_keys(text, symmap), no_ignore_keys=True, slow=slow)
return make_json_response()
def __ensure_symmap(self, keymap_name: str) -> dict[int, dict[int, str]]:
@@ -250,7 +251,7 @@ class HidApi:
state = valid_bool(req.query["state"])
self.__hid.send_key_event(key, state)
else:
- self.__hid.send_key_events([(key, True), (key, False)])
+ await self.__hid.send_key_events([(key, True), (key, False)], slow=True)
return make_json_response()
@exposed_http("POST", "/hid/events/send_mouse_button")
diff --git a/kvmd/apps/kvmd/snapshoter.py b/kvmd/apps/kvmd/snapshoter.py
index 76885c90..e9391306 100644
--- a/kvmd/apps/kvmd/snapshoter.py
+++ b/kvmd/apps/kvmd/snapshoter.py
@@ -123,7 +123,7 @@ class Snapshoter: # pylint: disable=too-many-instance-attributes
if self.__wakeup_key:
logger.info("Waking up using key %r ...", self.__wakeup_key)
- self.__hid.send_key_events(
+ await self.__hid.send_key_events(
keys=[(self.__wakeup_key, True), (self.__wakeup_key, False)],
no_ignore_keys=True,
)