Announce Pure Java HIDAPI

Hi,

I thought this might be of interest to some in the Java Gaming community.

I’ve written a Crossplatform (Mac OS X, Linux, Windows) library to access USB HID devices.

It is called PureJavaHIDAPI and you can find it here:

Maybe not the way to go if you want interface with your joystick (though I’ve successfully communicated with a cheap Chinese generic USB Gamepad with it) but if you need talk to some exotic I/O device that represents itself as HID, this is an easy to deploy alternative with minimal impact for the end users, no drivers or libraries to install, just include/embed a jar or two with your Java code.

It is free in every sense of the word and BSD licensed so should good for both open source and proprietary code development.

Thanks for your attention.

br Kusti

Excellent work!

Cheers,

Kev

Hi

Good job. Please add a license file into your project so that there is no doubt about it. Usually, we put a LICENSE.txt file into the root directory of the project.

This is absolutely awesome. It seems likes you are interacting with the kernel which takes a lot of skill, and you did it well. +1

Thanks for the kind words!

@ gouessej

And yeah, I forgot to include the license file, will add asap.

@ lcass

I can’t take ALL the credit for the details of interacting with the Operating Systems as I was able stand on the shoulder of HIDAPI creator.

I thought I read here a few hours ago that the api was not pure java but actually used JNA. Is that the case? Seems strange if those posts were deleted? Or am I going mad? ???

Riven cleaned up a large digression on the subject. Short story: it’s not "Pure Java"TM, it requires JNA.

Cas :slight_smile:

@nyholku Why do you use udev (instead of evdev) under GNU Linux? udev is in systemd whereas not all distros support it.

@ gouessej

Why udev?

Cause I don’t know any better, I’m no Linux guru, most of the principles used ( but not the code) were lifted from the successful and popular signal11 / HIDAPI which uses udev.

Who am I to disagree with the gurus :wink:

If this proves a problem for me or someone contributes or helps with the changes I happy incorporate both.

br Kusti

PS @ princec

without opening the pandora box again I would add that I never said it was Pure Java ™, I just misappropriated the words Pure Java and for the record I think the official name for the Oracle/Sun (if it is indeed trademark) is 100% Pure Java. And yes the code is pure Java but it uses JNA which in view of the Oracle/Sun 100% Pure Java certification makes this code un-pure. And of course it uses some native librarires, there is no other way AFAIK, but the native libraries are included in your favourite OS.

JNA is not included in the OS though! That was the crux of my issue before (not the stoopid “pure” argument :wink: ), but making sure people were clear it needs JNA, which is a native library. Just linking in the JNA jar works most of the time, but there can be issues with the automatic extraction of the native libs. Don’t get me wrong, I like JNA and have made some minor contribution to it, but it’s not always headache free to bring into a project.

Incidentally, on some Linux (eg. recent Ubuntu’s), installing things like VisualVM will bring in an old version of JNA to the OS that would stop your code working unless it’s setting jna.nosys. OTOH, forcing extraction won’t work on some systems. NetBeans actually uses a renamed JNA native lib to get around both those issues.

@ nsigma

Yeah, agreed, that is a valid point and it was good that you brought it up.