Link to home
Start Free TrialLog in
Avatar of BozzoCage
BozzoCage

asked on

Driver development - power management

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
ASKER CERTIFIED SOLUTION
Avatar of Tommy Hui
Tommy Hui

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BozzoCage
BozzoCage

ASKER

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