Selective suspent for a composite device

Hello,

  1. I’m implementing a selective suspend support in my kmdf driver. From OSRUSBFX2 sample, I could see that selective suspend idle policy is set only if remote wakeup is supported by the device. According to usb spec, the device should support suspend regardless the remote wakeup support (both global and selective).
    In the other hand, when I tried to call for WdfDeviceAssignS0IdleSettings() for device that doesn’t haver remote wakeup support, the call has failed with STATUS_POWER_STATE_INVALID error. There is the code I used:

static NTSTATUS MyDevSetPowerPolicy(IN WDFDEVICE Device)
{
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);
idle_settings.IdleTimeout = 10000; /* 10 secs */
status = WdfDeviceAssignS0IdleSettings(Device, &idleSettings);
if (!NT_SUCCESS(status))
{
Error(“WdfDeviceAssignS0IdleSettings failed %x\n”, status);
return status;
}

WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS_INIT(&wakeSettings);
status = WdfDeviceAssignSxWakeSettings(Device, &wakeSettings);
if (!NT_SUCCESS(status))
{
Error(“WdfDeviceAssignSxWakeSettings failed %x\n”, status);
return status;
}

return STATUS_SUCCESS;
}

I can see the WdfDeviceAssignS0IdleSettings() call fails, while I would expect to it to pass. I can also see that the device can be suspended when Global suspend is issued (from debugger, I can see related EvtDeviceD0Entry/Exit cb calls). From device properties -> Power Management I could see the ‘Allow the computer to turn off this device to save power’ option enabled. So I would expect that I could suspend the device selectively. What do I miss?

  1. I also tested the driver with 2 other devices, one composite and one non-composite. Both devices support remote wakeup (I could see it from device descriptors). On composit device, I used the same (my) function driver for both interfaces.
    For non-composite device I could see that upon call for MyDevSetPowerPolicy() the non-composit device gets a SetFeature(device, RemoteWakeup) packet, while the composit device doesn’t get one. For both device, the ‘Allow the computer to turn off this device to save power’ and ‘Allow this device to bring the computer out of standby’ options are selected in Power Management tab of device properties.
    Does that mean that remove wakeup is not supported for composit device (by usbccgp.sys)? Is here any way to suspend the device selectively without involving remote wakeup ability using kmdf api?

Thank you in advance,
S.

Hello,

Could any body respond?

Thanks,
S.