You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenJDK 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)
Macintoshs-MacBook-Air:HegFrontSite macintoshhd$
usb4java version 1.3.0
Bug description
Error when i tried to call LibUsb.getDeviceList(null, myList);
I get error from compiler
Caused by: org.usb4java.LibUsbException: USB error -1: Unable to find usb devices: Other error
Reproduction
DeviceList deviceList = new DeviceList();
int result = LibUsb.getDeviceList(null, deviceList);
if(result != LibUsb.SUCCESS) throw new LibUsbException("Unable to find usb devices", result);
Expected behavior
It should return me with device list.
The text was updated successfully, but these errors were encountered:
The bug is not in the library, but in the user program. The method LibUSB.getDeviceList() returns the number of devices copied to the DeviceList, in my case fourteen devices - that's why I got result == 14. Changed the test to (result < 0) and now I'm getting the whole list without problems.
The constructor of LibUSBException changes the errorCode sign, which makes the exception message to appear as USB Error: -14. The negative number led me to a wrong conclusion that there had been an error.
Previous comment:
I can confirm this behavior on Fedora 33 (stock kernel 5.14.18-100.fc33.x86_64), OpenJDK Runtime Environment (build 1.8.0_312-b07), libusb version 1.0.24.11584, usb4java version 1.3.0 from Maven central. Even tried to compile the libusb4java.so from sources (successfully) and replace it within the classpath, but to no success. The error code returned by LibUSB.getDeviceList is -14 and the debugging output is
[ 0.004276] [001d0eff] libusb: debug [libusb_get_device_list]
[ 0.004286] [001d0eff] libusb: debug [discovered_devs_append] need to increase capacity
Exception in thread "main" org.usb4java.LibUsbException: USB error -14: Other error
I succeeded to get the device list using the same libusb in a simple C program.
Environment:
OS: macOS Mojave version 10.14.6
openjdk version "12.0.2" 2019-07-16
OpenJDK Runtime Environment (build 12.0.2+10)
OpenJDK 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)
Macintoshs-MacBook-Air:HegFrontSite macintoshhd$
usb4java version 1.3.0
Bug description
Error when i tried to call
LibUsb.getDeviceList(null, myList);
I get error from compiler
Reproduction
Expected behavior
It should return me with device list.
The text was updated successfully, but these errors were encountered: