hackrf_stop_rx: First set mode, then kill transfer thread

Killing the transfer thread first means that the host stops polling the
device for reads, causing the device to hang while scheduling the dTD
This commit is contained in:
Ben Gamari
2013-07-06 19:21:12 -04:00
parent d30d7309d9
commit a9f8103fec

View File

@ -1141,14 +1141,13 @@ int ADDCALL hackrf_start_rx(hackrf_device* device, hackrf_sample_block_cb_fn cal
int ADDCALL hackrf_stop_rx(hackrf_device* device)
{
int result1, result2;
result1 = kill_transfer_thread(device);
result2 = hackrf_set_transceiver_mode(device, HACKRF_TRANSCEIVER_MODE_OFF);
if (result2 != HACKRF_SUCCESS)
int result;
result = hackrf_set_transceiver_mode(device, HACKRF_TRANSCEIVER_MODE_OFF);
if (result != HACKRF_SUCCESS)
{
return result2;
}
return result1;
return kill_transfer_thread(device);
}
int ADDCALL hackrf_start_tx(hackrf_device* device, hackrf_sample_block_cb_fn callback, void* tx_ctx)