usbdSetInterface
Purpose
Used to select an alternative setting of an interface.
Syntax
#include <usbdi.h>
USBstatus usbdSetInterface(handle, alternate)
USBhandle handle;
uint8_t alternate;Parameter
| Item | Description |
|---|---|
| handle | Handle of open USB logical device that is returned by the USBD_OPEN_DEVICE fp_ioctl. |
| alternate | The alternative setting number of an interface. |
Description
The USB client driver uses this function to change an interface to an alternative setting. The client driver must close all pipes to endpoints associated with the handle, except the control pipe, before this call. The USBD verifies that the interface has alternative settings and that the alternative settings have the same bInterfaceClass, bInterfaceSubClass,, and bInterfaceProtocol as the default interface alternative setting 0. Otherwise, it returns an error. The USBD rejects the change for other unknown reasons if it causes problems with device configuration or management. If the current setting is the same as the requested setting, USBD returns USBD_SUCCESS immediately. Then it will verifies if the pipes are closed and return an error if not. It sends the USB_SET_IF request to the interface. If the request returns an error, the USBD tries again for a limited number of times, then it is returned to the client driver. If successful, it frees the existing pipe control blocks, reset the interface descriptor pointer, pIFDesc, and endpoint descriptor pointer, pEPDesc, in the DESCIDX structure, and build new pipe control blocks. The USBD returns USBD_SUCCESS to the client driver. The client driver must then call usbdGetDescriptors function to get the updated descriptor information.
Execution Environment
This function might be called from kernel process environment only.
Return Values
| Value | Description |
|---|---|
| USBD_SUCCESS | Success |
| All others | Failure |