Closed laborg closed 2 months ago
Thanks for reporting this. That code hasn't changed beyond documentation since inception so I'm inclined to suspect the underlying compilation of the hidapi
library.
Can you give some more detail on the following:
libusb
or hidraw
(default))udev
settings are correctlinux-aarch64
)linux-x86-64
If you have time, could you review issue #97 which provides a lot of information regarding Ubuntu and hidraw/libusb.
I didn't see anything related in #97, but I found out that in version 0.7 linux-x86-64\libhidapi-libusb.so
and linux-x86-64\libhidapi.so
are binary equal and are actually the libusb backend build. So the "regression" stems from the fact there was a build bug in 0.7 which resulted in only one linux backend for 64bit (not 32!): libusb.
Finding out why I can't open devices using the linux backend will need to be investigated further.
Success! With the correct udev rule it finally worked:
KERNEL=="hidraw*", ATTRS{idVendor}=="XXXX", ATTRS{idProduct}=="YYYY", TAG+="uaccess"
(where XXXX and YYYY are, of course, the corresponding vendor and product ids). This is from https://github.com/libsdl-org/SDL/blob/main/src/hidapi/udev/69-hid.rules. Other udev recommendations floating around (ATTRS{busnum}="X"
) didn't work for me.
I'm glad you got to the bottom of this issue. Was the wiki Troubleshooting section any help? See https://github.com/gary-rowe/hid4java/wiki/Troubleshooting#how-usb-devices-are-mapped-in-linux
Describe the problem A USB hardware device which can be opened with version 0.7 can't be opened with 0.8.
To Reproduce
open(String path)
fromHidApi.java
https://github.com/gary-rowe/hid4java/blob/abb9c7f17adcb1e8a006d56cecf1b6dfdbf59875/src/main/java/org/hid4java/jna/HidApi.java#L147C1-L147C51Expected behavior Do not return null.
Platform:
hid4java
Version 0.8.0Additional information The underlying hidapi library version 0.14.0 works in for the same device in Julia (https://julialang.org/), where I maintain the wrapper (https://github.com/laborg/HidApi.jl), so I think this is not a problem with hidapi 0.14.0.