Skip to content

feat(uac_host): Add global suspend/resume#211

Draft
peter-marcisovsky wants to merge 2 commits intomasterfrom
feat/usb_host_uac_suspend_resume_events
Draft

feat(uac_host): Add global suspend/resume#211
peter-marcisovsky wants to merge 2 commits intomasterfrom
feat/usb_host_uac_suspend_resume_events

Conversation

@peter-marcisovsky
Copy link
Collaborator

@peter-marcisovsky peter-marcisovsky commented Jul 17, 2025

Description

This MR adds Suspend/Resume events for UAC class driver as a follow-up for the Global/Suspend resume

Changes

Added Suspend and Resume UAC Host interface events

// For backward compatibility with IDF versions which do not have suspend/resume api
#ifdef USB_HOST_LIB_EVENT_FLAGS_AUTO_SUSPEND
#define UAC_HOST_SUSPEND_RESUME_API_SUPPORTED
#endif

Related

Testing

  • Added target tests to test UAC Host reaction to suspend/resume events

Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

@peter-marcisovsky peter-marcisovsky self-assigned this Jul 17, 2025
@peter-marcisovsky peter-marcisovsky added the Status: In Progress Issue is being worked on label Jul 17, 2025
@peter-marcisovsky peter-marcisovsky force-pushed the feat/usb_host_uac_suspend_resume_events branch 2 times, most recently from d6a83d2 to 1c8eb77 Compare August 6, 2025 10:11
Comment on lines +1199 to +1206
case USB_HOST_CLIENT_EVENT_DEV_SUSPENDED:
ESP_LOGD(TAG, "Device suspended");
_uac_host_device_suspended(event->dev_suspend_resume.dev_hdl);
break;
case USB_HOST_CLIENT_EVENT_DEV_RESUMED:
ESP_LOGD(TAG, "Device resumed");
_uac_host_device_resumed(event->dev_suspend_resume.dev_hdl);
break;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @leeebo in this MR I am adding support for global suspend/resume of the root port.

In the current uac driver, there are public API functions like:

/**
 * @brief Resume a UAC stream with same stream configuration
 */
esp_err_t uac_host_device_resume(uac_host_device_handle_t uac_dev_handle);

and

/**
 * @brief Suspend a UAC stream
 *
 * @param[in] uac_dev_handle  UAC device handle
 */
esp_err_t uac_host_device_suspend(uac_host_device_handle_t uac_dev_handle);

And other static functions like uac_host_interface_suspend(), uac_host_interface_resume().

Which are suspending and resuming the UAC stream, not the device itself in terms of power consumption lowering.

My concern here is, that users might get confused with naming of those functions. And might mistakenly call uac_host_device_suspend() with intention to put a UAC device into a suspended state, to lower it's power consumption. But the function only suspends a UAC stream.

Do you thinks we should consider renaming the functions to something like uac_host_device_suspend_stream() and uac_host_device_resume_stream() ? Can you PTAL and advise how to handle this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think rename to _suspend_stream() and _resume_stream() is a good choice

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leeebo renaming the public api would cause a breaking change for the UAC component.
Should should we consider bumping a Major version when releasing this feature ?

Copy link
Collaborator

@leeebo leeebo Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peter-marcisovsky Sorry for the late response. I prefer using Minor (v1.4.0) for this new feature, because in my understanding, Major usually refers to a significant update or refactoring, such as the introduction of support for UAC 2.0

@peter-marcisovsky peter-marcisovsky added stall PR is stall due to low priority, or blocked by other PR and removed Status: In Progress Issue is being worked on labels Sep 26, 2025
Copy link
Collaborator

@leeebo leeebo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peter-marcisovsky The implements LGTM! Thanks

@peter-marcisovsky peter-marcisovsky force-pushed the feat/usb_host_uac_suspend_resume_events branch from 1c8eb77 to d55878d Compare December 8, 2025 15:03
@peter-marcisovsky peter-marcisovsky added Status: In Progress Issue is being worked on Component: usb_host Issue affects usb_host component and removed stall PR is stall due to low priority, or blocked by other PR labels Dec 8, 2025
@peter-marcisovsky peter-marcisovsky force-pushed the feat/usb_host_uac_suspend_resume_events branch from d55878d to 1e40388 Compare January 5, 2026 15:33
@peter-marcisovsky peter-marcisovsky force-pushed the feat/usb_host_uac_suspend_resume_events branch from 1cefd99 to 11cf819 Compare January 7, 2026 11:07
@peter-marcisovsky peter-marcisovsky force-pushed the feat/usb_host_uac_suspend_resume_events branch from c399316 to fc62a98 Compare January 7, 2026 13:47
@peter-marcisovsky peter-marcisovsky force-pushed the feat/usb_host_uac_suspend_resume_events branch from fc62a98 to 7d15732 Compare January 13, 2026 16:48
@peter-marcisovsky peter-marcisovsky added stall PR is stall due to low priority, or blocked by other PR and removed Status: In Progress Issue is being worked on labels Jan 13, 2026
@peter-marcisovsky
Copy link
Collaborator Author

peter-marcisovsky commented Jan 13, 2026

@tore-espressif tore-espressif added this to the usb_host_uac 2.0.0 milestone Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: usb_host Issue affects usb_host component stall PR is stall due to low priority, or blocked by other PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants