summaryrefslogtreecommitdiff
path: root/src/class
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2025-09-13 12:07:44 +0700
committerGitHub <[email protected]>2025-09-13 12:07:44 +0700
commitf674561696220825d111c90954d4cd88ae3278dd (patch)
tree0280b6260562d79a0f41460c48e48614dbb3d0b6 /src/class
parentc484aaeaa031fe7f86dfb1496a627ddfaba9c6b1 (diff)
parent99bee6a900db60cf232766531e785108f50e614d (diff)
Merge pull request #3246 from HiFiPhile/nxp_host
ehci: fix device removal and endpoint open on next plug
Diffstat (limited to 'src/class')
-rw-r--r--src/class/hid/hid_host.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/class/hid/hid_host.c b/src/class/hid/hid_host.c
index 56fccdd22..a44c83433 100644
--- a/src/class/hid/hid_host.c
+++ b/src/class/hid/hid_host.c
@@ -519,7 +519,8 @@ bool hidh_open(uint8_t rhport, uint8_t daddr, tusb_desc_interface_t const* desc_
// Assume bNumDescriptors = 1
p_hid->report_desc_type = desc_hid->bReportType;
- p_hid->report_desc_len = tu_unaligned_read16(&desc_hid->wReportLength);
+ // Use offsetof to avoid pointer to the odd/misaligned address
+ p_hid->report_desc_len = tu_unaligned_read16((uint8_t const*)desc_hid + offsetof(tusb_hid_descriptor_hid_t, wReportLength));
// Per HID Specs: default is Report protocol, though we will force Boot protocol when set_config
p_hid->protocol_mode = _hidh_default_protocol;