system standby & power IRPs

I seem to be having a problem with my driver that is preventing the system
from going into stand by. I’m getting a message saying “the device driver
is preventing the machine from entering standby”. I’m not doing anything
special with my power handling, in fact I’m using the OSR power handling
code from the usbfx2 samples. My device is a USB device installed as a
keyboard class device, and I have a thread that always has a pending read.
I tried having the read thread cancel the read when the power request comes
down, but that didn’t make a difference either. Any clues as to what’s
happening? below is a bit of my debugging output…

OsrPower: Entered with Minor Function IRP_MN_QUERY_POWER
OsrHandleSystemPowerIrp: Entered…
OsrHandleSystemPowerIrp: Querying for System state transition to
PowerSystemSleeping1
SystemPowerIoCompletionRoutine: Entered…
DevicePowerRequestCompletionRoutine: Entered…
DevicePowerRequestCompletionRoutine: Exiting!
SystemPowerIoCompletionRoutine: Exiting!
OsrHandleSystemPowerIrp: Exiting!
OsrPower: Exiting…
OsrPower: Entered with Minor Function IRP_MN_SET_POWER
OsrHandleSystemPowerIrp: Entered…
OsrHandleSystemPowerIrp: Setting System state to PowerSystemWorking
SystemPowerIoCompletionRoutine: Entered…
OsrPower: Entered with Minor Function IRP_MN_SET_POWER
OsrHandleDevicePowerIrp: Entered…
OsrHandleDevicePowerIrp: Setting Device state to PowerDeviceD0
OsrHandleDevicePowerIrp is telling the read thread to sleep
The read thread is sleeping
DevicePowerIoCompletionRoutine: Entered…
DevicePowerIoCompletionRoutine: IRP_MN_SET_POWER
DevicePowerIoCompletionRoutine: IRP_MN_SET_POWER Device powered down
DevicePowerIoCompletionRoutine: Exiting!
DevicePowerRequestCompletionRoutine: Entered…
DevicePowerRequestCompletionRoutine: Exiting!
OsrHandleDevicePowerIrp: Exiting!
OsrPower: Exiting…
SystemPowerIoCompletionRoutine: Exiting!
OsrHandleSystemPowerIrp: Exiting!
OsrPower: Exiting…
Abort: \Driver\Kbdclass \Device\KeyboardClass2 irp (83a88e90)
QueryPower-Sleeping1 status c00002d3
PopPolicyWorkerAction: action request 2 failed c00002d3

I would print out the irp you are processing in your dbg output. Are
you calling PoStartNextPowerIrp before completing (or skipping the
current stack location) the irp?

Find your device stack, run !devstack (doesn’t matter
which one). For each devobj listed, run !podev . If it says
sysact or dvact in the output, you are missing the call to
PoStartNextPowerIrp.

On my test machine when I hit the standby button, this is what it looked
like when I broke in right before I completed the Dx irp (and had the
system power irp pending as well).

1: kd> !devstack 0x82050ec0
!DevObj !DrvObj !DevExt ObjectName
> 82050ec0 \Driver\TargetUnitTest 83216ff8
82114700 \Driver\WdfRawBusEnumTest 8246cfe0 00000066
!DevNode 82144320 :
DeviceInst is
“{688291AD-8D9A-4EB3-A6D0-BB0AC8338C1B}\MsTargetUnitTest\2&31e92d51&0&01

ServiceName is “TargetUnitTest”

1: kd> !podev 82050ec0
Device object is for:
DriverObject 8200c8f0
Current Irp 00000000 RefCount 0 Type 00000000 DevFlags 00002004
DO_POWER_PAGABLE
Device queue is not busy.
Device Object Extension: 82050fd0:
PowerFlags: 00000540 =>SystemState=0 DeviceState=4 syact dvact
^^^^^^^^^^^
Dope: 00000000:

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jeff Lange
Sent: Tuesday, April 12, 2005 11:00 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] system standby & power IRPs

I seem to be having a problem with my driver that is preventing the
system
from going into stand by. I’m getting a message saying “the device
driver
is preventing the machine from entering standby”. I’m not doing anything

special with my power handling, in fact I’m using the OSR power handling

code from the usbfx2 samples. My device is a USB device installed as a
keyboard class device, and I have a thread that always has a pending
read.
I tried having the read thread cancel the read when the power request
comes
down, but that didn’t make a difference either. Any clues as to what’s
happening? below is a bit of my debugging output…

OsrPower: Entered with Minor Function IRP_MN_QUERY_POWER
OsrHandleSystemPowerIrp: Entered…
OsrHandleSystemPowerIrp: Querying for System state transition to
PowerSystemSleeping1
SystemPowerIoCompletionRoutine: Entered…
DevicePowerRequestCompletionRoutine: Entered…
DevicePowerRequestCompletionRoutine: Exiting!
SystemPowerIoCompletionRoutine: Exiting!
OsrHandleSystemPowerIrp: Exiting!
OsrPower: Exiting…
OsrPower: Entered with Minor Function IRP_MN_SET_POWER
OsrHandleSystemPowerIrp: Entered…
OsrHandleSystemPowerIrp: Setting System state to PowerSystemWorking
SystemPowerIoCompletionRoutine: Entered…
OsrPower: Entered with Minor Function IRP_MN_SET_POWER
OsrHandleDevicePowerIrp: Entered…
OsrHandleDevicePowerIrp: Setting Device state to PowerDeviceD0
OsrHandleDevicePowerIrp is telling the read thread to sleep
The read thread is sleeping
DevicePowerIoCompletionRoutine: Entered…
DevicePowerIoCompletionRoutine: IRP_MN_SET_POWER
DevicePowerIoCompletionRoutine: IRP_MN_SET_POWER Device powered down
DevicePowerIoCompletionRoutine: Exiting!
DevicePowerRequestCompletionRoutine: Entered…
DevicePowerRequestCompletionRoutine: Exiting!
OsrHandleDevicePowerIrp: Exiting!
OsrPower: Exiting…
SystemPowerIoCompletionRoutine: Exiting!
OsrHandleSystemPowerIrp: Exiting!
OsrPower: Exiting…
Abort: \Driver\Kbdclass \Device\KeyboardClass2 irp (83a88e90)
QueryPower-Sleeping1 status c00002d3
PopPolicyWorkerAction: action request 2 failed c00002d3


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

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Jeff Lange wrote:

I seem to be having a problem with my driver that is preventing the system
from going into stand by. I’m getting a message saying “the device driver
is preventing the machine from entering standby”. I’m not doing anything
special with my power handling, in fact I’m using the OSR power handling
code from the usbfx2 samples. My device is a USB device installed as a
keyboard class device, and I have a thread that always has a pending read.
I tried having the read thread cancel the read when the power request comes
down, but that didn’t make a difference either. Any clues as to what’s
happening? below is a bit of my debugging output…

OsrPower: Entered with Minor Function IRP_MN_QUERY_POWER
OsrHandleSystemPowerIrp: Entered…
OsrHandleSystemPowerIrp: Querying for System state transition to
PowerSystemSleeping1

OsrHandleDevicePowerIrp: Exiting!
OsrPower: Exiting…
SystemPowerIoCompletionRoutine: Exiting!
OsrHandleSystemPowerIrp: Exiting!
OsrPower: Exiting…
Abort: \Driver\Kbdclass \Device\KeyboardClass2 irp (83a88e90)
QueryPower-Sleeping1 status c00002d3
PopPolicyWorkerAction: action request 2 failed c00002d3

C00002D3 is STATUS_POWER_STATE_INVALID. What status are you eventually
returning?

Yep, the debug output is nearly useless without reporting parameters and return values. I’d suggest to improve it and problem probably becomes visible immediatelly.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Tim Roberts[SMTP:xxxxx@probo.com]
Reply To: Windows System Software Devs Interest List
Sent: Tuesday, April 12, 2005 8:39 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] system standby & power IRPs

Jeff Lange wrote:

>I seem to be having a problem with my driver that is preventing the system
>from going into stand by. I’m getting a message saying “the device driver
>is preventing the machine from entering standby”. I’m not doing anything
>special with my power handling, in fact I’m using the OSR power handling
>code from the usbfx2 samples. My device is a USB device installed as a
>keyboard class device, and I have a thread that always has a pending read.
>I tried having the read thread cancel the read when the power request comes
>down, but that didn’t make a difference either. Any clues as to what’s
>happening? below is a bit of my debugging output…
>
>OsrPower: Entered with Minor Function IRP_MN_QUERY_POWER
>OsrHandleSystemPowerIrp: Entered…
>OsrHandleSystemPowerIrp: Querying for System state transition to
>PowerSystemSleeping1
>…
>OsrHandleDevicePowerIrp: Exiting!
>OsrPower: Exiting…
>SystemPowerIoCompletionRoutine: Exiting!
>OsrHandleSystemPowerIrp: Exiting!
>OsrPower: Exiting…
>Abort: \Driver\Kbdclass \Device\KeyboardClass2 irp (83a88e90)
>QueryPower-Sleeping1 status c00002d3
>PopPolicyWorkerAction: action request 2 failed c00002d3
>
>

C00002D3 is STATUS_POWER_STATE_INVALID. What status are you eventually
returning?


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

You are currently subscribed to ntdev as: xxxxx@upek.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

OK,
Doron, I don’t seem to have any problem with not calling PoStartNextPowerIrp, so I’ve added a little more debugging output and this is what I’m seeing now.

HALACPI: The BIOS wants the OS to preserve 22000 bytes
Kbdsim: KbdsimPower Entered.
Kbdsim: Querying SystemPowerState state PowerSystemSleeping1
Kbdsim: Calling PoCallDriver with completion routine = kbdsimFDOPowerComplete
Kbdsim: Entered kbdsimFDOPowerComplete for IRP_MN_QUERY_POWER
Kbdsim: Calling PoRequestPowerIrp for
IRP_MN_QUERY_POWER
powerState.DeviceState=PowerDeviceD2
powerState.SystemState=PowerSystemSleeping2
Completion Routine=kbdsimFDOPowerTransitionPoRequestComplete
Kbdsim: Entered kbdsimFDOPowerTransitionPoRequestComplete for IRP_MN_QUERY_POWER
Kbdsim: IoStatus->Status = 0xc00002d3
Kbdsim: calling PoStartNextPowerIrp(SystemStateIrp)
Kbdsim: calling IoCompleteRequest(SystemStateIrp)
Kbdsim: kbdsimFDOPowerComplete returning STATUS_UNKNOWN_STATUS
Kbdsim: KbdsimPower Entered.
Kbdsim: Setting SystemPowerState state to PowerSystemWorking
Kbdsim: Calling PoCallDriver with completion routine = kbdsimFDOPowerComplete
Kbdsim: Entered kbdsimFDOPowerComplete for IRP_MN_SET_POWER, powerType=SystemPowerState
Kbdsim: Power Unchanged
Kbdsim: Calling PoRequestPowerIrp for
IRP_MN_SET_POWER
powerState.DeviceState=PowerDeviceD0
powerState.SystemState=PowerSystemWorking
Completion Routine=kbdsimFDOPowerTransitionPoRequestComplete
Kbdsim: KbdsimPower Entered.
Kbdsim: Setting DevicePowerState state to PowerDeviceD0
Kbdsim: Entered kbdsimFDOPowerTransitionPoRequestComplete for IRP_MN_SET_POWER
Kbdsim: IoStatus->Status = 0x0
Kbdsim: calling PoStartNextPowerIrp(SystemStateIrp)
Kbdsim: calling IoCompleteRequest(SystemStateIrp)
Kbdsim: kbdsimFDOPowerComplete returning STATUS_MORE_PROCESSING_REQUIRED
Kbdsim: kbdsimFDOPowerComplete returning STATUS_UNKNOWN_STATUS
Abort: \Driver\Kbdclass \Device\KeyboardClass2 irp (8312ce90) QueryPower-Sleeping1 status c00002d3
PopPolicyWorkerAction: action request 2 failed c00002d3

If I dump out my device capibilities this is what I see:

Received Device Capabilities Device Capabilities 825F49A8
Kbdsim: Size = 40
Kbdsim: Version = 1
Kbdsim: DeviceD1 TRUE
Kbdsim: DeviceD2 TRUE
Kbdsim: LockSupported FALSE
Kbdsim: EjectSupported FALSE
Kbdsim: Removable TRUE
Kbdsim: DockDevice FALSE
Kbdsim: UniqueID FALSE
Kbdsim: SilentInstall FALSE
Kbdsim: RawDeviceOK FALSE
Kbdsim: SurpriseRemovalOK FALSE
Kbdsim: WakeFromD0 TRUE
Kbdsim: WakeFromD1 TRUE
Kbdsim: WakeFromD2 TRUE
Kbdsim: WakeFromD3 FALSE
Kbdsim: HardwareDisabled FALSE
Kbdsim: NonDynamic FALSE
Kbdsim: WarmEjectSupported FALSE
Kbdsim: NoDisplayInUI FALSE
Kbdsim: Address 2
Kbdsim: UINumber 0
Kbdsim: PowerSystemUnspecified = PowerDeviceUnspecified
Kbdsim: PowerSystemWorking = PowerDeviceD0
Kbdsim: PowerSystemSleeping1 = PowerDeviceD2
Kbdsim: PowerSystemSleeping2 = PowerDeviceD3
Kbdsim: PowerSystemSleeping3 = PowerDeviceD3
Kbdsim: PowerSystemHibernate = PowerDeviceD3
Kbdsim: PowerSystemShutdown = PowerDeviceD3
Kbdsim: SystemWake = PowerSystemSleeping1
Kbdsim: DeviceWake = PowerDeviceD2
Kbdsim: D1Latency 0
Kbdsim: D2Latency 0
Kbdsim: D3Latency 0

I hope this makes some send to someone becuase this is the first time I’ve ever had to delve into to world of power management =(

Thanks in advance.
-Jeff

So you received a Sys-query for PowerSystemSleeping1 and requested a
Dev-query for D2 but one of the drivers in stack failed the D2-query. Did I
read you right?

When you handled the D-IRP, did you set Irp->IoStatus.Status to
STATUS_SUCCESS before passing it down? You can do a “ba” on the IoStatus to
see who is changing it.


Calvin Guan, Windows DDK MVP
Software Engineer,?NT Driver
ATI Technologies Inc. www.ati.com
?
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jeff Lange
Sent: April 13, 2005 9:34 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] system standby & power IRPs

OK,
? Doron, I don’t seem to have any problem with not calling
PoStartNextPowerIrp, so I’ve added a little more debugging output and this
is what I’m seeing now.

HALACPI: The BIOS wants the OS to preserve 22000 bytes
Kbdsim: KbdsimPower Entered.
Kbdsim: Querying SystemPowerState state PowerSystemSleeping1
Kbdsim: Calling PoCallDriver with completion routine =
kbdsimFDOPowerComplete
Kbdsim: Entered kbdsimFDOPowerComplete for IRP_MN_QUERY_POWER
Kbdsim: Calling PoRequestPowerIrp for
??? IRP_MN_QUERY_POWER
??? powerState.DeviceState=PowerDeviceD2
??? powerState.SystemState=PowerSystemSleeping2
??? Completion Routine=kbdsimFDOPowerTransitionPoRequestComplete
Kbdsim: Entered kbdsimFDOPowerTransitionPoRequestComplete for
IRP_MN_QUERY_POWER
Kbdsim: IoStatus->Status = 0xc00002d3
Kbdsim: calling PoStartNextPowerIrp(SystemStateIrp)
Kbdsim: calling IoCompleteRequest(SystemStateIrp)
Kbdsim: kbdsimFDOPowerComplete returning STATUS_UNKNOWN_STATUS
Kbdsim: KbdsimPower Entered.
Kbdsim: Setting SystemPowerState state to PowerSystemWorking
Kbdsim: Calling PoCallDriver with completion routine =
kbdsimFDOPowerComplete
Kbdsim: Entered kbdsimFDOPowerComplete for IRP_MN_SET_POWER,
powerType=SystemPowerState
Kbdsim: Power Unchanged
Kbdsim: Calling PoRequestPowerIrp for
??? IRP_MN_SET_POWER
??? powerState.DeviceState=PowerDeviceD0
??? powerState.SystemState=PowerSystemWorking
??? Completion Routine=kbdsimFDOPowerTransitionPoRequestComplete
Kbdsim: KbdsimPower Entered.
Kbdsim: Setting DevicePowerState state to PowerDeviceD0
Kbdsim: Entered kbdsimFDOPowerTransitionPoRequestComplete for
IRP_MN_SET_POWER
Kbdsim: IoStatus->Status = 0x0
Kbdsim: calling PoStartNextPowerIrp(SystemStateIrp)
Kbdsim: calling IoCompleteRequest(SystemStateIrp)
Kbdsim: kbdsimFDOPowerComplete returning STATUS_MORE_PROCESSING_REQUIRED
Kbdsim: kbdsimFDOPowerComplete returning STATUS_UNKNOWN_STATUS
Abort: \Driver\Kbdclass \Device\KeyboardClass2 irp (8312ce90)
QueryPower-Sleeping1 status c00002d3
PopPolicyWorkerAction: action request 2 failed c00002d3
?
?
?
?
If I dump out my device capibilities this is what I see:
?
Received Device Capabilities Device Capabilities 825F49A8
Kbdsim: Size = 40
Kbdsim: Version = 1
Kbdsim: DeviceD1 TRUE
Kbdsim: DeviceD2 TRUE
Kbdsim: LockSupported FALSE
Kbdsim: EjectSupported FALSE
Kbdsim: Removable TRUE
Kbdsim: DockDevice FALSE
Kbdsim: UniqueID FALSE
Kbdsim: SilentInstall FALSE
Kbdsim: RawDeviceOK FALSE
Kbdsim: SurpriseRemovalOK FALSE
Kbdsim: WakeFromD0 TRUE
Kbdsim: WakeFromD1 TRUE
Kbdsim: WakeFromD2 TRUE
Kbdsim: WakeFromD3 FALSE
Kbdsim: HardwareDisabled FALSE
Kbdsim: NonDynamic FALSE
Kbdsim: WarmEjectSupported FALSE
Kbdsim: NoDisplayInUI FALSE
Kbdsim: Address 2
Kbdsim: UINumber 0
Kbdsim: PowerSystemUnspecified = PowerDeviceUnspecified
Kbdsim: PowerSystemWorking = PowerDeviceD0
Kbdsim: PowerSystemSleeping1 = PowerDeviceD2
Kbdsim: PowerSystemSleeping2 = PowerDeviceD3
Kbdsim: PowerSystemSleeping3 = PowerDeviceD3
Kbdsim: PowerSystemHibernate = PowerDeviceD3
Kbdsim: PowerSystemShutdown = PowerDeviceD3
Kbdsim: SystemWake = PowerSystemSleeping1
Kbdsim: DeviceWake = PowerDeviceD2
Kbdsim: D1Latency 0
Kbdsim: D2Latency 0
Kbdsim: D3Latency 0
?
?
I hope this makes some send to someone becuase this is the first time I’ve
ever had to delve into to world of power management =(
?
Thanks in advance.
-Jeff
?

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

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

IIRC, you are in a stack with kbdclass as the class filter right? If so, you don’t need to convert system power irps to device power irps. Kbdclass is the power policy owner for the stack. The src for kbdclass is in the DDK. Kbdclass will send D irps and optionally wake irps for the stack.

Also, a chk version kdbclass will assert if send a query Dx state irp to the stack (it only expects query S irps since it is the power policy owner). Since kbdclass is only expecting query S irps, when you send a query D irp, it is misinterpreted and failed. From KeyboardClassPower:

case IRP_MN_QUERY_POWER:
ASSERT (SystemPowerState == powerType);

//
// Fail the query if we can’t wake the machine. We do, however, want to
// let hibernate succeed no matter what (besides, it is doubtful that a
// keyboard can wait wake the machine out of S4).
//
if (powerState.SystemState < PowerSystemHibernate &&
powerState.SystemState > data->MinSystemWakeState &&
WAITWAKE_ON(data)) {
status = STATUS_POWER_STATE_INVALID;
}
else {
status = STATUS_SUCCESS;
}

Irp->IoStatus.Status = status;
break;

Also, IIRC, this is a simulated device. As such, why are you reporting that you can wake the machine? Ie these power caps:

Kbdsim: WakeFromD0 TRUE
Kbdsim: WakeFromD1 TRUE
Kbdsim: WakeFromD2 TRUE

Kbdsim: PowerSystemSleeping1 = PowerDeviceD2
Kbdsim: SystemWake = PowerSystemSleeping1
Kbdsim: DeviceWake = PowerDeviceD2

These look eerily similar to toaster/busenum … Are are you simulating a keyboard off of a real piece of hardware (like a PCI card), in which case, these caps are filled in pci and this is not a concern.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Calvin Guan
Sent: Wednesday, April 13, 2005 8:21 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] system standby & power IRPs

So you received a Sys-query for PowerSystemSleeping1 and requested a
Dev-query for D2 but one of the drivers in stack failed the D2-query. Did I
read you right?

When you handled the D-IRP, did you set Irp->IoStatus.Status to
STATUS_SUCCESS before passing it down? You can do a “ba” on the IoStatus to
see who is changing it.


Calvin Guan, Windows DDK MVP
Software Engineer,?NT Driver
ATI Technologies Inc. www.ati.com
?
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jeff Lange
Sent: April 13, 2005 9:34 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] system standby & power IRPs

OK,
? Doron, I don’t seem to have any problem with not calling
PoStartNextPowerIrp, so I’ve added a little more debugging output and this
is what I’m seeing now.

HALACPI: The BIOS wants the OS to preserve 22000 bytes
Kbdsim: KbdsimPower Entered.
Kbdsim: Querying SystemPowerState state PowerSystemSleeping1
Kbdsim: Calling PoCallDriver with completion routine =
kbdsimFDOPowerComplete
Kbdsim: Entered kbdsimFDOPowerComplete for IRP_MN_QUERY_POWER
Kbdsim: Calling PoRequestPowerIrp for
??? IRP_MN_QUERY_POWER
??? powerState.DeviceState=PowerDeviceD2
??? powerState.SystemState=PowerSystemSleeping2
??? Completion Routine=kbdsimFDOPowerTransitionPoRequestComplete
Kbdsim: Entered kbdsimFDOPowerTransitionPoRequestComplete for
IRP_MN_QUERY_POWER
Kbdsim: IoStatus->Status = 0xc00002d3
Kbdsim: calling PoStartNextPowerIrp(SystemStateIrp)
Kbdsim: calling IoCompleteRequest(SystemStateIrp)
Kbdsim: kbdsimFDOPowerComplete returning STATUS_UNKNOWN_STATUS
Kbdsim: KbdsimPower Entered.
Kbdsim: Setting SystemPowerState state to PowerSystemWorking
Kbdsim: Calling PoCallDriver with completion routine =
kbdsimFDOPowerComplete
Kbdsim: Entered kbdsimFDOPowerComplete for IRP_MN_SET_POWER,
powerType=SystemPowerState
Kbdsim: Power Unchanged
Kbdsim: Calling PoRequestPowerIrp for
??? IRP_MN_SET_POWER
??? powerState.DeviceState=PowerDeviceD0
??? powerState.SystemState=PowerSystemWorking
??? Completion Routine=kbdsimFDOPowerTransitionPoRequestComplete
Kbdsim: KbdsimPower Entered.
Kbdsim: Setting DevicePowerState state to PowerDeviceD0
Kbdsim: Entered kbdsimFDOPowerTransitionPoRequestComplete for
IRP_MN_SET_POWER
Kbdsim: IoStatus->Status = 0x0
Kbdsim: calling PoStartNextPowerIrp(SystemStateIrp)
Kbdsim: calling IoCompleteRequest(SystemStateIrp)
Kbdsim: kbdsimFDOPowerComplete returning STATUS_MORE_PROCESSING_REQUIRED
Kbdsim: kbdsimFDOPowerComplete returning STATUS_UNKNOWN_STATUS
Abort: \Driver\Kbdclass \Device\KeyboardClass2 irp (8312ce90)
QueryPower-Sleeping1 status c00002d3
PopPolicyWorkerAction: action request 2 failed c00002d3
?
?
?
?
If I dump out my device capibilities this is what I see:
?
Received Device Capabilities Device Capabilities 825F49A8
Kbdsim: Size = 40
Kbdsim: Version = 1
Kbdsim: DeviceD1 TRUE
Kbdsim: DeviceD2 TRUE
Kbdsim: LockSupported FALSE
Kbdsim: EjectSupported FALSE
Kbdsim: Removable TRUE
Kbdsim: DockDevice FALSE
Kbdsim: UniqueID FALSE
Kbdsim: SilentInstall FALSE
Kbdsim: RawDeviceOK FALSE
Kbdsim: SurpriseRemovalOK FALSE
Kbdsim: WakeFromD0 TRUE
Kbdsim: WakeFromD1 TRUE
Kbdsim: WakeFromD2 TRUE
Kbdsim: WakeFromD3 FALSE
Kbdsim: HardwareDisabled FALSE
Kbdsim: NonDynamic FALSE
Kbdsim: WarmEjectSupported FALSE
Kbdsim: NoDisplayInUI FALSE
Kbdsim: Address 2
Kbdsim: UINumber 0
Kbdsim: PowerSystemUnspecified = PowerDeviceUnspecified
Kbdsim: PowerSystemWorking = PowerDeviceD0
Kbdsim: PowerSystemSleeping1 = PowerDeviceD2
Kbdsim: PowerSystemSleeping2 = PowerDeviceD3
Kbdsim: PowerSystemSleeping3 = PowerDeviceD3
Kbdsim: PowerSystemHibernate = PowerDeviceD3
Kbdsim: PowerSystemShutdown = PowerDeviceD3
Kbdsim: SystemWake = PowerSystemSleeping1
Kbdsim: DeviceWake = PowerDeviceD2
Kbdsim: D1Latency 0
Kbdsim: D2Latency 0
Kbdsim: D3Latency 0
?
?
I hope this makes some send to someone becuase this is the first time I’ve
ever had to delve into to world of power management =(
?
Thanks in advance.
-Jeff
?

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

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


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

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

You are correct that it is a keyboard device sitting above the kbdclass.
But this is a physical USB device (HID type) (not root enumerated simulated
hardware). So if I’m understanding you correctly, when I get the
IRP_MN_QUERY_POWER I should just call

PoStartNextPowerIrp(Irp);
IoSkipCurrentIrpStackLocaltion(Irp);
PoCallDriver(devExt->DeviceToSendIrpsTo, Irp);

Thanks for all your help.

-Jeff

“Doron Holan” wrote in message
news:xxxxx@ntdev…
IIRC, you are in a stack with kbdclass as the class filter right? If so,
you don’t need to convert system power irps to device power irps. Kbdclass
is the power policy owner for the stack. The src for kbdclass is in the
DDK. Kbdclass will send D irps and optionally wake irps for the stack.

Also, a chk version kdbclass will assert if send a query Dx state irp to the
stack (it only expects query S irps since it is the power policy owner).
Since kbdclass is only expecting query S irps, when you send a query D irp,
it is misinterpreted and failed. From KeyboardClassPower:

case IRP_MN_QUERY_POWER:
ASSERT (SystemPowerState == powerType);

//
// Fail the query if we can’t wake the machine. We do, however,
want to
// let hibernate succeed no matter what (besides, it is doubtful
that a
// keyboard can wait wake the machine out of S4).
//
if (powerState.SystemState < PowerSystemHibernate &&
powerState.SystemState > data->MinSystemWakeState &&
WAITWAKE_ON(data)) {
status = STATUS_POWER_STATE_INVALID;
}
else {
status = STATUS_SUCCESS;
}

Irp->IoStatus.Status = status;
break;

Also, IIRC, this is a simulated device. As such, why are you reporting that
you can wake the machine? Ie these power caps:

Kbdsim: WakeFromD0 TRUE
Kbdsim: WakeFromD1 TRUE
Kbdsim: WakeFromD2 TRUE

Kbdsim: PowerSystemSleeping1 = PowerDeviceD2
Kbdsim: SystemWake = PowerSystemSleeping1
Kbdsim: DeviceWake = PowerDeviceD2

These look eerily similar to toaster/busenum … Are are you simulating a
keyboard off of a real piece of hardware (like a PCI card), in which case,
these caps are filled in pci and this is not a concern.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Calvin Guan
Sent: Wednesday, April 13, 2005 8:21 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] system standby & power IRPs

So you received a Sys-query for PowerSystemSleeping1 and requested a
Dev-query for D2 but one of the drivers in stack failed the D2-query. Did I
read you right?

When you handled the D-IRP, did you set Irp->IoStatus.Status to
STATUS_SUCCESS before passing it down? You can do a “ba” on the IoStatus to
see who is changing it.

---------------------------------
Calvin Guan, Windows DDK MVP
Software Engineer, NT Driver
ATI Technologies Inc. www.ati.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jeff Lange
Sent: April 13, 2005 9:34 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] system standby & power IRPs

OK,
Doron, I don’t seem to have any problem with not calling
PoStartNextPowerIrp, so I’ve added a little more debugging output and this
is what I’m seeing now.

HALACPI: The BIOS wants the OS to preserve 22000 bytes
Kbdsim: KbdsimPower Entered.
Kbdsim: Querying SystemPowerState state PowerSystemSleeping1
Kbdsim: Calling PoCallDriver with completion routine =
kbdsimFDOPowerComplete
Kbdsim: Entered kbdsimFDOPowerComplete for IRP_MN_QUERY_POWER
Kbdsim: Calling PoRequestPowerIrp for
IRP_MN_QUERY_POWER
powerState.DeviceState=PowerDeviceD2
powerState.SystemState=PowerSystemSleeping2
Completion Routine=kbdsimFDOPowerTransitionPoRequestComplete
Kbdsim: Entered kbdsimFDOPowerTransitionPoRequestComplete for
IRP_MN_QUERY_POWER
Kbdsim: IoStatus->Status = 0xc00002d3
Kbdsim: calling PoStartNextPowerIrp(SystemStateIrp)
Kbdsim: calling IoCompleteRequest(SystemStateIrp)
Kbdsim: kbdsimFDOPowerComplete returning STATUS_UNKNOWN_STATUS
Kbdsim: KbdsimPower Entered.
Kbdsim: Setting SystemPowerState state to PowerSystemWorking
Kbdsim: Calling PoCallDriver with completion routine =
kbdsimFDOPowerComplete
Kbdsim: Entered kbdsimFDOPowerComplete for IRP_MN_SET_POWER,
powerType=SystemPowerState
Kbdsim: Power Unchanged
Kbdsim: Calling PoRequestPowerIrp for
IRP_MN_SET_POWER
powerState.DeviceState=PowerDeviceD0
powerState.SystemState=PowerSystemWorking
Completion Routine=kbdsimFDOPowerTransitionPoRequestComplete
Kbdsim: KbdsimPower Entered.
Kbdsim: Setting DevicePowerState state to PowerDeviceD0
Kbdsim: Entered kbdsimFDOPowerTransitionPoRequestComplete for
IRP_MN_SET_POWER
Kbdsim: IoStatus->Status = 0x0
Kbdsim: calling PoStartNextPowerIrp(SystemStateIrp)
Kbdsim: calling IoCompleteRequest(SystemStateIrp)
Kbdsim: kbdsimFDOPowerComplete returning STATUS_MORE_PROCESSING_REQUIRED
Kbdsim: kbdsimFDOPowerComplete returning STATUS_UNKNOWN_STATUS
Abort: \Driver\Kbdclass \Device\KeyboardClass2 irp (8312ce90)
QueryPower-Sleeping1 status c00002d3
PopPolicyWorkerAction: action request 2 failed c00002d3

If I dump out my device capibilities this is what I see:

Received Device Capabilities Device Capabilities 825F49A8
Kbdsim: Size = 40
Kbdsim: Version = 1
Kbdsim: DeviceD1 TRUE
Kbdsim: DeviceD2 TRUE
Kbdsim: LockSupported FALSE
Kbdsim: EjectSupported FALSE
Kbdsim: Removable TRUE
Kbdsim: DockDevice FALSE
Kbdsim: UniqueID FALSE
Kbdsim: SilentInstall FALSE
Kbdsim: RawDeviceOK FALSE
Kbdsim: SurpriseRemovalOK FALSE
Kbdsim: WakeFromD0 TRUE
Kbdsim: WakeFromD1 TRUE
Kbdsim: WakeFromD2 TRUE
Kbdsim: WakeFromD3 FALSE
Kbdsim: HardwareDisabled FALSE
Kbdsim: NonDynamic FALSE
Kbdsim: WarmEjectSupported FALSE
Kbdsim: NoDisplayInUI FALSE
Kbdsim: Address 2
Kbdsim: UINumber 0
Kbdsim: PowerSystemUnspecified = PowerDeviceUnspecified
Kbdsim: PowerSystemWorking = PowerDeviceD0
Kbdsim: PowerSystemSleeping1 = PowerDeviceD2
Kbdsim: PowerSystemSleeping2 = PowerDeviceD3
Kbdsim: PowerSystemSleeping3 = PowerDeviceD3
Kbdsim: PowerSystemHibernate = PowerDeviceD3
Kbdsim: PowerSystemShutdown = PowerDeviceD3
Kbdsim: SystemWake = PowerSystemSleeping1
Kbdsim: DeviceWake = PowerDeviceD2
Kbdsim: D1Latency 0
Kbdsim: D2Latency 0
Kbdsim: D3Latency 0

I hope this makes some send to someone becuase this is the first time I’ve
ever had to delve into to world of power management =(

Thanks in advance.
-Jeff


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

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


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

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Yes, and you should ignore for IRP_MN_SET_POWER system power irps. The
only power irp you should pay attention to and handle is
IRP_MN_SET_POWER fir device power irps.

If your device needs to support wake and you need to perform special arm
enabling logic, you need to handle IRP_MN_WAIT_WAKE on its way down the
stack.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jeff Lange
Sent: Wednesday, April 13, 2005 10:37 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] system standby & power IRPs

You are correct that it is a keyboard device sitting above the kbdclass.

But this is a physical USB device (HID type) (not root enumerated
simulated
hardware). So if I’m understanding you correctly, when I get the
IRP_MN_QUERY_POWER I should just call

PoStartNextPowerIrp(Irp);
IoSkipCurrentIrpStackLocaltion(Irp);
PoCallDriver(devExt->DeviceToSendIrpsTo, Irp);

Thanks for all your help.

-Jeff

“Doron Holan” wrote in message
news:xxxxx@ntdev…
IIRC, you are in a stack with kbdclass as the class filter right? If
so,
you don’t need to convert system power irps to device power irps.
Kbdclass
is the power policy owner for the stack. The src for kbdclass is in the

DDK. Kbdclass will send D irps and optionally wake irps for the stack.

Also, a chk version kdbclass will assert if send a query Dx state irp to
the
stack (it only expects query S irps since it is the power policy owner).

Since kbdclass is only expecting query S irps, when you send a query D
irp,
it is misinterpreted and failed. From KeyboardClassPower:

case IRP_MN_QUERY_POWER:
ASSERT (SystemPowerState == powerType);

//
// Fail the query if we can’t wake the machine. We do, however,

want to
// let hibernate succeed no matter what (besides, it is doubtful

that a
// keyboard can wait wake the machine out of S4).
//
if (powerState.SystemState < PowerSystemHibernate &&
powerState.SystemState > data->MinSystemWakeState &&
WAITWAKE_ON(data)) {
status = STATUS_POWER_STATE_INVALID;
}
else {
status = STATUS_SUCCESS;
}

Irp->IoStatus.Status = status;
break;

Also, IIRC, this is a simulated device. As such, why are you reporting
that
you can wake the machine? Ie these power caps:

Kbdsim: WakeFromD0 TRUE
Kbdsim: WakeFromD1 TRUE
Kbdsim: WakeFromD2 TRUE

Kbdsim: PowerSystemSleeping1 = PowerDeviceD2
Kbdsim: SystemWake = PowerSystemSleeping1
Kbdsim: DeviceWake = PowerDeviceD2

These look eerily similar to toaster/busenum … Are are you simulating
a
keyboard off of a real piece of hardware (like a PCI card), in which
case,
these caps are filled in pci and this is not a concern.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Calvin Guan
Sent: Wednesday, April 13, 2005 8:21 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] system standby & power IRPs

So you received a Sys-query for PowerSystemSleeping1 and requested a
Dev-query for D2 but one of the drivers in stack failed the D2-query.
Did I
read you right?

When you handled the D-IRP, did you set Irp->IoStatus.Status to
STATUS_SUCCESS before passing it down? You can do a “ba” on the IoStatus
to
see who is changing it.

---------------------------------
Calvin Guan, Windows DDK MVP
Software Engineer, NT Driver
ATI Technologies Inc. www.ati.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jeff Lange
Sent: April 13, 2005 9:34 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] system standby & power IRPs

OK,
Doron, I don’t seem to have any problem with not calling
PoStartNextPowerIrp, so I’ve added a little more debugging output and
this
is what I’m seeing now.

HALACPI: The BIOS wants the OS to preserve 22000 bytes
Kbdsim: KbdsimPower Entered.
Kbdsim: Querying SystemPowerState state PowerSystemSleeping1
Kbdsim: Calling PoCallDriver with completion routine =
kbdsimFDOPowerComplete
Kbdsim: Entered kbdsimFDOPowerComplete for IRP_MN_QUERY_POWER
Kbdsim: Calling PoRequestPowerIrp for
IRP_MN_QUERY_POWER
powerState.DeviceState=PowerDeviceD2
powerState.SystemState=PowerSystemSleeping2
Completion Routine=kbdsimFDOPowerTransitionPoRequestComplete
Kbdsim: Entered kbdsimFDOPowerTransitionPoRequestComplete for
IRP_MN_QUERY_POWER
Kbdsim: IoStatus->Status = 0xc00002d3
Kbdsim: calling PoStartNextPowerIrp(SystemStateIrp)
Kbdsim: calling IoCompleteRequest(SystemStateIrp)
Kbdsim: kbdsimFDOPowerComplete returning STATUS_UNKNOWN_STATUS
Kbdsim: KbdsimPower Entered.
Kbdsim: Setting SystemPowerState state to PowerSystemWorking
Kbdsim: Calling PoCallDriver with completion routine =
kbdsimFDOPowerComplete
Kbdsim: Entered kbdsimFDOPowerComplete for IRP_MN_SET_POWER,
powerType=SystemPowerState
Kbdsim: Power Unchanged
Kbdsim: Calling PoRequestPowerIrp for
IRP_MN_SET_POWER
powerState.DeviceState=PowerDeviceD0
powerState.SystemState=PowerSystemWorking
Completion Routine=kbdsimFDOPowerTransitionPoRequestComplete
Kbdsim: KbdsimPower Entered.
Kbdsim: Setting DevicePowerState state to PowerDeviceD0
Kbdsim: Entered kbdsimFDOPowerTransitionPoRequestComplete for
IRP_MN_SET_POWER
Kbdsim: IoStatus->Status = 0x0
Kbdsim: calling PoStartNextPowerIrp(SystemStateIrp)
Kbdsim: calling IoCompleteRequest(SystemStateIrp)
Kbdsim: kbdsimFDOPowerComplete returning STATUS_MORE_PROCESSING_REQUIRED
Kbdsim: kbdsimFDOPowerComplete returning STATUS_UNKNOWN_STATUS
Abort: \Driver\Kbdclass \Device\KeyboardClass2 irp (8312ce90)
QueryPower-Sleeping1 status c00002d3
PopPolicyWorkerAction: action request 2 failed c00002d3

If I dump out my device capibilities this is what I see:

Received Device Capabilities Device Capabilities 825F49A8
Kbdsim: Size = 40
Kbdsim: Version = 1
Kbdsim: DeviceD1 TRUE
Kbdsim: DeviceD2 TRUE
Kbdsim: LockSupported FALSE
Kbdsim: EjectSupported FALSE
Kbdsim: Removable TRUE
Kbdsim: DockDevice FALSE
Kbdsim: UniqueID FALSE
Kbdsim: SilentInstall FALSE
Kbdsim: RawDeviceOK FALSE
Kbdsim: SurpriseRemovalOK FALSE
Kbdsim: WakeFromD0 TRUE
Kbdsim: WakeFromD1 TRUE
Kbdsim: WakeFromD2 TRUE
Kbdsim: WakeFromD3 FALSE
Kbdsim: HardwareDisabled FALSE
Kbdsim: NonDynamic FALSE
Kbdsim: WarmEjectSupported FALSE
Kbdsim: NoDisplayInUI FALSE
Kbdsim: Address 2
Kbdsim: UINumber 0
Kbdsim: PowerSystemUnspecified = PowerDeviceUnspecified
Kbdsim: PowerSystemWorking = PowerDeviceD0
Kbdsim: PowerSystemSleeping1 = PowerDeviceD2
Kbdsim: PowerSystemSleeping2 = PowerDeviceD3
Kbdsim: PowerSystemSleeping3 = PowerDeviceD3
Kbdsim: PowerSystemHibernate = PowerDeviceD3
Kbdsim: PowerSystemShutdown = PowerDeviceD3
Kbdsim: SystemWake = PowerSystemSleeping1
Kbdsim: DeviceWake = PowerDeviceD2
Kbdsim: D1Latency 0
Kbdsim: D2Latency 0
Kbdsim: D3Latency 0

I hope this makes some send to someone becuase this is the first time
I’ve
ever had to delve into to world of power management =(

Thanks in advance.
-Jeff


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

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


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

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


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

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com