usb_descriptors: fix CDC interface numbers and total count in debug build#339
Merged
Merged
Conversation
…uild When built with DH_DEBUG=ON, the configuration descriptor declared CDC at interface number 4 with a total interface count of 3 (normal mode) or 5 (config mode). Both values were inconsistent with the actual descriptor contents: - Normal mode: HID(0) + HID_REL_M(1) + CDC(4, 5) - 4 interfaces, declared 3 - Config mode: HID(0) + HID_REL_M(1) + HID_VENDOR(2) + MSC(3) + CDC(4, 5) - 6 interfaces, declared 5 The non-consecutive interface numbers in normal mode (0, 1, 4, 5) caused Windows to reject the device with CM_PROB_FAILED_START (code 10). Linux and macOS were more permissive and worked despite the mismatch. Fix by: - Placing CDC at the next free interface number in each mode: 2 in normal mode, 4 in config mode (introducing ITF_NUM_CDC_CONFIG for the latter) - Correcting the declared interface counts to 4 and 6 respectively Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
When DeskHop is built with
DH_DEBUG=ON, the configuration descriptor declares CDC at interface number 4 with a total interface count of 3 (normal mode) or 5 (config mode). Both values are inconsistent with the actual descriptor contents:bNumInterfacesThe non-consecutive interface numbers in normal mode (gaps at 2, 3) caused Windows to reject the device with
CM_PROB_FAILED_START(problem code 10). Linux and macOS were more permissive and worked despite the mismatch — so this only manifests on Windows hosts.Changes
2in normal mode,4in config mode (newITF_NUM_CDC_CONFIGused only in the config-mode descriptor).ITF_NUM_TOTAL = 4,ITF_NUM_TOTAL_CONFIG = 6.No change in behavior when
DH_DEBUG=OFF(the entire block is gated on#ifdef DH_DEBUG).Test plan
-DDH_DEBUG=ONand flash to laptop-side Pico. Device enumerates cleanly on Windows 11;USB Serial Device (COMx)appears for the CDC debug port and serial output works.-DDH_DEBUG=OFF: no descriptor changes (block excluded), device behaves identically to upstream.🤖 Generated with Claude Code