I've written a demo application with JavaFX GUI which has to read a serial and a some kind of hardware ID from an USB device. I'm using the javax.usb (usb4java) library
<dependency>
<groupId>org.usb4java</groupId>
<artifactId>usb4java-javax</artifactId>
<version>1.2.0</version>
</dependency>
to access and claim the device:
UsbConfiguration configuration = imuniqe.getActiveUsbConfiguration();
UsbInterface iface = (UsbInterface) configuration.getUsbInterfaces().get(0); // FIXME
iface.claim(new UsbInterfacePolicy() {
@Override
public boolean forceClaim(UsbInterface arg0) {
return true;
}
});
Running the application on my Ubuntu 14.04 system works, if I start the program with sudo.
But if I run it on an MacBook Pro (OS X 10.9.5) with Java 8, I get the following exception:
javax.usb.UsbPlatformException: USB error 3: Unable to claim interface: Access denied (insufficient permissions)
at
org.usb4java.javax.ExceptionUtils.createPlatformException(ExceptionUtils.java:39)
at
org.usb4java.javax.AbstractDevice.claimInterface(AbstractDevice.java:430)
at
org.usb4java.javax.Interface.claim(Interface.java:102)
...
Even running the application with sudo doesn't change its behaviour.
Am I missing anything important? Is there any trick to allow my application claiming the USB interface on OS X?