libhackrf: Stop streaming before killing transfer thread

This commit is contained in:
Ben Gamari
2013-09-08 13:54:25 -04:00
parent 500aa5888c
commit 693c262134

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 ADDCALL hackrf_stop_rx(hackrf_device* device)
{ {
int result1, result2; int result;
result1 = kill_transfer_thread(device); result = hackrf_set_transceiver_mode(device, HACKRF_TRANSCEIVER_MODE_OFF);
result2 = hackrf_set_transceiver_mode(device, HACKRF_TRANSCEIVER_MODE_OFF); if (result != HACKRF_SUCCESS)
if (result2 != HACKRF_SUCCESS)
{ {
return result2; return result;
} }
return result1; return kill_transfer_thread(device);
} }
int ADDCALL hackrf_start_tx(hackrf_device* device, hackrf_sample_block_cb_fn callback, void* tx_ctx) int ADDCALL hackrf_start_tx(hackrf_device* device, hackrf_sample_block_cb_fn callback, void* tx_ctx)