You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. In 32-bit Linux, attempt to open a device when there are none plugged into
the system. I tried both OpenJDK and Oracle JREs. The issue is not present on
my 64-bit Windows machine.
The line:
for(HIDDeviceInfo d : devs)
throws a NullPointerException because listDevices() returns null.
I fixed the problem by changing to the source code:
public HIDDevice openById(int vendor_id, int product_id, String serial_number)
throws IOException, HIDDeviceNotFoundException
{
HIDDeviceInfo[] devs = listDevices();
if(devs == null)
{
throw new HIDDeviceNotFoundException();
}
else
{
for(HIDDeviceInfo d : devs)
{
if(d.getVendor_id() == vendor_id && d.getProduct_id() == product_id && (serial_number == null || d.getSerial_number().equals(serial_number)))
return d.open();
}
throw new HIDDeviceNotFoundException();
}
}
Original issue reported on code.google.com by [email protected] on 23 Nov 2013 at 5:01
The text was updated successfully, but these errors were encountered:
The code above works for me.
64-bit Linux (Ubuntu 14.04)
Oracle JRE 1.80_05-b13
Also had a problem with NullPointerException. But the reason wasn't a
non-plugged HID device.
My application was not able to access the hid device. Only root may read/write
access usb devices under linux. A udev rule in /etc/udev/rules.d was the
solution, and grants application running as user of the group "beef" read-write
permissions.
SUBSYSTEM=="usb", ATTRS{idVendor}=="1234", ATTRS{idProduct}=="4321",
GROUP="beef", MODE="0664"
Original issue reported on code.google.com by
[email protected]
on 23 Nov 2013 at 5:01The text was updated successfully, but these errors were encountered: