diff options
Diffstat (limited to 'kvmd/validators/kvm.py')
-rw-r--r-- | kvmd/validators/kvm.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/kvmd/validators/kvm.py b/kvmd/validators/kvm.py index 034587ef..40f5ced1 100644 --- a/kvmd/validators/kvm.py +++ b/kvmd/validators/kvm.py @@ -22,6 +22,8 @@ from typing import Any +from .. import keymap + from . import check_string_in_list from .basic import valid_number @@ -46,3 +48,22 @@ def valid_stream_quality(arg: Any) -> int: def valid_stream_fps(arg: Any) -> int: return int(valid_number(arg, min=0, max=30, name="stream FPS")) + + +# ===== +def valid_hid_key(arg: Any) -> str: + return check_string_in_list(arg, "HID key", keymap.KEYMAP, lower=False) + + +def valid_hid_mouse_move(arg: Any) -> int: + arg = valid_number(arg, name="HID mouse move") + return min(max(-32768, arg), 32767) + + +def valid_hid_mouse_button(arg: Any) -> str: + return check_string_in_list(arg, "HID mouse button", ["left", "right"]) + + +def valid_hid_mouse_wheel(arg: Any) -> int: + arg = valid_number(arg, name="HID mouse wheel") + return min(max(-128, arg), 127) |