Clear streaming flag in cancel_transfers().
by Martin Ling 3 years 9 months
Clear streaming flag in cancel_transfers().

Moving this into cancel_transfers() avoids duplicating it in the two
stop functions.
960d8015
Simplify hackrf_libusb_transfer_callback.
by Martin Ling 3 years 9 months
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.
c74c7423
Clear streaming flag in transfer_finished().
by Martin Ling 3 years 9 months
Clear streaming flag in transfer_finished().

Since we always do these together, move it into the function.
54e00de1
Clear streaming flag if a transfer was cancelled.
by Martin Ling 3 years 9 months
Clear streaming flag if a transfer was cancelled.

If a transfer was cancelled, we are on our way to shutdown.

If hackrf_stop_tx() or hackrf_stop_rx() were called, they will already
have cleared this flag, but it is not cleared in hackrf_close(), and
for consistency with other paths it makes sense to clear it here.
6bd9cb05
Don't call callback or submit new transfers once s...
by Martin Ling 3 years 9 months
Don't call callback or submit new transfers once streaming stops.

This stops the RX callback from being called again with further data
once it has returned nonzero, or after a transfer had an error status.
125bf9f7
Clear streaming flag if we didn't resubmit a trans...
by Martin Ling 3 years 9 months
Clear streaming flag if we didn't resubmit a transfer.

If result < 0 here, libusb_submit_transfer returned an error, so we
need to shut down.

If !resubmit, then cancel_transfers() was already called by one of the
stop or close functions, so streaming is already false.
6720e56f
Don't exit transfer thread if an error occurs.
by Martin Ling 3 years 9 months
Don't exit transfer thread if an error occurs.

In the case of a libusb error, we still need the transfer thread
running, in order to handle outstanding cancellations and to signal the
condition variable when that is done.
9e1cb5c0
Merge pull request #1067 from Matioupi/master
by Martin Ling 3 years 9 months
Merge pull request #1067 from Matioupi/master

proposal to fix regression in 4c9fcf86651232c2104b57510a0ac86cf86123e4 #1057
d3e4e9b6
fix regression in 4c9fcf86651232c2104b57510a0ac86c...
by Mathieu Peyréga 3 years 9 months
fix regression in 4c9fcf86651232c2104b57510a0ac86cf86123e4
a8a66187
Merge pull request #1063 from metayan/fast-exit
by Martin Ling 3 years 9 months
Merge pull request #1063 from metayan/fast-exit

Ensure fast exit
8b9a33d4
Report a bug