Skip to content

stm32/otg: report the full bLength in generated string descriptors - #63

Merged
andoma merged 1 commit into
masterfrom
sina/usb-string-blength
Sep 8, 2026
Merged

andoma merged 1 commit into
masterfrom
sina/usb-string-blength

Conversation

@kapouchima

Copy link
Copy Markdown
Collaborator

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.

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
@andoma
andoma merged commit 54982b1 into master Sep 8, 2026
1 check passed
@andoma
andoma deleted the sina/usb-string-blength branch September 8, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants