Commit 2930231
committed
pybricks.connections.pybricks: Clear halt on endpoints instead of resetting 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.1 parent 65210a2 commit 2930231
1 file changed
+6
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
946 | 946 | | |
947 | 947 | | |
948 | 948 | | |
949 | | - | |
950 | | - | |
951 | 949 | | |
952 | 950 | | |
953 | 951 | | |
| |||
964 | 962 | | |
965 | 963 | | |
966 | 964 | | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
967 | 971 | | |
968 | 972 | | |
969 | 973 | | |
| |||
0 commit comments