1

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

DodoProgramms
  • 11
  • 1
  • 7

1 Answers1

0

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.

Vitali Heinrich
  • 151
  • 1
  • 6