UsbOpen: Difference between revisions
Appearance
Created page with "==Description== Acquires access to a specific USB device. ==Syntax== <pre> ulrc=UsbOpen(pHandle,usVendor,usProduct,usBCDDevice,usEnumDevice) </pre> ==Parameters== ; pHandle ..." |
mNo edit summary |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
==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 : the Vendor Identifier (VendorID) from the device descriptor. | |||
; usVendor : | ; usProduct : the Product Identifier (ProductID) from the device descriptor. | ||
; usBCDDevice : the Device Release Number from the device descriptor. | |||
; usProduct : | ; usEnumDevice : 0 to accept any specified device or N for the Nth device. | ||
; usBCDDevice : | |||
; usEnumDevice : | |||
==Return Code== | ==Return Code== | ||
0x0000 - NO_ERROR | |||
===Errors=== | ===Errors=== | ||
<pre> | |||
0x0057 - ERROR_INVALID_PARAMETER | |||
0x1B58 - USB_NOT_INIT | |||
0xFF0C - ERROR_I24_GEN_FAILURE | |||
0xFF13 - ERROR_I24_INVALID_PARAMETER | |||
</pre> | |||
==Remarks== | ==Remarks== | ||
==Example Code== | ==Example Code== | ||
<pre> | <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> | </pre> | ||
==Related | ==Related Function== | ||
* [[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); }