Skip to content

Fix hang on GIGABYTE keyboard #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 13, 2023

Conversation

KurtE
Copy link
Contributor

@KurtE KurtE commented Nov 10, 2023

resolves #40

0 length items in the configuration descriptor.

As I mentioned in the issue: There as some devices who have 0 length fields within their configuration descriptor
Example GIGABYTE keyboard.

Configuration Descriptor
2400E8F0 - 09 02 54 00 03 01 00 A0  32 09 04 00 00 01 03 01  : ..T..... 2.......
2400E900 - 01 00 09 21 10 01 00 01  22 3B 00 07 05 81 03 08  : ...!.... ";......
2400E910 - 00 08 09 04 01 00 01 03  01 22 51 00 07 05 82 03  : ........ ."Q.....
2400E920 - 10 00 08 09 04 02 00 01  03 00 00 00 09 21 10 01  : ........ .....!..
2400E930 - 00 01 22 25 00 07 05 83  03 10 00 01 00 00 00 00  : .."%.... ........
2400E940 - 00 00 00 00                                       : ....

The issue came up before on another USBHost library (USBHost_t36).
The solution is when you find a zero length field, you simply increment to the next byte.

It works on my WIP branch, however here hard to test as the current released code fails to read in the full descriptors.
But that is a different issue and PR.

0 length items in the configuration descriptor.
Copy link

Memory usage change @ a2d6ead

Board flash % RAM for global variables %
arduino:mbed_giga:giga 💚 -64 - 0 -0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_opta:opta 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
Click for full report table
Board examples/DirList
flash
% examples/DirList
RAM for global variables
% examples/FileRead
flash
% examples/FileRead
RAM for global variables
% examples/FileWrite
flash
% examples/FileWrite
RAM for global variables
% examples/OptaDirList
flash
% examples/OptaDirList
RAM for global variables
% examples/PortentaOTA
flash
% examples/PortentaOTA
RAM for global variables
%
arduino:mbed_giga:giga 0 0.0 0 0.0 -64 -0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:mbed_opta:opta 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
Click for full report CSV
Board,examples/DirList<br>flash,%,examples/DirList<br>RAM for global variables,%,examples/FileRead<br>flash,%,examples/FileRead<br>RAM for global variables,%,examples/FileWrite<br>flash,%,examples/FileWrite<br>RAM for global variables,%,examples/OptaDirList<br>flash,%,examples/OptaDirList<br>RAM for global variables,%,examples/PortentaOTA<br>flash,%,examples/PortentaOTA<br>RAM for global variables,%
arduino:mbed_giga:giga,0,0.0,0,0.0,-64,-0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:mbed_opta:opta,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A

@facchinm facchinm merged commit 7a886dd into arduino-libraries:main Nov 13, 2023
@KurtE KurtE deleted the config_desc_0len_field branch November 13, 2023 12:21
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.

Code does not handle 0 length items contained within Configuration Descriptor.
2 participants