Search code examples
javapythonusblibusb

java: No Endpoint found, but python works


I want to try out the java libusb from http://libusbjava.sourceforge.net and cant even connect to my device...

I had this python code before:

def discover():
    my_device = None
    for bus in usb.busses():
        for dev in bus.devices:
            if dev.idVendor == 0x16c0 and dev.idProduct == 0x05dc:
                handle = dev.open()

which worked really great. now i wanted to build the same in java and made this:

Device dev = USB.getDevice((short) 0x16c0, (short) 0x05dc);
try {
    dev.open(1, 0, -1);

} catch (USBException e) {
    }

but all i get now is

ch.ntb.usb.USBException: No USB endpoints found. Check the device configuration
    at ch.ntb.usb.Device.updateMaxPacketSize(Device.java:82)
    at ch.ntb.usb.Device.initDevice(Device.java:114)
    at ch.ntb.usb.Device.open(Device.java:194)
    at Main.main(Main.java:14)

that cant be true because i double checked the values from lsusb and i have a Configuration 1 and an Interface 0... Whats could be so difficult to connect to my device? I dont get it...


Solution

  • I found out that the device only had an interrupt endpoint, which is reachable for the python implementation but not for the java one... I changed that and now it works!