title: Android USB host interrupt transfer: how to TX and RX at any time
body: <p>I'm trying to communicate with a USB device that uses interrupt transfer for communications.
  it is <em>not</em> a polled device, either side may send at any time. All the examples I find seem to be poll-response where you send data first, wait for the send to complete, then wait for the response, process it and then go back to sending data again.</p>
  
  <p>My code is modeled after the following which I found here on stackoverflow (I'm showing the original I based it on because my own code has a lot more going on and is less compact)</p>
  
  <pre><code>  boolean retval = request.queue(buffer, 1); 
      if (mConnection.requestWait() == request) { 
           // wait for confirmation (request was sent)
           UsbRequest inRequest = new UsbRequest(); 
           // URB for the incoming data
           inRequest.initialize(mConnection, mEndpointIn); 
           // the direction is dictated by this initialisation to the incoming endpoint.
           if(inRequest.queue(buffer, bufferMaxLength) == true){
                mConnection.requestWait(); 
                // wait for this request to be completed
                // at this point buffer contains the data received
           }
      }
  </code></pre>
  
  <p>The second requestWait() will block until something arrives, so I can't do another TX operation until I receive something!  What am I missing?</p>