Jump to content

UsbOpen

From EDM2

Description

Acquires access to a specific USB device.

Syntax

ulrc = UsbOpen(pHandle,usVendor,usProduct,usBCDDevice,usEnumDevice)

Parameters

pHandle
the address of the variable to receive the Device Handle.
usVendor
the Vendor Identifier (VendorID) from the device descriptor.
usProduct
the Product Identifier (ProductID) from the device descriptor.
usBCDDevice
the Device Release Number from the device descriptor.
usEnumDevice
0 to accept any specified device or N for the Nth device.

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

//Code Snippet - UsbOpen
{
  APIRET ulrc;
  PUSBHANDLE pHandle;
  USBHANDLE Handle;
  USHORT usVendor = 0x046D;
  USHORT usProduct = 0x0804;
  USHORT usBCDDevice = 0x0009;
  USHORT usEnumDevice = 0;

  pHandle = &Handle;
  ulrc = UsbOpen(pHandle,usVendor,usProduct,usBCDDevice,usEnumDevice);
  printf("\nUsbOpen - ulrc: 0x%04X",ulrc);
}

Related Function