Skip to content

Conversation

@dlech
Copy link
Member

@dlech dlech commented Jan 24, 2026

Change how we ensure the USB endpoints are in a good state when connecting to a device. Instead of resetting the device, which is not supported on all platforms, we now clear the halt condition on both endpoints.

We were doing the reset to ensure that the even/odd data toggle state was correct. The reset, if supported, would completely reset the connection and re-enumerate the device, which is more that we need. On Windows, resetting is not supported and libusb would poke all endpoints like this as a best-effort approximation of a reset. So now, the code reflects what is actually important and will be helpful if we switch to something other than pyusb in the future.

…etting device.

Change how we ensure the USB endpoints are in a good state when connecting
to a device. Instead of resetting the device, which is not supported on all
platforms, we now clear the halt condition on both endpoints.

We were doing the reset to ensure that the even/odd data toggle state
was correct. The reset, if supported, would completely reset the
connection and re-enumerate the device, which is more that we need.
On Windows, resetting is not supported and libusb would poke all endpoints
like this as a best-effort approximation of a reset. So now, the code
reflects what is actually important and will be helpful if we switch to
something other than pyusb in the future.
@dlech dlech changed the title pybricks.connections.pybricks: Clear halt on endpoints instead of res… pybricks.connections.pybricks: Clear halt on endpoints instead of resetting device. Jan 24, 2026
@dlech dlech merged commit 2930231 into pybricks:master Jan 24, 2026
7 checks passed
@dlech dlech deleted the usb-clear-halt-instead-of-reset branch January 24, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant