Control a device's power state using filter driver

Hi all,

I want to control a device’s (third party’s function driver) power state.
Now, I have a idea, but I’m not sure whether it is possible to implement my goal.

My idea is as following steps:
1.install a upper filter driver to attach to the given function driver.
2.Use my user mode app to send my filter driver an IOCTL.
3.IOCTL dispatch routine creates an IRP and send the power management operation to function driver by PoCallDriver.

Is it work for my destination?

Thanks in advanced.

No. There is only one power policy owner in the stack, that is the fdo in this case. Sending power irps in an unknown state can easily cause the fdo to crash, deadlock and leave it in a unrecoverable undefined state. What bigger problem are you trying to solve?

d

Bent from my phone


From: xxxxx@hotmail.commailto:xxxxx
Sent: ?9/?9/?2014 8:47 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: [ntdev] Control a device’s power state using filter driver

Hi all,

I want to control a device’s (third party’s function driver) power state.
Now, I have a idea, but I’m not sure whether it is possible to implement my goal.

My idea is as following steps:
1.install a upper filter driver to attach to the given function driver.
2.Use my user mode app to send my filter driver an IOCTL.
3.IOCTL dispatch routine creates an IRP and send the power management operation to function driver by PoCallDriver.

Is it work for my destination?

Thanks in advanced.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>

Hi Doron,

I just want to write an application to easily check if the specific device supports d0 and d3 state normally.
but I don’t know what way is possible to implement this requirement, that’s why I proposed such absurd thought.
Is there a given tool that was provided by microsoft?
The book of WDM mentions a tool that is called “PMTSHOOT”, but that is supported win98 only.

Thanks in advanced.

If you JUST want to know which D-States the device supports, you *could* filter the IRP_MJ_PNP, IRP_MN_QUERY_CAPABILITIES request and interpret the DEVICE_CAPABILITIES structure.

Peter
OSR
@OSRDrivers

Dear Peter,

Thanks you,
I also want to use upper filter to send the power IRP to its lower function driver for the state-changing operation,
the destination is to make device change its power state(d0 or d3), such as full-power or power-off.

I found using PoRequestPowerIrp() is able to send an power IRP to control a specific device’s power state.
and the driver which receives such power IRP will dispatch its IRP_MJ_POWER routine.
but I’m not sure whether it is a regular scheme.

Thanks.

I already told you that the fdo owns the power policy for the device and what would happen if you sent unexpected power irps. Again, what bigger problem are you trying to solve by powering down the device?

d

Bent from my phone


From: xxxxx@hotmail.commailto:xxxxx
Sent: ?9/?10/?2014 6:41 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: RE:[ntdev] Control a device’s power state using filter driver

Dear Peter,

Thanks you,
I also want to use upper filter to send the power IRP to its lower function driver for the state-changing operation,
the destination is to make device change its power state(d0 or d3), such as full-power or power-off.

I found using PoRequestPowerIrp() is able to send an power IRP to control a specific device’s power state.
and the driver which receives such power IRP will dispatch its IRP_MJ_POWER routine.
but I’m not sure whether it is a regular scheme.

Thanks.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>

Hi doron,

I’m trying to write the test tool for 3rd-parties sensor,
the test tool’s main goal is to check if the sensor’s power management function is normal.
another reason for writing it is we don’t need to make the whole system sleep and wake.
just need to make the device change its device power state directly(more easier to verify device’s power management capabilities).

Thanks.

OH, OK… I interpreted this:

To mean that you wanted to check to see if a specific device and/or driver supports D0 and D3 state ORDINARILY.

However, you apparently meant that you want to check to see if a specific device and/or driver supports D0 and D3 states CORRECTLY.

Sorry for the confusion.

There are some *very* good tests that do this is a *very* rigorous way that are part of the Device Fundamentals test group. Look at the PnPDTest utility, for one example.

Mostly this will eliminate the need to write your own test,

Peter
OSR
@OSRDrivers