summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2025-07-09 11:27:06 +0700
committerHa Thach <[email protected]>2025-07-09 11:27:06 +0700
commit59b55898d9f40e7a436836c95c0885e5fc5a0c7c (patch)
treec9f88294923c8f759203baf863a17c2c7c5d7db0 /src
parent1a41445b17e11db9ab58a39488e4b0d9d85f0fd1 (diff)
fix HID parser variable size handling
Diffstat (limited to 'src')
-rw-r--r--src/class/hid/hid_host.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/class/hid/hid_host.c b/src/class/hid/hid_host.c
index b2b68e108..0fbb97c53 100644
--- a/src/class/hid/hid_host.c
+++ b/src/class/hid/hid_host.c
@@ -662,7 +662,10 @@ 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 == 3) ? 4 : header.size;
+ uint8_t size = header.size;
+ if (size == 3) {
+ size = 4;
+ }
uint8_t const data8 = (size > 0) ? desc_report[0] : 0;