viUsbControlIn

NI-VISA

viUsbControlIn

Purpose

Performs a USB control pipe transfer from the device.

Note  This operation is intended only for users familiar with the USB protocol.

C Syntax

ViStatus viUsbControlIn (ViSession vi, ViInt16 bmRequestType, ViInt16 bRequest, ViUInt16 wValue, ViUInt16 wIndex, ViUInt16 wLength, ViPBuf buf, ViPUInt16 retCnt);

Visual Basic Syntax

viUsbControlIn& (ByVal vi&, ByVal bmRequestType%, ByVal bRequest%, ByVal wValue%, ByVal wIndex%, ByVal wLength%, buf As Byte, retCnt%)

Resource Classes

USB INSTR, USB RAW

Parameters

Name Direction Description

vi

IN

Unique logical identifier to a session.

bmRequestType

IN

The bmRequestType parameter of the setup stage of a USB control transfer. Refer to the USB specification for further details.

bRequest

IN

The bRequest parameter of the setup stage of a USB control transfer.

wValue

IN

The wValue parameter of the setup stage of a USB control transfer.

wIndex

IN

The wIndex parameter of the setup stage of a USB control transfer. This is usually the index of the interface or endpoint.

wLength

IN

The wLength parameter of the setup stage of a USB control transfer. This value also specifies the size of the data buffer to receive the data from the optional data stage of the control transfer.

buf

OUT

The data buffer that receives the data from the optional data stage of the control transfer. This is ignored if wLength is 0.

retCnt

OUT

Number of bytes actually transferred in the optional data stage of the control transfer. This parameter may be VI_NULL if you do not need this information.

Return Values

Error Codes Description

VI_ERROR_INV_OBJECT

The given session reference is invalid.

VI_ERROR_RSRC_LOCKED

Specified operation could not be performed because the resource identified by vi has been locked for this kind of access.

VI_ERROR_TMO

Timeout expired before operation completed.

VI_ERROR_INV_SETUP

Unable to start write operation because setup is invalid (due to attributes being set to an inconsistent state).

VI_ERROR_IO

An unknown I/O error occurred during transfer.

VI_ERROR_CONN_LOST

The I/O connection for the given session has been lost.

VI_ERROR_INV_PARAMETER

The value of some parameter—which parameter is not known—is invalid.

VI_ERROR_INV_MASK

The bmRequestType parameter contains an invalid mask.

Description

The viUsbControlIn() operation synchronously performs a USB control pipe transfer from the device. The values of the data payload in the setup stage of the control transfer are taken as parameters and include bmRequestType, bRequest, wValue, wIndex, and wLength. An optional data buffer buf receives data if a data stage is required for this transfer. Only one USB control pipe transfer operation can occur at any one time.

Related Topics

INSTR Resource

RAW Resource

VI_ATTR_USB_CTRL_PIPE

viUsbControlOut