LibUsbDotNet 2.2.8
SetInterfaceAltSetting Method (deviceHandle, interfaceNumber, alternateSetting)
Library Reference ► MonoLibUsb ► MonoUsbApi ► SetInterfaceAltSetting(MonoUsbDeviceHandle, Int32, Int32)
|
![]() |
Activate an alternate setting for an interface.

C# | Visual Basic | Visual C++ |
public static int SetInterfaceAltSetting( MonoUsbDeviceHandle deviceHandle, int interfaceNumber, int alternateSetting )
Public Shared Function SetInterfaceAltSetting ( _ deviceHandle As MonoUsbDeviceHandle, _ interfaceNumber As Integer, _ alternateSetting As Integer _ ) As Integer
public: static int SetInterfaceAltSetting( [InAttribute] MonoUsbDeviceHandle^ deviceHandle, int interfaceNumber, int alternateSetting )

- deviceHandle (MonoUsbDeviceHandle)
- A device handle.
- interfaceNumber (Int32)
- The bInterfaceNumber of the previously-claimed interface.
- alternateSetting (Int32)
- The bAlternateSetting of the alternate setting to activate.

- 0 on success
- ErrorNotFound if the interface was not claimed, or the requested alternate setting does not exist
- ErrorNoDevice if the device has been disconnected
- another MonoUsbError code on other failure

The interface must have been previously claimed with ClaimInterface(MonoUsbDeviceHandle, Int32).
You should always use this function rather than formulating your own SET_INTERFACE control request. This is because the underlying operating system needs to know when such changes happen.
This is a blocking function.
