Skip to content

Conversation

@peter-marcisovsky
Copy link
Collaborator

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

Description

According to the programming guide, there are several ways how to exit suspended state:

  • Host initiated resume
    • calling usb_host_lib_root_port_resume()
  • Device initiated remote wakeup
  • Device disconnect
    • already working
  • Host initiated reset
    • this PR
  • and others which are not relevant for us yet.

Exiting Suspend Through Host Initiated Reset

When the port is in suspended state, it must react to HCD_PORT_CMD_RESET command, which will effectively resume the root port after the reset sequence.

This change does not bring any benefits right now, adding it just for the sake of the completeness of the global suspend/resume feature.

Related

Testing


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

Enable host-initiated reset while port is suspended to exit suspend; add ping helper and tests, including a new suspend+reset test.

  • Driver (HCD DWC)
    • Allow HCD_PORT_CMD_RESET when port is HCD_PORT_STATE_SUSPENDED in _port_cmd_reset() (host/usb/src/hcd_dwc.c).
  • Tests
    • Add TRANSFER_MAX_BYTES and test_hcd_ping_device() helper to probe device responsiveness (host/usb/test/target_test/common/hcd_common.{c,h}).
    • Update suspend/resume and sudden disconnect tests to use test_hcd_ping_device(), manage URB lifecycle, and validate states (host/usb/test/target_test/hcd/main/test_hcd_port.c).
    • Add new test "Test HCD port suspend and resume port reset" verifying reset exits suspend and restores enabled state while pipe remains halted (test_hcd_port.c).

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

@peter-marcisovsky peter-marcisovsky added this to the usb_host 1.1.0 milestone Nov 25, 2025
@peter-marcisovsky peter-marcisovsky self-assigned this Nov 25, 2025
@peter-marcisovsky peter-marcisovsky added Status: In Progress Issue is being worked on Component: usb_host Issue affects usb_host component labels Nov 25, 2025
@peter-marcisovsky peter-marcisovsky force-pushed the feat/usb_host_exit_suspend_by_port_reset branch from bc85ce3 to b17b80c Compare November 25, 2025 10:07
@peter-marcisovsky peter-marcisovsky changed the title feat(usb_host): Exit suspend state by poert reset feat(usb_host): Exit suspend state by port reset Nov 25, 2025
@peter-marcisovsky peter-marcisovsky force-pushed the feat/usb_host_exit_suspend_by_port_reset branch from b17b80c to 1213c78 Compare November 25, 2025 13:21
@peter-marcisovsky peter-marcisovsky marked this pull request as ready for review November 25, 2025 15:23
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 is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on December 20

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_exit_suspend_by_port_reset branch 2 times, most recently from ef89423 to 9774d1b Compare November 26, 2025 12:30
@peter-marcisovsky peter-marcisovsky added Status: Reviewing Issue is being reviewed and removed Status: In Progress Issue is being worked on labels Nov 26, 2025
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.

LGTM!

    - Exiting suspended root port through host initiated reset
@peter-marcisovsky peter-marcisovsky force-pushed the feat/usb_host_exit_suspend_by_port_reset branch from 9774d1b to e48b3d4 Compare November 27, 2025 12:38
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