Skip to content

Conversation

@peter-marcisovsky
Copy link
Collaborator

@peter-marcisovsky peter-marcisovsky commented Nov 20, 2025

Description

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

Changes

Added Suspend and Resume UVC 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 UVC_HOST_SUSPEND_RESUME_API_SUPPORTED
#endif

Related

Testing

  • Added target tests to test UVC 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.

Note

Adds suspend/resume handling to UVC Host, exposing new events and updating examples and tests accordingly.

  • API/Driver:
    • Add UVC_HOST_DEVICE_SUSPENDED and UVC_HOST_DEVICE_RESUMED events in include/usb/uvc_host.h (gated by UVC_HOST_SUSPEND_RESUME_API_SUPPORTED).
    • Implement suspend/resume flow in uvc_host.c:
      • New helper uvc_host_device_suspended() to pause stream and ensure frames are returned.
      • Handle USB_HOST_CLIENT_EVENT_DEV_SUSPENDED/DEV_RESUMED to notify clients and manage stream state.
  • Examples:
    • Update examples/basic_uvc_stream and examples/camera_display to log and handle new suspend/resume events (conditional on macro); refresh SPDX year in camera_display.c.
  • Tests:
    • Add test_app/main/test_uvc_host_pm.c with suspend/resume scenarios (basic, while streaming, resume-on-transfer, close while suspended, open while suspended, concurrent suspend/disconnect, auto-suspend timer).
    • Update test_app/sdkconfig.defaults to enable indexed task notifications.
  • Docs:
    • Update CHANGELOG.md with “Added global suspend/resume support”.

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

@peter-marcisovsky peter-marcisovsky self-assigned this Nov 20, 2025
@peter-marcisovsky peter-marcisovsky added Status: In Progress Issue is being worked on Component: usb_host Issue affects usb_host component labels Nov 20, 2025
@peter-marcisovsky peter-marcisovsky force-pushed the feat/usb_host_uvc_suspend_resume_evts branch 3 times, most recently from 50c067a to 872764b Compare November 21, 2025 16:19
@peter-marcisovsky peter-marcisovsky marked this pull request as ready for review November 21, 2025 16:19
@tore-espressif tore-espressif added this to the usb_host_uvc 2.5.0 milestone Nov 23, 2025
@peter-marcisovsky peter-marcisovsky force-pushed the feat/usb_host_uvc_suspend_resume_evts branch 2 times, most recently from bf2051b to 5e417ee Compare November 24, 2025 12:19
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@peter-marcisovsky peter-marcisovsky force-pushed the feat/usb_host_uvc_suspend_resume_evts branch from 5e417ee to 76274d5 Compare November 24, 2025 12:49
    - usb_host lib supports global suspend and resume
    - backward compatibility with older IDF releases
    - UVC Host target tests
@peter-marcisovsky peter-marcisovsky force-pushed the feat/usb_host_uvc_suspend_resume_evts branch from 76274d5 to 4aac6fa Compare November 25, 2025 12:22
@peter-marcisovsky
Copy link
Collaborator Author

Updated the MR with the recent #333 PR (Refactor(usb_host): Rename auto suspend timer public API), fixed cursor review into a separate commit. And rebased.

Copy link
Contributor

@roma-jam roma-jam left a comment

Choose a reason for hiding this comment

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

Two questions from my side.

Copy link
Collaborator

@tore-espressif tore-espressif 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 LGTM!

But let's wait for #340 so Zhou Li does not have to rebase again...

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 Status: Reviewing Issue is being reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants