summaryrefslogtreecommitdiff
path: root/src/device/dcd.h
diff options
context:
space:
mode:
authornminaylov <[email protected]>2026-04-27 15:16:16 +0300
committernminaylov <[email protected]>2026-04-27 15:16:16 +0300
commit405dadecc73f2d9268e7872d7ba670d910a8f6eb (patch)
tree616b7fc3738ed0a9bd66baedd0ea21457277a12b /src/device/dcd.h
parent2cdd98104ece869f3a5eda3dd9c2b02f5b4c318d (diff)
parent4c7fd70e53b34bf63ef9334f2b5624cac48299f1 (diff)
Merge branch 'master' into ncm_packet_filter
Diffstat (limited to 'src/device/dcd.h')
-rw-r--r--src/device/dcd.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/device/dcd.h b/src/device/dcd.h
index 850c37bc2..f861eb258 100644
--- a/src/device/dcd.h
+++ b/src/device/dcd.h
@@ -219,6 +219,11 @@ TU_ATTR_ALWAYS_INLINE static inline void dcd_event_setup_received(uint8_t rhport
event.rhport = rhport;
event.event_id = DCD_EVENT_SETUP_RECEIVED;
(void) memcpy(&event.setup_received, setup, sizeof(tusb_control_request_t));
+ // USB wire format is little-endian. Convert multi-byte fields to host byte order
+ // so the stack always sees correct values regardless of CPU endianness.
+ event.setup_received.wValue = tu_le16toh(event.setup_received.wValue);
+ event.setup_received.wIndex = tu_le16toh(event.setup_received.wIndex);
+ event.setup_received.wLength = tu_le16toh(event.setup_received.wLength);
dcd_event_handler(&event, in_isr);
}