Jump to content

UsbOpen: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Ak120 (talk | contribs)
mNo edit summary
 
(4 intermediate revisions by one other user not shown)
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)
  ulrc = UsbOpen(pHandle,usVendor,usProduct,usBCDDevice,usEnumDevice)


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


===Return Code===
==Return Code==
Errors:
  0x0000 - NO_ERROR
  [0000] - NO_ERROR
 
[0057] - ERROR_INVALID_PARAMETER
===Errors===
[1B58] - USB_NOT_INIT (7000)
<pre>
[FF0C] - ERROR_I24_GEN_FAILURE
0x0057 - ERROR_INVALID_PARAMETER
[FF13] - ERROR_I24_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);
}
</pre>


==Related Function==
==Related Function==
*[[UsbClose]]
* [[UsbCtrlMessage]]
* [[UsbCtrlTransfer]]
* [[UsbDataTransfer]]
* [[UsbQueryDeviceInfo]]
* [[UsbQueryDeviceReport]]
* [[UsbQueryStringReport]]
* [[UsbStartCtrlTransfer]]
* [[UsbStartDataTransfer]]
* [[UsbStartIsoTransfer]]
* [[UsbClose]]


[[Category:USBCalls]]
[[Category:USBCalls]]

Latest revision as of 20:43, 13 September 2021

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