Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit aada542

Browse files
committedMar 19, 2024
usbd/device: Fix issue with load endpoints when >1 interface registered.
As reported at https://github.com/orgs/micropython/discussions/13784#discussioncomment-8824864 Signed-off-by: Angus Gratton <[email protected]>
1 parent eb274d7 commit aada542

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed
 

‎micropython/usbd/device.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,6 @@ def _open_itf_cb(self, desc):
218218
# - Find the highest numbered interface provided to the callback
219219
# (which will be the first interface, unless we're scanning
220220
# multiple interfaces inside an IAD.)
221-
self._eps = {}
222-
self._ep_cbs = {}
223221
offs = 0
224222
max_itf = itf_num
225223
while offs < len(desc):
@@ -246,14 +244,14 @@ def _open_itf_cb(self, desc):
246244
def _reset_cb(self):
247245
# Callback when the USB device is reset by the host
248246

249-
# Cancel outstanding transfer callbacks
250-
for k in self._ep_cbs.keys():
251-
self._ep_cbs[k] = None
252-
253247
# Allow interfaces to respond to the reset
254248
for itf in self._itfs.values():
255249
itf.handle_reset()
256250

251+
# Rebuilt when host re-enumerates
252+
self._eps = {}
253+
self._ep_cbs = {}
254+
257255
def _submit_xfer(self, ep_addr, data, done_cb=None):
258256
# Singleton function to submit a USB transfer (of any type except control).
259257
#

0 commit comments

Comments
 (0)
Please sign in to comment.