我写了一个简单的程序(基于下列的 http://codeandlife.com/2012/01/22/avr-attiny-usb-tutorial-part-1/教程)通过 USB 端口将数据从 AVR 芯片(Attiny 2313)发送到计算机,因为该设备没有内置 USB 端口,所以我使用了V-USB http://www.obdev.at/products/vusb/index.html通过软件模拟此类端口的库。
该设备按预期工作,并且我使用 C 语言将其连接起来没有任何问题libusb http://www.libusb.org/库,但是我想用Java访问它,所以我查找了libusb的java实现。我设法设置的唯一库,并且它已成功找到总线上的USB“libusb-win32 包装器” http://libusbjava.sourceforge.net/wp/.
唯一的问题是当我尝试打开它时设备抛出异常
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)
如何解决?还有其他方法吗?有什么推荐吗?
这是抛出异常的代码
Device dev = USB.getDevice((short) 0x16c0, (short) 0x05dc);
dev.open(1, 0, -1);
这是我获得的有关设备 viw USBview 的数据
Device Descriptor:
bcdUSB: 0x0110
bDeviceClass: 0xFF
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x08 (8)
idVendor: 0x16C0
idProduct: 0x05DC
bcdDevice: 0x0100
iManufacturer: 0x01
0x0409: "[email protected] /cdn-cgi/l/email-protection"
iProduct: 0x02
iSerialNumber: 0x00
bNumConfigurations: 0x01
ConnectionStatus: DeviceConnected
Current Config Value: 0x01
Device Bus Speed: Low
Device Address: 0x03
Open Pipes: 0
Configuration Descriptor:
wTotalLength: 0x0012
bNumInterfaces: 0x01
bConfigurationValue: 0x01
iConfiguration: 0x00
bmAttributes: 0x80 (Bus Powered )
MaxPower: 0x32 (100 Ma)
Interface Descriptor:
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x00
bInterfaceClass: 0x00
bInterfaceSubClass: 0x00
bInterfaceProtocol: 0x00
iInterface: 0x00
相关问题 https://stackoverflow.com/questions/8782721/java-no-endpoint-found-but-python-works答案,但我不明白要改变什么,如果它与设备有关,如何用VUSB来完成?