Hi all,
I have a driver for device that supports remote wakeup, and in the driver I want to support selective suspend.
Here is the code how I implement that:
WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS IdleSettings;
WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS WakeSettings;
NTSTATUS status;
WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS_INIT(&IdleSettings,
IdleUsbSelectiveSuspend);
IdleSettings.IdleTimeout = 15000; /* 15 seconds */
status = WdfDeviceAssignS0IdleSettings(device, &IdleSettings);
if (!NT_SUCCESS(status))
{
DbgPrint(“WdfDeviceAssignS0IdleSettings failed %x\n”, status);
return status;
}
WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS_INIT(&WakeSettings);
status = WdfDeviceAssignSxWakeSettings(device, &WakeSettings);
if (!NT_SUCCESS(status))
{
DbgPrint(“WdfDeviceAssignSxWakeSettings failed %x\n”, status);
return status;
}
return status;
In that I assume that if no traffic will be sent to the device or received from the device in 15 seconds, framework will move the device to D2.
Now to the problem: my driver creates a WDFREQUEST, prepares it for writing (using WdfUsbTargetPipeFormatRequestForWrite) and sends it to the device using WdfRequestSend. From the hardware USB analyzer I can see that the request was sent (and the OUT token was ACKed). After request is sent, another one is generated, and sent again. This happens for 14 seconds, and then after one second the device is suspended (IdleTimeout expires?).
I would expect that framework would suspend the device after 15 seconds of silence, and not when the driver sends traffic.
Where am I wrong? I run the driver on Vista SP1.
Thanks,
S.
Idle timeout is controlled automatically by power managed queues, there are no power managed io targets. If you want to reset the idle timer manually call WdfDeviceStopIdle and when you want it to resume (assuming all the pwr managed queues are empty), call WdfDeviceResumeIdle
d
Sent from my phone with no t9, all spilling mistakes are not intentional.
-----Original Message-----
From: xxxxx@gmail.com
Sent: Thursday, August 27, 2009 7:47 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] IdleTimeout and IdleUsbSelectiveSuspend
Hi all,
I have a driver for device that supports remote wakeup, and in the driver I want to support selective suspend.
Here is the code how I implement that:
WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS IdleSettings;
WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS WakeSettings;
NTSTATUS status;
WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS_INIT(&IdleSettings,
IdleUsbSelectiveSuspend);
IdleSettings.IdleTimeout = 15000; /* 15 seconds */
status = WdfDeviceAssignS0IdleSettings(device, &IdleSettings);
if (!NT_SUCCESS(status))
{
DbgPrint(“WdfDeviceAssignS0IdleSettings failed %x\n”, status);
return status;
}
WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS_INIT(&WakeSettings);
status = WdfDeviceAssignSxWakeSettings(device, &WakeSettings);
if (!NT_SUCCESS(status))
{
DbgPrint(“WdfDeviceAssignSxWakeSettings failed %x\n”, status);
return status;
}
return status;
In that I assume that if no traffic will be sent to the device or received from the device in 15 seconds, framework will move the device to D2.
Now to the problem: my driver creates a WDFREQUEST, prepares it for writing (using WdfUsbTargetPipeFormatRequestForWrite) and sends it to the device using WdfRequestSend. From the hardware USB analyzer I can see that the request was sent (and the OUT token was ACKed). After request is sent, another one is generated, and sent again. This happens for 14 seconds, and then after one second the device is suspended (IdleTimeout expires?).
I would expect that framework would suspend the device after 15 seconds of silence, and not when the driver sends traffic.
Where am I wrong? I run the driver on Vista SP1.
Thanks,
S.
—
NTDEV is sponsored by OSR
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
xxxxx@gmail.com wrote:
I have a driver for device that supports remote wakeup, and in the driver I want to support selective suspend.
…
In that I assume that if no traffic will be sent to the device or received from the device in 15 seconds, framework will move the device to D2.
I believe your assumption is incorrect. “Idle” refers to whether your
driver has RECEIVED any requests from above, not whether your driver has
SENT any requests. If you think about it, your interpretation doesn’t
make sense. If you are initiating activity on your own, without any
user requests, than YOU are in the best position to know exactly when
you have gone idle, and can trigger the idle state manually. A timeout
isn’t particularly sensible.
What is your driver doing, if there are no incoming requests for you to
respond to?
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.