- Remote wake up and selective suspend problem
- Posted by k.nancy.raj@gmail.com on May 3rd, 2007
Hi experts,
I am developing a KMDF Bulk USB driver.
My device supports Remote wake up and selective suspend features. I
studied news groups posts and searched in three to four KMDF samples
for implementation of these features.
I implemented the same in my drivers PrepareHardware call back routine
as follows:
After finishing ReadandSelectDescriptors() routine;
WaitWakeEnable = info.Traits &
WDF_USB_DEVICE_TRAIT_REMOTE_WAKE_CAPABLE;
Usbt_DbgPrint(3, ("IsDeviceRemoteWakeable: %s\n",
(WaitWakeEnable) ? "TRUE" : "FALSE"));
//
// Enable wait-wake and idle timeout if the device supports it
//
if(WaitWakeEnable)
{
status = UsbtSetPowerPolicy(Device);
if (!NT_SUCCESS (status)) {
Usbt_DbgPrint(3,("UsbtSetPowerPolicy 0x%x\n", status));
return status;
}
}
//UsbtSetPowerPolicy defination as follows
NTSTATUS
UsbSetPowerPolicy(
IN WDFDEVICE Device
)
{
WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS idleSettings;
WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS wakeSettings;
NTSTATUS status = STATUS_SUCCESS;
PAGED_CODE();
//
// Init the idle policy structure.
//
WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS_INIT(&idleSe ttings,
IdleUsbSelectiveSuspend);
idleSettings.IdleTimeout = 10000; // 10-sec
status = WdfDeviceAssignS0IdleSettings(Device, &idleSettings);
if ( !NT_SUCCESS(status)) {
Usb_DbgPrint(3,("WdfDeviceAssignS0IdleSettings failed %x\n",
status));
return status;
}
//
// Init wait-wake policy structure.
//
WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS_INIT(&wakeSe ttings);
status = WdfDeviceAssignSxWakeSettings(Device, &wakeSettings);
if (!NT_SUCCESS(status)) {
Usb_DbgPrint(3,("WdfDeviceAssignSxWakeSettings failed %x\n",
status));
return status;
}
return status;
}
My driver fails at WdfDeviceAssignS0IdleSettings() routine with
STATUS_POWER_STATE_INVALID (0xc00002d3) error status.
if I set the Device power state to
idleSettings.DxState = WdfPowerDeviceMaximum;
then my driver fails with STATUS_INVALID_PARAMETE(0xc000000d) error
status .
Can anybody help me in this regard? I want to implement remote wake up
and Seklective suspend features in my drivers.
Your valuable suggestions are always appreciable. Thanks in advance. I
hope somebody will guide me in the right directions to get these
features working in my driver.
~Nancy
- Posted by Kumar Rajeev [MSFT] on May 3rd, 2007
For DxState (in WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS in case of USB
Selective suspend), framework uses the value that the driver for the
device's bus supplied in the DeviceWake member of its
WDF_DEVICE_POWER_CAPABILITIES structure. In this case most likely bus driver
is reporting PowerDeviceUnspecified for DeviceWake and therefore the error
status STATUS_POWER_STATE_INVALID.
One way to look at what bus driver reported in its
WDF_DEVICE_POWER_CAPABILITIES for the device is through Device
Manager->Details tab. (You will have to first load the driver successfully
by commenting out code calling WdfDeviceAssignS0IdleSettings.)
-kumar
<k.nancy.raj@gmail.com> wrote in message
news:1178204253.933383.220310@y80g2000hsf.googlegr oups.com...
- Posted by k.nancy.raj@gmail.com on May 4th, 2007
On May 4, 1:27 am, "Kumar Rajeev [MSFT]" <k...@microsoft.com> wrote:
Hi Kumar,
Thanks for your immediate reply.
1) Is that code enough to get working of Remote wake up and Selective
Suspend features.
Do I need to implement anything else?
I commented my Powerpolicy code and loaded the driver. I saw the
following power caps for the device:
PDCAP_D0_SUPPORTED
PDCAP_D3_SUPPORTED
PDCAP_WAKE_FROM_D0_SUPPORTED
PDCAP_WAKE_FROM_D3_SUPPORTED
2) Can anybody help me to resolve this issue.
Thanks in advance.
~Nancy
- Posted by Kumar Rajeev [MSFT] on May 4th, 2007
What you are doing is correct. What OS is this on?
-kumar
<k.nancy.raj@gmail.com> wrote in message
news:1178255028.090724.205880@l77g2000hsb.googlegr oups.com...
- Posted by k.nancy.raj@gmail.com on May 7th, 2007
On May 5, 12:20 am, "Kumar Rajeev [MSFT]" <k...@microsoft.com> wrote:
Hi Kumar,
I am working on windowsXP. I need this driver should work for both
windowsXP and Windows Vista.
I have WDM driver for the same device in Windows XP and all the
features are working fine with that driver.
Thanks in advance.
~Nancy
- Posted by Kumar Rajeev [MSFT] on May 8th, 2007
Which service pack. Is it XP SP2?
-kumar
<k.nancy.raj@gmail.com> wrote in message
news:1178515646.333798.104130@e65g2000hsc.googlegr oups.com...
- Posted by k.nancy.raj@gmail.com on May 8th, 2007
Hi Kumar,
I tried on both Windows XP SP2 and Windows Vista Ultimate. But still i
have the same problem.
Is there any alternate solution to verify selective suspend and remote
wakeup features?
Thanks
Nancy
- Posted by Kumar Rajeev [MSFT] on May 8th, 2007
Can you try specifying idleSettings.DxState = PowerDeviceD2 and see if it
works.
WdfDeviceAssignS0IdleSettings can return STATUS_POWER_STATE_INVALID if the
DxState is PowerDeviceUnspecified or PowerDeviceD0. It can also return this
status if the driver specified a value greater than PowerDeviceD2 (barring
PowerDeviceMaximum). In your case the failure is likely coming from the
first check (PowerDeviceUnspecified/PowerDeviceD0) however the power data
you provided doesn't confirm this.
Also, the value of DEVICE_CAPABILITIES.DeviceWake set by USB bus driver for
its PDOs is "not" expected to be higher than PowerDeviceD2. In your case it
seems to be set to PowerDeviceD3 based on the flags
PDCAP_WAKE_FROM_D0_SUPPORTED & PDCAP_WAKE_FROM_D3_SUPPORTED which is
unexpected. Can you double-check the device capability data you reported
earlier (preferably from Vista because it provides more detailed power
data). Can you also post power data for hub and Host controller to which the
device is connected.
-kumar
This posting is provided "AS IS" with no warranties, and confers no rights.
<k.nancy.raj@gmail.com> wrote in message
news:1178625659.558795.292730@e51g2000hsg.googlegr oups.com...
- Posted by Doron Holan [MS] on May 9th, 2007
are you sure you are being enumerated by a usb bus driver? Can you please
do the following
!wdfkd.wdfdevice <the WDFDEVICE you create>
get your PDEVICE_OBJECT from the output, pass this to
!devstack <PDEVICE_OBJECT>
please send the output for both !wdfdevice and !devstack
thx
d
--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"Kumar Rajeev [MSFT]" <kumar@microsoft.com> wrote in message
news
A91AA21-FF4E-4E8E-9BE7-33E597D350B6@microsoft.com...
- Posted by vijayaraju.k@gmail.com on May 11th, 2007
On May 9, 12:42 am, "Kumar Rajeev [MSFT]" <k...@microsoft.com> wrote:
Hi Kumar,
I am sorry for the late reply. But I have a good news.
I resolved the problem. Thanks for your support.
Both Selective suspend and Remote wake up are working fine now.
But I have a different problem now.
My driver also does the firmware downloading into device. I am
downloading the Firmware and setting the power policy in
EvtPrepareHardware routine.
If My driver downloads and calls the setpowerpolicy routine then
WdfDeviceAssignS0IdleSettings fails with INVALID POWER STATE.
If My driver call setpowerpolicy routine without downloading the
firmware(assum that firmware downloaded already) then its working fine
I could do both selective suspend and remote wake up of the device. I
do not understand what mistake I am doing here OR whats wrong in
downloading the firmware and calling setpowerpolicy routine sequence?
2) the second problem is that its asking me to restart the computer,
To get the powerpolicy setting functionality.
Thank you for your valuable suggestions.
~Nancy
- Posted by Eliyas Yakub [MSFT] on May 12th, 2007
After you get the INVALID POWER STATE, dump the framework trace log
(wdflogdump) and see if it describes the reason for failing the call.
-Eliyas
<vijayaraju.k@gmail.com> wrote in message
news:1178861366.485160.258910@e65g2000hsc.googlegr oups.com...
- Posted by k.nancy.raj@gmail.com on June 6th, 2007
Hi Eliyas,
Finally i got chance to log in the framework trace log. Here are two
logs.
The first one i put a break point immediately after power policy where
it failed and the second one i returned status success and dumped the
log.
I could not find out any information from the log. Can you have look
at the log and let me know where im going wrong?
Please suggest
Thank You.
Regards,
Nancy
Log 1:
---------
Trace format prefix is: %7!u!: %!FUNC! -
TMF file used for formatting IFR log is: D:\WINDDK\6000\tools\tracing
\i386\wdf01005.tmf
Log at 8260b000
Gather log: Please wait, this may take a moment (reading 4032 bytes).
% read so far ... 10, 100
There are 17 log entries
--- start of log ---
1: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7D9F2E80 !devobj
0x82B1A090 entering PnP State WdfDevStatePnpInit from
WdfDevStatePnpObjectCreated
2: FxPkgPnp:
ispatch - WDFDEVICE 0x7D9F2E80 !devobj 0x82B1A090,
IRP_MJ_PNP, 0x00000000(IRP_MN_START_DEVICE) IRP 0x828362F0
3: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7D9F2E80 !devobj
0x82B1A090 entering PnP State WdfDevStatePnpInitStarting from
WdfDevStatePnpInit
4: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7D9F2E80 !devobj
0x82B1A090 entering PnP State WdfDevStatePnpHardwareAvailable from
WdfDevStatePnpInitStarting
5: FxIoTarget::SubmitLocked - ignoring WDFIOTARGET 7D9F99B8 state,
sending WDFREQUEST F89046E0, state 1
6: FxIoTarget::SubmitLocked - ignoring WDFIOTARGET 7D4E6CA0 state,
sending WDFREQUEST F8904648, state 1
7: FxIoTarget::SubmitLocked - ignoring WDFIOTARGET 7E17B6C8 state,
sending WDFREQUEST F8904648, state 1
8: FxIoTarget::SubmitLocked - ignoring WDFIOTARGET 7D82F900 state,
sending WDFREQUEST F8904648, state 1
9: FxIoTarget::SubmitLocked - ignoring WDFIOTARGET 7D55D9A8 state,
sending WDFREQUEST F8904648, state 1
10: FxIoTarget::SubmitLocked - ignoring WDFIOTARGET 7E19B108 state,
sending WDFREQUEST F8904648, state 1
11: FxIoTarget::SubmitLocked - ignoring WDFIOTARGET 7E19BAA0 state,
sending WDFREQUEST F8904670, state 1
12: FxIoTarget::SubmitLocked - ignoring WDFIOTARGET 7E1FCFE8 state,
sending WDFREQUEST F89046C0, state 1
13: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7E1FC890 !devobj
0x81E03220 entering PnP State WdfDevStatePnpInit from
WdfDevStatePnpObjectCreated
14: FxPkgPnp::PowerPolicyEnterNewState - WDFDEVICE 0x7D9F2E80 !devobj
0x82B1A090 entering power policy state WdfDevStatePwrPolStarting from
WdfDevStatePwrPolObjectCreated
15: FxPowerIdleMachine::ProcessEventLocked - WDFDEVICE 0x7D9F2E80 !
devobj 0x82B1A090 entering power idle state FxIdleStarted from
FxIdleStopped
16: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7D9F2E80 !devobj
0x82B1A090 entering Power State
WdfDevStatePowerStartingCheckDeviceType from
WdfDevStatePowerObjectCreated
17: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7D9F2E80 !devobj
0x82B1A090 entering Power State WdfDevStatePowerD0Starting from
WdfDevStatePowerStartingCheckDeviceType
---- end of log ----
Log 2:
---------
Trace format prefix is: %7!u!: %!FUNC! -
TMF file used for formatting IFR log is: D:\WINDDK\6000\tools\tracing
\i386\wdf01005.tmf
Log at 81e62000
Gather log: Please wait, this may take a moment (reading 4032 bytes).
% read so far ... 10, 20, 30, 100
There are 31 log entries
--- start of log ---
1: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DA97E50 !devobj
0x81EB3F00 entering PnP State WdfDevStatePnpInit from
WdfDevStatePnpObjectCreated
2: FxPkgPnp:
ispatch - WDFDEVICE 0x7DA97E50 !devobj 0x81EB3F00,
IRP_MJ_PNP, 0x00000000(IRP_MN_START_DEVICE) IRP 0x825DC840
3: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DA97E50 !devobj
0x81EB3F00 entering PnP State WdfDevStatePnpInitStarting from
WdfDevStatePnpInit
4: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DA97E50 !devobj
0x81EB3F00 entering PnP State WdfDevStatePnpHardwareAvailable from
WdfDevStatePnpInitStarting
5: FxIoTarget::SubmitLocked - ignoring WDFIOTARGET 7D7CAC28 state,
sending WDFREQUEST F88F46E0, state 1
6: FxIoTarget::SubmitLocked - ignoring WDFIOTARGET 7DA83108 state,
sending WDFREQUEST F88F4648, state 1
7: FxIoTarget::SubmitLocked - ignoring WDFIOTARGET 7D4A7B90 state,
sending WDFREQUEST F88F4648, state 1
8: FxIoTarget::SubmitLocked - ignoring WDFIOTARGET 7DA3C170 state,
sending WDFREQUEST F88F4648, state 1
9: FxIoTarget::SubmitLocked - ignoring WDFIOTARGET 7E18CD58 state,
sending WDFREQUEST F88F4648, state 1
10: FxIoTarget::SubmitLocked - ignoring WDFIOTARGET 7E105FE8 state,
sending WDFREQUEST F88F4648, state 1
11: FxIoTarget::SubmitLocked - ignoring WDFIOTARGET 7E105528 state,
sending WDFREQUEST F88F4670, state 1
12: FxIoTarget::SubmitLocked - ignoring WDFIOTARGET 7E105DF0 state,
sending WDFREQUEST F88F46C0, state 1
13: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7D5B0430 !devobj
0x82A4F6F0 entering PnP State WdfDevStatePnpInit from
WdfDevStatePnpObjectCreated
14: FxPkgPnp::PowerPolicyEnterNewState - WDFDEVICE 0x7DA97E50 !devobj
0x81EB3F00 entering power policy state WdfDevStatePwrPolStarting from
WdfDevStatePwrPolObjectCreated
15: FxPowerIdleMachine::ProcessEventLocked - WDFDEVICE 0x7DA97E50 !
devobj 0x81EB3F00 entering power idle state FxIdleStarted from
FxIdleStopped
16: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DA97E50 !devobj
0x81EB3F00 entering Power State
WdfDevStatePowerStartingCheckDeviceType from
WdfDevStatePowerObjectCreated
17: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DA97E50 !devobj
0x81EB3F00 entering Power State WdfDevStatePowerD0Starting from
WdfDevStatePowerStartingCheckDeviceType
18: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DA97E50 !devobj
0x81EB3F00 entering Power State
WdfDevStatePowerD0StartingConnectInterrupt from
WdfDevStatePowerD0Starting
19: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DA97E50 !devobj
0x81EB3F00 entering Power State WdfDevStatePowerD0StartingDmaEnable
from WdfDevStatePowerD0StartingConnectInterrupt
20: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DA97E50 !devobj
0x81EB3F00 entering Power State
WdfDevStatePowerD0StartingStartSelfManagedIo from
WdfDevStatePowerD0StartingDmaEnable
21: FxPowerIdleMachine::ProcessEventLocked - WDFDEVICE 0x7DA97E50 !
devobj 0x81EB3F00 entering power idle state FxIdleStartedPowerUp from
FxIdleStarted
22: FxPowerIdleMachine::ProcessEventLocked - WDFDEVICE 0x7DA97E50 !
devobj 0x81EB3F00 entering power idle state FxIdleDisabled from
FxIdleStartedPowerUp
23: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DA97E50 !devobj
0x81EB3F00 entering Power State WdfDevStatePowerDecideD0State from
WdfDevStatePowerD0StartingStartSelfManagedIo
24: FxPkgPnp::PowerEnterNewState - WDFDEVICE 0x7DA97E50 !devobj
0x81EB3F00 entering Power State WdfDevStatePowerD0 from
WdfDevStatePowerDecideD0State
25: FxPkgPnp::PowerPolicyEnterNewState - WDFDEVICE 0x7DA97E50 !devobj
0x81EB3F00 entering power policy state
WdfDevStatePwrPolStartingSucceeded from WdfDevStatePwrPolStarting
26: FxPkgPnp::PowerPolicyEnterNewState - WDFDEVICE 0x7DA97E50 !devobj
0x81EB3F00 entering power policy state
WdfDevStatePwrPolStartingDecideS0Wake from
WdfDevStatePwrPolStartingSucceeded
27: FxPkgPnp::PowerPolicyEnterNewState - WDFDEVICE 0x7DA97E50 !devobj
0x81EB3F00 entering power policy state WdfDevStatePwrPolStarted from
WdfDevStatePwrPolStartingDecideS0Wake
28: FxPowerIdleMachine::ProcessEventLocked - WDFDEVICE 0x7DA97E50 !
devobj 0x81EB3F00 entering power idle state FxIdleDisabled from
FxIdleDisabled
29: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DA97E50 !devobj
0x81EB3F00 entering PnP State WdfDevStatePnpEnableInterfaces from
WdfDevStatePnpHardwareAvailable
30: FxPkgPnp::PnpEnterNewState - WDFDEVICE 0x7DA97E50 !devobj
0x81EB3F00 entering PnP State WdfDevStatePnpStarted from
WdfDevStatePnpEnableInterfaces
31: FxChildList::ProcessBusRelations - PDO created successfully,
WDFDEVICE 7D5B0430 !devobj 82A4F6F0
---- end of log ----