Solved

Driver development - power management

Posted on 2001-08-03
2
194 Views
Last Modified: 2013-12-03
I wrote driver for Win2K for radio card. It all works perfect... but I have no idea how to implement awareness of power-management features in W2k.
Let's say system goes to hibernate mode. Radio turns off because of system power loss. But when system comes up again (from hibernation), driver should turn it back on (to same state it was before hibernation).

My problem is that I don't know how to figure out (at kernel mode of course) that system is powering on from hibernate mode.
I searched through almost all DDK docs, but found nothing usefull for my case. Anyone with more serious experiences?

Regards,
    BozzoCage
0
Comment
Question by:BozzoCage
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 300 total points
ID: 6351872
0
 
LVL 2

Author Comment

by:BozzoCage
ID: 6352733
Thanks!
I was so deep in DDK Help that I though I read EVERYTHING.
Now my driver finally works as I wished :)

For others looking for same solution:
I found it on http://www.microsoft.com/hwdev/desinit/ONNOWwdm.HTM
----
Turning on a Device
When the policy owner decides to turn a device on (due to a received I/O request that requires the device to be on), the following actions occur:

The policy owner calls PoRequestPowerIrp to create an IRP_MJ_POWER/IRP_MN_SET_POWER IRP for the D0 state and send it to the FDO at the top of the device's IRP stack.
When the device driver receives the SET_POWER IRP, it merely fills in a completion routine, then forwards the IRP to its PDO using PoStartNextPowerIrp and PoCallDriver.
When the bus driver receives the SET_POWER IRP at the PDO, it exercises its standard hardware mechanisms to restore power to the device and then completes the IRP.
In its completion routine, the device driver restores all device context to return the device to D0.
The device driver calls PoSetPowerState to tell the operating system that the driver is now fully in the D0 power state.
Summary of key points:


The policy owner decides when to turn on the device and initiates that change by calling PoRequestPowerIrp to request a SET_POWER IRP.
The bus driver turns on the device using industry-standard mechanisms.
The device driver restores device context in the completion routine for the SET_POWER IRP.
---

Thanks,
  BozzoCage
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now