Power-Manageable Device Drivers (Windows CE 5.0)
To create a device driver that recognizes the power states of a target device, you must first create a driver that advertises a non-COM-related device interface. This non-COM-related device interface, in turn, specifies that the device is power-managed.
You can advertise a device interface in the following ways:
- You can define the interface in the IClass value of the registry key used to activate the device.
- You can define the IClass value in the Active registry key using the Init function of the device driver.
- You can define the IClass value using the REGINI parameter for the ActivateDeviceEx function.
- You can explicitly call the AdvertiseInterface function in the device driver.
For additional information on advertising a non-COM-related interface for power management, see Device Interface Notifications.
You can register a device driver for power management notifications by calling the RequestPowerNotifications function and passing a handle to a message queue created exclusively for power management notifications. You should only do this if your driver must respond to a power notification and can afford to incur the associated overhead. Typically, once a driver has been advertised as a power-aware driver, the driver needs only to process DeviceIoControl calls from the Power Manager.
The Power Manager communicates to a device with IOCTL codes. The following table shows the IOCTL codes the Power Manager uses to communicate with a device.
Function | Description |
---|---|
IOCTL_POWER_CAPABILITIES | Requests that the device inform the Power Manager of supported power states along with any associated characteristics. |
IOCTL_POWER_SET | Requests that the device update the power state information. |
IOCTL_POWER_QUERY | Queries to verify that the device is ready to enter a new device power state. |
IOCTL_POWER_GET | Requests that the device inform the Power Manager of the current device power state. |
IOCTL_REGISTER_POWER_RELATIONSHIP | Notifies the parent device to register all controlled devices. |
You can implement and use the optional IOCTL_POWER_QUERY control code as a way to delay power state transitions until a driver has completed preparation for a change in power state. You can do this by modifying the MDD layer to support IOCTL_POWER_QUERY, although this modification may make the MDD layer incompatible with future versions of the Power Manager.
See Also
Device Power Management Guidelines | How to Add Power Management to a Device Driver | Power Management Implementation in Drivers | Power Management Implementation in Stream Interface Drivers
Send Feedback on this topic to the authors