Merge pull request #16 from sdn-ninja/hackrf-bug-fixes-v2

Hackrf bug fixes v2
This commit is contained in:
30hours 2024-05-10 08:09:05 +09:30 committed by GitHub
commit dd339533ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 13 additions and 11 deletions

View file

@ -307,7 +307,7 @@ int main(int argc, char **argv)
} }
} }
}); });
t2.join();
t1.join(); t1.join();
return 0; return 0;

View file

@ -61,7 +61,7 @@ void Capture::process(IqData *buffer1, IqData *buffer2, c4::yml::NodeRef config,
{ {
device->replay(buffer1, buffer2, file, loop); device->replay(buffer1, buffer2, file, loop);
} }
t1.join();
} }
std::unique_ptr<Source> Capture::factory_source(const std::string& type, c4::yml::NodeRef config) std::unique_ptr<Source> Capture::factory_source(const std::string& type, c4::yml::NodeRef config)

View file

@ -65,6 +65,9 @@ void Source::close_file()
void Source::kill() void Source::kill()
{ {
if (type == "RspDuo") if (type == "RspDuo")
{
stop();
} else if (type == "HackRF")
{ {
stop(); stop();
} }

View file

@ -76,6 +76,9 @@ void HackRf::start()
check_status(status, "Failed to set VGA gain."); check_status(status, "Failed to set VGA gain.");
status = hackrf_set_hw_sync_mode(dev[1], 1); status = hackrf_set_hw_sync_mode(dev[1], 1);
check_status(status, "Failed to enable hardware synchronising."); 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 // reference config
status = hackrf_open_by_serial(serial[0].c_str(), &dev[0]); 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) void HackRf::process(IqData *buffer1, IqData *buffer2)
{ {
int status; int status;
while (true)
{
status = hackrf_start_rx(dev[1], rx_callback, buffer2); status = hackrf_start_rx(dev[1], rx_callback, buffer2);
check_status(status, "Failed to start RX streaming."); check_status(status, "Failed to start RX streaming.");
status = hackrf_start_rx(dev[0], rx_callback, buffer1); status = hackrf_start_rx(dev[0], rx_callback, buffer1);
check_status(status, "Failed to start RX streaming."); check_status(status, "Failed to start RX streaming.");
}
} }
int HackRf::rx_callback(hackrf_transfer* transfer) int HackRf::rx_callback(hackrf_transfer* transfer)