简体   繁体   中英

usb4java on windows 10

I want to code a USB-Locker for any OS using usb4java. I can list all my devices, but if I want to use the HotPlug class made by Klaus Reimer I get the informaion:

"libusb doesn't support hotplug on this system"

Is there an alternitiv class, or an user code to do the same thing as the HotPlug class . 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.

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:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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