Skip to content

Conversation

@peter-marcisovsky
Copy link
Collaborator

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

Description

This MR adds Suspend/Resume events for CDC-ACM class driver as a follow-up for the Global/Suspend resume feature in the usb component.

Added a backward compatibility for older IDF releases, where the suspend/resume will not be backported, by:

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

Related

  • Suspend/Resume support for CDC Class driver

Testing

  • Added tests, which verify the class driver functionality with root port 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.

Note

Add suspend/resume event handling to CDC-ACM host with backward-compatible API guards and comprehensive test coverage.

  • CDC-ACM Host (core/driver):
    • Handle USB_HOST_CLIENT_EVENT_DEV_SUSPENDED/DEV_RESUMED; emit CDC_ACM_HOST_DEVICE_SUSPENDED/CDC_ACM_HOST_DEVICE_RESUMED to clients.
    • Add cdc_acm_resume() to re-submit BULK IN and INTR IN polls after resume.
    • Integrate backward-compat macro CDC_HOST_SUSPEND_RESUME_API_SUPPORTED (gated by USB_HOST_LIB_EVENT_FLAGS_AUTO_SUSPEND).
    • Minor robustness/logging tweaks in USB event handling.
  • Public API/Headers:
    • Extend cdc_acm_host_dev_event_t with suspend/resume events; include usb/usb_host.h.
    • Add compat macro in public headers; update SPDX years.
  • Tests:
    • Add suspend/resume scenarios: multiple pseudo-devs, auto PM timer (one-shot/periodic), sudden disconnect while suspended, open/close while suspended, auto-suspend under multi-thread load, resume by transfer submission.
    • Introduce app_queue helpers (wait_for_app_event, wait_for_no_app_event); refactor to a default device config; host loop reacts to USB_HOST_LIB_EVENT_FLAGS_AUTO_SUSPEND.
  • Docs:
    • Update CHANGELOG.md with "Added global suspend/resume support".

Written by Cursor Bugbot for commit 149a481. This will update automatically on new commits. Configure here.

@peter-marcisovsky peter-marcisovsky self-assigned this Jul 11, 2025
@peter-marcisovsky peter-marcisovsky added the Status: In Progress Issue is being worked on label Jul 11, 2025
@peter-marcisovsky peter-marcisovsky force-pushed the feat/usb_host_cdc_am_suspend_resume_evts branch from 86cd783 to b82e513 Compare July 11, 2025 13:26
@peter-marcisovsky peter-marcisovsky force-pushed the feat/usb_host_cdc_am_suspend_resume_evts branch 2 times, most recently from 042aa83 to adc2b01 Compare August 8, 2025 07:10
@peter-marcisovsky peter-marcisovsky force-pushed the feat/usb_host_cdc_am_suspend_resume_evts branch 2 times, most recently from b718d82 to 31ae0b4 Compare August 21, 2025 11:11
@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
@peter-marcisovsky peter-marcisovsky force-pushed the feat/usb_host_cdc_am_suspend_resume_evts branch from 31ae0b4 to 5ce4bcd Compare October 30, 2025 06:52
@peter-marcisovsky peter-marcisovsky marked this pull request as ready for review October 30, 2025 06:53
@peter-marcisovsky peter-marcisovsky added Component: usb_host Issue affects usb_host component and removed stall PR is stall due to low priority, or blocked by other PR labels Oct 30, 2025
@peter-marcisovsky peter-marcisovsky force-pushed the feat/usb_host_cdc_am_suspend_resume_evts branch from 5ce4bcd to 890e36b Compare October 30, 2025 07:41
    - usb_host lib supports global suspend and resume
    - backward compatibility with older IDF releases
    - CDC-ACM Host target tests
@tore-espressif tore-espressif force-pushed the feat/usb_host_cdc_am_suspend_resume_evts branch from 890e36b to 149a481 Compare November 3, 2025 10:47
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants