Locates and opens a device by vid/pid.
- open-device example:
- Finds a device by vid/pid (use vid=hhhh, pid=hhhhh and the command line).
- Initializes a new UsbK (usb device) handle.
- Prints pipe information.
- 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.
Device opened successfully!
Pipe Information:
PipeId=0x01 PipeType=0x02 Interval=0 MaximumPacketSize=32
PipeId=0x81 PipeType=0x02 Interval=0 MaximumPacketSize=32
DWORD __cdecl main(int argc, char* argv[])
{
DWORD ec = ERROR_SUCCESS;
UCHAR pipeIndex = 0;
return GetLastError();
if (!Usb.
Init(&handle, deviceInfo))
{
ec = GetLastError();
printf("Usb.Init failed. ErrorCode: %08Xh\n", ec);
goto Done;
}
printf("Device opened successfully!\n");
printf("Pipe Information:\n");
while (Usb.
QueryPipe(handle, 0, pipeIndex++, &pipeInfo))
{
printf(" PipeId=0x%02X PipeType=0x%02X Interval=%u MaximumPacketSize=%u\n",
}
Done:
return ec;
}