From 9ce62f8885c5fb7f0f312f85bdeef88d5ec685a0 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 7 Oct 2024 14:10:23 +0200 Subject: [PATCH] add whitelist for plutosdr-like devices --- source_modules/plutosdr_source/src/main.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/source_modules/plutosdr_source/src/main.cpp b/source_modules/plutosdr_source/src/main.cpp index e612af2e..c63d327a 100644 --- a/source_modules/plutosdr_source/src/main.cpp +++ b/source_modules/plutosdr_source/src/main.cpp @@ -23,6 +23,12 @@ SDRPP_MOD_INFO{ ConfigManager config; +const std::vector deviceWhiteList = { + "PlutoSDR", + "ANTSDR", + "LibreSDR" +}; + class PlutoSDRSourceModule : public ModuleManager::Instance { public: PlutoSDRSourceModule(std::string name) { @@ -130,7 +136,14 @@ private: std::string duri = iio_context_info_get_uri(info); // If the device is not a plutosdr, don't include it - if (desc.find("PlutoSDR") == std::string::npos) { + bool isPluto = false; + for (const auto type : deviceWhiteList) { + if (desc.find(type) != std::string::npos) { + isPluto = true; + break; + } + } + if (!isPluto) { flog::warn("Ignored IIO device: [{}] {}", duri, desc); continue; }