diff --git a/pylabrobot/io/hid.py b/pylabrobot/io/hid.py index 012c23ee11b..f4b15434266 100644 --- a/pylabrobot/io/hid.py +++ b/pylabrobot/io/hid.py @@ -10,6 +10,7 @@ try: import hid # type: ignore + from hid import HIDException USE_HID = True except ImportError as e: @@ -156,7 +157,12 @@ async def read(self, size: int, timeout: int) -> bytes: def _read(): assert self.device is not None, "forgot to call setup?" - return self.device.read(size, timeout=int(timeout)) + try: + return self.device.read(size, timeout=int(timeout)) + except HIDException as e: + if str(e) == "Success": + return b"" + raise if self._executor is None: raise RuntimeError("Call setup() first.")