summaryrefslogtreecommitdiff
path: root/kvmd/apps
diff options
context:
space:
mode:
Diffstat (limited to 'kvmd/apps')
-rw-r--r--kvmd/apps/kvmd/api/hid.py4
-rw-r--r--kvmd/apps/otgmsd/__init__.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/kvmd/apps/kvmd/api/hid.py b/kvmd/apps/kvmd/api/hid.py
index 59824e11..3580c373 100644
--- a/kvmd/apps/kvmd/api/hid.py
+++ b/kvmd/apps/kvmd/api/hid.py
@@ -37,7 +37,7 @@ from ....plugins.hid import BaseHid
from ....validators import raise_error
from ....validators.basic import valid_bool
-from ....validators.basic import valid_number
+from ....validators.basic import valid_int_f0
from ....validators.os import valid_printable_filename
@@ -98,7 +98,7 @@ class HidApi:
@exposed_http("POST", "/hid/print")
async def __print_handler(self, request: Request) -> Response:
text = await request.text()
- limit = int(valid_number(request.query.get("limit", "1024"), min=0, type=int))
+ limit = int(valid_int_f0(request.query.get("limit", "1024")))
if limit > 0:
text = text[:limit]
symmap = self.__ensure_symmap(request.query.get("keymap", self.__default_keymap_name))
diff --git a/kvmd/apps/otgmsd/__init__.py b/kvmd/apps/otgmsd/__init__.py
index 2e7122ac..a9891f0e 100644
--- a/kvmd/apps/otgmsd/__init__.py
+++ b/kvmd/apps/otgmsd/__init__.py
@@ -31,7 +31,7 @@ from typing import Optional
import psutil
from ...validators.basic import valid_bool
-from ...validators.basic import valid_number
+from ...validators.basic import valid_int_f0
from ...validators.os import valid_abs_file
@@ -90,7 +90,7 @@ def main(argv: Optional[List[str]]=None) -> None:
description="KVMD OTG-MSD low-level hand tool",
parents=[parent_parser],
)
- parser.add_argument("-i", "--instance", default=0, type=(lambda arg: valid_number(arg, min=0)),
+ parser.add_argument("-i", "--instance", default=0, type=valid_int_f0,
metavar="<N>", help="Drive instance (0 for KVMD drive)")
parser.add_argument("--unlock", action="store_true",
help="Send SIGUSR1 to MSD kernel thread")