Closed
Description
While running usb4java-javax-example DumpNames
I get an overflow error while reading manufacturer and product name.
The problems happens in LibUsb.getDescriptor()
called by AbstractDevice#getLanguages()
, but when I ignore this overflow (using language 0) a similiar error happens on AbstractDevice#getUsbStringDescriptor().
I tried to increase the ByteBuffer allocation, but this does not help.
C:\ws\github\usb4java-javax-examples>java -cp target\usb4java-javax-examples-1.0.0-SNAPSHOT.jar;c:\users\eckenfel\.m2\repository\org\usb4java\libusb4java\1.2.0\libusb4java-1.2.0-windows-x86_64.jar;c:\Users\eckenfel\.m2\repository\org\usb4java\usb4java-javax\1.2.1-SNAPSHOT\usb4java-javax-1.2.1-SNAPSHOT.jar;c:\users\eckenfel\.m2\repository\javax\usb\usb-api\1.0.2\usb-api-1.0.2.jar;C:\users\eckenfel\.m2\repository\org\usb4java\usb4java\1.2.0\usb4java-1.2.0.jar;C:\users\eckenfel\.m2\repository\org\apache\commons\commons-lang3\3.1\commons-lang3-3.1.jar org.usb4java.javax.examples.DumpNames
USB Service Implementation: usb4java
Implementation version: 1.2.0
Service API version: 1.0.2
Ignoring problematic device: Bus 001 Device 005: ID 1050:0120
javax.usb.UsbPlatformException: USB error 8: Unable to get string descriptor languages: Overflow
at org.usb4java.javax.ExceptionUtils.createPlatformException(ExceptionUtils.java:39)
at org.usb4java.javax.AbstractDevice.getLanguages(AbstractDevice.java:544)
at org.usb4java.javax.AbstractDevice.getUsbStringDescriptor(AbstractDevice.java:507)
at org.usb4java.javax.AbstractDevice.getString(AbstractDevice.java:526)
at org.usb4java.javax.examples.DumpNames.dumpName(DumpNames.java:53)
at org.usb4java.javax.examples.DumpNames.processDevice(DumpNames.java:87)
at org.usb4java.javax.examples.DumpNames.processDevice(DumpNames.java:75)
at org.usb4java.javax.examples.DumpNames.processDevice(DumpNames.java:75)
at org.usb4java.javax.examples.DumpNames.main(DumpNames.java:122)
I can work around this with ignoring the Overflow:
if (result == LibUsb.ERROR_OVERFLOW) return new short[0];
Ignoring problematic device: Bus 001 Device 005: ID 1050:0120
javax.usb.UsbPlatformException: USB error 8: Unable to get string descriptor 1 from device Bus 001 Device 005: ID 1050:0120: Overflow
at org.usb4java.javax.ExceptionUtils.createPlatformException(ExceptionUtils.java:39)
at org.usb4java.javax.AbstractDevice.getUsbStringDescriptor(AbstractDevice.java:515)
at org.usb4java.javax.AbstractDevice.getString(AbstractDevice.java:526)
at org.usb4java.javax.examples.DumpNames.dumpName(DumpNames.java:53)
at org.usb4java.javax.examples.DumpNames.processDevice(DumpNames.java:87)
at org.usb4java.javax.examples.DumpNames.processDevice(DumpNames.java:75)
at org.usb4java.javax.examples.DumpNames.processDevice(DumpNames.java:75)
at org.usb4java.javax.examples.DumpNames.main(DumpNames.java:122)
NB: using DumpDevices if usb4java-examples works with the device (it is using getStringDescriptorAscii
). It looks like:
Device 001/005
Connected to port: 2
Parent: 001/002
Speed: Full
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 Per Interface
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x1050
idProduct 0x0120
bcdDevice 3.32
iManufacturer 1 Yubico
iProduct 2 Security Key by Yubico
iSerial 0
bNumConfigurations 1
...
This is on Win7 (german, 64bit) with the Yubico security-key (HID) and 64bit Java7U72.
Metadata
Metadata
Assignees
Labels
No labels