-
Notifications
You must be signed in to change notification settings - Fork 75
Closed
Labels
Description
I have a Java program using Hid4Java that runs successfully on macOs and Windows 10, but fails on Mint Linux 19 when it tries to open() the device. Here is printout from test code when run on these three operating systems:
macOs 10.14.6
VID PID - Description - Manf - Serial Num - Can open
03EB:2141 - Atmel-ICE CMSIS-DAP - Atmel Corp. - J41800089996 - yes
Microsoft Windows [Version 10.0.19041.508]
03EB:2141 - Atmel-ICE CMSIS-DAP - Atmel Corp. - J41800089996 - yes
Mint Linux, version="19 (Tara)", 4.15.0-118-generic
03EB:2141 - Atmel-ICE CMSIS-DAP - Atmel Corp. - J41800089996 - no
The troubleshooting section does not seem to cover Mint Linux, but I tried the advice given for Ubuntu and created a rules file in /etc/udev/rules.d/ that contains:
KERNEL=="hidraw*", ATTRS{idVendor}=="03EB", ATTRS{idProduct}=="2141", MODE="0666", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl"
Then, used the following commands to verify the "plugdev" group:
$ groups
parallels adm cdrom sudo dip plugdev lpadmin sambashare
$ whoami
parallels
$ groups parallels
parallels : parallels adm cdrom sudo dip plugdev lpadmin sambashare
What am I missing?
Wayne
p.s. these test code I used is, as follows:
import org.hid4java.*;
public class ListHIDDevices {
public static void main(String[] args) throws HidException {
HidServicesSpecification hidServicesSpecification = new HidServicesSpecification();
hidServicesSpecification.setAutoShutdown(true);
hidServicesSpecification.setScanInterval(500);
hidServicesSpecification.setPauseInterval(5000);
hidServicesSpecification.setScanMode(ScanMode.SCAN_AT_FIXED_INTERVAL_WITH_PAUSE_AFTER_WRITE);
HidServices hidServices = HidManager.getHidServices(hidServicesSpecification);
hidServices.start();
System.out.printf(" %-3s %-3s - %-30s - %-20s - %-15s - %-10s\n", "VID", "PID", "Description", "Manf", "Serial Num", "Can open");
for (HidDevice hidDevice : hidServices.getAttachedHidDevices()) {
String manf = hidDevice.getManufacturer().trim();
String prod = hidDevice.getProduct();
int vendor = hidDevice.getVendorId();
int product = hidDevice.getProductId();
String serialNum = hidDevice.getSerialNumber();
serialNum = serialNum != null ? serialNum : "";
System.out.printf("%04X:%04X - %-30s - %-20s - %-15s", vendor, product, prod, manf, serialNum);
if (hidDevice.isOpen()) {
System.out.print(" - open");
} else if (hidDevice.open() && hidDevice.isOpen()) {
hidDevice.setNonBlocking(true);
System.out.print(" - yes");
hidDevice.close();
} else {
System.out.print(" - no");
}
System.out.println();
}
hidServices.shutdown();
}
}