Simplify hackrf_libusb_transfer_callback.
There are now only two possible outcomes to this function: either we successfully resubmitted a transfer, or the transfer is finished and we end up calling transfer_finished(). So we can go ahead and simplify it accordingly.
This commit is contained in:
@ -1755,21 +1755,14 @@ static void LIBUSB_CALL hackrf_libusb_transfer_callback(struct libusb_transfer*
|
|||||||
// cancelled or restarted, not both.
|
// cancelled or restarted, not both.
|
||||||
pthread_mutex_unlock(&device->transfer_lock);
|
pthread_mutex_unlock(&device->transfer_lock);
|
||||||
|
|
||||||
if (!resubmit || result < 0) {
|
if (resubmit && result == LIBUSB_SUCCESS)
|
||||||
transfer_finished(device, usb_transfer);
|
return;
|
||||||
}
|
|
||||||
} else {
|
|
||||||
transfer_finished(device, usb_transfer);
|
|
||||||
}
|
}
|
||||||
} else if(usb_transfer->status == LIBUSB_TRANSFER_CANCELLED) {
|
|
||||||
transfer_finished(device, usb_transfer);
|
|
||||||
} else {
|
|
||||||
/* Other cases LIBUSB_TRANSFER_NO_DEVICE
|
|
||||||
LIBUSB_TRANSFER_ERROR, LIBUSB_TRANSFER_TIMED_OUT
|
|
||||||
LIBUSB_TRANSFER_STALL, LIBUSB_TRANSFER_OVERFLOW ....
|
|
||||||
*/
|
|
||||||
transfer_finished(device, usb_transfer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unless we resubmitted this transfer and returned above,
|
||||||
|
// it's now finished.
|
||||||
|
transfer_finished(device, usb_transfer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int kill_transfer_thread(hackrf_device* device)
|
static int kill_transfer_thread(hackrf_device* device)
|
||||||
|
Reference in New Issue
Block a user