I have an embedded USB device called 'Cruise Dongle USBP' with VID 0x0001 and PID 0x0002 (these values are just for testing) for which I loaded the WinUSB driver using Zadig.

Screenshot 2025-03-17 155707.png

Screenshot 2025-03-17 155644.png

Now I want to communicate with this device in Qt using the libusb library, but when I search for it, the library cannot find it.

Qt Code:
  1. void USBDevice::ScanUsbDevices()
  2. {
  3. libusb_context *ctx = nullptr;
  4. libusb_device **device_list = nullptr;
  5. ssize_t count;
  6.  
  7. if (libusb_init(&ctx) != 0) {
  8. qWarning() << "Error initializing libusb";
  9. }
  10.  
  11. // Get the device list
  12. count = libusb_get_device_list(ctx, &device_list);
  13.  
  14. if (count < 0) {
  15. usbList->addItem("Error: Unable to get the device list.");
  16. libusb_exit(ctx);
  17. return;
  18. }
  19.  
  20. qDebug() << "USB devices found:" << count;
  21.  
  22. // usbList->addItem(QString("USB devices found: %1").arg(count));
  23.  
  24. // Iterate over the found devices
  25. for (ssize_t i = 0; i < count; i++) {
  26. libusb_device *device = device_list[i];
  27. libusb_device_descriptor desc;
  28.  
  29. if (libusb_get_device_descriptor(device, &desc) == 0) {
  30. QString info = QString("VID: 0x%1 PID: 0x%2")
  31. .arg(desc.idVendor, 4, 16, QChar('0'))
  32. .arg(desc.idProduct, 4, 16, QChar('0'));
  33.  
  34. // Try to open the device to read extra information
  35. libusb_device_handle *handle;
  36. if (libusb_open(device, &handle) == 0) {
  37. unsigned char buffer[256];
  38.  
  39. if (desc.iManufacturer && libusb_get_string_descriptor_ascii(handle, desc.iManufacturer, buffer, sizeof(buffer)) > 0) {
  40. info += " | Manufacturer: " + QString::fromUtf8(reinterpret_cast<char*>(buffer));
  41. }
  42.  
  43. if (desc.iProduct && libusb_get_string_descriptor_ascii(handle, desc.iProduct, buffer, sizeof(buffer)) > 0) {
  44. info += " | Product: " + QString::fromUtf8(reinterpret_cast<char*>(buffer));
  45. }
  46.  
  47. libusb_close(handle);
  48. }
  49.  
  50. // usbList->addItem(info);
  51. qDebug() << info;
  52. }
  53. }
  54.  
  55. // Free the device list
  56. libusb_free_device_list(device_list, 1);
  57. libusb_exit(ctx);
  58. }
To copy to clipboard, switch view to plain text mode 

that returns

Qt Code:
  1. AllK required contiguous memory = 675016 (64bit)
  2. 8 HotK Handles: HandleSize 2112 PoolSize 16912 (bytes)
  3. 64 LstK Handles: HandleSize 64 PoolSize 4112 (bytes)
  4. 2048 LstInfoK Handles: HandleSize 64 PoolSize 131088 (bytes)
  5. 128 UsbK Handles: HandleSize 96 PoolSize 12304 (bytes)
  6. 64 DevK Handles: HandleSize 112 PoolSize 7184 (bytes)
  7. 2048 OvlK Handles: HandleSize 104 PoolSize 213008 (bytes)
  8. 64 OvlPoolK Handles: HandleSize 96 PoolSize 6160 (bytes)
  9. 32 StmK Handles: HandleSize 176 PoolSize 5648 (bytes)
  10. 2048 IsochK Handles: HandleSize 136 PoolSize 278544 (bytes)
  11.  
  12. Dynamically allocated as needed:
  13. KLST_DEVINFO = 2596 bytes each
  14. USB devices found: 6
  15. "VID: 0x8086 PID: 0xa36d"
  16. "VID: 0x8087 PID: 0x0aaa"
  17. "VID: 0x10de PID: 0x1ada"
  18. "VID: 0x0b05 PID: 0x1866 | Manufacturer: ASUSTeK Computer Inc. | Product: N-KEY Device"
  19. "VID: 0x046d PID: 0xc01e | Manufacturer: Logitech | Product: USB-PS/2 Optical Mouse"
  20. "VID: 0x1366 PID: 0x1050"
To copy to clipboard, switch view to plain text mode 

I have tried reinstalling the drivers and changing them to Klibusb or others, but nothing works. Can anyone give me some advice?