-
Notifications
You must be signed in to change notification settings - Fork 930
Open
Description
Answers checklist.
- I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
- I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
- I have searched the issue tracker for a similar issue and not found a similar issue.
General issue report
Describe the bug
In the _cdc_close function, the cdc->data.out_xfer is reset (halted and flushed) twice. The first reset appears redundant and may not be necessary.
Code Snippet
esp-iot-solution/components/usb/iot_usbh_cdc/iot_usbh_cdc.c
Lines 805 to 827 in 21670a6
| // Cancel polling of BULK IN | |
| if (cdc->data.in_xfer) { | |
| ESP_ERROR_CHECK(_cdc_reset_transfer_endpoint(cdc->dev_hdl, cdc->data.in_xfer)); | |
| } | |
| ESP_ERROR_CHECK(_cdc_reset_transfer_endpoint(cdc->dev_hdl, cdc->data.out_xfer)); | |
| if (cdc->notif.xfer) { | |
| ESP_ERROR_CHECK(_cdc_reset_transfer_endpoint(cdc->dev_hdl, cdc->notif.xfer)); | |
| } | |
| if ((cdc->notif.intf_desc != NULL) && cdc->notif.intf_desc != cdc->data.intf_desc) { | |
| ESP_ERROR_CHECK(usb_host_interface_release(p_usbh_cdc_obj->cdc_client_hdl, cdc->dev_hdl, cdc->notif.intf_desc->bInterfaceNumber)); | |
| } | |
| if (cdc->data.out_xfer) { | |
| ESP_ERROR_CHECK(_cdc_reset_transfer_endpoint(cdc->dev_hdl, cdc->data.out_xfer)); | |
| } | |
| // wait for transfers to complete | |
| vTaskDelay(10 / portTICK_PERIOD_MS); | |
| // Release all interfaces | |
| ESP_ERROR_CHECK(usb_host_interface_release(p_usbh_cdc_obj->cdc_client_hdl, cdc->dev_hdl, cdc->data.intf_desc->bInterfaceNumber)); |
Expected behavior
The first reset for cdc->data.out_xfer should be removed to avoid unnecessary function calls and potential confusion.
Metadata
Metadata
Assignees
Labels
No labels