On 07/12/2013 09:44 AM, Johnson Z. wrote:
> :) Klaus, is there any bug in my read-data-code?
Sorry, I don't see an error.
> i think i cld a have a final fight for this issue: modify the jni with
> offcial dirver from usb vendor. but i am not sure is there a
> c-implemented dirver for my cypress usb device or not.
You mean modifying the JNI code of usb4java to use a special device
driver? This makes no sense. usb4java implements generic USB
functionality while a specific device driver implements a specific
device protocol. So in this case it makes more sense to write your own
JNI or JNA wrapper around the device driver if generic USB stuff fails.
You no longer need usb4java then.
But before you do this you could try writing a small test program which
directly uses libusb. If this works, then it would be good base to find
the problem in usb4java if there is one. If this also fails then it is a
good indicator that you are communicating with the device in the wrong
way (Maybe some other command must be sent to it before you can read
from it?). And if you are absolutely sure that you are communicating
correctly with the device but it still fails with native libusb then you
might find help on the libusb mailing list (And there are the *REAL* USB
gurus).
Another thing you might try: If you have access to a linux system maybe
you can try your Java program there? libusb works best on Linux. If your
program runs there then this is a good indicator that your program works
correctly and we have some windows problem with libusb here.