Fix hang in TX when a libusb error occurs.

Where our callback is called with a status other than COMPLETED,
something abnormal has happened and we no longer want to either
submit further transfers or await a flush. So clear the streaming
and flush flags, and proceed to transfer_finished.

Do the same in the case where libusb_submit_transfer fails when
called to submit the flush transfer.
This commit is contained in:
Martin Ling
2022-09-20 02:07:21 +01:00
parent c487e3f6b1
commit e53b9d5717

View File

@ -1830,8 +1830,15 @@ hackrf_libusb_transfer_callback(struct libusb_transfer* usb_transfer)
if (resubmit && result == LIBUSB_SUCCESS)
return;
} else if (device->flush) {
libusb_submit_transfer(device->flush_transfer);
result = libusb_submit_transfer(device->flush_transfer);
if (result != LIBUSB_SUCCESS) {
device->streaming = false;
device->flush = false;
}
}
} else {
device->streaming = false;
device->flush = false;
}
// Unless we resubmitted this transfer and returned above,