UsbOpen: Difference between revisions
Appearance
mNo edit summary |
|||
Line 3: | Line 3: | ||
==Syntax== | ==Syntax== | ||
ulrc = UsbOpen(pHandle,usVendor,usProduct,usBCDDevice,usEnumDevice) | |||
ulrc = UsbOpen(pHandle,usVendor,usProduct,usBCDDevice,usEnumDevice) | |||
==Parameters== | ==Parameters== | ||
; pHandle : the address of the variable to receive the Device Handle. | ; pHandle : the address of the variable to receive the Device Handle. | ||
; usVendor : the Vendor Identifier (VendorID) from the device descriptor. | ; usVendor : the Vendor Identifier (VendorID) from the device descriptor. | ||
; usProduct : the Product Identifier (ProductID) from the device descriptor. | ; usProduct : the Product Identifier (ProductID) from the device descriptor. | ||
; usBCDDevice : the Device Release Number 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. | ; usEnumDevice : 0 to accept any specified device or N for the Nth device. | ||
==Return Code== | ==Return Code== | ||
0x0000 - NO_ERROR | |||
0x0000 - NO_ERROR | |||
===Errors=== | ===Errors=== | ||
<pre> | <pre> | ||
Line 28: | Line 22: | ||
0xFF13 - ERROR_I24_INVALID_PARAMETER | 0xFF13 - ERROR_I24_INVALID_PARAMETER | ||
</pre> | </pre> | ||
==Remarks== | ==Remarks== | ||
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); }