feat(usb)!: support SuperSpeed packet sizes - #1883
Draft
uchouT (uchouT) wants to merge 4 commits into
Draft
Conversation
`interface_information` computed every `TS_USBD_PIPE_INFORMATION`'s `MaximumPacketSize` from the announced device speed through `usb2_max_payload`, and failed the whole selection when that returned `None`. This makes a SuperSpeed device impossible to configure. In a capture of a Windows Server redirecting a USB 3.1 mass-storage device (`bcdUSB` 0x0310, `bMaxPacketSize0` 9, bulk `wMaxPacketSize` 1024 with SuperSpeed endpoint companions), the server sends `MaximumPacketSize` 0 for every pipe. Signed-off-by: uchouT <i@uchout.moe>
`endpoint_zero_max_packet_size` took the negotiated speed and used it to pick between the two encodings USB defines for `bMaxPacketSize0`: the literal byte count of USB 2.0, and the base-2 exponent SuperSpeed uses because 512 does not fit in the field. Signed-off-by: uchouT <i@uchout.moe>
`is_valid_for_usb2` and `usb2_max_payload` were scoped to USB 2.0 and answered `false` and `None` for SuperSpeed, deferring its endpoint semantics. A consumer holding a SuperSpeed configuration descriptor therefore had no way to validate an endpoint or size its payload. Signed-off-by: uchouT <i@uchout.moe>
Signed-off-by: uchouT <i@uchout.moe>
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.
Based on #1871; its commit is included here until that one merges.
ironrdp-usbcould not describe a SuperSpeed device:is_valid_for_usb2rejected every SuperSpeed endpoint, andendpoint_zero_max_packet_sizerequired a bus speed to readbMaxPacketSize0.That speed parameter added nothing. USB 3.2 Section 9.6.1 admits only 9 there, as a base-2 exponent, while USB 2.0 admits only 8, 16, 32 and 64, stated literally, so the two encodings are disjoint and the value identifies itself. Requiring a speed only let a caller contradict the descriptor, which is exactly what a transport that cannot express SuperSpeed ends up doing.
Endpoint zero now decodes from the value alone, and the endpoint predicate carries the USB 3.2 Section 9.6.6 limits, so
is_valid_for_usb2andusb2_max_payloadlose their USB 2.0 names.Marc-André Lureau (@elmarco) has helped test with a USB 3 device from FreeRDP.