Jump to content

UsbOpen: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
W.m.brul (talk | contribs)
added parameter descriptions and example code
Line 1: Line 1:
==Description==
Acquires access to a specific USB device.
Acquires access to a specific USB device.


==Syntax==
==Syntax==
ulrc=UsbOpen(pHandle,usVendor,usProduct,usBCDDevice,usEnumDevice)
<pre>
ulrc = UsbOpen(pHandle,usVendor,usProduct,usBCDDevice,usEnumDevice)
</pre>
==Parameters==
; pHandle : receives Device Handle to be used to access this USB device.


===Parameters===
; usVendor : the Vendor Identifier (VendorID) from the device descriptor.
;pHandle :
;usVendor :  
;usProduct :
;usBCDDevice :
;usEnumDevice :


===Return Code===
; usProduct : the Product Identifier (ProductID) from the device descriptor.
Errors:
 
[0000] - NO_ERROR
; usBCDDevice : the Device Release Number from the device descriptor.
[0057] - ERROR_INVALID_PARAMETER
 
[1B58] - USB_NOT_INIT (7000)
; usEnumDevice : 0 to accept any specified device or N for the Nth device.
[FF0C] - ERROR_I24_GEN_FAILURE
 
[FF13] - ERROR_I24_INVALID_PARAMETER
==Return Code==
<pre>
0x0000 - NO_ERROR
</pre>
===Errors===
<pre>
0x0057 - ERROR_INVALID_PARAMETER
0x1B58 - USB_NOT_INIT
0xFF0C - ERROR_I24_GEN_FAILURE
0xFF13 - ERROR_I24_INVALID_PARAMETER
</pre>
==Remarks==
 
==Example Code==
<pre>
//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,ulrc);
}
</pre>


==Related Function==
==Related Function==

Revision as of 12:30, 25 January 2017

Description

Acquires access to a specific USB device.

Syntax

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

Parameters

pHandle
receives Device Handle to be used to access this USB device.
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,ulrc);
}

Related Function