File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -261,6 +261,7 @@ typedef struct _DEVICE_CONTEXT
261261 BOOLEAN InServiceSelectiveSuspension ;
262262 ULONG SelectiveSuspendIdleTime ;
263263 BOOLEAN SelectiveSuspendInMiliSeconds ;
264+ WDF_POWER_POLICY_S0_IDLE_CAPABILITIES AssignedIdleCaps ;
264265
265266 WMILIB_CONTEXT WmiLibInfo ; // to query system power management tab
266267 CHAR DevSerialNumber [256 ]; // to hold USB_STRING_DESCRIPTOR of the serial number
Original file line number Diff line number Diff line change @@ -2107,6 +2107,7 @@ NTSTATUS QCPNP_EnableSelectiveSuspend
21072107 {
21082108 idleSettings .IdleTimeout *= 1000 ;
21092109 }
2110+ idleSettings .Enabled = WdfTrue ; // explicitly enable SS (overrides any user/registry disable)
21102111 status = WdfDeviceAssignS0IdleSettings (Device , & idleSettings );
21112112 if (status == STATUS_POWER_STATE_INVALID )
21122113 {
@@ -2129,6 +2130,8 @@ NTSTATUS QCPNP_EnableSelectiveSuspend
21292130 );
21302131 }
21312132
2133+ pDevContext -> AssignedIdleCaps = idleSettings .IdleCaps ;
2134+
21322135 return status ;
21332136}
21342137
@@ -2159,8 +2162,14 @@ NTSTATUS QCPNP_DisableSelectiveSuspend
21592162 ("<%ws> QCPNP_DisableSelectiveSuspend\n" , pDevContext -> PortName )
21602163 );
21612164
2162- WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS_INIT (& idleSettings , IdleCannotWakeFromS0 );
2165+ WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS_INIT (
2166+ & idleSettings ,
2167+ (pDevContext -> AssignedIdleCaps != IdleCapsInvalid )
2168+ ? pDevContext -> AssignedIdleCaps
2169+ : IdleCannotWakeFromS0
2170+ );
21632171 idleSettings .Enabled = WdfFalse ;
2172+ idleSettings .UserControlOfIdleSettings = IdleAllowUserControl ;
21642173 return WdfDeviceAssignS0IdleSettings (Device , & idleSettings );
21652174}
21662175
You can’t perform that action at this time.
0 commit comments