IWDFDevice3::AssignS0IdleSettingsEx method
The AssignS0IdleSettingsEx method provides driver-supplied information that the framework uses when a device is idle and the system is in its working (S0) state.
Syntax
HRESULT AssignS0IdleSettingsEx(
  [in]  PWUDF_DEVICE_POWER_POLICY_IDLE_SETTINGS IdleSettings
);
Parameters
- IdleSettings [in]
- 
A pointer to a WUDF_DEVICE_POWER_POLICY_IDLE_SETTINGS structure that was initialized by a call to the WUDF_DEVICE_POWER_POLICY_IDLE_SETTINGS_INIT macro. 
Return value
The method returns S_OK if the operation succeeds. Otherwise, this method returns one of the error codes that are defined in Winerror.h.
Remarks
A driver can call AssignS0IdleSettingsEx at any point after the driver calls IWDFDriver::CreateDevice. Before calling IWDFDriver::CreateDevice, the driver must call IWDFDeviceInitialize::SetPowerPolicyOwnership with the fTrue parameter set to TRUE. For an example of this call sequence, see IWDFDriver::CreateDevice.
If your driver calls AssignS0IdleSettingsEx more than once, follow the rules described in the Remarks section of AssignS0IdleSettings.
For more information about idle power-down, see Supporting Idle Power-Down in UMDF-based Drivers.
Examples
The following code example initializes a WUDF_DEVICE_POWER_POLICY_IDLE_SETTINGS structure and sets an idle time-out value of 10 seconds. The example then obtains the IWDFDevice3 interface and calls AssignS0IdleSettingsEx.
IWDFDevice3 *pIWDFDevice3 = NULL;
HRESULT hr;
WUDF_DEVICE_POWER_POLICY_IDLE_SETTINGS  idleSettings;
WUDF_DEVICE_POWER_POLICY_IDLE_SETTINGS_INIT(
                                           &idleSettings,
                                           IdleCanWakeFromS0
                                           );
idleSettings.IdleTimeout = 10000;
//
// Get a pointer to the IWDFDevice3 interface.
//
hr = pIWDFDevice->QueryInterface(__uuidof(IWDFDevice3),
                                 (void**) &pIWDFDevice3);
if (SUCCEEDED(hr)) 
   {
    
   hr = pIWDFDevice3->AssignS0IdleSettingsEx(&idleSettings
                                            );
   }
...
SAFE_RELEASE(pIWDFDevice3);
   
Requirements
| End of support | Unavailable in UMDF 2.0 and later. | 
|---|---|
| Minimum UMDF version | 1.11 | 
| Header | 
 | 
| DLL | 
 | 
See also

