Closed
Conversation
delan
added a commit
to delan/usb3sun
that referenced
this pull request
Dec 9, 2022
delan
added a commit
to delan/usb3sun
that referenced
this pull request
Dec 9, 2022
hathach
reviewed
Dec 13, 2022
Owner
hathach
left a comment
There was a problem hiding this comment.
ah right, I remember putting the TODO expecting this issue in the future. Though I think we should use _dev0 e.g setting its rhport/speed to invalid as available instead of introducing a new variable.
7FM
pushed a commit
to 7FM/tinyusb
that referenced
this pull request
Aug 23, 2025
Use empty initializer list for struct clearing, avoiding a pedantic warning from G++ 12 and 14. Fixes hathach#1785
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Special thanks to @ar1a for its help investigating this bug!
Describe the PR
Enumerating new devices starts with an HCD_EVENT_DEVICE_ATTACH event, but requires several more events to finish. If another HCD_EVENT_DEVICE_ATTACH event arrives before the current enumeration is complete, it will clobber _usbh_ctrl_buf and cause assertion failures. This can happen on a Raspberry Pi Pico with Pico-PIO-USB and multiple root hub ports.
This patch makes the host task enumerate one device at a time, by checking if there is a device already being enumerated before handling an HCD_EVENT_DEVICE_ATTACH event. If so, we send the attach event to the back of the queue.
Additional context
To reproduce on a Raspberry Pi Pico with Pico-PIO-USB, connect one device to GP2 (D+) and GP3 (D-) and another device to GP4 (D+) and GP5 (D-). Create a PlatformIO project with
and src/main.cc based on HID_device_report.ino with the following changes.
The output on Serial1 (GP0), or the probe’s Serial (CDC) if using picoprobe with UART0 (GP0, GP1) connected to the probe’s UART1 (GP5, GP4), will be:
After applying the patch, the output will be: