Expand Minimize

WinUsb_GetPowerPolicy function

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

Syntax


BOOL __stdcall WinUsb_GetPowerPolicy(
  _In_     WINUSB_INTERFACE_HANDLE InterfaceHandle,
  _In_     ULONG PolicyType,
  _Inout_  PULONG ValueLength,
  _Out_    PVOID Value
);

Parameters

InterfaceHandle [in]

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

PolicyType [in]

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 typeDescription

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.

 

ValueLength [in, out]

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.

Value [out]

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 codeDescription
ERROR_INVALID_HANDLE

The caller passed NULL in the InterfaceHandle parameter.

 

Requirements

Header

Winusb.h (include Winusb.h)

Library

Winusb.lib

See also

WinUSB
WinUSB Power Management
WinUsb_Initialize
WinUSB Functions

 

 

Send comments about this topic to Microsoft

Build date: 12/5/2013

Show:
© 2014 Microsoft. All rights reserved.