diff options
author | Devaev Maxim <[email protected]> | 2020-10-03 10:06:04 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-10-03 10:06:04 +0300 |
commit | 2b2014f7b1c638184ab691fbf0821e61ce7237aa (patch) | |
tree | 04430ef0238a5462dd763d590fbe470bb1337385 /kvmd | |
parent | 877a0b844100c51ff96f19f4a00abed02dadec89 (diff) |
adjust reopen delay
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/plugins/hid/otg/__init__.py | 2 | ||||
-rw-r--r-- | kvmd/plugins/hid/otg/device.py | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/kvmd/plugins/hid/otg/__init__.py b/kvmd/plugins/hid/otg/__init__.py index 95dd34cd..1eae79e1 100644 --- a/kvmd/plugins/hid/otg/__init__.py +++ b/kvmd/plugins/hid/otg/__init__.py @@ -67,12 +67,14 @@ class Plugin(BaseHid): "select_timeout": Option(1.0, type=valid_float_f01), "write_retries": Option(5, type=valid_int_f1), "write_retries_delay": Option(0.1, type=valid_float_f01), + "reopen_delay": Option(0.5, type=valid_float_f01), }, "mouse": { "device": Option("", type=valid_abs_path, unpack_as="device_path"), "select_timeout": Option(1.0, type=valid_float_f01), "write_retries": Option(5, type=valid_int_f1), "write_retries_delay": Option(0.1, type=valid_float_f01), + "reopen_delay": Option(0.5, type=valid_float_f01), }, "noop": Option(False, type=valid_bool), } diff --git a/kvmd/plugins/hid/otg/device.py b/kvmd/plugins/hid/otg/device.py index 08777293..625aeef5 100644 --- a/kvmd/plugins/hid/otg/device.py +++ b/kvmd/plugins/hid/otg/device.py @@ -57,6 +57,7 @@ class BaseDeviceProcess(multiprocessing.Process): # pylint: disable=too-many-in select_timeout: float, write_retries: int, write_retries_delay: float, + reopen_delay: float, noop: bool, ) -> None: @@ -71,6 +72,7 @@ class BaseDeviceProcess(multiprocessing.Process): # pylint: disable=too-many-in self.__select_timeout = select_timeout self.__write_retries = write_retries self.__write_retries_delay = write_retries_delay + self.__reopen_delay = reopen_delay self.__noop = noop self.__fd = -1 @@ -230,13 +232,13 @@ class BaseDeviceProcess(multiprocessing.Process): # pylint: disable=too-many-in self.__fd = os.open(self.__device_path, flags) except FileNotFoundError: logger.error("Missing HID-%s device: %s", self.__name, self.__device_path) - time.sleep(self.__select_timeout) + time.sleep(self.__reopen_delay) except Exception as err: logger.error("Can't open HID-%s device: %s: %s: %s", self.__name, self.__device_path, type(err).__name__, err) - time.sleep(self.__select_timeout) + time.sleep(self.__reopen_delay) else: - time.sleep(self.__select_timeout) + time.sleep(self.__reopen_delay) if self.__fd >= 0: try: |