DevicePowerNotify (Compact 2013)

3/26/2014

This function requests that Power Manager change the power state of a device.

Syntax

DWORD DevicePowerNotify(
  PVOID pvDevice,
  CEDEVICE_POWER_STATE DeviceState,
  DWORD Flags
);

Parameters

  • pvDevice
    [in] Specifies the device. Must be a valid LPWSTR device name, for example, COM1:.
  • Flags
    [in] Set to POWER_NAME to specify the name of the device that is requesting the power request.

Return Value

  • ERROR_FILE_NOT_FOUND
    Indicates that the device class or the device within the device class cannot be found.
  • ERROR_INVALID_PARAMETER
    Indicates that there is no valid parameter.
  • ERROR_WRITE_FAULT
    Indicates that the attempt to update the device power state failed.

Remarks

When DevicePowerNotify is called, qualify the name of your device with an associated class. For example, {8DD679CE-8AB4-43c8-A14A-EA4963FAA715}\DSK1: refers to a power-managed block device called DSK1. If no class qualification is present, the generic power-manageable class {A32942B7-920C-486b-B0E6-92A702A99B35} is assumed.

A device driver can notify Power Manager that it wants to change its device power level using this function. If no entity has requested a power level requirement for the device, Power Manager may issue an IOCTL_POWER_SET to the requested device power level. Drivers should not assume that successful calls to this function will result in an IOCTL_POWER_SET or that subsequent IOCTL_POWER_SET operations are a result of this call.

Power Manager supports DevicePowerNotify requests from a device while processing IOCTL_POWER_CAPABILITIES. This enables devices that are set to be loaded at a device power state other than D0 to request that their power state value be updated immediately following registration with Power Manager. As with any DevicePowerNotify function call, the request might not result in a device power state update. This depends on constraints imposed on Power Manager by applications, as well as the system power state configuration.

Drivers that support power management should report their capabilities as accurately as possible during enumeration. From then on, they will receive requests from Power Manager to get or change their device power states. Devices that can manage their own power should use DevicePowerNotify to request that Power Manager change their device power state.

Requirements

Header

pm.h

Library

coredll.lib

See Also

Reference

Power Management Functions
CEDEVICE_POWER_STATE
IOCTL_POWER_SET