diff --git a/pybricksdev/connections/pybricks.py b/pybricksdev/connections/pybricks.py index 8b76c1d..634b25e 100644 --- a/pybricksdev/connections/pybricks.py +++ b/pybricksdev/connections/pybricks.py @@ -946,8 +946,6 @@ def __init__(self, device: USBDevice): self._response_queue = asyncio.Queue[bytes]() async def _client_connect(self) -> bool: - # Reset is essential to ensure endpoints are in a good state. - self._device.reset() self._device.set_configuration() # Save input and output endpoints @@ -964,6 +962,12 @@ async def _client_connect(self) -> bool: == ENDPOINT_OUT, ) + # Clearing halt (even if not stalled) resets the even/odd state on the + # endpoints in case it was left in an invalid state by a previous + # connection. + self._ep_in.clear_halt() + self._ep_out.clear_halt() + # There is 1 byte overhead for PybricksUsbMessageType self._max_write_size = self._ep_out.wMaxPacketSize - 1