gs_libusb
gs_libusb copied to clipboard
Correctly limit pending requests
Failing for me due to accumulating large number of pending requests (over 30,000) and then printing libusb error.
Root cause is logic error in HandleEvents:
https://github.com/hcs64/gs_libusb/blob/45e7b5f254c2f7816d651cc7a18a6c37ba1e15b2/gscomms/gscomms.c#L708
void HandleEvents(gscomms * g, long timeout_ms, int max_pending_writes) {
if (g->writes_pending > max_pending_writes) {
Changing this if to be a while makes pending requests stablize at 256, slows down progress bar, but actually succeeds eventually.