diff options
| author | copilot-swe-agent[bot] <[email protected]> | 2026-03-22 20:25:07 +0000 |
|---|---|---|
| committer | copilot-swe-agent[bot] <[email protected]> | 2026-03-22 20:25:07 +0000 |
| commit | f6fd60a6a3ff92ca3ee40cf74f8070e3b1c50812 (patch) | |
| tree | 9702af3977e57e4ec37a2544a579909445626493 | |
| parent | f494d3517fe21ecd7259cd8a90d2c6709edd0e90 (diff) | |
examples/net_lwip_webserver: fix other_speed_config to use TUSB_DESC_OTHER_SPEED_CONFIG and fix SEED typo
Co-authored-by: HiFiPhile <[email protected]>
Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/3d21b8d3-b2df-4603-a426-2bcfdb408f04
| -rw-r--r-- | examples/device/net_lwip_webserver/src/usb_descriptors.c | 31 | ||||
| m--------- | hw/mcu/raspberry_pi/Pico-PIO-USB | 0 | ||||
| m--------- | hw/mcu/st/cmsis_device_f4 | 0 | ||||
| m--------- | hw/mcu/st/stm32f4xx_hal_driver | 0 | ||||
| m--------- | lib/CMSIS_5 | 0 | ||||
| m--------- | lib/FreeRTOS-Kernel | 0 | ||||
| m--------- | lib/lwip | 0 | ||||
| m--------- | lib/threadx | 0 | ||||
| m--------- | tools/linkermap | 0 | ||||
| m--------- | tools/uf2 | 0 |
10 files changed, 28 insertions, 3 deletions
diff --git a/examples/device/net_lwip_webserver/src/usb_descriptors.c b/examples/device/net_lwip_webserver/src/usb_descriptors.c index 09a8a7548..80594fdeb 100644 --- a/examples/device/net_lwip_webserver/src/usb_descriptors.c +++ b/examples/device/net_lwip_webserver/src/usb_descriptors.c @@ -236,7 +236,25 @@ static const uint8_t *const configuration_hs_arr[CONFIG_ID_COUNT] = { #endif }; -// device qualifier is mostly similar to device descriptor since we don't change configuration based on speed +// Size array for each configuration +static const uint16_t configuration_sz_arr[CONFIG_ID_COUNT] = { +#if CFG_TUD_ECM_RNDIS + [CONFIG_ID_RNDIS] = MAIN_CONFIG_TOTAL_LEN, + [CONFIG_ID_ECM] = ALT_CONFIG_TOTAL_LEN +#else + [CONFIG_ID_NCM] = NCM_CONFIG_TOTAL_LEN +#endif +}; + +// Scratch buffer for other speed configuration (sized to hold the largest config) +#if CFG_TUD_ECM_RNDIS + #define MAX_CONFIG_TOTAL_LEN TU_MAX(MAIN_CONFIG_TOTAL_LEN, ALT_CONFIG_TOTAL_LEN) +#else + #define MAX_CONFIG_TOTAL_LEN NCM_CONFIG_TOTAL_LEN +#endif +static uint8_t desc_other_speed_config[MAX_CONFIG_TOTAL_LEN]; + +// device qualifier: device descriptor fields that differ at other speed static tusb_desc_device_qualifier_t const desc_device_qualifier = { .bLength = sizeof(tusb_desc_device_qualifier_t), .bDescriptorType = TUSB_DESC_DEVICE_QUALIFIER, @@ -259,13 +277,20 @@ uint8_t const *tud_descriptor_device_qualifier_cb(void) { return (uint8_t const *) &desc_device_qualifier; } -// Invoked when received GET OTHER SEED CONFIGURATION DESCRIPTOR request +// Invoked when received GET OTHER SPEED CONFIGURATION DESCRIPTOR request // Application return pointer to descriptor, whose contents must exist long enough for transfer to complete // Configuration descriptor in the other speed e.g if high speed then this is for full speed and vice versa uint8_t const *tud_descriptor_other_speed_configuration_cb(uint8_t index) { + if (index >= CONFIG_ID_COUNT) return NULL; + // if link speed is high return fullspeed config, and vice versa const uint8_t *const *arr = (tud_speed_get() == TUSB_SPEED_HIGH) ? configuration_fs_arr : configuration_hs_arr; - return (index < CONFIG_ID_COUNT) ? arr[index] : NULL; + + // Note: the descriptor type is OTHER_SPEED_CONFIG instead of CONFIG + memcpy(desc_other_speed_config, arr[index], configuration_sz_arr[index]); + desc_other_speed_config[1] = TUSB_DESC_OTHER_SPEED_CONFIG; + + return desc_other_speed_config; } #endif // highspeed diff --git a/hw/mcu/raspberry_pi/Pico-PIO-USB b/hw/mcu/raspberry_pi/Pico-PIO-USB new file mode 160000 +Subproject 675543bcc9baa8170f868ab7ba316d418dbcf41 diff --git a/hw/mcu/st/cmsis_device_f4 b/hw/mcu/st/cmsis_device_f4 new file mode 160000 +Subproject 3c77349ce04c8af401454cc51f85ea9a50e34fc diff --git a/hw/mcu/st/stm32f4xx_hal_driver b/hw/mcu/st/stm32f4xx_hal_driver new file mode 160000 +Subproject b6f0ed3829f3829eb358a2e7417d80bba1a42db diff --git a/lib/CMSIS_5 b/lib/CMSIS_5 new file mode 160000 +Subproject 2b7495b8535bdcb306dac29b9ded4cfb679d7e5 diff --git a/lib/FreeRTOS-Kernel b/lib/FreeRTOS-Kernel new file mode 160000 +Subproject cc0e0707c0c748713485b870bb980852b210877 diff --git a/lib/lwip b/lib/lwip new file mode 160000 +Subproject 159e31b689577dbf69cf0683bbaffbd71fa5ee1 diff --git a/lib/threadx b/lib/threadx new file mode 160000 +Subproject 4b6e8100d932a3a67b34c6eb17f84f3bffb9e2a diff --git a/tools/linkermap b/tools/linkermap new file mode 160000 +Subproject 8e1f440fa15c567aceb5aa0d14f6d18c329cc67 diff --git a/tools/uf2 b/tools/uf2 new file mode 160000 +Subproject c594542b2faa01cc33a2b97c9fbebc38549df80 |
