From a9f8103fec7c6a58472465b7147fe340517a489b Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sat, 6 Jul 2013 19:21:12 -0400 Subject: [PATCH] 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 --- host/libhackrf/src/hackrf.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/host/libhackrf/src/hackrf.c b/host/libhackrf/src/hackrf.c index 7e36dc55..f03f19aa 100644 --- a/host/libhackrf/src/hackrf.c +++ b/host/libhackrf/src/hackrf.c @@ -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)