summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2026-03-09 15:16:55 +0700
committerGitHub <[email protected]>2026-03-09 15:16:55 +0700
commite98d32a304a92418572f5fd65908beeab2183556 (patch)
treed5e238eb678dacda6ae723c7adbd19c54f83f81e /src/common
parent7fac2cda29a14e963c469a146f18ea294f955171 (diff)
parent3ca7ad1573e4931d430cc3b6412a7a31da6072c2 (diff)
Merge pull request #3541 from hathach/fix-3525
Refactor and validate USB device descriptor handling
Diffstat (limited to 'src/common')
-rw-r--r--src/common/tusb_private.h3
-rw-r--r--src/common/tusb_types.h2
2 files changed, 1 insertions, 4 deletions
diff --git a/src/common/tusb_private.h b/src/common/tusb_private.h
index 5a51dfc37..17ab267c3 100644
--- a/src/common/tusb_private.h
+++ b/src/common/tusb_private.h
@@ -81,9 +81,8 @@ typedef struct {
bool tu_edpt_validate(const tusb_desc_endpoint_t *desc_ep, tusb_speed_t speed);
#else
TU_ATTR_ALWAYS_INLINE static inline bool tu_edpt_validate(const tusb_desc_endpoint_t *desc_ep, tusb_speed_t speed) {
- (void)desc_ep;
(void)speed;
- return true;
+ return tu_edpt_packet_size(desc_ep) > 0;
}
#endif
diff --git a/src/common/tusb_types.h b/src/common/tusb_types.h
index 7d26ac74e..8a48a0f04 100644
--- a/src/common/tusb_types.h
+++ b/src/common/tusb_types.h
@@ -341,12 +341,10 @@ typedef struct TU_ATTR_PACKED {
uint8_t bLength ; ///< Size of this descriptor in bytes.
uint8_t bDescriptorType ; ///< DEVICE Descriptor Type.
uint16_t bcdUSB ; ///< BUSB Specification Release Number in Binary-Coded Decimal (i.e., 2.10 is 210H).
-
uint8_t bDeviceClass ; ///< Class code (assigned by the USB-IF).
uint8_t bDeviceSubClass ; ///< Subclass code (assigned by the USB-IF).
uint8_t bDeviceProtocol ; ///< Protocol code (assigned by the USB-IF).
uint8_t bMaxPacketSize0 ; ///< Maximum packet size for endpoint zero (only 8, 16, 32, or 64 are valid). For HS devices is fixed to 64.
-
uint16_t idVendor ; ///< Vendor ID (assigned by the USB-IF).
uint16_t idProduct ; ///< Product ID (assigned by the manufacturer).
uint16_t bcdDevice ; ///< Device release number in binary-coded decimal.