-
Notifications
You must be signed in to change notification settings - Fork 71
- Frequently asked questions (FAQ)
(This ToC is generated by ToC Generator Script)
The current source and target code levels are for Java 8 and above.
Historically this choice was first made when the library was originally written in 2014. At that time Java 7 was the latest and greatest. However issue #11 requested backporting to Java 6 to allow compatibility with older environments. This involved rewinding the JNA library to an earlier version which worked up until 2020 when I was able to revisit the project and perform various updates to fix bugs. This forced the migration from Java 6 (which had long since been EOL by Oracle).
While there are many interesting language features in later versions of Java I will resist the urge to upgrade as this library targets low level operations. Many in the hardware community are very conservative about upgrading to the new shiny unless absolutely necessary.
If you have a native version of hidapi
for your platform then you'll be able to support it.
Here is the current list of platform names with compiled binaries:
-
darwin-x86-64
- macOS 64-bit -
darwin-aarch64
- macOS ARM64 -
linux-aarch64
- Linux ARMv8 64-bit only -
linux-amd64
- Linux AMD 64-bit only -
linux-arm
- Linux ARMv7 hard float 32-bit only -
linux-armel
- Linux ARMv5 soft float 32-bit -
linux-riscv64
- Linux RISC-V 64-bit -
linux-x86-64
- Linux x86 64-bit only -
linux-x86
- Linux x86 32-bit only -
win32-x86
- Windows 32-bit only -
win32-x86-64
- Windows 64-bit only -
win32-aarch64
- Windows 64-bit ARM64
In the early days of the project there was some provision for Android but improvements to the accessibility of USB to the devices by the operating system have meant there is no real need for this library there.
Here is a USB HID driver provided by @Chakib-Temal with some discussion in issue #83
The usb4java project, while superb, does not support HID devices on macOS and apparently there are no plans to introduce HID support anytime soon.
You will find that trying to claim the USB device on macOS will fail with permissions problems. If you apply a workaround (such as adding a kernel extension) then it will still fall over just a little later in the process. The bottom line is that you must use the hidapi
native library to communicate with HID devices on macOS.
Yes. A typical entry in a downstream POM would be:
<dependencies>
<!-- hid4java for cross-platform HID USB -->
<dependency>
<groupId>org.hid4java</groupId>
<artifactId>hid4java</artifactId>
<version>0.8.0</version>
</dependency>
</dependencies>
The release deployment procedure follows the standard Maven release process and is based off the master
branch. You can find the latest release on the project README.
Updates to the develop-SNAPSHOT
code are pushed fairly regularly via develop
branch and act as a form of "pre-release" view of the upcoming code.
In many cases the code contained is not production ready, nor has it been comprehensively reviewed. Use it at your own risk.
<repositories>
<!-- Only include the snapshot repo if you're working with the latest hid4java on develop -->
<repository>
<id>hid4java-snapshot</id>
<url>https://repo.maven.apache.org/maven2</url>
<!-- These artifacts change frequently during development iterations -->
<snapshots>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<dependencies>
<!-- hid4java for cross-platform HID USB -->
<dependency>
<groupId>org.hid4java</groupId>
<artifactId>hid4java</artifactId>
<version>develop-SNAPSHOT</version>
</dependency>
</dependencies>
repositories {
mavenCentral()
}
dependencies {
implementation('org.hid4java:hid4java:develop-SNAPSHOT')
}
Yes. All artifacts are signed using my personal GPG key with fingerprint 59A81D7B
. You will need to download the JAR and ASC files from Maven Central, then issue the following GPG command:
gpg --verify hid4java-0.8.0.jar.asc hid4java-0.8.0.jar
You may need to import my public key beforehand.
The HidServices
entry class provides a method getVersion
which reads the version from the JAR manifest file. You can test it as follows:
mvn clean package
java -cp target/hid4java-develop-SNAPSHOT.jar org.hid4java.HidServices
The version will reflect what is in the pom.zml
so will only be a numeric triplet on the master
branch.