From 5d8eafe9e8c36c86f9b4c33f32305866dd898f3e Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Sun, 27 Mar 2016 14:40:42 +0200 Subject: Add state class --- src/device/Driver.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/device/Driver.java') diff --git a/src/device/Driver.java b/src/device/Driver.java index d629aa7..a099d95 100644 --- a/src/device/Driver.java +++ b/src/device/Driver.java @@ -110,12 +110,15 @@ public class Driver{ // Init HIDAPI Library com.codeminders.hidapi.ClassPathLibraryLoader.loadNativeHIDLibrary(); + // Try not bind the device try { HIDManager man=HIDManager.getInstance(); this.device=man.openById(0x1770, 0xff00, null); + if(this.device==null) + throw new Exception(); } catch(Exception e){ - throw new InstantiationException("Failed to instanciate driver."); + throw new InstantiationException("Failed to instanciate driver. Device not found or permission denied (try as root)"); } } -- cgit v1.2.3