Charles Chen wrote:

Dan,
I pasted the specifications of my USB device below. And the time for submitting 40 and 80 Irps are approximately 480 and 960 ms. It looks like 12 ms is still needed per irp. I used one of the alternate interface settings, which has IN iso endpoint. And thanks to your help before, I can submit various audio class requests to the device to play with the settings of Mute, Volume, Automatic Gain, and Sampling Frequency. I am not sure what specific settings I have to make to make iso transfer work?

Could you show some more of your code? I use a xanboo device for video and with it i get close to 100% utilization of the USB capacity.

In my code I have two buffers of 20 IRPs each, built like this. (queue is an array of List with length 2).

    public void init() {
       int maxVideoPacketSize = pipe.getUsbEndpoint()
               .getUsbEndpointDescriptor().wMaxPacketSize();
       for (int i = 0; i < queue.length; i++) {
           queue[i] = new ArrayList(WORKING_PACKETS);
           for (int j = 0; j < WORKING_PACKETS; j++) {
               byte[] dataPacket = new byte[maxVideoPacketSize];
               UsbIrp irp = new DefaultUsbIrp(dataPacket, 0,
                       dataPacket.length, true);
               queue[i].add(irp);
           }
       }
   }

Then when running I start with submitting both lists and then wait for the IRPs of queue [0] and process them as they come back in. Once processed I resubmit the list and start processing queue[1]. Once all there is presessed I resubmit those IRPs and then restart with queue[0]. Something like:

   public void run() {
       for (int i = 0; i < queue.length; i++) {
           try {
               pipe.asyncSubmit(queue[i]);
           } catch (UsbException ue) {
               ue.printStackTrace();
           }
       }

       while (keepRunning) {
           try {
for (int index = 0; index < queue[queueIndex].size(); index++) {
                   DefaultUsbIrp irp = (DefaultUsbIrp) queue[queueIndex]
                           .get(index);
                   irp.waitUntilComplete();
                   consume(irp.getData(), irp.getActualLength());
                   irp.setComplete(false);
                   irp.setActualLength(0);
               }
               pipe.asyncSubmit(queue[queueIndex]);
               queueIndex++;
               queueIndex %= queue.length;
           } catch (UsbException ue) {
               ue.printStackTrace();
           }
       }
   }

//Roger Lindsjö


-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
javax-usb-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel

Reply via email to