feat(usb_host): esp sleep modes verification#445
Open
peter-marcisovsky wants to merge 2 commits intomasterfrom
Open
feat(usb_host): esp sleep modes verification#445peter-marcisovsky wants to merge 2 commits intomasterfrom
peter-marcisovsky wants to merge 2 commits intomasterfrom
Conversation
aca937d to
4ad8b7d
Compare
5bcdbe4 to
1bce9cc
Compare
1bce9cc to
e54f2ba
Compare
e54f2ba to
2bc1e5f
Compare
2bc1e5f to
01d0528
Compare
5b0dae3 to
8b5e16d
Compare
6 tasks
70e0763 to
7a8ee7a
Compare
6 tasks
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7a8ee7a. Configure here.
Collaborator
Author
|
Converted to draft, trying to lower the sleep latency even more. |
7a8ee7a to
5374edc
Compare
0544e62 to
2d44f99
Compare
2d44f99 to
c33fd17
Compare
c33fd17 to
7f43c1a
Compare
7f43c1a to
3c0cfaa
Compare
- using esp light sleep and esp deep sleep modes with USB Host application
- verify USB Host functionality in both sleep modes
- light sleep: added pm callbacks to automatically suspend and resume USB Host driver
3c0cfaa to
66a9e6c
Compare
3 tasks
- Don't do the full suspend/resume when suspending/resuming from light sleep CBs
- Added latency measurement test
66a9e6c to
519d3a4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Verification of using light sleep and deep sleep in combination with USB Host application.
Light sleep
CONFIG_ESP_SLEEP_EVENT_CALLBACKSLight sleep log, with light sleep callbacks enabeld
Root port enters suspended mode before entering light sleep
Light sleep log, with light sleep callbacks disabled
Missing suspend/resume sequence from host. Host just stops sending SOFs without any "reason". This pattern only appears on HS port. The device does not enter suspended state
Enter light sleep latency
Added light sleep latency when entering and exiting light sleep with automatic suspend/resume of the peripheral
Deep sleep
HNPcap is enabled on allHNPcapable targets by default, to prevent current leakage in deep sleep.Testing
usb_sleep_modestarget testsLimitations
Related
Checklist
Before submitting a Pull Request, please ensure the following:
Note
Medium Risk
Adds sleep event callbacks that suspend/resume the USB root port from light-sleep critical sections and introduces new synchronization/error-handling paths, which could affect USB stability and wake latency on supported targets.
Overview
Adds optional automatic USB root-port suspend/resume around light sleep (guarded by
CONFIG_ESP_SLEEP_EVENT_CALLBACKS) by registering sleep event callbacks inusb_host_install()/usb_host_uninstall()and coordinating async suspend completion via a new semaphore.Extends the hub driver with a
HUB_EVENT_SUSPEND_COMPLETEDevent and ahub_root_mark_light_sleep_auto_resume()flag to safely handle the case where a device disconnects during light sleep (HCD port inRECOVERY) before attempting resume.Introduces a new
usb_sleep_modestarget test app (Unity + pytest) that exercises USB Host behavior across repeated light-sleep cycles and multi-stage deep-sleep resets, including an error-path test for sleep callback failures.Reviewed by Cursor Bugbot for commit 7a8ee7a. Bugbot is set up for automated code reviews on this repo. Configure here.