hid4java icon indicating copy to clipboard operation
hid4java copied to clipboard

On Ubuntu 22.04 64bit `WideStringBuffer` is not applicable for `hid_error`

Open laborg opened this issue 1 year ago • 0 comments
trafficstars

While investigating https://github.com/gary-rowe/hid4java/issues/148 I found out that the following code doesn't work for hid_error() (spacing should be four bytes instead of two):

https://github.com/gary-rowe/hid4java/blob/672f0a7adaeac0ae9ead2cca32548ed0974886c6/src/main/java/org/hid4java/jna/WideStringBuffer.java#L59

System:

... (master*) » lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.4 LTS
Release:	22.04
Codename:	jammy

... (master*) » uname -a
Linux e15 5.19.0-50-generic #50-Ubuntu SMP PREEMPT_DYNAMIC Mon Jul 10 18:24:29 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

In linux/hidapi.c the returned string is created with L"Success" which apparently uses a different encoding as all the other string IO calls (e.g. get_serial_number(...)) .

laborg avatar May 03 '24 06:05 laborg