java: No Endpoint found, but python works

给你一囗甜甜゛ 提交于 2019-12-11 18:36:57

问题


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...


回答1:


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!



来源:https://stackoverflow.com/questions/8782721/java-no-endpoint-found-but-python-works

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!