On Tue, 9 Nov 2004, Navjot Singh wrote: >public byte[] submit(byte[] data){ > > create irp from in pipe. > create another thread that will call syncSubmit > start that thread. > sleep for 1s.
this is one way to do it; or, you could first add a UsbPipeListener and then asyncSubmit() one or more buffers (UsbIrps). In the listener, handle data-events, and resubmit buffers (UsbIrps) as they complete. > create irp from out pipe. > set 'data' to out irp. > outpipe.syncSubmit() > > get data from the thread (which *should* have been populated by now) the data from the in-pipe may not have come back yet, there may be a small delay. Assuming it's already come back is a race. You could use a looping check for firstUsbIrp.isComplete(), or use a listener to handle incoming data. > retrun data that's fetch from inpipe. > } > >public void run() run method for the class implementing Runnable >{ > do{ > inpipe.syncSubmit(inIRP); // will this block here before >checking isComplete()?? > } while(!inirp.isComplete()) > buffer = inIRP.getData(); syncSubmit will block until either the data has come back or there was an error. No need to loop or check isComplete, it is guaranteed to be complete (or to throw a UsbException). -- Dan Streetman [EMAIL PROTECTED] --------------------- 186,272 miles per second: It isn't just a good idea, it's the law! ------------------------------------------------------- This SF.Net email is sponsored by: Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux. http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click _______________________________________________ javax-usb-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/javax-usb-devel