From 1442014a80b5ce33f16ef665538c2881b37d3a68 Mon Sep 17 00:00:00 2001 From: Matioupi Date: Wed, 16 Oct 2019 12:03:08 +0200 Subject: [PATCH] Modified hackrf_stop_tx and hackrf_stop_rx to first join the transfer thread before setting the receiver to OFF mode (cf. issue #650) --- host/libhackrf/src/hackrf.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/host/libhackrf/src/hackrf.c b/host/libhackrf/src/hackrf.c index 76f74895..4665da13 100644 --- a/host/libhackrf/src/hackrf.c +++ b/host/libhackrf/src/hackrf.c @@ -1629,12 +1629,12 @@ int ADDCALL hackrf_start_rx(hackrf_device* device, hackrf_sample_block_cb_fn cal int ADDCALL hackrf_stop_rx(hackrf_device* device) { int result; - result = hackrf_set_transceiver_mode(device, HACKRF_TRANSCEIVER_MODE_OFF); + result = kill_transfer_thread(device); if (result != HACKRF_SUCCESS) { return result; } - return kill_transfer_thread(device); + return hackrf_set_transceiver_mode(device, HACKRF_TRANSCEIVER_MODE_OFF); } int ADDCALL hackrf_start_tx(hackrf_device* device, hackrf_sample_block_cb_fn callback, void* tx_ctx) @@ -1653,12 +1653,13 @@ int ADDCALL hackrf_start_tx(hackrf_device* device, hackrf_sample_block_cb_fn cal int ADDCALL hackrf_stop_tx(hackrf_device* device) { int result; - result = hackrf_set_transceiver_mode(device, HACKRF_TRANSCEIVER_MODE_OFF); + result = kill_transfer_thread(device); if (result != HACKRF_SUCCESS) { return result; } - return kill_transfer_thread(device); + + return hackrf_set_transceiver_mode(device, HACKRF_TRANSCEIVER_MODE_OFF); } int ADDCALL hackrf_close(hackrf_device* device)