Perform a USB control transfer.

C# | Visual Basic | Visual C++ |
public static int ControlTransfer( MonoUsbDeviceHandle deviceHandle, byte requestType, byte request, short value, short index, Object data, short dataLength, int timeout )
Public Shared Function ControlTransfer ( _ deviceHandle As MonoUsbDeviceHandle, _ requestType As Byte, _ request As Byte, _ value As Short, _ index As Short, _ data As Object, _ dataLength As Short, _ timeout As Integer _ ) As Integer
public: static int ControlTransfer( [InAttribute] MonoUsbDeviceHandle^ deviceHandle, unsigned char requestType, unsigned char request, short value, short index, Object^ data, short dataLength, int timeout )

- deviceHandle (MonoUsbDeviceHandle)
- A handle for the device to communicate with.
- requestType (Byte)
- The request type field for the setup packet.
- request (Byte)
- The request field for the setup packet.
- value (Int16)
- The value field for the setup packet
- index (Int16)
- The index field for the setup packet.
- data (Object)
A suitably-sized data buffer for either input or output (depending on direction bits within bmRequestType).
This value can be:- An Array of bytes or other blittable types.
- An already allocated, pinned GCHandle. In this case AddrOfPinnedObject()()()() is used for the buffer address.
- An IntPtr.
- dataLength (Int16)
- The length field for the setup packet. The data buffer should be at least this size.
- timeout (Int32)
- timeout (in milliseconds) that this function should wait before giving up due to no response being received. For an unlimited timeout, use value 0.

- on success, the number of bytes actually transferred
- ErrorTimeout if the transfer timed out
- ErrorPipe if the control request was not supported by the device.
- ErrorNoDevice if the device has been disconnected
- another MonoUsbError code on other failures

The direction of the transfer is inferred from the bmRequestType field of the setup packet.
The wValue, wIndex and wLength fields values should be given in host-endian byte order.
