diff options
| author | hathach <[email protected]> | 2021-09-29 15:27:41 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2021-09-29 15:27:41 +0700 |
| commit | 103309b88b0f4e566f2de17d26c159f5e1e92c8b (patch) | |
| tree | f0a618acfd6295b10cf10ac0974a93ea2193a5a3 /src/device | |
| parent | 3eeb79be4f54b8ab954ae2542e211bc37575e2bf (diff) | |
| parent | 32bdf3b79d27ed9f0851440df35b6a72bcd8bff8 (diff) | |
Merge branch 'master' of github.com:hathach/tinyusb into zhangslice-master
examples/device/hid_composite_freertos/src/FreeRTOSConfig/FreeRTOSConfig.h
Diffstat (limited to 'src/device')
| -rw-r--r-- | src/device/usbd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c index 3043fc7bc..cf3ecea42 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c @@ -971,9 +971,11 @@ static bool process_get_descriptor(uint8_t rhport, tusb_control_request_t const uint16_t len = sizeof(tusb_desc_device_t); - // Only send up to EP0 Packet Size if not addressed + // Only send up to EP0 Packet Size if not addressed and host requested more data + // that device descriptor has. // This only happens with the very first get device descriptor and EP0 size = 8 or 16. - if ((CFG_TUD_ENDPOINT0_SIZE < sizeof(tusb_desc_device_t)) && !_usbd_dev.addressed) + if ((CFG_TUD_ENDPOINT0_SIZE < sizeof(tusb_desc_device_t)) && !_usbd_dev.addressed && + ((tusb_control_request_t*) p_request)->wLength > sizeof(tusb_desc_device_t)) { len = CFG_TUD_ENDPOINT0_SIZE; |
