mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 01:29:21 -04:00
refactor(usb_host): Removed error in enum when stalled, added hcd_dwc no more free channels
This commit is contained in:
parent
dcc31f89f7
commit
c19e2b7f8d
@ -765,9 +765,15 @@ static esp_err_t control_response_handling(enum_stage_t stage)
|
||||
usb_transfer_t *ctrl_xfer = &p_enum_driver->constant.urb->transfer;
|
||||
|
||||
if (ctrl_xfer->status != USB_TRANSFER_STATUS_COMPLETED) {
|
||||
if (ctrl_xfer->status == USB_TRANSFER_STATUS_STALL &&
|
||||
stage >= ENUM_STAGE_CHECK_SHORT_LANGID_TABLE &&
|
||||
stage <= ENUM_STAGE_CHECK_FULL_SER_STR_DESC) {
|
||||
// String Descriptor request could be STALLed, if the device doesn't have them
|
||||
} else {
|
||||
ESP_LOGE(ENUM_TAG, "Bad transfer status %d: %s",
|
||||
ctrl_xfer->status,
|
||||
enum_stage_strings[stage]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1015,10 +1021,6 @@ static bool set_next_stage(bool last_stage_pass)
|
||||
next_stage = last_stage + 1;
|
||||
}
|
||||
} else {
|
||||
ESP_LOGE(ENUM_TAG, "[%d:%d] %s FAILED",
|
||||
p_enum_driver->single_thread.parent_dev_addr,
|
||||
p_enum_driver->single_thread.parent_port_num,
|
||||
enum_stage_strings[last_stage]);
|
||||
// These stages cannot fail
|
||||
assert(last_stage != ENUM_STAGE_SET_ADDR_RECOVERY &&
|
||||
last_stage != ENUM_STAGE_SELECT_CONFIG &&
|
||||
@ -1055,6 +1057,10 @@ static bool set_next_stage(bool last_stage_pass)
|
||||
break;
|
||||
default:
|
||||
// Stage is not allowed to failed. Cancel enumeration.
|
||||
ESP_LOGE(ENUM_TAG, "[%d:%d] %s FAILED",
|
||||
p_enum_driver->single_thread.parent_dev_addr,
|
||||
p_enum_driver->single_thread.parent_port_num,
|
||||
enum_stage_strings[last_stage]);
|
||||
next_stage = ENUM_STAGE_CANCEL;
|
||||
break;
|
||||
}
|
||||
|
@ -1826,6 +1826,8 @@ esp_err_t hcd_pipe_alloc(hcd_port_handle_t port_hdl, const hcd_pipe_config_t *pi
|
||||
bool chan_allocated = usb_dwc_hal_chan_alloc(port->hal, pipe->chan_obj, (void *) pipe);
|
||||
if (!chan_allocated) {
|
||||
HCD_EXIT_CRITICAL();
|
||||
// The only reason why alloc channel could return false is no more free channels
|
||||
ESP_LOGE(HCD_DWC_TAG, "No more HCD channels available");
|
||||
ret = ESP_ERR_NOT_SUPPORTED;
|
||||
goto err;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user