Selective suspend for UMDF driver

Hi all, I’m writing a WBF driver by using UMDF. Now I need support selective suspend.
Firstly I use non_ppo mode, but I get nothing , device can go to low-power mode even system sleep. Then I used PPO mode for my device. The device can go to D3 automatically. But when I need wake up the device , I will get a new DeviceAdd, it looks like the driver had been unload/load. I used the following code to enable ss.
hr = m_FxDevice->AssignS0IdleSettings(IdleUsbSelectiveSuspend,
PowerDeviceMaximum,
WBDI_SUSPEND_DELAY,
IdleAllowUserControl,
WdfTrue);

if (FAILED(hr))
{
TraceEvents(TRACE_LEVEL_ERROR,
BIOMETRIC_TRACE_DEVICE,
“%!FUNC! Unable to set power policy (SUSPEND_DELAY) for the device %!HRESULT!”,
hr
);
if (hr == HRESULT_FROM_NT(STATUS_POWER_STATE_INVALID)) {
//
// The device probably does not support wake.
// It might support idle without wake.
//
hr = m_FxDevice->AssignS0IdleSettings(IdleCannotWakeFromS0,
PowerDeviceMaximum,
WBDI_SUSPEND_DELAY,
IdleAllowUserControl,
WdfTrue);
if (!SUCCEEDED(hr))
{
int ttt;
}
}
}
The first AssignS0IdleSettings always get fail, I can only set IdleCannotWakeFromS0 for my device, is that OK?
So am I missing something in my driver or my device need change some capabilities?
Thanks

Sorry, for non-ppo mode, device can not go to low-power mode.

I assume this is over winusb. Is idle without OK? Do you expect the users to be able to interact with the device to wait it up? If yes, idle without waking is not OK as the device will appear non functional in this case. If only woken from software, it is fine

Get Outlook for Androidhttps:

On Tue, Jul 19, 2016 at 12:13 AM -0700, “xxxxx@gmail.com” > wrote:

Hi all, I’m writing a WBF driver by using UMDF. Now I need support selective suspend.
Firstly I use non_ppo mode, but I get nothing , device can go to low-power mode even system sleep. Then I used PPO mode for my device. The device can go to D3 automatically. But when I need wake up the device , I will get a new DeviceAdd, it looks like the driver had been unload/load. I used the following code to enable ss.
hr = m_FxDevice->AssignS0IdleSettings(IdleUsbSelectiveSuspend,
PowerDeviceMaximum,
WBDI_SUSPEND_DELAY,
IdleAllowUserControl,
WdfTrue);

if (FAILED(hr))
{
TraceEvents(TRACE_LEVEL_ERROR,
BIOMETRIC_TRACE_DEVICE,
“%!FUNC! Unable to set power policy (SUSPEND_DELAY) for the device %!HRESULT!”,
hr
);
if (hr == HRESULT_FROM_NT(STATUS_POWER_STATE_INVALID)) {
//
// The device probably does not support wake.
// It might support idle without wake.
//
hr = m_FxDevice->AssignS0IdleSettings(IdleCannotWakeFromS0,
PowerDeviceMaximum,
WBDI_SUSPEND_DELAY,
IdleAllowUserControl,
WdfTrue);
if (!SUCCEEDED(hr))
{
int ttt;
}
}
}
The first AssignS0IdleSettings always get fail, I can only set IdleCannotWakeFromS0 for my device, is that OK?
So am I missing something in my driver or my device need change some capabilities?
Thanks


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:></https:>