USB: 64 byte packet read limit = Poor Performance ! But larger size does not work

I have developed a simple USB device driver that has a Bulk IN and Bulk
Out pipe to communicate with a camera. The driver works fine at this
point, I can send and recieve data over the pipes reliably.

When I first started working on the driver, I noticed that I had
problems reading data from the device in anything other than 64 byte
chunks. So as a temporary fix, I put code in the application to only
read data from the driver in 64 byte chunks.

Now I want to increase this to something that will speed things up. It
seems that no matter what value I use (Other than 64) I get very strange
results. Most of the time I will be able to read almost all of the data
I am expecting, and then when I attempt to make a final read on the
remainer by read never returns.

So for example:

My protocol requires me to do an initial read of 64 bytes, which the
first 4 are the total size of the transfer (And I buffer the other 60

So my read sequence is as follows

  1. Read 64 bytes, figure out size of the entire transfer (Have to read
    entire 64 byte packet, cant just read 4 bytes). Save the 64 byte packet,
    being sure to account for the fact that the first 64 bytes of the
    transfer have been read already.

  2. Loop, reading from the driver in specified 2048 byte chunks until
    there is less than 2048 bytes left to read. This leftover is
    pre-computed and is the remainder.

  3. Read the remainder bytes (< 2048).

Now -

When I read the remainer, I never complete the read. My driver sends the
URB down to the bus driver, and it never gets back.

If I apply the above algorithm, but use 64 byte chunks instead of 2048
byte chunks it works perfectly.

Any Ideas ??

Are there any tools that I can run on the host to really take a good
close look at what is going on with my IN pipe, and what my device is
sending me and what the Microsoft USBDI is doing with my requests ! I’d
really like to be able to do the math as to what I think I should be
reading, what I have read so far and what the USB device has send me so
far for a given I/O transaction.

Thanks in advance !