-
Notifications
You must be signed in to change notification settings - Fork 35
feat(usb_host): Global suspend/resume #275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6b88280 to
5ead420
Compare
|
@tore-espressif @roma-jam @igi540 There is one change in the separate commit 6594a35. The change is regarding USB Hal. The suspend/resume feature calls one function from HAL, which was merged to esp-idf separately in 57d48ef and will be bacported to ID 5.4 and IDF 5.5. We decided to access This change will be removed ( PTAL, Thank you. |
6594a35 to
025f3a1
Compare
roma-jam
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still LGTM.
I tried to review it from the scratch again and maybe there are more notes, that I might gave sooner.
I checked the test cases, and I didn't see the one, which handles the sudden disconnection after putting the port to suspend state (tests in the test_usb_host_plugging.c).
Basically, it is interesting to verify the following cases:
- detaching the device, while the suspend command was triggered (device has a flag USBH_DEV_SUSPEND_EVT or any other flags, that we can set during the
usbh_devs_set_pm_actions_all) - detaching the device, which already is in suspended mode (so the hcd_port is in suspended state).
host/usb/test/target_test/usb_host/main/msc_client_transfer_resume.c
Outdated
Show resolved
Hide resolved
|
@roma-jam Thank you very much for the review. To address your point about testing
I see you are mentioning |
tore-espressif
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peter-marcisovsky great work. I leave only 2 nitpicky questions.
Can you also add an entry to changelog?
I want to run few experiments on HW and then we can finally merge it.
623f8c4 to
3cd4cc8
Compare
tore-espressif
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peter-marcisovsky I tested with P4-ECO5, no additional remarks, LGTM!
oh, the changelog entry is still missing! |
- Suspend/Resume of the root port (global)
- Auto resume by transfer submit feature
- No remote wake-up feature
- Closes espressif/esp-idf#14805
3cd4cc8 to
d6209d7
Compare
|
@tore-espressif thanks for checking. Changelog added, ready to be merged. |
|
Hello this seems great, thank you very much for this! I have a question. Let's say I have a keyboard connected to the ESP32-S3, and I put it to sleep using this new method. Can I wake it up by pressing a key on the keyboard, or is that the |
|
Thank you for the amazing work @peter-marcisovsky ! That feature will be a game changer for me. |
Description
This MR adds Global Suspend/Resume functionality for USB Host.
Limitations
How it works
HubandHCD Portmust be in correct state (active state, with a device connected) to enter suspend modeHPRT.PrtSuspbitHubandHCD Portmust be in correct state (Suspended state) to exit suspended modeHPRT.PrtSuspbitChanges
Client events
USB_HOST_CLIENT_EVENT_DEV_SUSPENDEDdelivered to a client which opened a device which is now suspendedUSB_HOST_CLIENT_EVENT_DEV_RESUMEDdelivered to a client which opened a device which is now resumedUSB Host lib event - unblock
usb_host_libtaskUSB_HOST_LIB_EVENT_FLAGS_AUTO_SUSPENDautomatic suspend timer has expired.Auto Suspend timer
usb_host_lib_set_auto_pm()USB_HOST_LIB_PM_SUSPEND_ONE_SHOTone shot suspend timerUSB_HOST_LIB_PM_SUSPEND_PERIODICperiodic suspend timerUSB host public API
usb_host_lib_root_port_suspend(void)usb_host_lib_root_port_resume(void)USBH public API
usbh_devs_set_pm_actions_all()Hub public API
hub_process()-> HCD commandhub_root_mark_suspend()hub_process()-> HCD commandhub_root_mark_resume()hub_root_can_suspend()HCD Tests
USB Host Tests
Related
Checklist
Before submitting a Pull Request, please ensure the following: