From 3eab0488a538e2b8fc762442f5441d63876fdde0 Mon Sep 17 00:00:00 2001 From: Ratmandu Date: Mon, 21 Jul 2025 05:12:08 +0000 Subject: [PATCH 01/13] Initial gr-iio support --- CMakeLists.txt | 6 +- cmake/Modules/FindGnuradioIIO.cmake | 128 ++++++++++++++++++++++++++++ trunk-recorder/config.cc | 4 +- trunk-recorder/source.cc | 33 +++++++ trunk-recorder/source.h | 5 ++ 5 files changed, 173 insertions(+), 3 deletions(-) mode change 100644 => 100755 CMakeLists.txt create mode 100644 cmake/Modules/FindGnuradioIIO.cmake mode change 100644 => 100755 trunk-recorder/config.cc mode change 100644 => 100755 trunk-recorder/source.cc mode change 100644 => 100755 trunk-recorder/source.h diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100644 new mode 100755 index ca7676ecc..35e3a6fb2 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,7 +75,7 @@ find_package(Gnuradio REQUIRED) include(GrVersion) set(GR_REQUIRED_COMPONENTS RUNTIME ANALOG BLOCKS DIGITAL FILTER FFT PMT) -find_package(Gnuradio REQUIRED COMPONENTS runtime analog blocks digital filter fft) +find_package(Gnuradio REQUIRED COMPONENTS runtime analog blocks digital filter fft iio) if(Gnuradio_VERSION VERSION_LESS "3.8") find_package(Volk) endif() @@ -140,6 +140,9 @@ find_package(GnuradioUHD) find_package(GnuradioOsmosdr) find_package(LibHackRF) find_package(LibUHD) +find_package(GnuradioIIO) +find_library(IIO_LIBRARIES iio) +find_path(IIO_INCLUDE_DIRS iio.h) find_package(OpenSSL REQUIRED) find_package(CURL REQUIRED) if (STREAMER) @@ -383,6 +386,7 @@ if(NOT Gnuradio_VERSION VERSION_LESS "3.8") gnuradio::gnuradio-digital gnuradio::gnuradio-filter gnuradio::gnuradio-pmt + gnuradio::gnuradio-iio ) endif() diff --git a/cmake/Modules/FindGnuradioIIO.cmake b/cmake/Modules/FindGnuradioIIO.cmake new file mode 100644 index 000000000..7e92a0ee7 --- /dev/null +++ b/cmake/Modules/FindGnuradioIIO.cmake @@ -0,0 +1,128 @@ +# +# Provides the following imported target: +# Gnuradio::iio +# + +if(NOT COMMAND feature_summary) + include(FeatureSummary) +endif() + +if(NOT PKG_CONFIG_FOUND) + include(FindPkgConfig) +endif() + +pkg_check_modules(PC_IIO gnuradio-iio) + +if(NOT GnuradioIIO_ROOT) + set(GnuradioIIO_ROOT_USER_DEFINED /usr) +else() + set(GnuradioIIO_ROOT_USER_DEFINED ${GnuradioIIO_ROOT}) +endif() +if(DEFINED ENV{GnuradioIIO_ROOT}) + set(GnuradioIIO_ROOT_USER_DEFINED + ${GnuradioIIO_ROOT_USER_DEFINED} + $ENV{GRIIO_ROOT} + ) +endif() +if(DEFINED ENV{IIO_DIR}) + set(GnuradioIIO_ROOT_USER_DEFINED + ${GnuradioIIO_ROOT_USER_DEFINED} + $ENV{IIO_DIR} + ) +endif() +set(GnuradioIIO_ROOT_USER_DEFINED + ${GnuradioIIO_ROOT_USER_DEFINED} + ${CMAKE_INSTALL_PREFIX} +) + + +find_path(IIO_INCLUDE_DIRS + NAMES gnuradio/iio/api.h + HINTS ${PC_IIO_INCLUDEDIR} + PATHS ${GnuradioIIO_ROOT_USER_DEFINED}/include + /usr/include + /usr/local/include + /opt/local/include +) + +if(IIO_INCLUDE_DIRS) + set(GR_IIO_INCLUDE_HAS_GNURADIO TRUE) +else() + find_path(IIO_INCLUDE_DIRS + NAMES iio/api.h + HINTS ${PC_IIO_INCLUDEDIR} + PATHS ${GnuradioIIO_ROOT_USER_DEFINED}/include + /usr/include + /usr/local/include + /opt/local/include + ) + set(GR_IIO_INCLUDE_HAS_GNURADIO FALSE) +endif() + +find_library(IIO_LIBRARIES + NAMES gnuradio-iio + HINTS ${PC_IIO_LIBDIR} + PATHS ${GnuradioIIO_ROOT_USER_DEFINED}/lib + ${GnuradioIIO_ROOT_USER_DEFINED}/lib64 + /usr/lib + /usr/lib64 + /usr/lib/x86_64-linux-gnu + /usr/lib/i386-linux-gnu + /usr/lib/alpha-linux-gnu + /usr/lib/aarch64-linux-gnu + /usr/lib/arm-linux-gnueabi + /usr/lib/arm-linux-gnueabihf + /usr/lib/hppa-linux-gnu + /usr/lib/i686-gnu + /usr/lib/i686-linux-gnu + /usr/lib/x86_64-kfreebsd-gnu + /usr/lib/i686-kfreebsd-gnu + /usr/lib/m68k-linux-gnu + /usr/lib/mips-linux-gnu + /usr/lib/mips64el-linux-gnuabi64 + /usr/lib/mipsel-linux-gnu + /usr/lib/powerpc-linux-gnu + /usr/lib/powerpc-linux-gnuspe + /usr/lib/powerpc64-linux-gnu + /usr/lib/powerpc64le-linux-gnu + /usr/lib/riscv64-linux-gnu + /usr/lib/s390x-linux-gnu + /usr/lib/sparc64-linux-gnu + /usr/lib/x86_64-linux-gnux32 + /usr/lib/sh4-linux-gnu + /usr/local/lib + /usr/local/lib64 + /opt/local/lib +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GnuradioIIO DEFAULT_MSG IIO_LIBRARIES IIO_INCLUDE_DIRS) + +if(PC_IIO_VERSION) + set(GnuradioIIO_VERSION ${PC_IIO_VERSION}) +endif() + +set_package_properties(GnuradioIIO PROPERTIES + URL "https://github.com/analogdevicesinc/gr-iio" +) +if(GnuradioIIO_FOUND AND GnuradioIIO_VERSION) + set_package_properties(GnuradioIIO PROPERTIES + DESCRIPTION "IIO blocks for GNU Radio (found: v${GnuradioIIO_VERSION})" + ) +else() + set_package_properties(GnuradioIIO PROPERTIES + DESCRIPTION "IIO blocks for GNU Radio" + ) +endif() + +if(GnuradioIIO_FOUND AND NOT TARGET Gnuradio::iio) + add_library(Gnuradio::iio SHARED IMPORTED) + set_target_properties(Gnuradio::iio PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${IIO_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${IIO_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${IIO_LIBRARIES}" + ) +endif() + +mark_as_advanced(IIO_LIBRARIES IIO_INCLUDE_DIRS GR_IIO_INCLUDE_HAS_GNURADIO) \ No newline at end of file diff --git a/trunk-recorder/config.cc b/trunk-recorder/config.cc old mode 100644 new mode 100755 index bc89b6a1d..3da7a48d3 --- a/trunk-recorder/config.cc +++ b/trunk-recorder/config.cc @@ -442,8 +442,8 @@ bool load_config(string config_file, Config &config, gr::top_block_sptr &tb, std bool gain_set = false; std::string driver = element.value("driver", ""); - if ((driver != "osmosdr") && (driver != "usrp") && (driver != "sigmf") && (driver != "iqfile")) { - BOOST_LOG_TRIVIAL(error) << "Driver specified in config.json not recognized, needs to be osmosdr, sigmf, iqfile or usrp"; + if ((driver != "osmosdr") && (driver != "usrp") && (driver != "sigmf") && (driver != "iqfile") && (driver != "iio")) { + BOOST_LOG_TRIVIAL(error) << "Driver specified in config.json not recognized, needs to be osmosdr, sigmf, iqfile, usrp, or iio"; return false; } diff --git a/trunk-recorder/source.cc b/trunk-recorder/source.cc old mode 100644 new mode 100755 index d8177baae..507638a9f --- a/trunk-recorder/source.cc +++ b/trunk-recorder/source.cc @@ -144,6 +144,33 @@ Source::Source(double c, double r, double e, std::string drv, std::string dev, C source_block = usrp_src; } + + if (driver == "iio") { + std::vector enable_channels{1,1,0,0}; + BOOST_LOG_TRIVIAL(info) << "SOURCE TYPE IIO"; + + gr::iio::fmcomms2_source::sptr iio_src; + iio_src = gr::iio::fmcomms2_source::make(device, enable_channels, 65535); + iio_src->set_len_tag_key(""); + iio_src->set_gain_mode(0, "manual"); + iio_src->set_gain(0, gain); + + BOOST_LOG_TRIVIAL(info) << "Tuning to " << format_freq(center + error); + iio_src->set_frequency(center + error); + + + BOOST_LOG_TRIVIAL(info) << "Setting sample rate to: " << FormatSamplingRate(rate); + iio_src->set_samplerate(rate); + + iio_src->set_quadrature(true); + iio_src->set_rfdc(true); + iio_src->set_bbdc(true); + iio_src->set_filter_params("Auto", "", 0.0, 0.0); + + + + source_block = iio_src; + } } void Source::set_iq_source(std::string iq_file, bool repeat, double center, double rate) { @@ -321,6 +348,12 @@ void Source::set_gain(int r) { gain = r; cast_to_usrp_sptr(source_block)->set_gain(gain); } + + if (driver == "iio") { + gain = r; + cast_to_iio_sptr(source_block)->set_gain(0, gain); + BOOST_LOG_TRIVIAL(info) << "Gain set to: " << gain; + } } void Source::add_gain_stage(std::string stage_name, int value) { diff --git a/trunk-recorder/source.h b/trunk-recorder/source.h old mode 100644 new mode 100755 index 9aaa24b45..16323a2d8 --- a/trunk-recorder/source.h +++ b/trunk-recorder/source.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -152,6 +153,10 @@ class Source { Recorder *get_sigmf_recorder(); std::vector get_recorders(); + inline gr::iio::fmcomms2_source::sptr cast_to_iio_sptr(gr::basic_block_sptr p) { + return std::dynamic_pointer_cast, gr::basic_block>(p); + } + #if GNURADIO_VERSION < 0x030900 inline osmosdr::source::sptr cast_to_osmo_sptr(gr::basic_block_sptr p) { return boost::dynamic_pointer_cast(p); From 6fbd6543848e505d688d095a31df44a6f009564b Mon Sep 17 00:00:00 2001 From: Ratmandu Date: Mon, 21 Jul 2025 05:38:34 +0000 Subject: [PATCH 02/13] inconsequential --- trunk-recorder/source.cc | 1 + trunk-recorder/source.h | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/trunk-recorder/source.cc b/trunk-recorder/source.cc index 507638a9f..a5dacff49 100755 --- a/trunk-recorder/source.cc +++ b/trunk-recorder/source.cc @@ -161,6 +161,7 @@ Source::Source(double c, double r, double e, std::string drv, std::string dev, C BOOST_LOG_TRIVIAL(info) << "Setting sample rate to: " << FormatSamplingRate(rate); iio_src->set_samplerate(rate); + actual_rate = rate; iio_src->set_quadrature(true); iio_src->set_rfdc(true); diff --git a/trunk-recorder/source.h b/trunk-recorder/source.h index 16323a2d8..9b5b32838 100755 --- a/trunk-recorder/source.h +++ b/trunk-recorder/source.h @@ -153,10 +153,6 @@ class Source { Recorder *get_sigmf_recorder(); std::vector get_recorders(); - inline gr::iio::fmcomms2_source::sptr cast_to_iio_sptr(gr::basic_block_sptr p) { - return std::dynamic_pointer_cast, gr::basic_block>(p); - } - #if GNURADIO_VERSION < 0x030900 inline osmosdr::source::sptr cast_to_osmo_sptr(gr::basic_block_sptr p) { return boost::dynamic_pointer_cast(p); @@ -164,6 +160,9 @@ class Source { inline gr::uhd::usrp_source::sptr cast_to_usrp_sptr(gr::basic_block_sptr p) { return boost::dynamic_pointer_cast(p); } + inline gr::iio::fmcomms2_source::sptr cast_to_iio_sptr(gr::basic_block_sptr p) { + return boost::dynamic_pointer_cast, gr::basic_block>(p); + } #else inline osmosdr::source::sptr cast_to_osmo_sptr(gr::basic_block_sptr p) { return std::dynamic_pointer_cast(p); @@ -171,6 +170,9 @@ class Source { inline gr::uhd::usrp_source::sptr cast_to_usrp_sptr(gr::basic_block_sptr p) { return std::dynamic_pointer_cast(p); } + inline gr::iio::fmcomms2_source::sptr cast_to_iio_sptr(gr::basic_block_sptr p) { + return std::dynamic_pointer_cast, gr::basic_block>(p); + } #endif }; #endif From 957717d37afb3a2d1de34f20717b5f5244185fc8 Mon Sep 17 00:00:00 2001 From: Ratmandu Date: Mon, 22 Dec 2025 10:40:26 +0000 Subject: [PATCH 03/13] testing --- trunk-recorder/recorders/p25_recorder_impl.cc | 5 +++++ trunk-recorder/source.cc | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/trunk-recorder/recorders/p25_recorder_impl.cc b/trunk-recorder/recorders/p25_recorder_impl.cc index a673ea925..7744afe78 100644 --- a/trunk-recorder/recorders/p25_recorder_impl.cc +++ b/trunk-recorder/recorders/p25_recorder_impl.cc @@ -44,6 +44,11 @@ void p25_recorder_impl::initialize(Source *src) { timestamp = time(NULL); starttime = time(NULL); + BOOST_LOG_TRIVIAL(info) << "p25_recorder.cc: Initializing P25 Recorder Num [" << rec_num << "]\tType: " << (conventional ? "Conventional" : "Trunked") << "\tQPSK: " << qpsk_mod; + BOOST_LOG_TRIVIAL(info) << "p25_recorder.cc: Center Freq:\t" << format_freq(center_freq) << "\tInput Rate: " << input_rate; + BOOST_LOG_TRIVIAL(info) << "p25_recorder.cc: Silence Frames: " << silence_frames << "\tSoft Vocoder: " << d_soft_vocoder; + BOOST_LOG_TRIVIAL(info) << "p25_recorder.cc: Squelch DB: " << squelch_db; + if (config == NULL) { this->set_enable_audio_streaming(false); } else { diff --git a/trunk-recorder/source.cc b/trunk-recorder/source.cc index a5dacff49..b2fb9f92e 100755 --- a/trunk-recorder/source.cc +++ b/trunk-recorder/source.cc @@ -150,7 +150,7 @@ Source::Source(double c, double r, double e, std::string drv, std::string dev, C BOOST_LOG_TRIVIAL(info) << "SOURCE TYPE IIO"; gr::iio::fmcomms2_source::sptr iio_src; - iio_src = gr::iio::fmcomms2_source::make(device, enable_channels, 65535); + iio_src = gr::iio::fmcomms2_source::make(device, enable_channels, 4096); iio_src->set_len_tag_key(""); iio_src->set_gain_mode(0, "manual"); iio_src->set_gain(0, gain); From ed0d0343bd6f87832a8689caa4fbb5c11b016c63 Mon Sep 17 00:00:00 2001 From: Ratmandu Date: Tue, 23 Dec 2025 00:30:20 +0000 Subject: [PATCH 04/13] tweaks --- trunk-recorder/source.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trunk-recorder/source.cc b/trunk-recorder/source.cc index b929de15a..aca9c82ae 100755 --- a/trunk-recorder/source.cc +++ b/trunk-recorder/source.cc @@ -168,7 +168,7 @@ Source::Source(double c, double r, double e, std::string drv, std::string dev, C iio_src->set_quadrature(true); iio_src->set_rfdc(true); iio_src->set_bbdc(true); - iio_src->set_filter_params("Auto", "", 0.0, 0.0); + iio_src->set_filter_params("Off", "", 0.0, 0.0); From 992bc6f86a65fe389642ca7126acc2a0ae7d294b Mon Sep 17 00:00:00 2001 From: Ratmandu Date: Tue, 23 Dec 2025 01:31:18 +0000 Subject: [PATCH 05/13] Decoding well at 8MSPS --- trunk-recorder/source.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trunk-recorder/source.cc b/trunk-recorder/source.cc index aca9c82ae..60158ddc9 100755 --- a/trunk-recorder/source.cc +++ b/trunk-recorder/source.cc @@ -152,7 +152,7 @@ Source::Source(double c, double r, double e, std::string drv, std::string dev, C BOOST_LOG_TRIVIAL(info) << "SOURCE TYPE IIO"; gr::iio::fmcomms2_source::sptr iio_src; - iio_src = gr::iio::fmcomms2_source::make(device, enable_channels, 4096); + iio_src = gr::iio::fmcomms2_source::make(device, enable_channels, 102400); iio_src->set_len_tag_key(""); iio_src->set_gain_mode(0, "manual"); iio_src->set_gain(0, gain); @@ -168,7 +168,7 @@ Source::Source(double c, double r, double e, std::string drv, std::string dev, C iio_src->set_quadrature(true); iio_src->set_rfdc(true); iio_src->set_bbdc(true); - iio_src->set_filter_params("Off", "", 0.0, 0.0); + iio_src->set_filter_params("Auto", "", 0.0, 0.0); From c9a28e502c2d922bdc907c7059b9e2db5329073c Mon Sep 17 00:00:00 2001 From: Ratmandu Date: Tue, 23 Dec 2025 23:07:51 +0000 Subject: [PATCH 06/13] added buffer length config --- trunk-recorder/config.cc | 1 + trunk-recorder/source.cc | 16 +++++++++++++++- trunk-recorder/source.h | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/trunk-recorder/config.cc b/trunk-recorder/config.cc index b8aa48a4c..07ce3254b 100755 --- a/trunk-recorder/config.cc +++ b/trunk-recorder/config.cc @@ -477,6 +477,7 @@ bool load_config(string config_file, Config &config, gr::top_block_sptr &tb, std BOOST_LOG_TRIVIAL(info) << "Device: " << device; int silence_frames = element.value("silenceFrames", 0); + unsigned long buffer_length = element.value("bufLength", 32768); double center = element.value("center", 0.0); double rate = element.value("rate", 0.0); double error = element.value("error", 0.0); diff --git a/trunk-recorder/source.cc b/trunk-recorder/source.cc index 60158ddc9..59bcd878a 100755 --- a/trunk-recorder/source.cc +++ b/trunk-recorder/source.cc @@ -46,6 +46,7 @@ Source::Source(double c, double r, double e, std::string drv, std::string dev, C rate = r; center = c; error = e; + bufLength = 0; set_min_max(); driver = drv; device = dev; @@ -68,6 +69,7 @@ Source::Source(double c, double r, double e, std::string drv, std::string dev, C autotune_source = false; autotune_manager = new AutotuneManager(this); + recorder_selector = gr::blocks::selector::make(sizeof(gr_complex), 0, 0); // parameters for signal_detector_cvf @@ -151,8 +153,20 @@ Source::Source(double c, double r, double e, std::string drv, std::string dev, C std::vector enable_channels{1,1,0,0}; BOOST_LOG_TRIVIAL(info) << "SOURCE TYPE IIO"; + // check to see if device string has bufferLength, and if so, split them + std::string dev = device; + bufLength = 32768; + + if (device.find(",")) { + dev = device.substr(0,device.find(",")); + bufLength = std::stoul(device.substr(device.find(",") + 1, device.length())); + } + + BOOST_LOG_TRIVIAL(info) << "Device: " << dev; + BOOST_LOG_TRIVIAL(info) << "Buffer Length: " << bufLength; + gr::iio::fmcomms2_source::sptr iio_src; - iio_src = gr::iio::fmcomms2_source::make(device, enable_channels, 102400); + iio_src = gr::iio::fmcomms2_source::make(dev, enable_channels, bufLength); iio_src->set_len_tag_key(""); iio_src->set_gain_mode(0, "manual"); iio_src->set_gain(0, gain); diff --git a/trunk-recorder/source.h b/trunk-recorder/source.h index b75c712bc..7598c53a4 100755 --- a/trunk-recorder/source.h +++ b/trunk-recorder/source.h @@ -54,6 +54,7 @@ class Source { int debug_recorder_port; int next_selector_port; int silence_frames; + unsigned long bufLength; Config *config; bool autotune_source; From c355124fa3a2e287e74c8d7d23641e693c9d08e1 Mon Sep 17 00:00:00 2001 From: Ratmandu Date: Tue, 23 Dec 2025 23:09:46 +0000 Subject: [PATCH 07/13] reverting config.cc change as it was not needed --- trunk-recorder/config.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/trunk-recorder/config.cc b/trunk-recorder/config.cc index 07ce3254b..b8aa48a4c 100755 --- a/trunk-recorder/config.cc +++ b/trunk-recorder/config.cc @@ -477,7 +477,6 @@ bool load_config(string config_file, Config &config, gr::top_block_sptr &tb, std BOOST_LOG_TRIVIAL(info) << "Device: " << device; int silence_frames = element.value("silenceFrames", 0); - unsigned long buffer_length = element.value("bufLength", 32768); double center = element.value("center", 0.0); double rate = element.value("rate", 0.0); double error = element.value("error", 0.0); From 2474d50ccfaa39eb8cbba644df004d10bb671207 Mon Sep 17 00:00:00 2001 From: Ratmandu Date: Wed, 24 Dec 2025 02:27:00 +0000 Subject: [PATCH 08/13] adding AGC to iio driver --- trunk-recorder/source.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/trunk-recorder/source.cc b/trunk-recorder/source.cc index 59bcd878a..abe60418a 100755 --- a/trunk-recorder/source.cc +++ b/trunk-recorder/source.cc @@ -428,6 +428,13 @@ void Source::set_gain_mode(bool m) { } else { BOOST_LOG_TRIVIAL(info) << "Auto gain control is OFF"; } + } else if (driver == "iio") { + gain_mode = m; + if (gain_mode) { + cast_to_iio_sptr(source_block)->set_gain_mode(0, "fast_attack"); + } else { + cast_to_iio_sptr(source_block)->set_gain_mode(0, "manual"); + } } } From 456c374216581b534ed9d13fcdd4d0d329b179c8 Mon Sep 17 00:00:00 2001 From: Ratmandu Date: Sun, 11 Jan 2026 06:41:49 +0000 Subject: [PATCH 09/13] Ensuring all IIO related stuff is found before building with IIO enabled --- CMakeLists.txt | 19 +++++++++++++++++-- cmake/Modules/FindGnuradioIIO.cmake | 12 +++++++++++- docs/CONFIGURE.md | 6 +++--- trunk-recorder/source.cc | 10 +++++++++- trunk-recorder/source.h | 9 ++++++++- 5 files changed, 48 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd4ebf5d0..d525f0d9b 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,7 +75,13 @@ find_package(Gnuradio REQUIRED) include(GrVersion) set(GR_REQUIRED_COMPONENTS RUNTIME ANALOG BLOCKS DIGITAL FILTER FFT PMT) -find_package(Gnuradio REQUIRED COMPONENTS runtime analog blocks digital filter fft iio) +find_package(Gnuradio REQUIRED COMPONENTS runtime analog blocks digital filter fft) +# find_package(Gnuradio REQUIRED COMPONENTS iio) +# if (iio_FOUND) +# message(STATUS "gr-iio found!") +# else() +# message(WARNING "gr-iio not found! Will not be able to build with iio support.") +# endif() if(Gnuradio_VERSION VERSION_LESS "3.8") find_package(Volk) endif() @@ -141,6 +147,12 @@ find_package(GnuradioOsmosdr) find_package(LibHackRF) find_package(LibUHD) find_package(GnuradioIIO) +if (GnuradioIIO_FOUND) + message(STATUS "GR-IIO Found! Adding IIO support") +else() + message(STATUS "GR-IIO Not Found! Skipping IIO support") +endif() + find_library(IIO_LIBRARIES iio) find_path(IIO_INCLUDE_DIRS iio.h) find_package(OpenSSL REQUIRED) @@ -387,9 +399,12 @@ if(NOT Gnuradio_VERSION VERSION_LESS "3.8") gnuradio::gnuradio-digital gnuradio::gnuradio-filter gnuradio::gnuradio-pmt - gnuradio::gnuradio-iio ) endif() +if (Gnuradio_IIO_FOUND) + target_link_libraries(trunk-recorder gnuradio::gnuradio-iio) +endif() + install(TARGETS trunk-recorder RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/cmake/Modules/FindGnuradioIIO.cmake b/cmake/Modules/FindGnuradioIIO.cmake index 7e92a0ee7..3377d9d8b 100644 --- a/cmake/Modules/FindGnuradioIIO.cmake +++ b/cmake/Modules/FindGnuradioIIO.cmake @@ -11,7 +11,13 @@ if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() -pkg_check_modules(PC_IIO gnuradio-iio) +# Check if libiio is installed +pkg_check_modules(PC_IIO iio) + +# Check if libad9361 is installed +pkg_check_modules(PC_AD9361 ad9361) + +pkg_check_modules(PC_GR_IIO gnuradio-iio) if(NOT GnuradioIIO_ROOT) set(GnuradioIIO_ROOT_USER_DEFINED /usr) @@ -125,4 +131,8 @@ if(GnuradioIIO_FOUND AND NOT TARGET Gnuradio::iio) ) endif() +if(NOT PC_IIO_FOUND OR NOT PC_AD9361_FOUND OR NOT PC_GR_IIO_FOUND) + set(GnuradioIIO_FOUND FALSE CACHE BOOL "Gnuradio IIO library" FORCE) +endif() + mark_as_advanced(IIO_LIBRARIES IIO_INCLUDE_DIRS GR_IIO_INCLUDE_HAS_GNURADIO) \ No newline at end of file diff --git a/docs/CONFIGURE.md b/docs/CONFIGURE.md index 6658ae882..b2ae774cb 100644 --- a/docs/CONFIGURE.md +++ b/docs/CONFIGURE.md @@ -159,8 +159,8 @@ There is a list of available Plugins [here](./Plugins.md). | Key | Required | Default Value | Type | Description | | :--------------- | :------: | :-----------: | --------------------------- | ------------------------------------------------------------ | -| driver | ✓ | | **"usrp"**, **"osmosdr"** | The GNURadio block you wish to use for the SDR. | -| device | | | **string**
See the [osmosdr page](http://sdr.osmocom.org/trac/wiki/GrOsmoSDR) for supported devices and parameters. | Osmosdr device name and possibly serial number or index of the device.
You only need to do add this key if there are more than one osmosdr devices being used.
Example: `bladerf=00001` for BladeRF with serial 00001 or `rtl=00923838` for RTL-SDR with serial 00923838, just `airspy` for an airspy.
It seems that when you have 5 or more RTLSDRs on one system you need to decrease the buffer size. I think it has something to do with the driver. Try adding buflen: `"device": "rtl=serial_num,buflen=65536"`, there should be no space between the comma and `buflen`. | +| driver | ✓ | | **"usrp"**, **"osmosdr"**, **"iio"** | The GNURadio block you wish to use for the SDR. | +| device | | | **string**
See the [osmosdr page](http://sdr.osmocom.org/trac/wiki/GrOsmoSDR) for supported devices and parameters. | Osmosdr device name and possibly serial number or index of the device.
You only need to do add this key if there are more than one osmosdr devices being used.
Example: `bladerf=00001` for BladeRF with serial 00001 or `rtl=00923838` for RTL-SDR with serial 00923838, just `airspy` for an airspy.
It seems that when you have 5 or more RTLSDRs on one system you need to decrease the buffer size. I think it has something to do with the driver. Try adding buflen: `"device": "rtl=serial_num,buflen=65536"`, there should be no space between the comma and `buflen`. For iio devices, "ip:192.168.1.5,65536" or "usb:1.3.5,65536" can be used, depending on if you are connecting over ethernet or USB. iio_util -S will scan for iio devices and give you the ip address or usb device number. The number after the comma is the buffer length.| | center | ✓ | | number | The center frequency in Hz to tune the SDR to | | rate | ✓ | | number | The sampling rate to set the SDR to, in samples / second | | error | | 0 | number | The tuning error for the SDR, in Hz. This is the difference between the target value and the actual value. So if you wanted to recv 856MHz but you had to tune your SDR to 855MHz (when set to 0ppm) to actually receive it, you would set this to -1000000. You should also probably get a new SDR if it is off by this much. | @@ -169,7 +169,7 @@ There is a list of available Plugins [here](./Plugins.md). | analogRecorders | | | number | The number of Analog Recorder to have attached to this source. The same as Digital Recorders except for Analog Voice channels. *This is only required for Trunk systems. Channels in Conventional systems have dedicated recorders and do not need to be included here.* | | signalDetectorThreshold | | | number | If set, a static threshold will be used for the Signal Detector on all conventional recorder. Otherwise, the threshold value for the noise floor will be automatically be determined. Only set this is you are having problems. The value is in dB, but is generally higher than the Squelch value because the power is measured differently | | ppm | | 0 | number | The tuning error for the SDR in ppm (parts per million), as an alternative to `error` above. Use a program like GQRX to find an accurate value. | -| agc | | false | **true** / **false** | Whether or not to enable the SDR's automatic gain control (if supported). This is false by default. It is not recommended to set this as it often yields worse performance compared to a manual gain setting. | +| agc | | false | **true** / **false** | Whether or not to enable the SDR's automatic gain control (if supported). This is false by default. It is not recommended to set this as it often yields worse performance compared to a manual gain setting. On iio devices this will enable "fast_attack" agc mode. | | gainSettings | | | { "stageName": value} | Set the gain for any stage. The value for this setting should be passed as an object, where the key specifies the name of the gain stage and the value is the amount of gain in dB. For example:
````"gainSettings": { "IF": 10, "BB": 11.9},```` | | ifGain | | | number | *AirSpy/hackrf only* sets the **IF** gain. | | bbGain | | | number | *hackrf only* sets the **BB** gain. | diff --git a/trunk-recorder/source.cc b/trunk-recorder/source.cc index abe60418a..8dee5fcb3 100755 --- a/trunk-recorder/source.cc +++ b/trunk-recorder/source.cc @@ -149,6 +149,7 @@ Source::Source(double c, double r, double e, std::string drv, std::string dev, C source_block = usrp_src; } +#ifdef GnuradioIIO_FOUND if (driver == "iio") { std::vector enable_channels{1,1,0,0}; BOOST_LOG_TRIVIAL(info) << "SOURCE TYPE IIO"; @@ -188,6 +189,7 @@ Source::Source(double c, double r, double e, std::string drv, std::string dev, C source_block = iio_src; } +#endif //GnuradioIIO_FOUND } void Source::set_iq_source(std::string iq_file, bool repeat, double center, double rate) { @@ -372,11 +374,13 @@ void Source::set_gain(double r) { cast_to_usrp_sptr(source_block)->set_gain(gain); } +#ifdef GnuradioIIO_FOUND if (driver == "iio") { gain = r; cast_to_iio_sptr(source_block)->set_gain(0, gain); BOOST_LOG_TRIVIAL(info) << "Gain set to: " << gain; } +#endif //GnuradioIIO_FOUND } void Source::add_gain_stage(std::string stage_name, double value) { @@ -428,7 +432,10 @@ void Source::set_gain_mode(bool m) { } else { BOOST_LOG_TRIVIAL(info) << "Auto gain control is OFF"; } - } else if (driver == "iio") { + + } +#ifdef GnuradioIIO_FOUND + else if (driver == "iio") { gain_mode = m; if (gain_mode) { cast_to_iio_sptr(source_block)->set_gain_mode(0, "fast_attack"); @@ -436,6 +443,7 @@ void Source::set_gain_mode(bool m) { cast_to_iio_sptr(source_block)->set_gain_mode(0, "manual"); } } +#endif } double Source::get_if_gain() { diff --git a/trunk-recorder/source.h b/trunk-recorder/source.h index 7598c53a4..e158da6ff 100755 --- a/trunk-recorder/source.h +++ b/trunk-recorder/source.h @@ -13,7 +13,9 @@ #include #include #include -#include +#ifdef GnuradioIIO_FOUND + #include +#endif #include #include #include @@ -169,9 +171,11 @@ class Source { inline gr::uhd::usrp_source::sptr cast_to_usrp_sptr(gr::basic_block_sptr p) { return boost::dynamic_pointer_cast(p); } +#ifdef GnuradioIIO_FOUND inline gr::iio::fmcomms2_source::sptr cast_to_iio_sptr(gr::basic_block_sptr p) { return boost::dynamic_pointer_cast, gr::basic_block>(p); } +#endif // GnuradioIIO_FOUND #else inline osmosdr::source::sptr cast_to_osmo_sptr(gr::basic_block_sptr p) { return std::dynamic_pointer_cast(p); @@ -179,9 +183,12 @@ class Source { inline gr::uhd::usrp_source::sptr cast_to_usrp_sptr(gr::basic_block_sptr p) { return std::dynamic_pointer_cast(p); } +#ifdef GnuradioIIO_FOUND inline gr::iio::fmcomms2_source::sptr cast_to_iio_sptr(gr::basic_block_sptr p) { return std::dynamic_pointer_cast, gr::basic_block>(p); } +#endif // GnuradioIIO_FOUND + #endif }; #endif From 388b7c1972a3a379c3790b36696de0d307b27451 Mon Sep 17 00:00:00 2001 From: Ratmandu Date: Wed, 14 Jan 2026 13:25:18 +0000 Subject: [PATCH 10/13] Cleanup and ensuring iio dependencies are installed --- CMakeLists.txt | 22 ++-- cmake/Modules/FindGnuradioIIO.cmake | 150 +++++----------------------- trunk-recorder/source.cc | 9 ++ 3 files changed, 44 insertions(+), 137 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d525f0d9b..965220002 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,12 +76,7 @@ include(GrVersion) set(GR_REQUIRED_COMPONENTS RUNTIME ANALOG BLOCKS DIGITAL FILTER FFT PMT) find_package(Gnuradio REQUIRED COMPONENTS runtime analog blocks digital filter fft) -# find_package(Gnuradio REQUIRED COMPONENTS iio) -# if (iio_FOUND) -# message(STATUS "gr-iio found!") -# else() -# message(WARNING "gr-iio not found! Will not be able to build with iio support.") -# endif() + if(Gnuradio_VERSION VERSION_LESS "3.8") find_package(Volk) endif() @@ -146,15 +141,19 @@ find_package(GnuradioUHD) find_package(GnuradioOsmosdr) find_package(LibHackRF) find_package(LibUHD) +find_library(IIO_LIBRARIES iio) +find_path(IIO_INCLUDE_DIRS iio.h) find_package(GnuradioIIO) -if (GnuradioIIO_FOUND) +if (GR_IIO_FOUND) message(STATUS "GR-IIO Found! Adding IIO support") + set(BUILD_WITH_GR_IIO TRUE) + add_compile_definitions(GnuradioIIO_FOUND=1) + set(GR_REQUIRED_COMPONENTS RUNTIME ANALOG BLOCKS DIGITAL FILTER FFT PMT IIO) + find_package(Gnuradio REQUIRED COMPONENTS iio) else() - message(STATUS "GR-IIO Not Found! Skipping IIO support") + message(STATUS "Gnuradio-IIO or a dependency Not Found! Skipping IIO support") endif() -find_library(IIO_LIBRARIES iio) -find_path(IIO_INCLUDE_DIRS iio.h) find_package(OpenSSL REQUIRED) find_package(CURL REQUIRED) if (STREAMER) @@ -402,9 +401,8 @@ if(NOT Gnuradio_VERSION VERSION_LESS "3.8") ) endif() -if (Gnuradio_IIO_FOUND) +if (GR_IIO_FOUND) target_link_libraries(trunk-recorder gnuradio::gnuradio-iio) endif() - install(TARGETS trunk-recorder RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/cmake/Modules/FindGnuradioIIO.cmake b/cmake/Modules/FindGnuradioIIO.cmake index 3377d9d8b..45419412c 100644 --- a/cmake/Modules/FindGnuradioIIO.cmake +++ b/cmake/Modules/FindGnuradioIIO.cmake @@ -1,138 +1,38 @@ -# -# Provides the following imported target: -# Gnuradio::iio -# +PKG_CHECK_MODULES(PC_GNURADIO_IIO gnuradio-iio) -if(NOT COMMAND feature_summary) - include(FeatureSummary) -endif() - -if(NOT PKG_CONFIG_FOUND) - include(FindPkgConfig) -endif() - -# Check if libiio is installed -pkg_check_modules(PC_IIO iio) - -# Check if libad9361 is installed -pkg_check_modules(PC_AD9361 ad9361) - -pkg_check_modules(PC_GR_IIO gnuradio-iio) - -if(NOT GnuradioIIO_ROOT) - set(GnuradioIIO_ROOT_USER_DEFINED /usr) -else() - set(GnuradioIIO_ROOT_USER_DEFINED ${GnuradioIIO_ROOT}) -endif() -if(DEFINED ENV{GnuradioIIO_ROOT}) - set(GnuradioIIO_ROOT_USER_DEFINED - ${GnuradioIIO_ROOT_USER_DEFINED} - $ENV{GRIIO_ROOT} - ) -endif() -if(DEFINED ENV{IIO_DIR}) - set(GnuradioIIO_ROOT_USER_DEFINED - ${GnuradioIIO_ROOT_USER_DEFINED} - $ENV{IIO_DIR} - ) -endif() -set(GnuradioIIO_ROOT_USER_DEFINED - ${GnuradioIIO_ROOT_USER_DEFINED} - ${CMAKE_INSTALL_PREFIX} -) - - -find_path(IIO_INCLUDE_DIRS +FIND_PATH( + GNURADIO_IIO_INCLUDE_DIRS NAMES gnuradio/iio/api.h - HINTS ${PC_IIO_INCLUDEDIR} - PATHS ${GnuradioIIO_ROOT_USER_DEFINED}/include + HINTS $ENV{GNURADIO_IIO_DIR}/include + ${PC_GNURADIO_IIO_INCLUDEDIR} + PATHS /usr/local/include /usr/include - /usr/local/include - /opt/local/include ) -if(IIO_INCLUDE_DIRS) - set(GR_IIO_INCLUDE_HAS_GNURADIO TRUE) -else() - find_path(IIO_INCLUDE_DIRS - NAMES iio/api.h - HINTS ${PC_IIO_INCLUDEDIR} - PATHS ${GnuradioIIO_ROOT_USER_DEFINED}/include - /usr/include - /usr/local/include - /opt/local/include - ) - set(GR_IIO_INCLUDE_HAS_GNURADIO FALSE) -endif() - -find_library(IIO_LIBRARIES - NAMES gnuradio-iio - HINTS ${PC_IIO_LIBDIR} - PATHS ${GnuradioIIO_ROOT_USER_DEFINED}/lib - ${GnuradioIIO_ROOT_USER_DEFINED}/lib64 +FIND_LIBRARY( + GNURADIO_IIO_LIBRARIES + NAME gnuradio-iio + HINTS $ENV{GNURADIO_IIO_DIR}/lib + ${PC_GNURADIO_IIO_LIBDIR} + PATHS /usr/local/lib + /usr/local/lib64 /usr/lib /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/hppa-linux-gnu - /usr/lib/i686-gnu - /usr/lib/i686-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i686-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/sh4-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib ) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(GnuradioIIO DEFAULT_MSG IIO_LIBRARIES IIO_INCLUDE_DIRS) - -if(PC_IIO_VERSION) - set(GnuradioIIO_VERSION ${PC_IIO_VERSION}) -endif() +pkg_check_modules(PC_IIO libiio) -set_package_properties(GnuradioIIO PROPERTIES - URL "https://github.com/analogdevicesinc/gr-iio" -) -if(GnuradioIIO_FOUND AND GnuradioIIO_VERSION) - set_package_properties(GnuradioIIO PROPERTIES - DESCRIPTION "IIO blocks for GNU Radio (found: v${GnuradioIIO_VERSION})" - ) -else() - set_package_properties(GnuradioIIO PROPERTIES - DESCRIPTION "IIO blocks for GNU Radio" - ) -endif() +pkg_check_modules(PC_AD9361 libad9361) -if(GnuradioIIO_FOUND AND NOT TARGET Gnuradio::iio) - add_library(Gnuradio::iio SHARED IMPORTED) - set_target_properties(Gnuradio::iio PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_LOCATION "${IIO_LIBRARIES}" - INTERFACE_INCLUDE_DIRECTORIES "${IIO_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "${IIO_LIBRARIES}" - ) -endif() +# pkg_check_modules(PC_GR_IIO gnuradio-iio) -if(NOT PC_IIO_FOUND OR NOT PC_AD9361_FOUND OR NOT PC_GR_IIO_FOUND) - set(GnuradioIIO_FOUND FALSE CACHE BOOL "Gnuradio IIO library" FORCE) -endif() +if (GNURADIO_IIO_INCLUDE_DIRS AND GNURADIO_IIO_LIBRARIES AND PC_IIO_FOUND AND PC_AD9361_FOUND) + set(GR_IIO_FOUND TRUE CACHE INTERNAL "gnuradio-iio found") + message(STATUS "Found gnuradio-iio: ${GNURADIO_IIO_INCLUDE_DIRS}, ${GNURADIO_IIO_LIBRARIES}") +else(GNURADIO_IIO_INCLUDE_DIRS AND GNURADIO_IIO_LIBRARIES AND PC_IIO_FOUND AND PC_AD9361_FOUND) + set(GR_IIO_FOUND FALSE CACHE INTERNAL "gnuradio-uhd found") +endif(GNURADIO_IIO_INCLUDE_DIRS AND GNURADIO_IIO_LIBRARIES AND PC_IIO_FOUND AND PC_AD9361_FOUND) -mark_as_advanced(IIO_LIBRARIES IIO_INCLUDE_DIRS GR_IIO_INCLUDE_HAS_GNURADIO) \ No newline at end of file +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuradioIIO DEFAULT_MSG GNURADIO_IIO_LIBRARIES GNURADIO_IIO_INCLUDE_DIRS) +MARK_AS_ADVANCED(GNURADIO_IIO_LIBRARIES GNURADIO_IIO_INCLUDE_DIRS) diff --git a/trunk-recorder/source.cc b/trunk-recorder/source.cc index 8dee5fcb3..825903581 100755 --- a/trunk-recorder/source.cc +++ b/trunk-recorder/source.cc @@ -189,6 +189,9 @@ Source::Source(double c, double r, double e, std::string drv, std::string dev, C source_block = iio_src; } +#else // GnuradioIIO_FOUND + BOOST_LOG_TRIVIAL(fatal) << "Trunk-recorder was not compiled with IIO enabled."; + exit(1); #endif //GnuradioIIO_FOUND } @@ -380,6 +383,9 @@ void Source::set_gain(double r) { cast_to_iio_sptr(source_block)->set_gain(0, gain); BOOST_LOG_TRIVIAL(info) << "Gain set to: " << gain; } +#else // GnuradioIIO_FOUND + BOOST_LOG_TRIVIAL(fatal) << "Trunk-recorder was not compiled with IIO enabled."; + exit(1); #endif //GnuradioIIO_FOUND } @@ -443,6 +449,9 @@ void Source::set_gain_mode(bool m) { cast_to_iio_sptr(source_block)->set_gain_mode(0, "manual"); } } +#else // GnuradioIIO_FOUND + BOOST_LOG_TRIVIAL(fatal) << "Trunk-recorder was not compiled with IIO enabled."; + exit(1); #endif } From 7c155be753e65205a53916aab535579ffb08275a Mon Sep 17 00:00:00 2001 From: Ratmandu Date: Wed, 14 Jan 2026 15:36:55 +0000 Subject: [PATCH 11/13] Updating dockerfile for iio support --- Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 16ad4ab04..4e323ae36 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,11 @@ RUN apt-get update && \ wget \ python3-six \ openssh-client \ - ffmpeg + ffmpeg \ + libiio-dev \ + libiio-utils \ + libad9361-dev \ + libgnuradio-iio3.10.9t64 WORKDIR /src @@ -50,7 +54,8 @@ RUN cmake .. && make -j$(nproc) && make DESTDIR=/newroot install FROM ubuntu:24.04 RUN apt-get update && apt-get -y upgrade && apt-get install --no-install-recommends -y ca-certificates gr-funcube gr-iqbal curl wget libboost-log1.83.0 \ libboost-chrono1.83.0t64 libgnuradio-digital3.10.9t64 libgnuradio-analog3.10.9t64 libgnuradio-filter3.10.9t64 libgnuradio-network3.10.9t64 \ - libgnuradio-uhd3.10.9t64 libgnuradio-osmosdr0.2.0t64 libsoapysdr0.8 soapysdr0.8-module-all libairspyhf1 libfreesrp0 librtlsdr2 libxtrx0 sox fdkaac docker.io && \ + libgnuradio-uhd3.10.9t64 libgnuradio-osmosdr0.2.0t64 libiio-dev libiio-utils libad9361-dev libgnuradio-iio3.10.9t64 libsoapysdr0.8 \ + soapysdr0.8-module-all libairspyhf1 libfreesrp0 librtlsdr2 libxtrx0 sox fdkaac docker.io && \ rm -rf /var/lib/apt/lists/* && \ rm -rf /usr/share/{doc,man,info} && rm -rf /usr/local/share/{doc,man,info} From bca899dbce848b82205033883f0d59f9387bd6ea Mon Sep 17 00:00:00 2001 From: Ratmandu Date: Wed, 14 Jan 2026 15:37:09 +0000 Subject: [PATCH 12/13] Documentation updates --- docs/CONFIGURE.md | 4 ++-- docs/Install/INSTALL-LINUX.md | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/docs/CONFIGURE.md b/docs/CONFIGURE.md index b2ae774cb..fad51f34a 100644 --- a/docs/CONFIGURE.md +++ b/docs/CONFIGURE.md @@ -155,12 +155,12 @@ There is a list of available Plugins [here](./Plugins.md). ## Source Object -### USRP or OSMOSDR Sources +### USRP, OSMOSDR or IIO Sources | Key | Required | Default Value | Type | Description | | :--------------- | :------: | :-----------: | --------------------------- | ------------------------------------------------------------ | | driver | ✓ | | **"usrp"**, **"osmosdr"**, **"iio"** | The GNURadio block you wish to use for the SDR. | -| device | | | **string**
See the [osmosdr page](http://sdr.osmocom.org/trac/wiki/GrOsmoSDR) for supported devices and parameters. | Osmosdr device name and possibly serial number or index of the device.
You only need to do add this key if there are more than one osmosdr devices being used.
Example: `bladerf=00001` for BladeRF with serial 00001 or `rtl=00923838` for RTL-SDR with serial 00923838, just `airspy` for an airspy.
It seems that when you have 5 or more RTLSDRs on one system you need to decrease the buffer size. I think it has something to do with the driver. Try adding buflen: `"device": "rtl=serial_num,buflen=65536"`, there should be no space between the comma and `buflen`. For iio devices, "ip:192.168.1.5,65536" or "usb:1.3.5,65536" can be used, depending on if you are connecting over ethernet or USB. iio_util -S will scan for iio devices and give you the ip address or usb device number. The number after the comma is the buffer length.| +| device | | | **string**
See the [osmosdr page](http://sdr.osmocom.org/trac/wiki/GrOsmoSDR) for supported devices and parameters. | Osmosdr device name and possibly serial number or index of the device.
You only need to do add this key if there are more than one osmosdr devices being used.
Example: `bladerf=00001` for BladeRF with serial 00001 or `rtl=00923838` for RTL-SDR with serial 00923838, just `airspy` for an airspy.
It seems that when you have 5 or more RTLSDRs on one system you need to decrease the buffer size. I think it has something to do with the driver. Try adding buflen: `"device": "rtl=serial_num,buflen=65536"`, there should be no space between the comma and `buflen`.
For iio devices, `"ip:192.168.1.5,65536"` or `"usb:1.3.5,65536"` can be used, depending on if you are connecting over ethernet or USB. `iio_info -S` will scan for iio devices and give you the ip address or usb device number. The number after the comma is the buffer length.| | center | ✓ | | number | The center frequency in Hz to tune the SDR to | | rate | ✓ | | number | The sampling rate to set the SDR to, in samples / second | | error | | 0 | number | The tuning error for the SDR, in Hz. This is the difference between the target value and the actual value. So if you wanted to recv 856MHz but you had to tune your SDR to 855MHz (when set to 0ppm) to actually receive it, you would set this to -1000000. You should also probably get a new SDR if it is off by this much. | diff --git a/docs/Install/INSTALL-LINUX.md b/docs/Install/INSTALL-LINUX.md index bef1518fb..aec32fc66 100644 --- a/docs/Install/INSTALL-LINUX.md +++ b/docs/Install/INSTALL-LINUX.md @@ -23,6 +23,10 @@ If you are using a HackRF: sudo apt install -y hackrf libhackrf-dev libhackrf0 ``` +If you are using an IIO device (Pluto, LibreSDR, fmcomms2/3/4, etc): +```bash +sudo apt install -y libad9361-dev libiio-dev libiio-utils libgnuradio-iio* +``` ### Ubuntu 22.04 @@ -36,6 +40,10 @@ If you are using a HackRF: sudo apt install -y hackrf libhackrf-dev libhackrf0 ``` +If you are using an IIO device (Pluto, LibreSDR, fmcomms2/3/4, etc): +```bash +sudo apt install -y libad9361-dev libiio-dev libiio-utils libgnuradio-iio* +``` ### Ubuntu 21.04 @@ -50,6 +58,10 @@ If you are using a HackRF: sudo apt install -y hackrf libhackrf-dev libhackrf0 ``` +If you are using an IIO device (Pluto, LibreSDR, fmcomms2/3/4, etc): +```bash +sudo apt install -y libad9361-dev libiio-dev libiio-utils libgnuradio-iio* +``` ### Ubuntu 20.x @@ -63,6 +75,11 @@ If you are using a HackRF: sudo apt install -y hackrf libhackrf-dev libhackrf0 ``` +If you are using an IIO device (Pluto, LibreSDR, fmcomms2/3/4, etc): +```bash +sudo apt install -y libad9361-dev libiio-dev libiio-utils libgnuradio-iio* +``` + ### Older Ubuntu Versions... These instructions should work on Ubuntu 16.x to 17.x, including Debian 9 and 10. From 216938e71c1afa1cd3e6efa6f80520c227c994ae Mon Sep 17 00:00:00 2001 From: Ratmandu Date: Wed, 14 Jan 2026 15:49:21 +0000 Subject: [PATCH 13/13] adding iio example config --- examples/config-iio.json | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 examples/config-iio.json diff --git a/examples/config-iio.json b/examples/config-iio.json new file mode 100644 index 000000000..012a361fa --- /dev/null +++ b/examples/config-iio.json @@ -0,0 +1,32 @@ + { + "ver": 2, + "sources": [ + { + "center": 857000000.0, + "rate": 8000000, + "error": 0, + "gain": 65, + "digitalRecorders": 6, + "driver": "iio", + "device": "ip:10.10.1.222,1048576" + }, + { + "center": 773000000.0, + "rate": 8000000, + "error": 0, + "gain": 65, + "digitalRecorders": 6, + "driver": "iio", + "device": "usb:1.3.5,1048576" + } + + ], + "systems": [ + { + "type": "p25", + "control_channels": [ 772281250 ], + "talkgroupsFile": "talkgroups.csv", + "modulation": "qpsk" + } + ] +}