codeminders / javahidapi

Java API for HID (Human Interface) Devices
Other
10 stars 7 forks source link

Different results for same code in OSX 10.7.5 vs. Windows XP #35

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Same java code in OSX 10.7.5 and Windows XP
2. On a call to write(), passing in a byte[] as a parameter.
3. On 10.7.5 all works fine, on Windows XP an exception is raised 
"The parameter is incorrect".

What is the expected output? What do you see instead?
I would expect to see the same result for both Mac and Windows

What version of the product are you using? On what operating system?
1.1

Please provide any additional information below.
Error happens on line 96 of the attached code.  Again it only throws the 
exception with Windows XP not OSX 10.7.5

Original issue reported on code.google.com by gbarna...@gmail.com on 17 Dec 2012 at 7:21

Attachments:

GoogleCodeExporter commented 9 years ago
This is directly related to Issue 34 but I will repeat my comment here.

Solved my issue.  I should have read the instructions better for the hidapi 
API. "The first byte of data[] must contain the Report ID. For devices which 
only support a single report, this must be set to 0x0." Somewhat in my defense 
it worked just fine without that in my OSX 10.7.5 environment. My Arduino 
device got the message fine and I was able to process the byte[] array from the 
first element byte[0]. However when I ran the .jar on my XP computer the HID 
interface was looking for that 0x0 first byte. All I needed to do was change 
the code to pass that as the first byte of the buffer and both the Windows and 
Mac saw the write request fine.

No custom install needed, all necessary files are in the hidapi-1.1.jar.  Just 
add it as a Referenced Library and you are good to go.

Original comment by gbarna...@gmail.com on 18 Dec 2012 at 4:46