Hi there, I've a doubt related to a scanner device I'm accessing to through the javax-usb API. To send to device the bytes that order it starts image scanning works fine. I use syncSubmit in its OUT PIPE and the scanner works fine!! The matter is that, when retrieving the image, I use different UsbIrps (one per image chunk I retrieve), but the problem is that I have NO way to know when to stop requesting bytes. Is there any way to resolve when the device has no data to send? Is it correct to assume that an UsbIrp with actualLenght set as zero would mean that there's nothing else to send?
Is this piece of code correct? do { //IN PIPE (device to host) UsbIrp usbIrp = inPipe.createUsbIrp(); usbIrp.setAcceptShortPacket( true ); usbIrp.setLength( 1024 ); usbIrp.setOffset( 0 ); usbIrp.setData ( new byte[ 1024 ] ); try { //SYNC REQUEST: Locked till device response!! inPipe.syncSubmit( usbIrp ); } catch ( Exception e ) { printStackTrace( e ); } //Storing image data for later use!! buffer.append ( usbIrp.getData() ); } while ( usbIrp.getActualLength () != 0); Thanks in advance ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ javax-usb-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/javax-usb-devel