diff options
-rw-r--r-- | kvmd/plugins/hid/otg/device.py | 5 | ||||
-rw-r--r-- | kvmd/plugins/hid/serial.py | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/kvmd/plugins/hid/otg/device.py b/kvmd/plugins/hid/otg/device.py index 44c286cb..45681aba 100644 --- a/kvmd/plugins/hid/otg/device.py +++ b/kvmd/plugins/hid/otg/device.py @@ -126,7 +126,10 @@ class BaseDeviceProcess(multiprocessing.Process): # pylint: disable=too-many-in def _clear_queue(self) -> None: while not self.__events_queue.empty(): - self.__events_queue.get_nowait() + try: + self.__events_queue.get_nowait() + except queue.Empty: + break def _ensure_write(self, report: bytes, reopen: bool=False, close: bool=False) -> bool: if reopen: diff --git a/kvmd/plugins/hid/serial.py b/kvmd/plugins/hid/serial.py index 752870d7..cee0048d 100644 --- a/kvmd/plugins/hid/serial.py +++ b/kvmd/plugins/hid/serial.py @@ -298,7 +298,10 @@ class Plugin(BaseHid, multiprocessing.Process): # pylint: disable=too-many-inst def clear_events(self) -> None: while not self.__events_queue.empty(): - self.__events_queue.get_nowait() + try: + self.__events_queue.get_nowait() + except queue.Empty: + break self.__queue_event(_ClearEvent()) def __queue_event(self, event: _BaseEvent) -> None: |