Click or drag to resize

USBDeviceControlTransfer Method (Byte, Byte, Int32, Int32, Byte)

Initiates a control transfer over the default control endpoint. This method allows both IN and OUT direction transfers, depending on the highest bit of the requestType parameter). Alternatively, ControlIn(Byte, Byte, Int32, Int32, Byte) and ControlOut(Byte, Byte, Int32, Int32, Byte) can be used for control transfers in a specific direction, which is the recommended way because it prevents using the wrong direction accidentally. Use the ControlTransfer method when the direction is not known at compile time.

Namespace:  MadWizard.WinUSBNet
Assembly:  WinUSBNet (in WinUSBNet.dll) Version: 2.0.0.0 (2.0.0.0)
Syntax
public int ControlTransfer(
	byte requestType,
	byte request,
	int value,
	int index,
	byte[] buffer
)

Parameters

requestType
Type: SystemByte
The setup packet request type.
request
Type: SystemByte
The setup packet device request.
value
Type: SystemInt32
The value member in the setup packet. Its meaning depends on the request. Value should be between zero and 65535 (0xFFFF).
index
Type: SystemInt32
The index member in the setup packet. Its meaning depends on the request. Index should be between zero and 65535 (0xFFFF).
buffer
Type: SystemByte
The data to transfer in the data stage of the control. When the transfer is in the IN direction the data received will be written to this buffer. For an OUT direction transfer the contents of the buffer are written sent through the pipe. The length of this buffer is used as the number of bytes in the control transfer. The setup packet's length member will be set to this length as well.

Return Value

Type: Int32
The number of bytes received from the device.
See Also