summaryrefslogtreecommitdiff
path: root/kvmd/apps
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-11-20 19:12:41 +0300
committerDevaev Maxim <[email protected]>2020-11-20 19:12:41 +0300
commit3ffbc7554a33f40640aa06dad9bb3803d69757e7 (patch)
treee6f7ef92492066aa940de786124d81dccf93c61a /kvmd/apps
parent6490c8835c53e0fcb9aa8e86f138a64cb8b3e3a1 (diff)
outputs api
Diffstat (limited to 'kvmd/apps')
-rw-r--r--kvmd/apps/kvmd/api/hid.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/kvmd/apps/kvmd/api/hid.py b/kvmd/apps/kvmd/api/hid.py
index 1f51a0e4..bedc01c8 100644
--- a/kvmd/apps/kvmd/api/hid.py
+++ b/kvmd/apps/kvmd/api/hid.py
@@ -38,6 +38,8 @@ from ....validators import raise_error
from ....validators.basic import valid_bool
from ....validators.basic import valid_int_f0
from ....validators.os import valid_printable_filename
+from ....validators.kvm import valid_hid_keyboard_output
+from ....validators.kvm import valid_hid_mouse_output
from ....validators.kvm import valid_hid_key
from ....validators.kvm import valid_hid_mouse_move
from ....validators.kvm import valid_hid_mouse_button
@@ -67,6 +69,16 @@ class HidApi:
async def __state_handler(self, _: Request) -> Response:
return make_json_response(await self.__hid.get_state())
+ @exposed_http("POST", "/hid/keyboard/set_params")
+ async def __keyboard_set_params_handler(self, request: Request) -> Response:
+ self.__hid.set_keyboard_output(valid_hid_keyboard_output(request.query.get("output")))
+ return make_json_response()
+
+ @exposed_http("POST", "/hid/mouse/set_params")
+ async def __mouse_set_params_handler(self, request: Request) -> Response:
+ self.__hid.set_mouse_output(valid_hid_mouse_output(request.query.get("output")))
+ return make_json_response()
+
@exposed_http("POST", "/hid/reset")
async def __reset_handler(self, _: Request) -> Response:
await self.__hid.reset()