Click or drag to resize

UsbDeviceControlRead Method

Initiates a USB control transfer that reads data from the USB device.

Namespace:  WinUsbNet
Assembly:  WinUsbNet (in WinUsbNet.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public byte[] ControlRead(
	byte bmRequestType,
	byte bRequest,
	ushort wValue,
	ushort wIndex,
	ushort wLength
)

Parameters

bmRequestType
Type: SystemByte
The USB bmRequestTypefield.
bRequest
Type: SystemByte
The USB bRequestfield.
wValue
Type: SystemUInt16
The USB wValuefield.
wIndex
Type: SystemUInt16
The USB wIndexfield.
wLength
Type: SystemUInt16
The USB wLengthfield.

Return Value

Type: Byte

A byte array containing the bytes read from the USB device.

Exceptions
ExceptionCondition
IOExceptionThe UsbDevice is not open.
Win32ExceptionAn error was reported by the operating system.
Remarks

The arguments of this method correspond precisely with the like-named fields of a USB Setup packet. See the USB specification for the meaning and use of these parameters.

The wLength parameter is the maximum number of bytes to read from the USB device, and the USB device may send less. The length of the returned byte array is the actual number of bytes received.

See Also