diff --git a/pyocd/probe/pydapaccess/interface/hidapi_backend.py b/pyocd/probe/pydapaccess/interface/hidapi_backend.py index 6382cfc48..25a1d03aa 100644 --- a/pyocd/probe/pydapaccess/interface/hidapi_backend.py +++ b/pyocd/probe/pydapaccess/interface/hidapi_backend.py @@ -321,7 +321,10 @@ def read(self): """@brief Read data on the IN endpoint associated to the HID interface""" # Windows doesn't use the read thread, so read directly. if _IS_WINDOWS: - read_data = bytes(self.device.read(self.packet_size)) + # Pass a timeout so the read cannot block forever if the probe stops responding. + read_data = bytes(self.device.read(self.packet_size, timeout_ms=self.DEFAULT_USB_TIMEOUT_MS)) + if not read_data: + raise DAPAccessIntf.DeviceError(f"Timeout reading from probe {self.serial_number}") if TRACE.isEnabledFor(logging.DEBUG): # Strip off trailing zero bytes to reduce clutter.