Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pylabrobot/io/hid.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

try:
import hid # type: ignore
from hid import HIDException

USE_HID = True
except ImportError as e:
Expand Down Expand Up @@ -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.")
Expand Down