Sorry, didn't finish, clicked "send" by mistake. So step 2:

2. To read the data, get to the inbound endpoint, then

create instance of UsbPipeListener. Call it MyListener, for example. 

UsbPipe pipe = ep.getUsbPipe();
pipe.addUsbPipeListener(new MyListener());
UsbIrp irp = pipe.createUsbIrp();

byte buf[] = new byte[8];

while (true) {
  try {
    irp.setData(buf);
    irp.setComplete(false);
    pipe.syncSubmit(irp);
  } catch (UsbException e) {
    System.err.println(e.toString());
}

Now, step 1 and step 2 have to be on separate threads, 'cause I'm using
syncSubmit. You can use asyncSubmit but I've never tried. Also, stop 2 really
have to be executed before step 1. You should get callbacks in MyListener class
if everything is done correctly.



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel

Reply via email to