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: 6 additions & 2 deletions pybricksdev/connections/pybricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down