与设备通信的 USB4java 错误

Usb4java error communicating with Device

这里需要你的帮助。

我目前正在开发 Java 可以与 ingenico iWL220 设备通信的应用程序,使用 libusb 库中的 usb4java。我安装了驱动程序,可以从设备管理器中读取它就好了。我主要遵循

处的代码

http://www.mets-blog.com/java-usb-communication-usb4java/ 低 API.

http://www.mets-blog.com/java-usb-communication-usb4java-high-api/ 高 API.

我第一个试的是LowAPI,我的MainClass如下:

public class DeviceHandles {
private static final Short VendorID = 0x079b;
private static final Short ProductID = 0x0028;    
public static void main(String[] args){
UsbLowPos upos = new UsbLowPos();
upos.claimDevice(VendorID,ProductID);
   }
}

而这个 returns 有一个错误:

Device Found 
Exception in thread "main" org.usb4java.LibUsbException: USB error 12: Unable to open USB device: Operation not supported or unimplemented on this platform     at Usb.UsbLowPos.getDeviceHandle(UsbLowPos.java:121)    at Usb.UsbLowPos.findDevice(UsbLowPos.java:103)     at Usb.UsbLowPos.claimDevice(UsbLowPos.java:27)     at Usb.DeviceHandles.main(DeviceHandles.java:24)

在那之后,我尝试了高API,我的主要Class是这样的:

public class DeviceHandles {
private static final Short VendorID = 0x079b;
private static final Short ProductID = 0x0028;
public static void main(String[] args){
UsbHighPos upos = new UsbHighPos();
UsbDevice usbDevice = upos.findDevice(VendorID,ProductID);
upos.readMessage(upos.getDeviceInterface(usbDevice, 0), 0);  
   }
}

这也 returns 错误为:

javax.usb.UsbException: Properties file javax.usb.properties not found.     at javax.usb.UsbHostManager.setupProperties(Unknown Source)     at javax.usb.UsbHostManager.getProperties(Unknown Source)   at javax.usb.UsbHostManager.createUsbServices(Unknown Source)   at javax.usb.UsbHostManager.getUsbServices(Unknown Source)  at Usb.UsbHighPos.getUsbRootHoob(UsbHighPos.java:29)    at Usb.UsbHighPos.findDevice(UsbHighPos.java:43)    at Usb.DeviceHandles.main(DeviceHandles.java:27) Exception in thread "main" java.lang.NullPointerException  at Usb.UsbHighPos.findDevice(UsbHighPos.java:49)    at Usb.UsbHighPos.findDevice(UsbHighPos.java:43)    at Usb.DeviceHandles.main(DeviceHandles.java:27)

我在这里遗漏了什么吗?是图书馆无法与设备通信吗?或者问题出在设备上?请帮忙,谢谢你的时间。

解决了,我用Java串行连接代替了,效果很好!