usbd: Workaround for non standard device descriptor request#1102
Merged
hathach merged 1 commit intoSep 25, 2021
Merged
Conversation
Windows and Linux host during enumeration requests device descriptor with request size set to 64 bytes when device was in default state (no address). Those systems do not want 64 bytes though since usb descriptors is only 18 bytes long so they silently expect that only one packet will be received possibly 18 bytes for EPS > 16 or 8 or 16 bytes for smaller EP0. For devices with CFG_TUD_ENDPOINT0_SIZE size 8 or 16 there was workaround that reduced request size to CFG_TUD_ENDPOINT0_SIZE and that was enough to satisfy Windows and Linux hosts. However USBCV testing application also requests device descriptor but with size set to 18 bytes. Workaround for Window/Linux prevented USBVC to tests devices with 8 bytes EP0 size since it send only 8 bytes while application did wanted 18 bytes. Solution that satisfies both cases it to check if in default state device descriptor request wants more bytes than descriptor size (18). If so host is expecting to receive less bytes then requested and workaround would be applied since Linux/Windows only try to read one packet. If 18 bytes was requested as is the case for USBCV, core returns descriptor in 2 or 3 packets as application expects.
hathach
approved these changes
Sep 25, 2021
Owner
hathach
left a comment
There was a problem hiding this comment.
look great, thank you for your PR. Test with MP430 port, but it seems to break somewhere.
|
I have similar issue. then issue happen! |
Owner
|
@maemoKKK it is not the same issue, please open your own one with detailed information to troubleshoot, And don't spam on others. |
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.
Describe the PR
Windows and Linux host during enumeration requests device
descriptor with request size set to 64 bytes when device
was in default state (no address).
Those systems do not want 64 bytes though since usb descriptors is
only 18 bytes long so they silently expect that only one packet
will be received possibly 18 bytes for EPS > 16 or 8 or 16 bytes
for smaller EP0.
For devices with CFG_TUD_ENDPOINT0_SIZE size 8 or 16 there was
workaround that reduced request size to CFG_TUD_ENDPOINT0_SIZE
and that was enough to satisfy Windows and Linux hosts.
However USBCV testing application also requests device descriptor
but with size set to 18 bytes. Workaround for Window/Linux
prevented USBVC to tests devices with 8 bytes EP0 size since it
send only 8 bytes while application did wanted 18 bytes.
Solution that satisfies both cases it to check if in default state device
descriptor request wants more bytes than descriptor size (18).
If so host is expecting to receive less bytes then requested
and workaround would be applied since Linux/Windows only try
to read one packet.
If 18 bytes was requested as is the case for USBCV, core returns
descriptor in 2 or 3 packets as application expects.