summaryrefslogtreecommitdiff
path: root/kvmd/clients
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2023-06-05 16:37:02 +0300
committerMaxim Devaev <[email protected]>2023-06-05 16:37:02 +0300
commit66c1d321d2048feab7c786d64a5356660216ad38 (patch)
tree04b8de4ca556f629acc590be1491bffad31bf33f /kvmd/clients
parent82aedb9c4ea7b57f03fe83fe0edee4c511c883ef (diff)
vnc: force absolute usb mouse_output
Diffstat (limited to 'kvmd/clients')
-rw-r--r--kvmd/clients/kvmd.py37
1 files changed, 24 insertions, 13 deletions
diff --git a/kvmd/clients/kvmd.py b/kvmd/clients/kvmd.py
index f8511504..ec86378d 100644
--- a/kvmd/clients/kvmd.py
+++ b/kvmd/clients/kvmd.py
@@ -46,6 +46,18 @@ class _BaseApiPart:
self._ensure_http_session = ensure_http_session
self._make_url = make_url
+ async def _set_params(self, handle: str, **params: (int | str | None)) -> None:
+ session = self._ensure_http_session()
+ async with session.post(
+ url=self._make_url(handle),
+ params={
+ key: value
+ for (key, value) in params.items()
+ if value is not None
+ },
+ ) as response:
+ htclient.raise_not_200(response)
+
class _AuthApiPart(_BaseApiPart):
async def check(self) -> bool:
@@ -68,19 +80,11 @@ class _StreamerApiPart(_BaseApiPart):
return (await response.json())["result"]
async def set_params(self, quality: (int | None)=None, desired_fps: (int | None)=None) -> None:
- session = self._ensure_http_session()
- async with session.post(
- url=self._make_url("streamer/set_params"),
- params={
- key: value
- for (key, value) in [
- ("quality", quality),
- ("desired_fps", desired_fps),
- ]
- if value is not None
- },
- ) as response:
- htclient.raise_not_200(response)
+ await self._set_params(
+ "streamer/set_params",
+ quality=quality,
+ desired_fps=desired_fps,
+ )
class _HidApiPart(_BaseApiPart):
@@ -100,6 +104,13 @@ class _HidApiPart(_BaseApiPart):
) as response:
htclient.raise_not_200(response)
+ async def set_params(self, keyboard_output: (str | None)=None, mouse_output: (str | None)=None) -> None:
+ await self._set_params(
+ "hid/set_params",
+ keyboard_output=keyboard_output,
+ mouse_output=mouse_output,
+ )
+
class _AtxApiPart(_BaseApiPart):
async def get_state(self) -> dict: