我正在尝试从通过USB连接到具有usb4java库的Windows 10pro机器的RFID阅读器读取消息。
我设法声明了接口,打开了管道并为数据注册了侦听器,但是从未触发过该侦听器。 读取器充当键盘,其读取的内容最终都在活动应用程序(例如我已打开的IDE)中,而不是在侦听器中 。
UsbInterface usbInterface = activeInteface(device);
// there is only one endpoint in the list
UsbEndpoint endpoint = (UsbEndpoint)usbInterface.getUsbEndpoints().get(0);
UsbPipe pipe = endpoint.getUsbPipe();
try {
usbInterface.claim();
// true
System.out.println("claimed usb interface: " + usbInterface.isClaimed());
pipe.open();
// true
System.out.println("pipe open: " + pipe.isOpen());
pipe.addUsbPipeListener(new MessageListener());
// true
System.out.println("pipe active: " + pipe.isActive());
// keep main thread alive, async call should be done from another thread i guess
Threa

本文档描述了在Windows 10 Pro上使用Java USB4Java库从RFID阅读器读取数据时遇到的问题。开发者成功声明了接口、打开管道并注册了侦听器,但侦听器未被触发,设备似乎作为键盘直接在IDE中输出数据。尝试同步读取时遇到了'Input/Output error'异常。作者探讨了可能需要USBDK、设备驱动问题以及代码是否正确的问题。
最低0.47元/天 解锁文章
2140

被折叠的 条评论
为什么被折叠?



