While the system is in a low-power state, some devices can detect an external event, such as an incoming network packet, and then wake the system. For example, if a PCI device has a system wakeup capability, as indicated in the device's Power Management Capabilities (PMC) register, it wakes the system by raising the Power Management Event (PME) signal on the PCI bus.
Call WdfDeviceAssignSxWakeSettings to specify:
- The low-power state that the device will enter
- Whether users can control the device's idle settings
- Whether the device's wake capability is enabled or disabled
For more information about these settings, see the WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS structure.
Call WdfDeviceInitSetPowerPolicyEventCallbacks to register the following event callback functions, if you need them for your device:
- EvtDeviceArmWakeFromSx or EvtDeviceArmWakeFromSxWithReason, which enable the device hardware to respond to an external wake-up event.
- EvtDeviceDisarmWakeFromSx, which disables the device's ability to respond to an external wake-up event.
- EvtDeviceWakeFromSxTriggered, which informs the driver that the bus detected a wake signal.
Bus drivers also participate in waking up the system. The driver for the device's bus typically provides EvtDeviceEnableWakeAtBus and EvtDeviceDisableWakeAtBus callback functions. These functions do whatever is necessary on the bus adapter to enable and disable a device's ability to wake from a low-power state.
When a bus driver determines that a device has triggered a wake signal, it must call WdfDeviceIndicateWakeStatus to inform the framework that the device's power should be restored. The framework then passes this information to the rest of the drivers in the driver stack.
For information about registry entries that control a device's wake capabilities, see User Control of Device Idle and Wake Behavior.