Hi,
I got another problem.
I used a loop to receive data from the device with asyncSubmit().It is like:
While(iRet != SOMEVALUE){
Byte[] bufferIn = new byte[512];
irpIn.setData(bufferIn);
usbPipeIn.asyncSubmit(irpIn);
irpIn.waitUntilCompleted(1000);
iRet = analysisBuffer(bufferIn);
}
Sometimes the device will reboot itself, and before it reboots, it will send
some data to the usbPipe. However, I cannot get the data with asyncSubmit()
function. Every time it will throw an exception saying that the device cannot
connect.
But, in the same code, when I use syncSubmit(), I can get the data sent by the
device. It seems that the function waitUntilCompleted() cost some time, which
makes the data lost.
I cannot use syncSubmit() to substitute asyncSubmit(), because if there is no
data come back ,syncSubmit() will block forever.
So, how to make the asyncSubmit() work? Maybe, adding a usbPipeListener is a
good idea, but I do not know how to use it. Anyone can show me a sample?
Thank you very much!
Regards.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
javax-usb-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel