From 7c28ecfcd8c4f8c5ce8698e3444d12f615b24e71 Mon Sep 17 00:00:00 2001 From: Ceres2805 Date: Mon, 24 Mar 2025 23:12:20 +0530 Subject: [PATCH] Fix: Display clear HackRF One channel limit error --- .../adapters/osmosdr_signal_source.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc index f7ab32057..695aa4445 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc @@ -153,7 +153,15 @@ OsmosdrSignalSource::OsmosdrSignalSource(const ConfigurationInterface* configura } if (out_stream_ > 1) { - LOG(ERROR) << "This implementation only supports one output stream"; + if (osmosdr_args_.find("hackrf") != std::string::npos) + { + LOG(ERROR) << "HackRF One hardware supports only one output stream. " + << "Please update your configuration to use only one channel."; + } + else + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } } @@ -167,6 +175,15 @@ void OsmosdrSignalSource::driver_instance() std::cout << "OsmoSdr arguments: " << osmosdr_args_ << '\n'; LOG(INFO) << "OsmoSdr arguments: " << osmosdr_args_; } + if (osmosdr_args_.find("hackrf") != std::string::npos && out_stream_ > 1) + { + LOG(ERROR) << "HackRF One supports only a single RF channel. You have configured " + << out_stream_ << " output streams. Please update your configuration to use " + << "only one channel with this device."; + throw std::invalid_argument("HackRF One supports only a single RF channel"); + } + } + osmosdr_source_ = osmosdr::source::make(osmosdr_args_); } catch (const boost::exception& e)