diff options
| author | Zixun LI <[email protected]> | 2026-04-24 11:19:41 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-04-24 11:19:41 +0200 |
| commit | 4c7fd70e53b34bf63ef9334f2b5624cac48299f1 (patch) | |
| tree | 827d5c3ab5e53bdf2ab633a5805715ef05c8e686 /src/device/dcd.h | |
| parent | 1e644339fd984fd6168b8cc09728d3bb56f2eea2 (diff) | |
| parent | 5939831f17272571911d089508b458f496a4cc62 (diff) | |
Merge pull request #3597 from canokeys/big-endian-for-setup-packets
fix #3596: big-endian host support for SETUP packet handling
Diffstat (limited to 'src/device/dcd.h')
| -rw-r--r-- | src/device/dcd.h | 5 |
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); } |
