Skip to content

feat(usb)!: support SuperSpeed packet sizes - #1883

Draft
uchouT (uchouT) wants to merge 4 commits into
Devolutions:masterfrom
uchouT:usb-superspeed
Draft

feat(usb)!: support SuperSpeed packet sizes#1883
uchouT (uchouT) wants to merge 4 commits into
Devolutions:masterfrom
uchouT:usb-superspeed

Conversation

@uchouT

Copy link
Copy Markdown
Contributor

Based on #1871; its commit is included here until that one merges.

ironrdp-usb could not describe a SuperSpeed device: is_valid_for_usb2 rejected every SuperSpeed endpoint, and endpoint_zero_max_packet_size required a bus speed to read bMaxPacketSize0.

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_usb2 and usb2_max_payload lose their USB 2.0 names.

Marc-André Lureau (@elmarco) has helped test with a USB 3 device from FreeRDP.

`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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant