File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -328,6 +328,8 @@ void usbh_devs_set_pm_actions_all(usbh_dev_ctrl_t device_ctrl);
328328 * - ESP_OK: All devices flush/halt successful
329329 * - ESP_ERR_INVALID_STATE: USBH driver is not installed
330330 * - ESP_ERR_INVALID_SIZE: Too many devices connected for synchronous handling
331+ * - ESP_ERR_NOT_FINISHED: usb host lib busy, mutex to process the EPs can't be acquired. We bail the auto-suspend
332+ * operation in favor of a low latency to enter light sleep.
331333 */
332334esp_err_t usbh_devs_halt_flush_all_sync (void );
333335#endif // AUTO_PM_LIGHT_SLEEP
Original file line number Diff line number Diff line change @@ -1120,7 +1120,11 @@ esp_err_t usbh_devs_halt_flush_all_sync(void)
11201120{
11211121 esp_err_t ret ;
11221122 USBH_CHECK (p_usbh_obj != NULL , ESP_ERR_INVALID_STATE );
1123- xSemaphoreTake (p_usbh_obj -> constant .mux_lock , portMAX_DELAY );
1123+
1124+ // Try to acquire mutex, if busy, bail the auto supend in favour of low latency to enter the light sleep
1125+ if (xSemaphoreTake (p_usbh_obj -> constant .mux_lock , 0 ) != pdTRUE ) {
1126+ return ESP_ERR_NOT_FINISHED ;
1127+ }
11241128
11251129 ESP_GOTO_ON_FALSE (p_usbh_obj -> mux_protected .num_device <= USBH_MAX_SYNC_DEVS_HANDLED , ESP_ERR_INVALID_SIZE ,
11261130 unlock , USBH_TAG , "Too many devices for synchronous handling" );
You can’t perform that action at this time.
0 commit comments