Thanks for the capture! It looks to me like we did submit the bulk request before the exposure completed, which was the intent of my latest change...but it still didn't help a whole lot. I went and looked at one of the OCS dumps and notice a pattern.
When using OCS, there is a single bulk request made immediately after the exposure has begun (even for the 100s exposure that I'm looking at). The camera will respond in 2 seconds saying it doesn't have any data (URB status says -ENOENT) and then OCS will immediately send out another (single) bulk request again. This repeats until the capture has completed, at which point OCS will continue to submit bulk in requests and the camera will send the data.
The capture of our driver shows us sending 54 bulk in requests starting 29.2s after the 30s exposure has started. We (libusb) doesn't wait for a response before sending the next request. We get the first response from the camera 0.8s after we sent the first bulk in request. This is in line with the 2s request/response that is observed in OCS. The first response contains image data! But, the URB also shows -EREMOTEIO. I think this is a message that the USB layer thinks it's received all of the data that it's going to.
While writing this, I think I've figured out what's happened. libusb is submitted 54 bulk in requests because we told it we want 875328 bytes. Our URB size is 16k (I don't know what controls this yet), so it would take 53.4 urbs to store the data...which means 54. Instead of telling libusb to download all of the data at once, it seems we should do individual requests for each line. If only someone had mentioned that earlier
...
I just pushed some code that implements this.