nyholku / purejavahidapi

Other
121 stars 69 forks source link

PureJavaHidApi.enumerateDevices() returning empty List #41

Closed KartikSoneji closed 7 years ago

KartikSoneji commented 7 years ago

Hi, I am quite new to Java, and need help with an issue. I want to detect keypresses from multiple keyboards, and am using PureJavaHidApi for that. But, I am stuck on trying to get a List of connected Hid devices. PureJavaHidApi.enumerateDevices() returns an empty List. The Here is the full code:

import purejavahidapi.*;
import java.util.List;
public class Test{
    public static void main(String args[]){
        List<HidDeviceInfo> devList = PureJavaHidApi.enumerateDevices();
        System.out.println(devList.size());
        for (HidDeviceInfo info : devList) {
            System.out.printf("VID = 0x%04X PID = 0x%04X Manufacturer = %s Product = %s Path = %s\n", //
                info.getVendorId(), //
                info.getProductId(), //
                info.getManufacturerString(), //
                info.getProductString(), //
                info.getPath());
        }
    }
}

When I run the code, the output is 0. I am using an Acer Aspire E1-510 Laptop, running Windows 10 Pro, with Java 8, Update 121, and the BlueJ IDE.

tresf commented 7 years ago

To quote the README.md from the project page:

Why would you like to use PureJavaHidApi to access HID devices?

The answer is that you usually don't!

Most HID devices (like Mouse, Keyboard etc) have specific APIs provided by the operating system and you should use those to access them.

And from a sister-project, hidapi:

(Linux computers) In addition, it will only communicate with devices which have hidraw nodes associated with them. Keyboards, mice, and some other devices which are blacklisted from having hidraw nodes will not work. Fortunately, for nearly all the uses of hidraw, this is not a problem.

A better explanation is available here: https://github.com/signal11/hidapi/issues/247#issuecomment-161152387

KartikSoneji commented 7 years ago

Yes, but I want to differentiate between keystrokes from two different keyboards, and I do not know of any other way except tying the keyevents with the id of the source keyboard. I did try to use hid4java, but it too returned an empty list when emulateDevices was called.

tresf commented 7 years ago

@KartikSoneji then you will have to remove the device filter and recompile. Can you try to replace this line:

windows/WindowsBackend.java#L142 if ("HIDClass".equals(drivername)) { with if (true) { and see if you can get it?

KartikSoneji commented 7 years ago

Trying it right now!

KartikSoneji commented 7 years ago

Nope. Still getting an empty List.

tresf commented 7 years ago

I did try to use hid4java, but it too returned an empty list when emulateDevices was called.

If it works, I'd assume this same technique should be available via hid4java as well.

KartikSoneji commented 7 years ago

But I have no experience or knowledge of working with c or c++. I am using PureJavaHidApi mainly because it is pure java.

tresf commented 7 years ago

I want to detect keypresses from multiple keyboards, and am using PureJavaHidApi for that.

Still, if your end-goal is to read data direct from the keyboard, it looks like it is going to be a non-starter due to the reasons mentioned above.

KartikSoneji commented 7 years ago

But is there no solution to the problem?

tresf commented 7 years ago

But is there no solution to the problem?

Not with HID, no but you may be able to get to the device with libusb instead.

http://stackoverflow.com/questions/8719603/libusb-win32-cant-read-from-keyboard

tresf commented 7 years ago

@KartikSoneji if you're looking for a(nother) Java wrapper around the USB library, here you are: http://usb4java.org/quickstart/javax-usb.html

Vzor- commented 7 years ago

Try running this jar from cmd, does it list the devices? If it does then the issue is with your build environment. purejavahidapit.zip

KartikSoneji commented 7 years ago

OK, Will get back to you.

KartikSoneji commented 7 years ago

Hi. I tried running the jar from cmd, and it gives me this error.

Exception in thread "main" java.lang.NoClassDefFoundError: purejavahidapi/PureJavaHidApi
        at Test.main(Test.java:5)
Caused by: java.lang.ClassNotFoundException: purejavahidapi.PureJavaHidApi
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 1 more

I have both the purejavahidapi.jar and the jna.jar in my cp while compiling. Using the original purejavahidapi.jar also gives me the same error while running from cmd. When I use the BlueJ IDE, it compiles fine. In the IDE, both jars work, but give me an empty List when PureJavaHidApi.emulateDevices() is called.

KartikSoneji commented 7 years ago

Update

I did a bit of reserch, and java -cp purejavahidapi.jar;jna-4.0.0.jar Test was causing problems, so I added a semicolon and tried java -cp purejavahidapi.jar;jna-4.0.0.jar; Test, and it compiled properly! But, I still got the output as 0 (With both the jars).

KartikSoneji commented 7 years ago

@tresf I tried hid4java, and I got this error, both in the IDE and while using cmd:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000000000000, pid=5172, tid=0x00000000000025ac
#
# JRE version: Java(TM) SE Runtime Environment (8.0_121-b13) (build 1.8.0_121-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.121-b13 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  0x0000000000000000
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# hs_err_pid5172.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

The logfile:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000000000000, pid=5172, tid=0x00000000000025ac
#
# JRE version: Java(TM) SE Runtime Environment (8.0_121-b13) (build 1.8.0_121-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.121-b13 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  0x0000000000000000
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  T H R E A D  ---------------

Current thread (0x0000000003140800):  JavaThread "main" [_thread_in_native, id=9644, stack(0x0000000002f50000,0x0000000003050000)]

siginfo: ExceptionCode=0xc0000005, ExceptionInformation=0x0000000000000008 0x0000000000000000

Registers:
RAX=0x000000006b61beb0, RBX=0x000000000304ef50, RCX=0x000000000304ef50, RDX=0x000000000304f6b8
RSP=0x000000000304edf8, RBP=0x000000000304ee80, RSI=0x0000000000000000, RDI=0x0000000000000000
R8 =0x000000000000000b, R9 =0x0000000000000004, R10=0x000000000182201e, R11=0x000000000304f130
R12=0x000000000304f728, R13=0x0000000016534258, R14=0x000000000304f7f8, R15=0x0000000003140800
RIP=0x0000000000000000, EFLAGS=0x0000000000010206

Top of Stack: (sp=0x000000000304edf8)
0x000000000304edf8:   000000006b60e861 000000001857c5a0
0x000000000304ee08:   0000000076e9e32a 0000000003140800
0x000000000304ee18:   0000000000000027 000000000304ee38
0x000000000304ee28:   000000000304ee90 0000d35715b8ed96
0x000000000304ee38:   00000000e0ae0c98 000000001628b838
0x000000000304ee48:   0000000000000000 000000000304efa8
0x000000000304ee58:   000000001857c5a0 0000000003140800
0x000000000304ee68:   000000000304efb0 00000000031409f8
0x000000000304ee78:   0000000050478d94 000000001857c5a0
0x000000000304ee88:   00007ff900000000 000000000304f6b8
0x000000000304ee98:   000000000324835d 000000001857c5a0
0x000000000304eea8:   0000000076dc0f61 0000000000000000
0x000000000304eeb8:   00000000503d2639 0000000000270026
0x000000000304eec8:   000000001857c5a0 0000000070881cc0
0x000000000304eed8:   00000000503d264f 0000000070880000
0x000000000304eee8:   0000000070881cc0 0000000070881cc0 

Instructions: (pc=0x0000000000000000)
0xffffffffffffffe0:   

Register to memory mapping:

RAX=0x000000006b61beb0 is an unknown value
RBX=0x000000000304ef50 is pointing into the stack for thread: 0x0000000003140800
RCX=0x000000000304ef50 is pointing into the stack for thread: 0x0000000003140800
RDX=0x000000000304f6b8 is pointing into the stack for thread: 0x0000000003140800
RSP=0x000000000304edf8 is pointing into the stack for thread: 0x0000000003140800
RBP=0x000000000304ee80 is pointing into the stack for thread: 0x0000000003140800
RSI=0x0000000000000000 is an unknown value
RDI=0x0000000000000000 is an unknown value
R8 =0x000000000000000b is an unknown value
R9 =0x0000000000000004 is an unknown value
R10=0x000000000182201e is an unknown value
R11=0x000000000304f130 is pointing into the stack for thread: 0x0000000003140800
R12=0x000000000304f728 is pointing into the stack for thread: 0x0000000003140800
R13={method} {0x0000000016534260} 'getDeviceList' '(Lorg/usb4java/Context;Lorg/usb4java/DeviceList;)I' in 'org/usb4java/LibUsb'
R14=0x000000000304f7f8 is pointing into the stack for thread: 0x0000000003140800
R15=0x0000000003140800 is a thread

Stack: [0x0000000002f50000,0x0000000003050000],  sp=0x000000000304edf8,  free space=1019k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.usb4java.LibUsb.getDeviceList(Lorg/usb4java/Context;Lorg/usb4java/DeviceList;)I+0
j  Test.main([Ljava/lang/String;)V+10
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x0000000018430800 JavaThread "Service Thread" daemon [_thread_blocked, id=8672, stack(0x0000000018810000,0x0000000018910000)]
  0x0000000016ad5800 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=11476, stack(0x0000000018310000,0x0000000018410000)]
  0x0000000016ad2800 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=12032, stack(0x0000000018210000,0x0000000018310000)]
  0x0000000016ace800 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=7184, stack(0x0000000018110000,0x0000000018210000)]
  0x0000000016acb000 JavaThread "Attach Listener" daemon [_thread_blocked, id=9188, stack(0x0000000018010000,0x0000000018110000)]
  0x0000000016aca000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=9888, stack(0x0000000017f10000,0x0000000018010000)]
  0x0000000016aba800 JavaThread "Finalizer" daemon [_thread_blocked, id=10116, stack(0x0000000017d20000,0x0000000017e20000)]
  0x0000000016a99000 JavaThread "Reference Handler" daemon [_thread_blocked, id=12040, stack(0x0000000017c20000,0x0000000017d20000)]
=>0x0000000003140800 JavaThread "main" [_thread_in_native, id=9644, stack(0x0000000002f50000,0x0000000003050000)]

Other Threads:
  0x0000000016a97000 VMThread [stack: 0x0000000017b20000,0x0000000017c20000] [id=7336]
  0x0000000018454000 WatcherThread [stack: 0x0000000018910000,0x0000000018a10000] [id=9872]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap:
 PSYoungGen      total 28672K, used 1966K [0x00000000e0900000, 0x00000000e2900000, 0x0000000100000000)
  eden space 24576K, 8% used [0x00000000e0900000,0x00000000e0aeb8c0,0x00000000e2100000)
  from space 4096K, 0% used [0x00000000e2500000,0x00000000e2500000,0x00000000e2900000)
  to   space 4096K, 0% used [0x00000000e2100000,0x00000000e2100000,0x00000000e2500000)
 ParOldGen       total 65536K, used 0K [0x00000000a1a00000, 0x00000000a5a00000, 0x00000000e0900000)
  object space 65536K, 0% used [0x00000000a1a00000,0x00000000a1a00000,0x00000000a5a00000)
 Metaspace       used 3720K, capacity 4628K, committed 4864K, reserved 1056768K
  class space    used 428K, capacity 460K, committed 512K, reserved 1048576K

Card table byte_map: [0x0000000012600000,0x0000000012900000] byte_map_base: 0x00000000120f3000

Marking Bits: (ParMarkBitMap*) 0x000000007749b6d0
 Begin Bits: [0x0000000012f00000, 0x0000000014698000)
 End Bits:   [0x0000000014698000, 0x0000000015e30000)

Polling page: 0x0000000001280000

CodeCache: size=245760Kb used=1271Kb max_used=1273Kb free=244488Kb
 bounds [0x0000000003240000, 0x00000000034b0000, 0x0000000012240000]
 total_blobs=398 nmethods=120 adapters=191
 compilation: enabled

Compilation events (10 events):
Event: 0.411 Thread 0x0000000016ad5800  116       3       java.lang.StringCoding::access$300 (8 bytes)
Event: 0.411 Thread 0x0000000016ace800  117       4       java.lang.Math::min (11 bytes)
Event: 0.412 Thread 0x0000000016ace800 nmethod 117 0x000000000337ea90 code [0x000000000337ebc0, 0x000000000337ec18]
Event: 0.412 Thread 0x0000000016ad5800 nmethod 116 0x000000000337e190 code [0x000000000337e320, 0x000000000337e848]
Event: 0.416 Thread 0x0000000016ad5800  118       3       java.util.BitSet::checkInvariants (111 bytes)
Event: 0.416 Thread 0x0000000016ad5800 nmethod 118 0x000000000337de50 code [0x000000000337dfa0, 0x000000000337e130]
Event: 0.454 Thread 0x0000000016ad5800  119       1       java.net.URL::getFile (5 bytes)
Event: 0.454 Thread 0x0000000016ad5800 nmethod 119 0x000000000337db90 code [0x000000000337dce0, 0x000000000337ddf0]
Event: 0.454 Thread 0x0000000016ad5800  120       3       sun.nio.cs.UTF_8$Encoder::encode (359 bytes)
Event: 0.455 Thread 0x0000000016ad5800 nmethod 120 0x000000000337c810 code [0x000000000337ca00, 0x000000000337d518]

GC Heap History (0 events):
No events

Deoptimization events (0 events):
No events

Internal exceptions (6 events):
Event: 0.051 Thread 0x0000000003140800 Exception <a 'java/lang/NoSuchMethodError': Method sun.misc.Unsafe.defineClass(Ljava/lang/String;[BII)Ljava/lang/Class; name or signature does not match> (0x00000000e0907ca8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\
Event: 0.051 Thread 0x0000000003140800 Exception <a 'java/lang/NoSuchMethodError': Method sun.misc.Unsafe.prefetchRead(Ljava/lang/Object;J)V name or signature does not match> (0x00000000e0907f90) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims
Event: 0.186 Thread 0x0000000003140800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e0a45f20) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jvm.cpp, line 1390]
Event: 0.186 Thread 0x0000000003140800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e0a46130) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jvm.cpp, line 1390]
Event: 0.187 Thread 0x0000000003140800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e0a49da0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jvm.cpp, line 1390]
Event: 0.187 Thread 0x0000000003140800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e0a49fb0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jvm.cpp, line 1390]

Events (10 events):
Event: 0.416 loading class sun/net/www/protocol/jar/JarFileFactory
Event: 0.417 loading class sun/net/www/protocol/jar/URLJarFile$URLJarFileCloseController
Event: 0.417 loading class sun/net/www/protocol/jar/URLJarFile$URLJarFileCloseController done
Event: 0.417 loading class sun/net/www/protocol/jar/JarFileFactory done
Event: 0.417 loading class sun/net/www/protocol/jar/URLJarFile
Event: 0.417 loading class sun/net/www/protocol/jar/URLJarFile done
Event: 0.417 loading class sun/net/www/protocol/jar/URLJarFile$URLJarFileEntry
Event: 0.418 loading class sun/net/www/protocol/jar/URLJarFile$URLJarFileEntry done
Event: 0.418 loading class sun/net/www/protocol/jar/JarURLConnection$JarURLInputStream
Event: 0.418 loading class sun/net/www/protocol/jar/JarURLConnection$JarURLInputStream done

Dynamic libraries:
0x00007ff76c2d0000 - 0x00007ff76c307000     C:\ProgramData\Oracle\Java\javapath\java.exe
0x00007ff9e7a30000 - 0x00007ff9e7c01000     C:\Windows\SYSTEM32\ntdll.dll
0x00007ff9e6e70000 - 0x00007ff9e6f1b000     C:\Windows\System32\KERNEL32.DLL
0x00007ff9e43b0000 - 0x00007ff9e45cd000     C:\Windows\System32\KERNELBASE.dll
0x00007ff9e7980000 - 0x00007ff9e7a22000     C:\Windows\System32\ADVAPI32.dll
0x00007ff9e4fd0000 - 0x00007ff9e506e000     C:\Windows\System32\msvcrt.dll
0x00007ff9e6d50000 - 0x00007ff9e6da9000     C:\Windows\System32\sechost.dll
0x00007ff9e6f30000 - 0x00007ff9e7051000     C:\Windows\System32\RPCRT4.dll
0x00007ff9e5070000 - 0x00007ff9e51d5000     C:\Windows\System32\USER32.dll
0x00007ff9e4020000 - 0x00007ff9e403e000     C:\Windows\System32\win32u.dll
0x00007ff9e52e0000 - 0x00007ff9e5314000     C:\Windows\System32\GDI32.dll
0x00007ff9e46f0000 - 0x00007ff9e4872000     C:\Windows\System32\gdi32full.dll
0x00007ff9d79f0000 - 0x00007ff9d7c69000     C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.14393.447_none_42191651c6827bb3\COMCTL32.dll
0x00007ff9e6920000 - 0x00007ff9e6be8000     C:\Windows\System32\combase.dll
0x00007ff9e3f20000 - 0x00007ff9e4015000     C:\Windows\System32\ucrtbase.dll
0x00007ff9e45d0000 - 0x00007ff9e463a000     C:\Windows\System32\bcryptPrimitives.dll
0x00007ff9e7510000 - 0x00007ff9e753e000     C:\Windows\System32\IMM32.DLL
0x0000000050410000 - 0x00000000504e2000     C:\Program Files\Java\jre1.8.0_121\bin\msvcr100.dll
0x0000000076c80000 - 0x000000007751b000     C:\Program Files\Java\jre1.8.0_121\bin\server\jvm.dll
0x00007ff9e4fc0000 - 0x00007ff9e4fc8000     C:\Windows\System32\PSAPI.DLL
0x00007ff9cce30000 - 0x00007ff9cce39000     C:\Windows\SYSTEM32\WSOCK32.dll
0x00007ff9d24d0000 - 0x00007ff9d24da000     C:\Windows\SYSTEM32\VERSION.dll
0x00007ff9e1c70000 - 0x00007ff9e1c93000     C:\Windows\SYSTEM32\WINMM.dll
0x00007ff9e7120000 - 0x00007ff9e718a000     C:\Windows\System32\WS2_32.dll
0x0000000001250000 - 0x000000000127b000     C:\Windows\SYSTEM32\WINMMBASE.dll
0x00007ff9e4360000 - 0x00007ff9e43a2000     C:\Windows\System32\cfgmgr32.dll
0x0000000050400000 - 0x000000005040f000     C:\Program Files\Java\jre1.8.0_121\bin\verify.dll
0x00000000503d0000 - 0x00000000503f9000     C:\Program Files\Java\jre1.8.0_121\bin\java.dll
0x00000000503b0000 - 0x00000000503c6000     C:\Program Files\Java\jre1.8.0_121\bin\zip.dll
0x00007ff9e5390000 - 0x00007ff9e6899000     C:\Windows\System32\SHELL32.dll
0x00007ff9e48e0000 - 0x00007ff9e4fba000     C:\Windows\System32\windows.storage.dll
0x00007ff9e3eb0000 - 0x00007ff9e3efc000     C:\Windows\System32\powrprof.dll
0x00007ff9e6db0000 - 0x00007ff9e6e02000     C:\Windows\System32\shlwapi.dll
0x00007ff9e3e90000 - 0x00007ff9e3e9f000     C:\Windows\System32\kernel.appcore.dll
0x00007ff9e4640000 - 0x00007ff9e46e9000     C:\Windows\System32\shcore.dll
0x00007ff9e3f00000 - 0x00007ff9e3f14000     C:\Windows\System32\profapi.dll
0x00007ff9e3900000 - 0x00007ff9e3917000     C:\Windows\SYSTEM32\CRYPTSP.dll
0x00007ff9e3370000 - 0x00007ff9e33a3000     C:\Windows\system32\rsaenh.dll
0x00007ff9e3dd0000 - 0x00007ff9e3dfb000     C:\Windows\SYSTEM32\bcrypt.dll
0x00007ff9e35e0000 - 0x00007ff9e35ff000     C:\Windows\SYSTEM32\USERENV.dll
0x00007ff9e3dc0000 - 0x00007ff9e3dcb000     C:\Windows\SYSTEM32\CRYPTBASE.dll
0x0000000050390000 - 0x00000000503aa000     C:\Program Files\Java\jre1.8.0_121\bin\net.dll
0x00007ff9e3760000 - 0x00007ff9e37bc000     C:\Windows\system32\mswsock.dll
0x00007ff9e34f0000 - 0x00007ff9e3528000     C:\Windows\SYSTEM32\IPHLPAPI.DLL
0x00007ff9e7540000 - 0x00007ff9e7548000     C:\Windows\System32\NSI.dll
0x00007ff9de300000 - 0x00007ff9de316000     C:\Windows\SYSTEM32\dhcpcsvc6.DLL
0x00007ff9de130000 - 0x00007ff9de14a000     C:\Windows\SYSTEM32\dhcpcsvc.DLL
0x0000000050370000 - 0x0000000050381000     C:\Program Files\Java\jre1.8.0_121\bin\nio.dll
0x000000006b600000 - 0x000000006b62f000     C:\Users\Kartik\AppData\Local\Temp\usb4java8817590672826132258.tmp\libusb-1.0.dll
0x0000000070880000 - 0x0000000070897000     C:\Users\Kartik\AppData\Local\Temp\usb4java8817590672826132258.tmp\libusb4java.dll
0x00007ff9d6d70000 - 0x00007ff9d6f02000     C:\Windows\SYSTEM32\dbghelp.dll

VM Arguments:
java_command: Test
java_class_path (initial): commons-lang3-3.2.1.jar;libusb4java-1.2.0-linux-arm.jar;libusb4java-1.2.0-linux-x86.jar;libusb4java-1.2.0-linux-x86_64.jar;libusb4java-1.2.0-osx-x86.jar;libusb4java-1.2.0-osx-x86_64.jar;libusb4java-1.2.0-windows-x86.jar;libusb4java-1.2.0-windows-x86_64.jar;libusb4java-1.2.0-windows-x86_64.jar;usb4java-1.2.0.jar;
Launcher Type: SUN_STANDARD

Environment Variables:
PATH=C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Users\Kartik\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Java\jdk1.8.0_121\bin;
USERNAME=Kartik
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel

---------------  S Y S T E M  ---------------

OS: Windows 10.0 , 64 bit Build 14393 (10.0.14393.0)

CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 58 stepping 9, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, clmul, erms, ht, tsc, tscinvbit, tscinv

Memory: 4k page, physical 6178072k(2690428k free), swap 10372376k(4202880k free)

vm_info: Java HotSpot(TM) 64-Bit Server VM (25.121-b13) for windows-amd64 JRE (1.8.0_121-b13), built on Dec 12 2016 18:21:36 by "java_re" with MS VC++ 10.0 (VS2010)

time: Thu Feb 16 13:23:11 2017
elapsed time: 0 seconds (0d 0h 0m 0s)

So, usb4java is not working for me, and I would prefer not to have to debug the above error.

nyholku commented 7 years ago

As I don't think there is a PureJavaHidApi problem, seems to work as intended, and what the OP is trying to achieve is probably not possible with PureJavaHidApi I'm closing this now. Feel free to re-open if there is something you think I can work on.