Loads a dynamic driver api for use with all drivers and opens the device.
- load-driver-api example:
- Finds a device by vid/pid (use vid=hhhh, pid=hhhhh and the command line).
- Loads a dynamic driver API set specific to the devices driver.
- Initializes a new UsbK (usb device) handle.
- Frees the UsbK (usb device) handle.
- Frees the LstK (device list) handle created in step #1.
- Console Output
Looking for device vid/pid 04D8/FA2E..
Using 04D8:FA2E (LUSBW1): Benchmark Device - Microchip Technology, Inc.
libusbK driver api loaded!
Device opened successfully!
DWORD __cdecl main(int argc, char* argv[])
{
DWORD errorCode = ERROR_SUCCESS;
return GetLastError();
{
errorCode = GetLastError();
printf("LibK_LoadDriverAPI failed. ErrorCode: %08Xh\n", errorCode);
goto Done;
}
{
printf("libusbK driver api loaded!\n");
break;
printf("libusb0 driver api loaded!\n");
break;
printf("WinUSB driver api loaded!\n");
break;
printf("libusb0/filter driver api loaded!\n");
break;
}
if (!Usb.
Init(&handle, deviceInfo))
{
errorCode = GetLastError();
printf("Usb.Init failed. ErrorCode: %08Xh\n", errorCode);
goto Done;
}
printf("Device opened successfully!\n");
Done:
return errorCode;
}