viUsbControlOut

Agilent VISA.NET

viUsbControlOut

Syntax

viUsbControlOut(ViSession vi, ViInt16 bmRequestType, ViInt16 bRequest, ViUInt16 wValue, ViUInt16 wIndex, ViUInt16 wLength, ViBuf buf)

Description

This function can be used to send arbitrary data to a USB device on the default control port. The user must be aware of how to use each parameter based on the relevant USB base or class specification, or based on a vendor-specific request definition.

Since the USBTMC specification does not currently define any standard control port requests in the direction of host-to-device, this function is intended for use with only vendor-defined requests. However, this function implementation should not check the bmRequestType parameter for this aspect.

Parameters

Name

Dir

Type

Description

vi

IN

ViSession

Unique logical identifier to a session.

bmRequestType

IN

ViInt16

 Bitmap field for defining the USB control port request.  The bitmap fields are as defined by the USB specification.  The direction bit must be host-to-device.

bRequest

IN

ViInt16

Request ID for this transfer.  The meaning of this value depends on bmRequestType.

wValue

IN

ViUInt16

Request value for this transfer.

wIndex

IN

ViUInt16

Specifies the interface or endpoint index number, depending on bmRequestType.

wLength

IN

ViUInt16

Length of the data in bytes to send to the device during the Data stage.  If this value is 0, then buf is ignored.

buf

IN

ViBuf

Actual data to send to the device during the Data stage.  If wLength is 0, then this parameter is ignored.

Return Values

Type ViStatus

This is the function return status. It returns either a completion code or an error code as follows.

Completion Code

Description

VI_SUCCESS

Operation completed successfully.

Error Codes

Description

VI_ERROR_INV_MASK

The value in bmRequestType does not have the direction bit set to the correct value.

VI_ERROR_IO

Could not perform operation because of I/O error.

VI_ERROR_INV_PARAMETER

The upper 8 bits of bmRequestType or bRequest are not zero.

VI_ERROR_INV_SESSION
VI_ERROR_INV_OBJECT

The given session or object reference is invalid (both are the same value).

VI_ERROR_NSUP_OPER

The given vi does not support this operation.

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_CONN_LOST

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

See Also

USB INSTR resource description