Expand Minimize

WinUsb_SetCurrentAlternateSetting function

The WinUsb_SetCurrentAlternateSetting function sets the alternate setting of an interface.

Syntax


BOOL __stdcall WinUsb_SetCurrentAlternateSetting(
  _In_  WINUSB_INTERFACE_HANDLE InterfaceHandle,
  _In_  UCHAR AlternateSetting
);

Parameters

InterfaceHandle [in]

An opaque handle to an interface, which defines the alternate setting to set.

To set an alternate setting in the first interface on the device, use the interface handle returned by WinUsb_Initialize. For all other interfaces, use the handle to the target interface, retrieved by WinUsb_GetAssociatedInterface.

AlternateSetting [in]

The value that is contained in the bAlternateSetting member of the USB_INTERFACE_DESCRIPTOR structure. This structure is populated by the WinUsb_QueryInterfaceSettings routine.

Return value

WinUsb_SetCurrentAlternateSetting returns TRUE if the operation succeeds. Otherwise, this function 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.

 

Remarks

WinUsb_SetCurrentAlternateSetting fails if outstanding I/O requests are present on the interface.

Requirements

Header

Winusb.h (include Winusb.h)

Library

Winusb.lib

See also

WinUSB
WinUsb_Initialize
WinUsb_QueryInterfaceSettings
USB_INTERFACE_DESCRIPTOR
WinUSB Functions

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft