Jump to content

RxUsbOpen

From EDM2
Revision as of 19:15, 12 February 2017 by W.m.brul (talk | contribs) (Related Functions)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

Acquires access to a specific USB device.

Syntax

To acquire access to a specific USB device use:

 rc = RxUsbOpen(Handle,EnumDevice,idVendor,idProduct)

To acquire access to an even more specific USB device use:

 rc = RxUsbOpen(Handle,EnumDevice,idVendor,idProduct,bcdDevice) 

Parameters

Handle
receives Device Handle to be used to access this USB device.
EnumDevice
use 0 to accept any specified device or N for the Nth device.
idVendor
the Vendor Identifier (VendorID) from the device descriptor.
idProduct
the Product Identifier (ProductID) from the device descriptor.
bcdDevice
the Device Release Number from the device descriptor.

Return Code

0x0000 - NO_ERROR

Errors

0x0057 - ERROR_INVALID_PARAMETER
0x1B58 - USB_NOT_INIT
0xFF0C - ERROR_I24_GEN_FAILURE
0xFF13 - ERROR_I24_INVALID_PARAMETER

Remarks

Example Code

/* add RxUsbOpen */
rc = RxFuncAdd('RxUsbOpen','usbcalls','RxUsbOpen')
say '+RxUsbOpen(),RC=0x'd2x(rc)

/* invoke RxUsbOpen */
drop Handle /* receives device handle */
EnumDevice=0 /* accept any free device */
idVendor=x2d(046D) /* vendor identifier */
idProduct=x2d(0804) /* product identifier */
bcdDevice=x2d(0009) /* device release number */
rc = RxUsbOpen(Handle,EnumDevice,idVendor,idProduct,bcdDevice)
say '*RxUsbOpen(),RC=0x'd2x(rc)

/* drop RxUsbOpen */
rc = RxFuncDrop('RxUsbOpen')
say '-RxUsbOpen(),RC=0x'd2x(rc)

Related Functions