hid4java
hid4java copied to clipboard
Support RPi OS "bullseye" aarch64; support old glibc versions
Is your feature request related to a problem? Please describe. First of all, thanks for creating this; very close to what I am looking for.
I just started playing around with this trying to get rid of some native code (a C REST server and a JNI shared library) which is using libusb/hidapi-0.14.0 directly and implements higher-level functionality on top of our custom inhouse HID report format protocol (exchange of 64 byte reports with a custom device).
It works out of the box on Windows 10 x64 and Ubuntu 22.04 which are my dev environments. Unfortunately my target is RPi (Raspberry Pi) OS buster, armhf (yes it's a bit old... it's out in the field, tricky to update...). My other rpi target is rpi bullseye (bookworm works) on aarch64 architecture and this is the one that's making problems.
Describe the solution you'd like
- You support platform RPi OS "bullseye" aarch64 (and "buster" armhf version - this already works).
Describe alternatives you've considered I imagine it might be a JNA issue, but I really only care about doing USB HID, these technicalities are just a (necessary...) evil, so I reported my issue here where I see it.
Possible alternatives:
- Build native JNA and hidapi stuff that is required just for myself.
- Build my own simple JNI based wrapper around hidapi. Something like that already exists in my context, but it contains a lot of high-level details about our proprietary usb hid protocol (meaning of the exchanged reports), implemented on top of the hidapi in native code and this high-level stuff I would prefer to do in Java.
I would prefer a community effort where a solution is included in the next maven central release of this library for everyone to benefit from. I see no reason this library should not be as backwards-compatible as possible. I would like to help, but I need to be pointed into the right direction. I am familiar with make, cmake, gcc (vaguely with glibc and incompatibilities there...) and JNI, but not JNA or how this library handles the low-level stuff.
Additional context right now I only have access to an RPi 4 running bullseye aarch64, but I expect the same problem on the even older platform:
system information:
pi@usbmux1:~ $ cat /sys/firmware/devicetree/base/model
Raspberry Pi 4 Model B Rev 1.5
pi@usbmux1:~ $ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
pi@usbmux1:~ $ uname -m
aarch64
pi@usbmux1:~ $ ldd --version ldd
ldd (Debian GLIBC 2.31-13+rpt2+rpi1+deb11u5) 2.31
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
pi@usbmux1:~ $ java -version
openjdk version "11.0.23" 2024-04-16
OpenJDK Runtime Environment (build 11.0.23+9-post-Debian-1deb11u1)
OpenJDK 64-Bit Server VM (build 11.0.23+9-post-Debian-1deb11u1, mixed mode)
observed behavior:
pi@usbmux1:~ $ java -cp hid4java-test-1.0-SNAPSHOT-jar-with-dependencies.jar -ea org.example.Main
Hello and welcome!
2024-05-24T21:01:47.644892Z main WARN Runtime environment or build system does not support multi-release JARs. This will impact location-based features.
2024-05-24T23:01:47,635 INFO [main] org.example.Main - Hello and welcome!
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.example.Main.main(Main.java:22)
Caused by: org.hid4java.HidException: Hidapi did not initialise: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /home/pi/.cache/JNA/temp/jna512391573883764077.tmp)
at org.hid4java.HidDeviceManager.<init>(HidDeviceManager.java:87)
at org.hid4java.HidServices.<init>(HidServices.java:81)
at org.hid4java.HidManager.getHidServices(HidManager.java:72)
at org.example.tihidapi.impl.hid4java.TiHidSessionFactoryHid4JavaImplementation.<clinit>(TiHidApiSessionFactoryHid4JavaImplementation.java:25)
... 1 more
Caused by: java.lang.UnsatisfiedLinkError: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /home/pi/.cache/JNA/temp/jna512391573883764077.tmp)
at com.sun.jna.Native.open(Native Method)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:300)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:481)
at com.sun.jna.Library$Handler.<init>(Library.java:197)
at com.sun.jna.Native.load(Native.java:618)
at com.sun.jna.Native.load(Native.java:592)
at org.hid4java.jna.HidrawHidApiLibrary.<clinit>(HidrawHidApiLibrary.java:37)
at org.hid4java.jna.HidApi.init(HidApi.java:123)
at org.hid4java.HidDeviceManager.<init>(HidDeviceManager.java:84)
this is just a simple example application that tries to init hid4java and open a device and talk to it a bit.