On 15.04.2014 10:05, Fariz Siracli wrote:
> Mister Klaus, i will ask once more to pay attention to my work please. It
> will take just 10-15 minutes.
> I'm sending the log of sniffer of usb port(both-original program and my
> java sample) and my java code with output. Am i doing the process of
> communication in a right way ? or may be there is some error.
> Thanks in advance.
I have no experience in reverse-engineering USB device protocols so I
can't help you in deciphering the sniffer logs, sorry.
Looking at your code I don't see a problem. I don't know your device so
I can't tell if the response is correct or if you sent the correct data
to it. Only you can know this. But usb4java is used correctly here. You
have various data arrays (The "arrs" list) which you sent to the device.
And obviously this works correctly. You don't get an exception and
syncSubmit returns the correct number of sent bytes. In the read method
you create a new empty byte array with an initial size of 0 (Size is
increased by 1 on each iteration, actually I don't know if this is
intended, I see no sense in it) and then you read the data from the
device. And again this seems to work. You get no exception, you get the
correct size of read bytes (0 bytes in first iteration, 1 in second, 2
in third and so on) and your data array has data in it which must be
coming from the device because it can't appear magically out of nowhere.
The exception at the end of the output is a simple Java programming
error and has nothing to do with usb4java. You are trying to access the
20th data array from the "arrs" list but there are only 19 data arrays
in this list.
So from my point of view you are using usb4java correctly. If the result
of your program is not what you expect then I'm still pretty sure the
reason for this is the wrong communication with the device. And that's
something I can't help you with.