Fix Wdfserial power management checkbox "Allow the computer to turn off this device to save power"#30
Merged
5656hcx merged 2 commits intoqualcomm:mainfrom May 4, 2026
Conversation
- Remove unnecessary IdleCaps assignment when SS is disabled (registry not set) - Explicitly enable selective suspend in high timeout case to override user/registry settings - Use IdleUsbSelectiveSuspend instead of IdleCannotWakeFromS0 when disabling SS - Add UserControlOfIdleSettings to restore user control when disabling selective suspend Ensures proper power policy state transitions and respects user preferences. Signed-off-by: Cristian Manca <Cristian.Manca@telit.com>
922ecee to
a13740a
Compare
5656hcx
requested changes
Apr 29, 2026
Contributor
5656hcx
left a comment
There was a problem hiding this comment.
The idea to make enabling explicit and store the capabilities is good.
My suggestion is to save this value in the end of function, set and save it only once, and use it in both enable and disable function.
Store assigned idle capabilities in device context to maintain power policy consistency when toggling selective suspend enable/disable. - Add AssignedIdleCaps field to device context to track idle capabilities - Store assigned idle caps once at function end - Restore stored idle caps or fallback to IdleCannotWakeFromS0 when disabling selective suspend - Ensures power policy state consistency across enable/disable cycles Signed-off-by: Cristian Manca <Cristian.Manca@telit.com>
a13740a to
1907900
Compare
5656hcx
approved these changes
May 4, 2026
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.
Problem
For qcwdfser devices, unchecking "Allow the computer to turn off this device to save power" sets IdleInWorkingState
= 0 and disables selective suspend. Re-checking the box does not restore IdleInWorkingState = 1 — selective suspend
stays disabled until a manual registry edit and device re-enumeration.
Root Cause Analysis
IdleInWorkingState = 0 in the registry and does not re-enable idle, because the driver provides no explicit
override. This is the direct cause of the bug.
IdleUsbSelectiveSuspend on the first successful enable call. The mismatch causes STATUS_INVALID_DEVICE_REQUEST, so
the disable call silently fails.
user-initiated power management toggles.
Solution
restore IdleInWorkingState = 1 regardless of the registry state.
WdfDeviceAssignS0IdleSettings call.
always matches what WDF locked — across all code paths (normal, STATUS_POWER_STATE_INVALID fallback, and LPC).