arduino-libraries / Arduino_USBHostMbed5

Apache License 2.0
4 stars 11 forks source link

Fix hang on GIGABYTE keyboard #41

Closed KurtE closed 1 year ago

KurtE commented 1 year ago

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.

github-actions[bot] commented 1 year ago

Memory usage change @ a2d6ead1660d5386a1cad9ee0800f3f91f7db8c2

Board flash % RAM for global variables %
arduino:mbed_giga:giga :green_heart: -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
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 ```