I am sure Roger and Boris can tell you much more than I can, but I will venture a guess that you haven't set up the device correctly. ISO is unlike other transfers, which the device can 'NAK' until its' ready to send info. For ISO, the device must send whatever it has, and NAK is not an option. If there isn't any data to send (e.g. if the device isn't set-up) then it will send 0 bytes data (or indicate an error, but it doesn't seem that's happening in your case...).
At a minimum, the USB spec states that an ISO device's default interface setting must have an ISO pipe maxPacketSize of 0 (meaning it can't transfer data!). So, you need to change interface settings to one with a non-zero maxPacketSize. However, this isn't always the case, as I have a ISO device whose maxPacketSize is 1023 (the largest). Not all device manufacturers decided to read the entire USB spec...;) On Sun, 16 Feb 2003, Aur=?iso-8859-1?Q?=E9lien GODIN?= wrote: >Thank you for your quick answers. > >Looking at your explanations, it seems that I had correctly written my code... but it >does not work yet. >Here are some more details. > >Actually, it seems that I receive some data through the isochronous pipe but when I >send it >to the component that aims to display the image, that does not look like an image at >all (rather like some noise !). >I checked by asking for the number of bytes that were transferred using the result of >"syncsubmit(byte[] data)". >"0" is always returned, so no data is actually sent from the WebCam to the host... > >Why is 0 byte always returned ? Why do I receive something anyway (even if it is not >correct) ? >And a second pipe (interrupt transfer mode) is open. I do not understand its use. > >In case it could be useful, I run the 0.9.3 version of javax.usb on my computer. > >Below, the code I use : > >--------------------------------------------------------- > >public class CameraDriver implements Runnable >{ > private UsbInterface uInterface; > private UsbPipe[] pipes; > > private CameraInterface ci; > > public CameraDriver(UsbDevice camera,CameraInterface camInterface) > //CameraInterface is a personal interface not belonging to the JDK... > { > ci = camInterface; > > UsbConfig config = camera.getActiveUsbConfig(); > uInterface = getUsbInterface(config); > > addListener(camera); > > try > { > uInterface.claim(); > } > catch(UsbException ue) > { > System.out.println(ue); > } > > pipes = getUsbPipes(uInterface); > > System.out.println("Debug : number of pipes in interface : >"+pipes.length); > > for(int i=0;i<pipes.length;i++) > { > try > { > pipes[i].open(); > > //the following two lines indicate which transfer mode is used >by the pipes > //it enables me to see that 2 pipes are open, the first one >using isochronous mode > //the second one using interrupt mode > > System.out.println("Debug : isochronous mode ? : >"+(pipes[i].getType()==UsbInfoConst.ENDPOINT_TYPE_ISOC)); > System.out.println("Debug : interrupt mode ? : >"+(pipes[i].getType()==UsbInfoConst.ENDPOINT_TYPE_INT)); > } > catch(UsbException ue) > { > System.out.println(ue); > } > } > Thread runningDriver = new Thread(this); > runningDriver.start(); > } > > public void run() > { > try > { > byte[] isoData = new byte[1023]; > > //from what I read, 1023 is the maximum number of bytes that can be >passed to the "syncSubmit()" method used below > //So, I need a second array, "image", that will actually contain the >whole image data. > > byte[] image = new byte[3*352*288]; > > //352*288*3 bytes > //corresponding to 352*288 images with 3 colors > //maybe it is not the right way to define the size of the byte array > //but I guess the size is not the important parameter for the moment, >is it ? > > while(true) > { > int isoResult = -1; > for(int i=0;i<300;i++) > > //100 arrays are needed to transfer 352*288 bytes > //or 3*100 to transfer 3*352*288 bytes corresponding to the 3 >color channels > > { > isoResult = pipes[0].syncSubmit(isoData); > > //the following loop only copies the data in >the "image" array > for(int j=0;j<1023;j++) > { > if(1023*i+j<3*352*288) //stops the >"for" loop if the size of the image is reached > { > image[1023*i+j] = isoData[j]; > } > else > { > break; > } > } > } > System.out.println("Debug : number of bytes >transferred through isochronous pipe: "+String.valueOf(isoResult)); > > //this always returns "0"... > > ci.setImage(image);//method defined in CameraInterface >that sends the image to a JFrame for displaying purposes > } > } > catch(UsbException ue) > { > System.out.println(ue+"\nMaybe a device was detached that >interrupted the submission"); > } > } > > private UsbInterface getUsbInterface(UsbConfig config) > { > //enumerates the interfaces that are within this UsbConfig > } > > private UsbPipe[] getUsbPipes(UsbInterface uInterface) > { > //returns the pipes connected to uInterface > } > > private void addListener(UsbDevice device) > { > //releases properly the inferface uInterface in case the UsbDevice is >detached > } >} > > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >javax-usb-devel mailing list >[EMAIL PROTECTED] >https://lists.sourceforge.net/lists/listinfo/javax-usb-devel > -- Dan Streetman [EMAIL PROTECTED] -------------------------------------------------- 186,282 miles per second: It isn't just a good idea, it's the law! ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ javax-usb-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/javax-usb-devel