From 25eea870832b1d59d16ae9b22856784b707112e9 Mon Sep 17 00:00:00 2001 From: sdn-ninja Date: Thu, 9 May 2024 21:54:08 +0100 Subject: [PATCH 1/4] Update Capture.cpp terminating the t1 thread correctly to stop device start() and process() every time the while(true) loop is executed. --- src/capture/Capture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/capture/Capture.cpp b/src/capture/Capture.cpp index ad636d7..73511a8 100644 --- a/src/capture/Capture.cpp +++ b/src/capture/Capture.cpp @@ -61,7 +61,7 @@ void Capture::process(IqData *buffer1, IqData *buffer2, c4::yml::NodeRef config, { device->replay(buffer1, buffer2, file, loop); } - + t1.join(); } std::unique_ptr Capture::factory_source(const std::string& type, c4::yml::NodeRef config) From 363a81dfaf8a4f4184653b1d90209193539be002 Mon Sep 17 00:00:00 2001 From: sdn-ninja Date: Thu, 9 May 2024 21:57:38 +0100 Subject: [PATCH 2/4] Update blah2.cpp Cosmetic (as there's no further code to execute.. But terminating the t2 thread correctly. --- src/blah2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/blah2.cpp b/src/blah2.cpp index affa499..9d3231b 100644 --- a/src/blah2.cpp +++ b/src/blah2.cpp @@ -307,7 +307,7 @@ int main(int argc, char **argv) } } }); - + t2.join(); t1.join(); return 0; @@ -418,4 +418,4 @@ void timing_helper(std::vector& timing_name, double delta_ms = (double)(time_us.back()-time_us[time_us.size()-2]) / 1000; timing_name.push_back(name); timing_time.push_back(delta_ms); -} \ No newline at end of file +} From e109c2f07afc1b92b0c09199f4836591dd292448 Mon Sep 17 00:00:00 2001 From: sdn-ninja Date: Thu, 9 May 2024 22:04:26 +0100 Subject: [PATCH 3/4] Update HackRf.cpp - enable CLKOUT (assumption is to plug that into ref device CLKIN) on surv device; otherwise, user has to do this from cmdline every time they plug the device - remove that while loop; not needed. --- src/capture/hackrf/HackRf.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/capture/hackrf/HackRf.cpp b/src/capture/hackrf/HackRf.cpp index 4aefa01..b328a1f 100644 --- a/src/capture/hackrf/HackRf.cpp +++ b/src/capture/hackrf/HackRf.cpp @@ -76,6 +76,9 @@ void HackRf::start() check_status(status, "Failed to set VGA gain."); status = hackrf_set_hw_sync_mode(dev[1], 1); check_status(status, "Failed to enable hardware synchronising."); + status = hackrf_set_clkout_enable(dev[1], 1); + check_status(status, "Failed to set CLKOUT on survillance device"); + // reference config status = hackrf_open_by_serial(serial[0].c_str(), &dev[0]); @@ -104,14 +107,10 @@ void HackRf::stop() void HackRf::process(IqData *buffer1, IqData *buffer2) { int status; - - while (true) - { - status = hackrf_start_rx(dev[1], rx_callback, buffer2); - check_status(status, "Failed to start RX streaming."); - status = hackrf_start_rx(dev[0], rx_callback, buffer1); - check_status(status, "Failed to start RX streaming."); - } + status = hackrf_start_rx(dev[1], rx_callback, buffer2); + check_status(status, "Failed to start RX streaming."); + status = hackrf_start_rx(dev[0], rx_callback, buffer1); + check_status(status, "Failed to start RX streaming."); } int HackRf::rx_callback(hackrf_transfer* transfer) From ada610e060482d20d142ee2d3150c66b63eba2f7 Mon Sep 17 00:00:00 2001 From: sdn-ninja Date: Thu, 9 May 2024 22:08:24 +0100 Subject: [PATCH 4/4] Update Source.cpp There was no code path to call HackRF::stop(). I presume you need the same for USRP? --- src/capture/Source.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/capture/Source.cpp b/src/capture/Source.cpp index 5d40395..2f7e96a 100644 --- a/src/capture/Source.cpp +++ b/src/capture/Source.cpp @@ -65,6 +65,9 @@ void Source::close_file() void Source::kill() { if (type == "RspDuo") + { + stop(); + } else if (type == "HackRF") { stop(); }