From ab4498f8ac63cafcca457d6c1cf1ad06e14c892d Mon Sep 17 00:00:00 2001 From: Yan Date: Sat, 20 Mar 2021 10:07:51 +0100 Subject: [PATCH] hackrf_sweep: exit early from rx_callback if do_exit set Sometimes, if a small frequency interval is scanned, the callback is triggered even though we already have the number of sweeps we want, and sweep_count gets increased, showing the wrong "Total sweeps". --- host/hackrf-tools/src/hackrf_sweep.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/host/hackrf-tools/src/hackrf_sweep.c b/host/hackrf-tools/src/hackrf_sweep.c index e81c809d..1355a633 100644 --- a/host/hackrf-tools/src/hackrf_sweep.c +++ b/host/hackrf-tools/src/hackrf_sweep.c @@ -220,6 +220,9 @@ int rx_callback(hackrf_transfer* transfer) { return -1; } + if(do_exit) { + return 0; + } gettimeofday(&usb_transfer_time, NULL); byte_count += transfer->valid_length; buf = (int8_t*) transfer->buffer;