Fix usb enumeration stage error for some device

pull/11113/head
Jason 2023-04-03 21:03:07 +08:00
rodzic 42261df71f
commit 9d1c8f4f18
1 zmienionych plików z 3 dodań i 1 usunięć

Wyświetl plik

@ -164,6 +164,7 @@ typedef struct {
uint8_t iProduct; /**< Index of the Product string descriptor */
uint8_t iSerialNumber; /**< Index of the Serial Number string descriptor */
uint8_t str_desc_bLength; /**< Saved bLength from getting a short string descriptor */
uint8_t bConfigurationValue; /**< Device's current configuration number */
} enum_ctrl_t;
typedef struct {
@ -365,7 +366,7 @@ static bool enum_stage_transfer(enum_ctrl_t *enum_ctrl)
break;
}
case ENUM_STAGE_SET_CONFIG: {
USB_SETUP_PACKET_INIT_SET_CONFIG((usb_setup_packet_t *)transfer->data_buffer, ENUM_CONFIG_INDEX + 1);
USB_SETUP_PACKET_INIT_SET_CONFIG((usb_setup_packet_t *)transfer->data_buffer, enum_ctrl->bConfigurationValue);
transfer->num_bytes = sizeof(usb_setup_packet_t); //No data stage
enum_ctrl->expect_num_bytes = 0; //OUT transfer. No need to check number of bytes returned
break;
@ -516,6 +517,7 @@ static bool enum_stage_transfer_check(enum_ctrl_t *enum_ctrl)
case ENUM_STAGE_CHECK_FULL_CONFIG_DESC: {
//Fill configuration descriptor into the device object
const usb_config_desc_t *config_desc = (usb_config_desc_t *)(transfer->data_buffer + sizeof(usb_setup_packet_t));
enum_ctrl->bConfigurationValue = config_desc->bConfigurationValue;
ESP_ERROR_CHECK(usbh_hub_enum_fill_config_desc(enum_ctrl->dev_hdl, config_desc));
ret = true;
break;