Get error java.io.IOException: The parameter is incorrect -


i use hidapi-jni.dll/hidapi-jni.so , write program in java read , write data device. device defined hid device. code run on linux (debian 7.1) , can read , write data from/to device. on windows (windows 7 , xp) can read data , when try write error:

java.io.ioexception: parameter incorrect. 

one part of write method is:

try {      hidmanager hid_mgr = hidmanager.getinstance();      dev = hid_mgr.openbyid(vendor_id, product_id, null);      byte[] = new byte[4];      by[0] = (byte) 1;      by[1] = (byte) 2;      by[2] = (byte) 3;      by[3] = (byte) 4;      dev.write(by);      } catch (ioexception | nullpointerexception ne) {      system.err.println(ne);      } 

how can fix error?

i found solution error. in windows first byte 0. code is:

by[0] = 0; 

and if write via

dev.write(by); 

work correctly.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -