diff options
| author | Ha Thach <[email protected]> | 2025-07-09 12:04:10 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-09 12:04:10 +0700 |
| commit | 04fb5873effebb3dff770e3257ed789ee36f3846 (patch) | |
| tree | 8a98f41bf4c9a946eb57e921c131a5ea959ab017 /src | |
| parent | bb07a8221189760d0f07212c39caad7384c55205 (diff) | |
| parent | 5eb68a3c8777b9085d1fea8e0bba1ac8fb5a26d6 (diff) | |
Merge pull request #3165 from hathach/codex/find-and-fix-a-codebase-bug
Fix HID descriptor parsing of 4‑byte items
Diffstat (limited to 'src')
| -rw-r--r-- | src/class/hid/hid_host.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/class/hid/hid_host.c b/src/class/hid/hid_host.c index 57e437196..56fccdd22 100644 --- a/src/class/hid/hid_host.c +++ b/src/class/hid/hid_host.c @@ -662,9 +662,12 @@ uint8_t tuh_hid_parse_report_descriptor(tuh_hid_report_info_t* report_info_arr, uint8_t const tag = header.tag; uint8_t const type = header.type; - uint8_t const size = header.size; + uint8_t size = header.size; + if (size == 3) { + size = 4; // HID 1.11 6.2.2.2 3 is 4 bytes + } - uint8_t const data8 = desc_report[0]; + uint8_t const data8 = (size > 0) ? desc_report[0] : 0; TU_LOG(3, "tag = %d, type = %d, size = %d, data = ", tag, type, size); for (uint32_t i = 0; i < size; i++) { |
