summaryrefslogtreecommitdiff
path: root/src/class/hid
diff options
context:
space:
mode:
authorReinhard Panhuber <[email protected]>2020-06-20 10:51:21 +0200
committerReinhard Panhuber <[email protected]>2020-06-20 10:51:21 +0200
commitada82b840f642681f8012cb2a46aa7577393dd30 (patch)
treef1aaa316a03c38ae5e59b69f6272494b529a3a54 /src/class/hid
parentd9496256cf5979f4bf2a6eb915e098861a459394 (diff)
Get update from tinyusb.
Diffstat (limited to 'src/class/hid')
-rw-r--r--src/class/hid/hid_device.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/class/hid/hid_device.c b/src/class/hid/hid_device.c
index 2a20bc173..526394d4a 100644
--- a/src/class/hid/hid_device.c
+++ b/src/class/hid/hid_device.c
@@ -194,7 +194,9 @@ uint16_t hidd_open(uint8_t rhport, tusb_desc_interface_t const * desc_itf, uint1
p_hid->boot_mode = false; // default mode is REPORT
p_hid->itf_num = desc_itf->bInterfaceNumber;
- memcpy(&p_hid->report_desc_len, &(p_hid->hid_descriptor->wReportLength), 2);
+
+ // Use offsetof to avoid pointer to the odd/misaligned address
+ memcpy(&p_hid->report_desc_len, (uint8_t*) p_hid->hid_descriptor + offsetof(tusb_hid_descriptor_hid_t, wReportLength), 2);
// Prepare for output endpoint
if (p_hid->ep_out)