Power management for USB self powered device

Hi,

I have two questions,

  1. What are the values for DeviceState that the driver should report for IRP_MN_QUERY_CAPABILITIES? Since the device is self powered should the driver report PowerDeviceD0 for all the system power states.

  2. If the driver is reporting PowereDeviceD0 for all the systems states, then my understanding is that, the driver can simply skip SYSTEM POWER IRPs and pass them on to the lower driver (Without creating and sending DEVICE POWER IRPs). Am I right?


regards,
Vijairaj

  1. you should not change these values, the bus driver sets these. The
    bus driver knows that your device is self powered and will do the right
    thing
  2. no, you are not right. You should still map s->d irps and behave as
    a proper power policy owner. The bus driver uses the d irps to manage
    the state of the device as well as your driver.

In conclusion, just b/c your device has an external power source does
not mean that you can skip power management duties. Any reason you are
not using KMDF and getting this behavior by default.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Tuesday, July 24, 2007 8:06 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Power management for USB self powered device

Hi,

I have two questions,

  1. What are the values for DeviceState that the driver should report for
    IRP_MN_QUERY_CAPABILITIES? Since the device is self powered should the
    driver report PowerDeviceD0 for all the system power states.

  2. If the driver is reporting PowereDeviceD0 for all the systems states,
    then my understanding is that, the driver can simply skip SYSTEM POWER
    IRPs and pass them on to the lower driver (Without creating and sending
    DEVICE POWER IRPs). Am I right?


regards,
Vijairaj


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

> In conclusion, just b/c your device has an external power source does not

mean that you can skip power management duties. Any reason you are not
using KMDF and getting this behavior by default.

Thanks D for your clarification,
I am using WDM and the bus driver reports S0->D0 and {S1-S5}->D3.
I had previously thought that by setting Sx->D0, power handling can be skipped.
Now its clear that COPY-PASTE in inevitable.


Regards,
Vijairaj

I bet a conversion to KMDF would take just as much time as you
copy/paste and you know for certain that KMDF implemention will be as or
more correct then what you are copying into your driver (as well as
better integrated into your i/o processing).

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Tuesday, July 24, 2007 11:28 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Power management for USB self powered device

In conclusion, just b/c your device has an external power source does
not
mean that you can skip power management duties. Any reason you are not
using KMDF and getting this behavior by default.

Thanks D for your clarification,
I am using WDM and the bus driver reports S0->D0 and {S1-S5}->D3.
I had previously thought that by setting Sx->D0, power handling can be
skipped.
Now its clear that COPY-PASTE in inevitable.


Regards,
Vijairaj


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

> I bet a conversion to KMDF would take just as much time as you

copy/paste and you know for certain that KMDF implemention will be as
or more correct then what you are copying into your driver (as well as
better integrated into your i/o processing).

I really appreciate KMDF and the relief it has brought to us driver writers but
sadly, believe me, this is a 98/Me driver. I can only hope that KMDF existed
for 98.

xxxxx@gmail.com wrote:

I really appreciate KMDF and the relief it has brought to us driver writers but
sadly, believe me, this is a 98/Me driver. I can only hope that KMDF existed
for 98.

No, KMDF did not exist for Win98.

  • If your driver is solely targetted at Win2000/XP/Vista, please look
    into the KMDF. It will save you a lot of time, effort and frustration.

  • If, however, your driver must run with Win98/ME, forget KMDF and go
    for WDM. It’s (AFAIK) the only driver model that gives you a chance to
    support all platforms since Win9x. But even WDM matured over time, so I
    recommend to get Walter Oney’s book on driver programming to see how to
    bridge the changes.

If your Win98/ME driver was derived from a Microsoft driver sample, I
recommend to first get the old DDK plus the latest WDK. Then analyze the
changes that have been made to the DDK driver sample.

Then (if possible) re-implement the changes in the KMDF version of the
driver sample.
This way you don’t have to care about lots of housekeeping and
administrative stuff (KMDF will do most of this for you) and you can
concentrate on getting the functionality working.

My first try of this method was actually with UMDF (Vista driver
signing… need I say more?), and I had - to my own surprise - a working
driver very quickly.

Because I needed something that works from Win98SE up to Vista64,
however, I went for WDM next and used the same method to ‘upgrade’ the
code to the current WDM version sources.

This provides at least a very good starting point for improvements and
further changes (to be done as and if necessary).