Expand Minimize

WdfDeviceGetSystemPowerAction method

[Applies to KMDF and UMDF]

The WdfDeviceGetSystemPowerAction method returns the system power action, if any, that is currently occurring for the computer.

Syntax


POWER_ACTION WdfDeviceGetSystemPowerAction(
  [in]  WDFDEVICE Device
);

Parameters

Device [in]

A handle to a framework device object.

Return value

WdfDeviceGetSystemPowerAction returns a POWER_ACTION-typed enumerator value. The value indicates the system power action that is currently occurring for the computer. For more information, see the following Remarks section. The POWER_ACTION enumeration is defined in wdm.h.

A bug check occurs if the driver supplies an invalid object handle.

Remarks

The WdfDeviceGetSystemPowerAction method enables a driver to determine whether a device's power transition is occurring because the device is idle (or waking up), or because the entire computer is entering (or leaving) a low-power state.

The driver must call WdfDeviceGetSystemPowerAction only from the event callback functions that the framework calls when the device is entering a low-power state or returning to its working state.

The value that WdfDeviceGetSystemPowerAction returns depends on the following situations:

  • If the computer is entering a low-power state when the driver calls WdfDeviceGetSystemPowerAction, the method returns the reason that the computer is entering the low-power state. For example, the method returns PowerActionSleep if the computer is entering its S1, S2, or S3 low-power state.

  • If the computer is returning to its working (S0) state from a low-power state when the driver calls WdfDeviceGetSystemPowerAction, the method returns the reason that the computer entered the low-power state. For example, the method returns PowerActionSleep if the computer is leaving its S1, S2, or S3 low-power state.

  • If the computer is powering up (after having been turned off) when the driver calls WdfDeviceGetSystemPowerAction, the method returns PowerActionNone.

  • If the device is entering a low-power idle state or returning to its working (D0) state when the driver calls WdfDeviceGetSystemPowerAction, while the rest of the system remains at its working (S0) state, the method returns PowerActionNone.

  • If the computer and the device are both in their working states when the driver calls WdfDeviceGetSystemPowerAction, the method returns PowerActionNone.

For more information about low-power states, see A Device Enters a Low-Power State.

Examples

The following code example obtains the power transition activity that is currently occurring for the computer.


POWER_ACTION SysPowerAction;

SysPowerAction = WdfDeviceGetSystemPowerAction(device);

Requirements

Minimum KMDF version

1.9

Minimum UMDF version

2.0

Header

Wdfdevice.h (include Wdf.h)

Library

Wdf01000.sys (KMDF);
WUDFx02000.dll (UMDF)

IRQL

<= DISPATCH_LEVEL

DDI compliance rules

DriverCreate, KmdfIrql, KmdfIrql2

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft. All rights reserved.