Repository navigation
fix(usb_device): check endpoints against the selected port's USB-OTG core - #925
Merged
Merged
Conversation
…core The IN budget allowed 5 data IN endpoints, but the full-speed USB-OTG core (ESP32-S2 / -S3, the ESP32-P4's port 0) has 5 IN endpoints including EP0 IN: 4 data IN. CDC + Vendor + HID + MSC passed the check, then its fifth IN endpoint failed to open at SET_CONFIGURATION and the device stayed unconfigured (hathach/tinyusb#4450). TinyUSB also gives IN endpoint n TX FIFO n, so an IN endpoint numbered past the FIFOs opens but never transmits (hathach/tinyusb#4007); X-Input's separate OUT number could push a later function's IN endpoint there (Vendor + HID + X-Input + MSC put MSC IN on 5). initialize() now checks against the limits TinyUSB's DWC2 driver enforces for the core behind the port the device will use (Config::port, else esp_tinyusb's default): data IN count and highest IN number below ep_in_count, and every endpoint number below ep_count - full-speed 4 data IN / numbers 1-6, high-speed (ESP32-P4 port 1, its default) 7 data IN / numbers 1-15. X-Input's OUT number is taken after every IN endpoint, so IN numbers stay contiguous. Endpoint numbers are unchanged for every combination without MSC. The error names the core, the port and the limit exceeded. FIFO RAM is not a limit for any combination (comment shows why). README + docs: per-core budget table and the combinations that fit. Fixes #924 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DFjjnq3XCTRAXENSxsCxJU
|
✅Static analysis result - no issues found! ✅ |
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.
Fixes #924.
initialize()allowed 5 data IN endpoints on every port. The full-speed USB-OTG core (ESP32-S2 / -S3, and the ESP32-P4's port 0) has 5 IN endpoints including EP0 IN, so only 4 data IN.dcd_dwc2.c,tx_fifo_num = epnum). An IN endpoint numbered past the FIFOs opens but never transmits (DWC2 device: IN endpoint *number* is never bounded → silent dead endpoint on ESP32-S2/S3 hathach/tinyusb#4007). X-Input's separate OUT number could push a later function's IN endpoint there: Vendor + HID + X-Input + MSC put MSC's IN on 5.Change
initialize()now checks against the limits TinyUSB's DWC2 driver enforces (its_dwc2_controllertable) for the core behind the port the device will use. That port isConfig::port, or esp_tinyusb'sTINYUSB_DEFAULT_CONFIG()port when it is -1.Testing
Built
usb_device/examplefor ESP32-S3 and ESP32-P4, andxinput_examplewithsdkconfig.compositefor ESP32-S3, under IDF 6.1, with no warnings. Not run on hardware.🤖 Generated with Claude Code
https://claude.ai/code/session_01DFjjnq3XCTRAXENSxsCxJU