stm32/otg: report the full bLength in generated string descriptors - #63
Merged
Merged
Conversation
The string generators wrote tp->total, the transfer size clamped to wLength, into bLength. A host that probes the 2-byte header first (macOS, Windows) therefore read bLength = 2 and recorded empty manufacturer, product and serial strings: the device showed up as "Generic CDC" with no serial, and WebUSB permissions keyed on the serial did not carry over from the ST ROM DFU device to the app. Linux asks for 255 bytes up front and was unaffected. String 0 was also fed through the UTF-16 widening generator and came out as 06 03 09 00 04 00 instead of the 4-byte LANGID list 04 03 09 04. Carry the full length in tx_ptr_t and serve string 0 as raw bytes. Verified on an STM32H725 (PMD mock): 2-byte probes return the real bLength, langid 0x0409 requests return the strings, and macOS records vendor, product and the ROM-identical serial at enumeration. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ExwkpjVKyyM5HBhzois9fr
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.
The string generators wrote tp->total, the transfer size clamped to wLength, into bLength. A host that probes the 2-byte header first (macOS, Windows) therefore read bLength = 2 and recorded empty manufacturer, product and serial strings: the device showed up as "Generic CDC" with no serial, and WebUSB permissions keyed on the serial did not carry over from the ST ROM DFU device to the app. Linux asks for 255 bytes up front and was unaffected.
String 0 was also fed through the UTF-16 widening generator and came out as 06 03 09 00 04 00 instead of the 4-byte LANGID list 04 03 09 04.
Carry the full length in tx_ptr_t and serve string 0 as raw bytes. Verified on an STM32H725 (PMD mock): 2-byte probes return the real bLength, langid 0x0409 requests return the strings, and macOS records vendor, product and the ROM-identical serial at enumeration.