WinUsb Device suspend and resume

What is the way to suspend the device having winusb as a functional driver?

I am using WinUsb_SetPowerPolicy () to set the powerpolicy and to suspend the device, but I am not getting any success.

Below is code:

ULONG Delay = 10000;

    if (WinUsb_SetPowerPolicy(WinusbHandle, SUSPEND_DELAY, sizeof(Delay), &Delay))
    {
        OutputDebugString(TEXT(Device put in suspend mode"));
    }

WinUsb_SetPowerPolicy is returing success and I am getting the print. But when I check the device after 10secs, it is not in suspended state, the device still shows in D0 state.

I am trying to do this from a windows service.

What am I missing here?

Since the default value is 5 seconds, that call is not doing anything.

Have you double-checked that you have made all of the necessary registry entries to allow WinUSB to support power management?

https://learn.microsoft.com/en-us/windows-hardware/drivers/usbcon/winusb-power-management

But if second parameter is SUSPEND DELAY we can mention the delay time right, after which the device will be suspended.

Also below section is present in the winusb inf file

[WINUSB_Disable_PowerPolicy]
HKR,“WinUsbPowerPolicyOwnershipDisabled”,0x00010001,1

Is this causing any issues

You can find it in your registry block and delete it to see if it helps.

Can you tell me the path in registry where I can delete it…I am not able to find it

It should be in your device’s hardware key. HKLM\System\CurrentControlSet\Enum\USB\VID_xxxx&PID_xxxx.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.