WinUsb_GetPowerPolicy function (winusb.h)

The WinUsb_GetPowerPolicy function retrieves the power policy for a device. This is a synchronous operation.

Syntax

BOOL WinUsb_GetPowerPolicy(
  [in]      WINUSB_INTERFACE_HANDLE InterfaceHandle,
  [in]      ULONG                   PolicyType,
  [in, out] PULONG                  ValueLength,
  [out]     PVOID                   Value
);

Parameters

[in] InterfaceHandle

An opaque handle to the first interface on the device, which is returned by WinUsb_Initialize.

[in] PolicyType

A value that specifies the power policy parameter to retrieve in Value. The following table describes symbolic constants that are defined in Winusbio.h.

Policy type Description
AUTO_SUSPEND

(0x81)

If the caller specifies a power policy of AUTO_SUSPEND, WinUsb_GetPowerPolicy returns the value of the auto suspend policy parameter in the Value parameter.

If Value is TRUE (that is, nonzero), the USB stack suspends the device when no transfers are pending or the only transfers pending are IN transfers on an interrupt or bulk endpoint.

The value of the DefaultIdleState registry value determines the default value of the auto suspend policy parameter.

The Value parameter must point to a UCHAR variable.

SUSPEND_DELAY

(0x83)

If the caller specifies a power policy of SUSPEND_DELAY, WinUsb_GetPowerPolicy returns the value of the suspend delay policy parameter in Value.

The suspend delay policy parameter specifies the minimum amount of time, in milliseconds, that the WinUSB driver must wait after any transfer before it can suspend the device.

Value must point to a ULONG variable.

[in, out] ValueLength

A pointer to the size of the buffer that Value. On output, ValueLength receives the size of the data that was copied into the Value buffer.

[out] Value

A buffer that receives the specified power policy parameter. For more information, see PolicyType.

Return value

WinUsb_GetPowerPolicy returns TRUE if the operation succeeds. Otherwise, this routine returns FALSE, and the caller can retrieve the logged error by calling GetLastError.

GetLastError can return the following error code.

Return code Description
ERROR_INVALID_HANDLE
The caller passed NULL in the InterfaceHandle parameter.

Requirements

Requirement Value
Target Platform Universal
Header winusb.h (include Winusb.h)
Library Winusb.lib
DLL Winusb.dll

See also

WinUSB

WinUSB Functions

WinUSB Power Management

WinUsb_Initialize