LibUsbDotNet/LibUsbDotNet/LibUsb/UsbDevice.Interfaces.cs
/// <summary>
/// Gets the selected alternate interface of the specified interface.
/// </summary>
/// <param name="interfaceID">The interface settings number (index) to retrieve the selected alternate interface setting for.</param>
/// <param name="selectedAltInterfaceID">The alternate interface setting selected for use with the specified interface.</param>
Gets the selected alternate interface of the specified interface.
Gets the selected alternate interface of the specified interface .
public void GetAltInterfaceSetting(byte interfaceID, out byte selectedAltInterfaceID)
        {
            byte[] buf = new byte[1];
            int uTransferLength;
            UsbSetupPacket setupPkt = new UsbSetupPacket();
            setupPkt.RequestType = (byte)EndpointDirection.In | (byte)UsbRequestType.TypeStandard |
                                   (byte)UsbRequestRecipient.RecipInterface;
            setupPkt.Request = (byte)StandardRequest.GetInterface;
            setupPkt.Value = 0;
            setupPkt.Index = interfaceID;
            setupPkt.Length = 1;
            uTransferLength = this.ControlTransfer(setupPkt, buf, 0, buf.Length);
            if (uTransferLength == 1)
            {
                selectedAltInterfaceID = buf[0];
            }
            else
            {
                selectedAltInterfaceID = 0;
            }
        }
public void GetAltInterfaceSetting ( byte interfaceID , out byte selectedAltInterfaceID ) { byte [ ] buf = new byte [ 1 ] ; int uTransferLength ; UsbSetupPacket setupPkt = new UsbSetupPacket ( ) ; setupPkt . RequestType = ( byte ) EndpointDirection . In | ( byte ) UsbRequestType . TypeStandard | ( byte ) UsbRequestRecipient . RecipInterface ; setupPkt . Request = ( byte ) StandardRequest . GetInterface ; setupPkt . Value = 0 ; setupPkt . Index = interfaceID ; setupPkt . Length = 1 ; uTransferLength = this . ControlTransfer ( setupPkt , buf , 0 , buf . Length ) ; if ( uTransferLength == 1 ) { selectedAltInterfaceID = buf [ 0 ] ; } else { selectedAltInterfaceID = 0 ; } }
Gets the selected alternate interface of the specified interface.
Gets the selected alternate interface of the specified interface .
interfaceID
byte
The interface settings number (index) to retrieve the selected alternate interface setting for.
The interface settings number ( index ) to retrieve the selected alternate interface setting for .
byte
out
selectedAltInterfaceID
The alternate interface setting selected for use with the specified interface.
The alternate interface setting selected for use with the specified interface .