简体   繁体   English

Windows 10上的usb4java

[英]usb4java on windows 10

I want to code a USB-Locker for any OS using usb4java. 我想使用usb4java为任何操作系统编写USB-Locker。 I can list all my devices, but if I want to use the HotPlug class made by Klaus Reimer I get the informaion: 我可以列出所有设备,但是如果我想使用Klaus Reimer制作的HotPlug类 ,则会得到以下信息:

"libusb doesn't support hotplug on this system" “ libusb在此系统上不支持热插拔”

Is there an alternitiv class, or an user code to do the same thing as the HotPlug class . 是否有其他类或用户代码可以执行与HotPlug类相同的操作。 I am working on Windows 10 and it should run on this os as well, so programming in Linux or so is not an option to avoid this error. 我正在Windows 10上工作,它也应该在此os上运行,因此避免在Linux上编程不是避免此错误的选择。

thanks 谢谢

I used the same example and had the same notification. 我使用相同的示例并具有相同的通知。 Now I´m using usb4java-javax in version 1.2.0 and it works like this: 现在,我在1.2.0版中使用usb4java-javax,它的工作方式如下:

final UsbServices services = UsbHostManager.getUsbServices();
final UsbDeviceService usbDeviceService = new UsbDeviceService();

services.addUsbServicesListener(new UsbServicesListener() {
        public void usbDeviceAttached(UsbServicesEvent usbServicesEvent) {}
        public void usbDeviceDetached(UsbServicesEvent usbServicesEvent) {}
}

Be sure your application is running all the time. 确保您的应用程序一直在运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM