File gr-osmosdr-0.2.6-iioboards.diff of Package gr-osmosdr

diff -urN gr-osmosdr-0.2.6.orig/cmake/Modules/FindIIO.cmake gr-osmosdr-0.2.6/cmake/Modules/FindIIO.cmake
--- gr-osmosdr-0.2.6.orig/cmake/Modules/FindIIO.cmake	1970-01-01 01:00:00.000000000 +0100
+++ gr-osmosdr-0.2.6/cmake/Modules/FindIIO.cmake	2024-07-24 21:25:21.476153256 +0200
@@ -0,0 +1,28 @@
+########################################################################
+# Find the IIO userspace library
+########################################################################
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PC_IIO iio)
+
+FIND_PATH(
+    IIO_INCLUDE_DIRS
+    NAMES iio.h
+    HINTS $ENV{IIO_DIR}/include
+        ${PC_IIO_INCLUDEDIR}
+    PATHS /usr/local/include
+          /usr/include
+)
+
+FIND_LIBRARY(
+    IIO_LIBRARIES
+    NAMES iio
+    HINTS $ENV{IIO_DIR}/lib
+        ${PC_IIO_LIBDIR}
+    PATHS /usr/local/lib
+          /usr/lib
+)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(IIO DEFAULT_MSG IIO_LIBRARIES IIO_INCLUDE_DIRS)
+MARK_AS_ADVANCED(IIO_LIBRARIES IIO_INCLUDE_DIRS)
diff -urN gr-osmosdr-0.2.6.orig/CMakeLists.txt gr-osmosdr-0.2.6/CMakeLists.txt
--- gr-osmosdr-0.2.6.orig/CMakeLists.txt	2024-05-15 19:40:15.000000000 +0200
+++ gr-osmosdr-0.2.6/CMakeLists.txt	2024-07-24 21:25:21.476153256 +0200
@@ -42,7 +42,7 @@
 
 # Find GNURadio (pmt and runtime are core, always included)
 include(FindPkgConfig)
-find_package(Gnuradio "3.9" REQUIRED COMPONENTS blocks fft filter)
+find_package(Gnuradio "3.9" REQUIRED COMPONENTS blocks fft filter analog)
 
 # Set the version information here
 set(VERSION_MAJOR 0)
@@ -144,6 +144,10 @@
 find_package(gnuradio-blocks PATHS ${Gnuradio_DIR})
 message(STATUS " Found GNURadio-Blocks: ${gnuradio-blocks_FOUND}")
 
+message(STATUS "Searching for GNURadio-IIO...")
+find_package(gnuradio-iio PATHS ${Gnuradio_DIR})
+message(STATUS " Found GNURadio-IIO: ${gnuradio-iio_FOUND}")
+
 message(STATUS "Searching for IQ Balance...")
 find_package(gnuradio-iqbalance PATHS ${Gnuradio_DIR})
 message (STATUS " Found IQ Balance: ${gnuradio-iqbalance_FOUND}")
diff -urN gr-osmosdr-0.2.6.orig/lib/CMakeLists.txt gr-osmosdr-0.2.6/lib/CMakeLists.txt
--- gr-osmosdr-0.2.6.orig/lib/CMakeLists.txt	2024-05-15 19:40:15.000000000 +0200
+++ gr-osmosdr-0.2.6/lib/CMakeLists.txt	2024-07-24 21:25:21.480153264 +0200
@@ -176,6 +176,15 @@
 endif(ENABLE_UHD)
 
 ########################################################################
+# Setup IIO component
+########################################################################
+GR_REGISTER_COMPONENT("IIO Devices" ENABLE_IIO gnuradio-iio_FOUND)
+if(ENABLE_IIO)
+    add_subdirectory(plutosdr)
+    add_subdirectory(hnchboard2)
+endif(ENABLE_IIO)
+
+########################################################################
 # Setup MiriSDR component
 ########################################################################
 GR_REGISTER_COMPONENT("Osmocom MiriSDR" ENABLE_MIRI LIBMIRISDR_FOUND)
diff -urN gr-osmosdr-0.2.6.orig/lib/config.h.in gr-osmosdr-0.2.6/lib/config.h.in
--- gr-osmosdr-0.2.6.orig/lib/config.h.in	2024-05-15 19:40:15.000000000 +0200
+++ gr-osmosdr-0.2.6/lib/config.h.in	2024-07-24 21:28:15.996523622 +0200
@@ -10,6 +10,7 @@
 #cmakedefine ENABLE_RTL_TCP
 #cmakedefine ENABLE_UHD
 #cmakedefine ENABLE_MIRI
+#cmakedefine ENABLE_IIO
 #cmakedefine ENABLE_SDRPLAY
 #cmakedefine ENABLE_HACKRF
 #cmakedefine ENABLE_BLADERF
diff -urN gr-osmosdr-0.2.6.orig/lib/device.cc gr-osmosdr-0.2.6/lib/device.cc
--- gr-osmosdr-0.2.6.orig/lib/device.cc	2024-05-15 19:40:15.000000000 +0200
+++ gr-osmosdr-0.2.6/lib/device.cc	2024-07-24 21:25:21.480153264 +0200
@@ -53,6 +53,13 @@
 #include <miri_source_c.h>
 #endif
 
+#ifdef ENABLE_IIO
+#include <plutosdr_source_c.h>
+#include <hnchboard2_source_c.h>
+#include <hnchboard2u_source_c.h>
+#include <hnchbbboard_source_c.h>
+#endif
+
 #ifdef ENABLE_SDRPLAY
 #include <sdrplay_source_c.h>
 #endif
@@ -161,6 +168,16 @@
   for (std::string dev : miri_source_c::get_devices())
     devices.push_back( device_t(dev) );
 #endif
+#ifdef ENABLE_IIO
+  for (std::string dev : plutosdr_source_c::get_devices())
+    devices.push_back( device_t(dev) );
+  for (std::string dev : hnchboard2_source_c::get_devices())
+    devices.push_back( device_t(dev) );
+  for (std::string dev : hnchboard2u_source_c::get_devices())
+    devices.push_back( device_t(dev) );
+  for (std::string dev : hnchbbboard_source_c::get_devices())
+    devices.push_back( device_t(dev) );
+#endif
 #ifdef ENABLE_SDRPLAY
   for (std::string dev : sdrplay_source_c::get_devices())
     devices.push_back( device_t(dev) );
diff -urN gr-osmosdr-0.2.6.orig/lib/hnchboard2/CMakeLists.txt gr-osmosdr-0.2.6/lib/hnchboard2/CMakeLists.txt
--- gr-osmosdr-0.2.6.orig/lib/hnchboard2/CMakeLists.txt	1970-01-01 01:00:00.000000000 +0100
+++ gr-osmosdr-0.2.6/lib/hnchboard2/CMakeLists.txt	2024-07-24 21:25:21.480153264 +0200
@@ -0,0 +1,41 @@
+# Copyright 2012 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+########################################################################
+# This file included, use CMake directory variables
+########################################################################
+
+target_include_directories(gnuradio-osmosdr PRIVATE
+    ${CMAKE_CURRENT_SOURCE_DIR}
+    ${GNURADIO_IIO_INCLUDE_DIRS}
+    ${IIO_INCLUDE_DIRS}
+)
+
+APPEND_LIB_LIST(
+	gnuradio::gnuradio-iio
+	${IIO_LIBRARIES}
+)
+
+list(APPEND gr_osmosdr_srcs
+    ${CMAKE_CURRENT_SOURCE_DIR}/hnchboard2_source_c.cc
+    ${CMAKE_CURRENT_SOURCE_DIR}/hnchboard2u_source_c.cc
+    ${CMAKE_CURRENT_SOURCE_DIR}/hnchbbboard_source_c.cc
+)
+set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
+
diff -urN gr-osmosdr-0.2.6.orig/lib/hnchboard2/hnchbbboard_source_c.cc gr-osmosdr-0.2.6/lib/hnchboard2/hnchbbboard_source_c.cc
--- gr-osmosdr-0.2.6.orig/lib/hnchboard2/hnchbbboard_source_c.cc	1970-01-01 01:00:00.000000000 +0100
+++ gr-osmosdr-0.2.6/lib/hnchboard2/hnchbbboard_source_c.cc	2024-07-24 21:25:21.484153273 +0200
@@ -0,0 +1,253 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2017 Dimitri Stolnikov <horiz0n@gmx.net>
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+#include <boost/assign.hpp>
+#include <iostream>
+#include <cmath>
+
+#include "arg_helpers.h"
+#include "osmosdr/source.h"
+#include "hnchbbboard_source_c.h"
+#include <gnuradio/blocks/short_to_float.h>
+#include <gnuradio/blocks/float_to_complex.h>
+
+
+using namespace boost::assign;
+
+hnchbbboard_source_c_sptr make_hnchbbboard_source_c(const std::string &args)
+{
+  return gnuradio::get_initial_sptr(new hnchbbboard_source_c(args));
+}
+
+hnchbbboard_source_c::hnchbbboard_source_c(const std::string &args) :
+    gr::hier_block2("hnchbbboard_source_c",
+                   gr::io_signature::make(0, 0, 0),
+                   gr::io_signature::make(1, 1, sizeof(gr_complex)))
+{    
+  gr::blocks::short_to_float::sptr s2f1 =  gr::blocks::short_to_float::make(1, 2048.0);
+  gr::blocks::short_to_float::sptr s2f2 =  gr::blocks::short_to_float::make(1, 2048.0);
+  gr::blocks::float_to_complex::sptr f2c =  gr::blocks::float_to_complex::make(1);
+  
+  uri = "ip:hnchbbboard.local";
+  samplerate = 5000000;
+  lo_freq = 5000000;
+  buffer_size = 0x10000;
+  gain_value = 4.5;
+  stream_id = 0;
+  
+  dict_t dict = params_to_dict(args);
+  if (dict.count("uri"))
+    uri = boost::lexical_cast< std::string >( dict["uri"] );
+
+  std::cerr << "Using hnchBoard2 URI = " << uri << std::endl;
+  
+  if (dict.count("stream_id"))
+    stream_id = boost::lexical_cast< int >( dict["stream_id"] );
+
+  _src = gr::iio::hnchbbboard_source::make(uri, lo_freq, samplerate, stream_id, buffer_size, gain_value);  
+  
+  connect(_src, 0, s2f1, 0);
+  connect(_src, 1, s2f2, 0);
+  connect(s2f1, 0, f2c, 0);
+  connect(s2f2, 0, f2c, 1);
+  connect(f2c, 0, self(), 0);
+}
+
+hnchbbboard_source_c::~hnchbbboard_source_c()
+{
+}
+
+std::vector< std::string > hnchbbboard_source_c::get_devices()
+{
+  std::vector< std::string > devices;
+
+  std::string args = "hnchbbboard,label='hnchBBBoard'";
+
+  devices.push_back( args );
+
+  return devices;
+}
+
+std::string hnchbbboard_source_c::name()
+{
+  return "hnchBBBoard";
+}
+
+size_t hnchbbboard_source_c::get_num_channels()
+{
+  return output_signature()->max_streams();
+}
+
+osmosdr::meta_range_t hnchbbboard_source_c::get_sample_rates( void )
+{
+  osmosdr::meta_range_t rates;
+
+  rates += osmosdr::range_t(   500000 );    
+  rates += osmosdr::range_t(  1000000 );
+  rates += osmosdr::range_t(  2000000 );
+  rates += osmosdr::range_t(  3000000 );
+  rates += osmosdr::range_t(  4000000 );
+  rates += osmosdr::range_t(  5000000 );    
+  rates += osmosdr::range_t( 10000000 );
+  rates += osmosdr::range_t( 20000000 );    
+  rates += osmosdr::range_t( 40000000 );  
+
+  return rates;
+}
+
+double hnchbbboard_source_c::set_sample_rate( double rate )
+{
+  samplerate = (unsigned long) rate;
+  set_params();
+
+  return samplerate;
+}
+
+double hnchbbboard_source_c::get_sample_rate( void )
+{
+  return samplerate;
+}
+
+osmosdr::freq_range_t hnchbbboard_source_c::get_freq_range( size_t chan )
+{
+  osmosdr::freq_range_t range;
+
+  range += osmosdr::range_t( 0, 40000000.0, 5000000.0 );
+
+  return range;
+}
+
+double hnchbbboard_source_c::set_center_freq( double freq, size_t chan )
+{
+  lo_freq = (unsigned long) (round(freq/samplerate)*samplerate);
+  set_params();
+  return (double)lo_freq;
+}
+
+double hnchbbboard_source_c::get_center_freq( size_t chan )
+{
+  return (double)lo_freq;
+}
+
+double hnchbbboard_source_c::set_freq_corr( double ppm, size_t chan)
+{
+  return 0;
+}
+
+double hnchbbboard_source_c::get_freq_corr( size_t chan)
+{
+  return 0;
+}
+
+std::vector<std::string> hnchbbboard_source_c::get_gain_names( size_t chan )
+{
+  std::vector< std::string > gains;
+  gains.push_back( "Dummy" );
+  
+  return gains;
+}
+
+osmosdr::gain_range_t hnchbbboard_source_c::get_gain_range( size_t chan)
+{
+  osmosdr::gain_range_t range;
+  range += osmosdr::range_t(4.5, 20.25, 0.25 );
+
+  return range;
+}
+
+osmosdr::gain_range_t hnchbbboard_source_c::get_gain_range( const std::string & name,
+                                                         size_t chan)
+{
+  osmosdr::gain_range_t range;
+
+    range += osmosdr::range_t(4.5, 20.25, 0.25 );
+
+  return range;
+}
+
+bool hnchbbboard_source_c::set_gain_mode( bool automatic, size_t chan )
+{
+  return 0;
+}
+
+bool hnchbbboard_source_c::get_gain_mode( size_t chan )
+{
+  return 0;
+}
+
+double hnchbbboard_source_c::set_gain( double gain, size_t chan )
+{  
+    gain_value = gain;
+    set_params();
+    return 0;
+}
+
+double hnchbbboard_source_c::set_gain( double gain, const std::string & name, size_t chan )
+{
+    gain_value = gain;
+    set_params();
+    return 0;
+}
+
+double hnchbbboard_source_c::get_gain( size_t chan )
+{
+  return gain_value;
+}
+
+double hnchbbboard_source_c::get_gain( const std::string & name, size_t chan )
+{
+  return gain_value;
+}
+
+std::vector< std::string > hnchbbboard_source_c::get_antennas( size_t chan )
+{
+  std::vector< std::string > antennas;
+
+  antennas += get_antenna( chan );
+
+  return antennas;
+}
+
+std::string hnchbbboard_source_c::set_antenna( const std::string & antenna, size_t chan )
+{
+  return get_antenna( chan );
+}
+
+std::string hnchbbboard_source_c::get_antenna( size_t chan )
+{
+  return "Default";
+}
+
+double hnchbbboard_source_c::set_bandwidth( double bw, size_t chan )
+{
+    
+  return (5000000);
+}
+
+double hnchbbboard_source_c::get_bandwidth( size_t chan )
+{
+  return (5000000);
+}
+
+void hnchbbboard_source_c::set_params( void )
+{  
+  _src->set_params(lo_freq, samplerate, gain_value);
+  
+  return;
+}
diff -urN gr-osmosdr-0.2.6.orig/lib/hnchboard2/hnchbbboard_source_c.h gr-osmosdr-0.2.6/lib/hnchboard2/hnchbbboard_source_c.h
--- gr-osmosdr-0.2.6.orig/lib/hnchboard2/hnchbbboard_source_c.h	1970-01-01 01:00:00.000000000 +0100
+++ gr-osmosdr-0.2.6/lib/hnchboard2/hnchbbboard_source_c.h	2024-07-24 21:25:21.484153273 +0200
@@ -0,0 +1,97 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2017 Dimitri Stolnikov <horiz0n@gmx.net>
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef HNCHBBBOARD_SOURCE_C_H
+#define HNCHBBBOARD_SOURCE_C_H
+
+#include <gnuradio/blocks/float_to_complex.h>
+#include <gnuradio/blocks/short_to_float.h>
+#include <gnuradio/hier_block2.h>
+#include <iio/hnchbbboard_source.h>
+
+#include "source_iface.h"
+
+class hnchbbboard_source_c;
+
+typedef std::shared_ptr< hnchbbboard_source_c > hnchbbboard_source_c_sptr;
+
+hnchbbboard_source_c_sptr make_hnchbbboard_source_c(const std::string &args = "");
+
+class hnchbbboard_source_c :
+    public gr::hier_block2,
+    public source_iface
+{
+private:
+  friend hnchbbboard_source_c_sptr make_hnchbbboard_source_c(const std::string &args);
+
+  hnchbbboard_source_c(const std::string &args);
+
+public:
+  ~hnchbbboard_source_c();
+
+  static std::vector< std::string > get_devices();
+
+  std::string name();
+
+  size_t get_num_channels( void );
+
+  osmosdr::meta_range_t get_sample_rates( void );
+  double set_sample_rate( double rate );
+  double get_sample_rate( void );
+
+  osmosdr::freq_range_t get_freq_range( size_t chan = 0 );
+  double set_center_freq( double freq, size_t chan = 0 );
+  double get_center_freq( size_t chan = 0 );
+
+  double set_freq_corr( double ppm, size_t chan = 0 );
+  double get_freq_corr( size_t chan = 0 );
+
+  std::vector<std::string> get_gain_names( size_t chan = 0 );
+  osmosdr::gain_range_t get_gain_range( size_t chan = 0 );
+  osmosdr::gain_range_t get_gain_range( const std::string & name, size_t chan = 0 );
+  bool set_gain_mode( bool automatic, size_t chan = 0 );
+  bool get_gain_mode( size_t chan = 0 );
+  double set_gain( double gain, size_t chan = 0 );
+  double set_gain( double gain, const std::string & name, size_t chan = 0 );
+  double get_gain( size_t chan = 0 );
+  double get_gain( const std::string & name, size_t chan = 0 );
+
+  std::vector< std::string > get_antennas( size_t chan = 0 );
+  std::string set_antenna( const std::string & antenna, size_t chan = 0 );
+  std::string get_antenna( size_t chan = 0 );
+
+  double set_bandwidth( double bw, size_t chan = 0 );
+  double get_bandwidth( size_t chan = 0 );
+
+private:
+
+  void set_params(void);
+
+  gr::iio::hnchbbboard_source::sptr       _src;
+
+  std::string   uri;
+  unsigned long samplerate;
+  unsigned long long lo_freq;
+  unsigned long buffer_size;
+  double gain_value;
+  int stream_id;
+
+};
+
+#endif // HNCHBBBOARD_SOURCE_C_H
diff -urN gr-osmosdr-0.2.6.orig/lib/hnchboard2/hnchboard2_source_c.cc gr-osmosdr-0.2.6/lib/hnchboard2/hnchboard2_source_c.cc
--- gr-osmosdr-0.2.6.orig/lib/hnchboard2/hnchboard2_source_c.cc	1970-01-01 01:00:00.000000000 +0100
+++ gr-osmosdr-0.2.6/lib/hnchboard2/hnchboard2_source_c.cc	2024-07-24 21:25:21.484153273 +0200
@@ -0,0 +1,247 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2017 Dimitri Stolnikov <horiz0n@gmx.net>
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+#include <boost/assign.hpp>
+#include <iostream>
+
+#include "arg_helpers.h"
+#include "osmosdr/source.h"
+#include "hnchboard2_source_c.h"
+#include <gnuradio/blocks/short_to_float.h>
+#include <gnuradio/blocks/float_to_complex.h>
+
+
+using namespace boost::assign;
+
+hnchboard2_source_c_sptr make_hnchboard2_source_c(const std::string &args)
+{
+  return gnuradio::get_initial_sptr(new hnchboard2_source_c(args));
+}
+
+hnchboard2_source_c::hnchboard2_source_c(const std::string &args) :
+    gr::hier_block2("hnchboard2_source_c",
+                   gr::io_signature::make(0, 0, 0),
+                   gr::io_signature::make(1, 1, sizeof(gr_complex)))
+{
+  gr::blocks::short_to_float::sptr s2f1 =  gr::blocks::short_to_float::make(1, 2048.0);
+  gr::blocks::short_to_float::sptr s2f2 =  gr::blocks::short_to_float::make(1, 2048.0);
+  gr::blocks::float_to_complex::sptr f2c =  gr::blocks::float_to_complex::make(1);
+
+  uri = "ip:hnchboard2.local";
+  samplerate = 5000000;
+  lo_freq = 100000000;
+  buffer_size = 0x10000;
+  gain_value = 4.5;
+  
+  dict_t dict = params_to_dict(args);
+  if (dict.count("uri"))
+    uri = boost::lexical_cast< std::string >( dict["uri"] );
+
+  std::cerr << "Using hnchBoard2 URI = " << uri << std::endl;
+
+  _src = gr::iio::hnchboard2_source::make(uri, samplerate, lo_freq, gain_value, buffer_size);  
+  
+  connect(_src, 0, s2f1, 0);
+  connect(_src, 1, s2f2, 0);
+  connect(s2f1, 0, f2c, 0);
+  connect(s2f2, 0, f2c, 1);
+  connect(f2c, 0, self(), 0);    
+}
+
+hnchboard2_source_c::~hnchboard2_source_c()
+{
+}
+
+std::vector< std::string > hnchboard2_source_c::get_devices()
+{
+  std::vector< std::string > devices;
+
+  std::string args = "hnchboard2,label='hnchBoard2'";
+
+  devices.push_back( args );
+
+  return devices;
+}
+
+std::string hnchboard2_source_c::name()
+{
+  return "hnchBoard2";
+}
+
+size_t hnchboard2_source_c::get_num_channels()
+{
+  return output_signature()->max_streams();
+}
+
+osmosdr::meta_range_t hnchboard2_source_c::get_sample_rates( void )
+{
+  osmosdr::meta_range_t rates;
+
+  rates += osmosdr::range_t(   500000 );    
+  rates += osmosdr::range_t(  1000000 );
+  rates += osmosdr::range_t(  2500000 );
+  rates += osmosdr::range_t(  3000000 );    
+  rates += osmosdr::range_t(  5000000 );    
+  rates += osmosdr::range_t( 10000000 );
+  rates += osmosdr::range_t( 20000000 );    
+  rates += osmosdr::range_t( 40000000 );  
+
+  return rates;
+}
+
+double hnchboard2_source_c::set_sample_rate( double rate )
+{
+  samplerate = (unsigned long) rate;
+  set_params();
+
+  return samplerate;
+}
+
+double hnchboard2_source_c::get_sample_rate( void )
+{
+  return samplerate;
+}
+
+osmosdr::freq_range_t hnchboard2_source_c::get_freq_range( size_t chan )
+{
+  osmosdr::freq_range_t range;
+
+  range += osmosdr::range_t( 70000000, 500000000, 1.0 );
+
+  return range;
+}
+
+double hnchboard2_source_c::set_center_freq( double freq, size_t chan )
+{
+  lo_freq = (unsigned long) freq;
+  set_params();
+  return (double)lo_freq;
+}
+
+double hnchboard2_source_c::get_center_freq( size_t chan )
+{
+  return (double)lo_freq;
+}
+
+double hnchboard2_source_c::set_freq_corr( double ppm, size_t chan)
+{
+  return 0;
+}
+
+double hnchboard2_source_c::get_freq_corr( size_t chan)
+{
+  return 0;
+}
+
+std::vector<std::string> hnchboard2_source_c::get_gain_names( size_t chan )
+{
+  std::vector< std::string > gains;
+  gains.push_back( "Dummy" );
+  
+  return gains;
+}
+
+osmosdr::gain_range_t hnchboard2_source_c::get_gain_range( size_t chan)
+{
+  osmosdr::gain_range_t range;
+  range += osmosdr::range_t(4.5, 20.25, 0.253 );
+
+  return range;
+}
+
+osmosdr::gain_range_t hnchboard2_source_c::get_gain_range( const std::string & name,
+                                                         size_t chan)
+{
+  osmosdr::gain_range_t range;
+
+    range += osmosdr::range_t(4.5, 20.25, 0.253 );
+
+  return range;
+}
+
+bool hnchboard2_source_c::set_gain_mode( bool automatic, size_t chan )
+{
+  return 0;
+}
+
+bool hnchboard2_source_c::get_gain_mode( size_t chan )
+{
+  return 0;
+}
+
+double hnchboard2_source_c::set_gain( double gain, size_t chan )
+{  
+    gain_value = gain;
+    set_params();
+    return 0;
+}
+
+double hnchboard2_source_c::set_gain( double gain, const std::string & name, size_t chan )
+{
+    gain_value = gain;
+    set_params();
+    return 0;
+}
+
+double hnchboard2_source_c::get_gain( size_t chan )
+{
+  return gain_value;
+}
+
+double hnchboard2_source_c::get_gain( const std::string & name, size_t chan )
+{
+  return gain_value;
+}
+
+std::vector< std::string > hnchboard2_source_c::get_antennas( size_t chan )
+{
+  std::vector< std::string > antennas;
+
+  antennas += get_antenna( chan );
+
+  return antennas;
+}
+
+std::string hnchboard2_source_c::set_antenna( const std::string & antenna, size_t chan )
+{
+  return get_antenna( chan );
+}
+
+std::string hnchboard2_source_c::get_antenna( size_t chan )
+{
+  return "Default";
+}
+
+double hnchboard2_source_c::set_bandwidth( double bw, size_t chan )
+{
+    
+  return (5000000);
+}
+
+double hnchboard2_source_c::get_bandwidth( size_t chan )
+{
+  return (5000000);
+}
+
+void hnchboard2_source_c::set_params( void )
+{  
+  _src->set_params(samplerate, lo_freq, gain_value);
+  
+  return;
+}
diff -urN gr-osmosdr-0.2.6.orig/lib/hnchboard2/hnchboard2_source_c.h gr-osmosdr-0.2.6/lib/hnchboard2/hnchboard2_source_c.h
--- gr-osmosdr-0.2.6.orig/lib/hnchboard2/hnchboard2_source_c.h	1970-01-01 01:00:00.000000000 +0100
+++ gr-osmosdr-0.2.6/lib/hnchboard2/hnchboard2_source_c.h	2024-07-24 21:25:21.488153281 +0200
@@ -0,0 +1,96 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2017 Dimitri Stolnikov <horiz0n@gmx.net>
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef HNCHBOARD2_SOURCE_C_H
+#define HNCHBOARD2_SOURCE_C_H
+
+#include <gnuradio/blocks/float_to_complex.h>
+#include <gnuradio/blocks/short_to_float.h>
+#include <gnuradio/hier_block2.h>
+#include <iio/hnchboard2_source.h>
+
+#include "source_iface.h"
+
+class hnchboard2_source_c;
+
+typedef std::shared_ptr< hnchboard2_source_c > hnchboard2_source_c_sptr;
+
+hnchboard2_source_c_sptr make_hnchboard2_source_c(const std::string &args = "");
+
+class hnchboard2_source_c :
+    public gr::hier_block2,
+    public source_iface
+{
+private:
+  friend hnchboard2_source_c_sptr make_hnchboard2_source_c(const std::string &args);
+
+  hnchboard2_source_c(const std::string &args);
+
+public:
+  ~hnchboard2_source_c();
+
+  static std::vector< std::string > get_devices();
+
+  std::string name();
+
+  size_t get_num_channels( void );
+
+  osmosdr::meta_range_t get_sample_rates( void );
+  double set_sample_rate( double rate );
+  double get_sample_rate( void );
+
+  osmosdr::freq_range_t get_freq_range( size_t chan = 0 );
+  double set_center_freq( double freq, size_t chan = 0 );
+  double get_center_freq( size_t chan = 0 );
+
+  double set_freq_corr( double ppm, size_t chan = 0 );
+  double get_freq_corr( size_t chan = 0 );
+
+  std::vector<std::string> get_gain_names( size_t chan = 0 );
+  osmosdr::gain_range_t get_gain_range( size_t chan = 0 );
+  osmosdr::gain_range_t get_gain_range( const std::string & name, size_t chan = 0 );
+  bool set_gain_mode( bool automatic, size_t chan = 0 );
+  bool get_gain_mode( size_t chan = 0 );
+  double set_gain( double gain, size_t chan = 0 );
+  double set_gain( double gain, const std::string & name, size_t chan = 0 );
+  double get_gain( size_t chan = 0 );
+  double get_gain( const std::string & name, size_t chan = 0 );
+
+  std::vector< std::string > get_antennas( size_t chan = 0 );
+  std::string set_antenna( const std::string & antenna, size_t chan = 0 );
+  std::string get_antenna( size_t chan = 0 );
+
+  double set_bandwidth( double bw, size_t chan = 0 );
+  double get_bandwidth( size_t chan = 0 );
+
+private:
+
+  void set_params(void);
+
+  gr::iio::hnchboard2_source::sptr       _src;
+
+  std::string   uri;
+  unsigned long samplerate;
+  unsigned long lo_freq;
+  unsigned long buffer_size;
+  double gain_value;
+
+};
+
+#endif // HNCHBOARD2_SOURCE_C_H
diff -urN gr-osmosdr-0.2.6.orig/lib/hnchboard2/hnchboard2u_source_c.cc gr-osmosdr-0.2.6/lib/hnchboard2/hnchboard2u_source_c.cc
--- gr-osmosdr-0.2.6.orig/lib/hnchboard2/hnchboard2u_source_c.cc	1970-01-01 01:00:00.000000000 +0100
+++ gr-osmosdr-0.2.6/lib/hnchboard2/hnchboard2u_source_c.cc	2024-07-24 21:25:21.488153281 +0200
@@ -0,0 +1,247 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2017 Dimitri Stolnikov <horiz0n@gmx.net>
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+#include <boost/assign.hpp>
+#include <iostream>
+
+#include "arg_helpers.h"
+#include "osmosdr/source.h"
+#include "hnchboard2u_source_c.h"
+#include <gnuradio/blocks/short_to_float.h>
+#include <gnuradio/blocks/float_to_complex.h>
+
+
+using namespace boost::assign;
+
+hnchboard2u_source_c_sptr make_hnchboard2u_source_c(const std::string &args)
+{
+  return gnuradio::get_initial_sptr(new hnchboard2u_source_c(args));
+}
+
+hnchboard2u_source_c::hnchboard2u_source_c(const std::string &args) :
+    gr::hier_block2("hnchboard2u_source_c",
+                   gr::io_signature::make(0, 0, 0),
+                   gr::io_signature::make(1, 1, sizeof(gr_complex)))
+{
+  gr::blocks::short_to_float::sptr s2f1 =  gr::blocks::short_to_float::make(1, 2048.0);
+  gr::blocks::short_to_float::sptr s2f2 =  gr::blocks::short_to_float::make(1, 2048.0);
+  gr::blocks::float_to_complex::sptr f2c =  gr::blocks::float_to_complex::make(1);
+
+  uri = "ip:hnchboard2u.local";
+  samplerate = 5000000;
+  lo_freq = 2440000000;
+  buffer_size = 0x10000;
+  gain_value = 4.5;
+  
+  dict_t dict = params_to_dict(args);
+  if (dict.count("uri"))
+    uri = boost::lexical_cast< std::string >( dict["uri"] );
+
+  std::cerr << "Using hnchBoard2 URI = " << uri << std::endl;
+
+  _src = gr::iio::hnchboard2u_source::make(uri, samplerate, lo_freq, gain_value, buffer_size);  
+  
+  connect(_src, 0, s2f1, 0);
+  connect(_src, 1, s2f2, 0);
+  connect(s2f1, 0, f2c, 0);
+  connect(s2f2, 0, f2c, 1);
+  connect(f2c, 0, self(), 0);    
+}
+
+hnchboard2u_source_c::~hnchboard2u_source_c()
+{
+}
+
+std::vector< std::string > hnchboard2u_source_c::get_devices()
+{
+  std::vector< std::string > devices;
+
+  std::string args = "hnchboard2u,label='hnchBoard2'";
+
+  devices.push_back( args );
+
+  return devices;
+}
+
+std::string hnchboard2u_source_c::name()
+{
+  return "hnchBoard2";
+}
+
+size_t hnchboard2u_source_c::get_num_channels()
+{
+  return output_signature()->max_streams();
+}
+
+osmosdr::meta_range_t hnchboard2u_source_c::get_sample_rates( void )
+{
+  osmosdr::meta_range_t rates;
+
+  rates += osmosdr::range_t(   500000 );    
+  rates += osmosdr::range_t(  1000000 );
+  rates += osmosdr::range_t(  2500000 );
+  rates += osmosdr::range_t(  3000000 );    
+  rates += osmosdr::range_t(  5000000 );    
+  rates += osmosdr::range_t( 10000000 );
+  rates += osmosdr::range_t( 20000000 );    
+  rates += osmosdr::range_t( 40000000 );  
+
+  return rates;
+}
+
+double hnchboard2u_source_c::set_sample_rate( double rate )
+{
+  samplerate = (unsigned long) rate;
+  set_params();
+
+  return samplerate;
+}
+
+double hnchboard2u_source_c::get_sample_rate( void )
+{
+  return samplerate;
+}
+
+osmosdr::freq_range_t hnchboard2u_source_c::get_freq_range( size_t chan )
+{
+  osmosdr::freq_range_t range;
+
+  range += osmosdr::range_t( 450000000, 2800000000, 1.0 );
+
+  return range;
+}
+
+double hnchboard2u_source_c::set_center_freq( double freq, size_t chan )
+{
+  lo_freq = (unsigned long) freq;
+  set_params();
+  return (double)lo_freq;
+}
+
+double hnchboard2u_source_c::get_center_freq( size_t chan )
+{
+  return (double)lo_freq;
+}
+
+double hnchboard2u_source_c::set_freq_corr( double ppm, size_t chan)
+{
+  return 0;
+}
+
+double hnchboard2u_source_c::get_freq_corr( size_t chan)
+{
+  return 0;
+}
+
+std::vector<std::string> hnchboard2u_source_c::get_gain_names( size_t chan )
+{
+  std::vector< std::string > gains;
+  gains.push_back( "Dummy" );
+  
+  return gains;
+}
+
+osmosdr::gain_range_t hnchboard2u_source_c::get_gain_range( size_t chan)
+{
+  osmosdr::gain_range_t range;
+  range += osmosdr::range_t(4.5, 20.25, 0.253 );
+
+  return range;
+}
+
+osmosdr::gain_range_t hnchboard2u_source_c::get_gain_range( const std::string & name,
+                                                         size_t chan)
+{
+  osmosdr::gain_range_t range;
+
+    range += osmosdr::range_t(4.5, 20.25, 0.253 );
+
+  return range;
+}
+
+bool hnchboard2u_source_c::set_gain_mode( bool automatic, size_t chan )
+{
+  return 0;
+}
+
+bool hnchboard2u_source_c::get_gain_mode( size_t chan )
+{
+  return 0;
+}
+
+double hnchboard2u_source_c::set_gain( double gain, size_t chan )
+{  
+    gain_value = gain;
+    set_params();
+    return 0;
+}
+
+double hnchboard2u_source_c::set_gain( double gain, const std::string & name, size_t chan )
+{
+    gain_value = gain;
+    set_params();
+    return 0;
+}
+
+double hnchboard2u_source_c::get_gain( size_t chan )
+{
+  return gain_value;
+}
+
+double hnchboard2u_source_c::get_gain( const std::string & name, size_t chan )
+{
+  return gain_value;
+}
+
+std::vector< std::string > hnchboard2u_source_c::get_antennas( size_t chan )
+{
+  std::vector< std::string > antennas;
+
+  antennas += get_antenna( chan );
+
+  return antennas;
+}
+
+std::string hnchboard2u_source_c::set_antenna( const std::string & antenna, size_t chan )
+{
+  return get_antenna( chan );
+}
+
+std::string hnchboard2u_source_c::get_antenna( size_t chan )
+{
+  return "Default";
+}
+
+double hnchboard2u_source_c::set_bandwidth( double bw, size_t chan )
+{
+    
+  return (5000000);
+}
+
+double hnchboard2u_source_c::get_bandwidth( size_t chan )
+{
+  return (5000000);
+}
+
+void hnchboard2u_source_c::set_params( void )
+{  
+  _src->set_params(samplerate, lo_freq, gain_value);
+  
+  return;
+}
diff -urN gr-osmosdr-0.2.6.orig/lib/hnchboard2/hnchboard2u_source_c.h gr-osmosdr-0.2.6/lib/hnchboard2/hnchboard2u_source_c.h
--- gr-osmosdr-0.2.6.orig/lib/hnchboard2/hnchboard2u_source_c.h	1970-01-01 01:00:00.000000000 +0100
+++ gr-osmosdr-0.2.6/lib/hnchboard2/hnchboard2u_source_c.h	2024-07-24 21:25:21.488153281 +0200
@@ -0,0 +1,96 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2017 Dimitri Stolnikov <horiz0n@gmx.net>
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef HNCHBOARD2U_SOURCE_C_H
+#define HNCHBOARD2U_SOURCE_C_H
+
+#include <gnuradio/blocks/float_to_complex.h>
+#include <gnuradio/blocks/short_to_float.h>
+#include <gnuradio/hier_block2.h>
+#include <iio/hnchboard2u_source.h>
+
+#include "source_iface.h"
+
+class hnchboard2u_source_c;
+
+typedef std::shared_ptr< hnchboard2u_source_c > hnchboard2u_source_c_sptr;
+
+hnchboard2u_source_c_sptr make_hnchboard2u_source_c(const std::string &args = "");
+
+class hnchboard2u_source_c :
+    public gr::hier_block2,
+    public source_iface
+{
+private:
+  friend hnchboard2u_source_c_sptr make_hnchboard2u_source_c(const std::string &args);
+
+  hnchboard2u_source_c(const std::string &args);
+
+public:
+  ~hnchboard2u_source_c();
+
+  static std::vector< std::string > get_devices();
+
+  std::string name();
+
+  size_t get_num_channels( void );
+
+  osmosdr::meta_range_t get_sample_rates( void );
+  double set_sample_rate( double rate );
+  double get_sample_rate( void );
+
+  osmosdr::freq_range_t get_freq_range( size_t chan = 0 );
+  double set_center_freq( double freq, size_t chan = 0 );
+  double get_center_freq( size_t chan = 0 );
+
+  double set_freq_corr( double ppm, size_t chan = 0 );
+  double get_freq_corr( size_t chan = 0 );
+
+  std::vector<std::string> get_gain_names( size_t chan = 0 );
+  osmosdr::gain_range_t get_gain_range( size_t chan = 0 );
+  osmosdr::gain_range_t get_gain_range( const std::string & name, size_t chan = 0 );
+  bool set_gain_mode( bool automatic, size_t chan = 0 );
+  bool get_gain_mode( size_t chan = 0 );
+  double set_gain( double gain, size_t chan = 0 );
+  double set_gain( double gain, const std::string & name, size_t chan = 0 );
+  double get_gain( size_t chan = 0 );
+  double get_gain( const std::string & name, size_t chan = 0 );
+
+  std::vector< std::string > get_antennas( size_t chan = 0 );
+  std::string set_antenna( const std::string & antenna, size_t chan = 0 );
+  std::string get_antenna( size_t chan = 0 );
+
+  double set_bandwidth( double bw, size_t chan = 0 );
+  double get_bandwidth( size_t chan = 0 );
+
+private:
+
+  void set_params(void);
+
+  gr::iio::hnchboard2u_source::sptr       _src;
+
+  std::string   uri;
+  unsigned long samplerate;
+  unsigned long lo_freq;
+  unsigned long buffer_size;
+  double gain_value;
+
+};
+
+#endif // HNCHBOARD2U_SOURCE_C_H
diff -urN gr-osmosdr-0.2.6.orig/lib/plutosdr/CMakeLists.txt gr-osmosdr-0.2.6/lib/plutosdr/CMakeLists.txt
--- gr-osmosdr-0.2.6.orig/lib/plutosdr/CMakeLists.txt	1970-01-01 01:00:00.000000000 +0100
+++ gr-osmosdr-0.2.6/lib/plutosdr/CMakeLists.txt	2024-07-24 21:25:21.488153281 +0200
@@ -0,0 +1,39 @@
+# Copyright 2012 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+########################################################################
+# This file included, use CMake directory variables
+########################################################################
+
+target_include_directories(gnuradio-osmosdr PRIVATE
+    ${CMAKE_CURRENT_SOURCE_DIR}
+    ${GNURADIO_IIO_INCLUDE_DIRS}
+    ${IIO_INCLUDE_DIRS}
+)
+
+APPEND_LIB_LIST(
+	gnuradio::gnuradio-iio
+	${IIO_LIBRARIES}
+)
+
+list(APPEND gr_osmosdr_srcs
+    ${CMAKE_CURRENT_SOURCE_DIR}/plutosdr_source_c.cc
+)
+set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)
+
diff -urN gr-osmosdr-0.2.6.orig/lib/plutosdr/plutosdr_source_c.cc gr-osmosdr-0.2.6/lib/plutosdr/plutosdr_source_c.cc
--- gr-osmosdr-0.2.6.orig/lib/plutosdr/plutosdr_source_c.cc	1970-01-01 01:00:00.000000000 +0100
+++ gr-osmosdr-0.2.6/lib/plutosdr/plutosdr_source_c.cc	2024-07-24 21:25:21.488153281 +0200
@@ -0,0 +1,262 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2017 Dimitri Stolnikov <horiz0n@gmx.net>
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+#include <boost/assign.hpp>
+#include <iostream>
+
+#include "arg_helpers.h"
+#include "osmosdr/source.h"
+#include "plutosdr_source_c.h"
+
+using namespace boost::assign;
+
+plutosdr_source_c_sptr make_plutosdr_source_c(const std::string &args)
+{
+  return gnuradio::get_initial_sptr(new plutosdr_source_c(args));
+}
+
+plutosdr_source_c::plutosdr_source_c(const std::string &args) :
+    gr::hier_block2("plutosdr_source_c",
+                   gr::io_signature::make(0, 0, 0),
+                   gr::io_signature::make(1, 1, sizeof(gr_complex)))
+{
+  uri = "ip:pluto.local";
+  frequency = 434000000;
+  samplerate = 2500000;
+  decimation = 0;
+  bandwidth = 2000000;
+  buffer_size = 0x4000;
+  quadrature = true;
+  rfdc = true;
+  bbdc = true;
+  gain_auto = false;
+  gain_value = 50;
+  filter = "";
+  filter_auto = true;
+  _freq_corr = 0.0;
+
+  dict_t dict = params_to_dict(args);
+  if (dict.count("uri"))
+    uri = boost::lexical_cast< std::string >( dict["uri"] );
+
+  std::cerr << "Using PlutoSDR URI = " << uri << std::endl;
+
+  _src = gr::iio::pluto_source::make(uri, frequency, samplerate,
+                                     bandwidth, buffer_size,
+                                     quadrature, rfdc, bbdc,
+                                     "manual", gain_value,
+                                     filter.c_str(), filter_auto);
+
+  connect( _src, 0, self(), 0 );
+}
+
+plutosdr_source_c::~plutosdr_source_c()
+{
+}
+
+std::vector< std::string > plutosdr_source_c::get_devices()
+{
+  std::vector< std::string > devices;
+
+  std::string args = "plutosdr,label='PlutoSDR'";
+
+  devices.push_back( args );
+
+  return devices;
+}
+
+std::string plutosdr_source_c::name()
+{
+  return "PlutoSDR";
+}
+
+size_t plutosdr_source_c::get_num_channels()
+{
+  return output_signature()->max_streams();
+}
+
+osmosdr::meta_range_t plutosdr_source_c::get_sample_rates( void )
+{
+  osmosdr::meta_range_t rates;
+
+  rates += osmosdr::range_t( 2500000 );
+  rates += osmosdr::range_t( 5000000 );
+  rates += osmosdr::range_t( 10000000 );
+  rates += osmosdr::range_t( 20000000 );
+
+  return rates;
+}
+
+double plutosdr_source_c::set_sample_rate( double rate )
+{
+  samplerate = (unsigned long) rate;
+  set_params();
+
+  return samplerate;
+}
+
+double plutosdr_source_c::get_sample_rate( void )
+{
+  return samplerate;
+}
+
+osmosdr::freq_range_t plutosdr_source_c::get_freq_range( size_t chan )
+{
+  osmosdr::freq_range_t range;
+
+  range += osmosdr::range_t( 70.0e6, 6000.0e6, 1.0 );
+
+  return range;
+}
+
+double plutosdr_source_c::set_center_freq( double freq, size_t chan )
+{
+  frequency = (unsigned long long) freq;
+  set_params();
+
+  return freq;
+}
+
+double plutosdr_source_c::get_center_freq( size_t chan )
+{
+  return frequency;
+}
+
+double plutosdr_source_c::set_freq_corr( double ppm, size_t chan)
+{
+  _freq_corr = ppm;
+  set_params();
+
+  return ppm;
+}
+
+double plutosdr_source_c::get_freq_corr( size_t chan)
+{
+  return _freq_corr;
+}
+
+std::vector<std::string> plutosdr_source_c::get_gain_names( size_t chan )
+{
+  std::vector< std::string > gains;
+
+  gains.push_back( "RF" );
+
+  return gains;
+}
+
+osmosdr::gain_range_t plutosdr_source_c::get_gain_range( size_t chan)
+{
+  osmosdr::gain_range_t range;
+  range += osmosdr::range_t( -10, 77, 1 );   // https://wiki.analog.com/resources/tools-software/linux-drivers/iio-transceiver/ad9361#rx_gain_control
+
+  return range;
+}
+
+osmosdr::gain_range_t plutosdr_source_c::get_gain_range( const std::string & name,
+                                                         size_t chan)
+{
+  osmosdr::gain_range_t range;
+
+  range += osmosdr::range_t( -10, 77, 1 );
+
+  return range;
+}
+
+bool plutosdr_source_c::set_gain_mode( bool automatic, size_t chan )
+{
+  gain_auto = automatic;
+  set_params();
+
+  return automatic;
+}
+
+bool plutosdr_source_c::get_gain_mode( size_t chan )
+{
+  return gain_auto;
+}
+
+double plutosdr_source_c::set_gain( double gain, size_t chan )
+{
+  gain_value = gain;
+  set_params();
+
+  return gain;
+}
+
+double plutosdr_source_c::set_gain( double gain, const std::string & name, size_t chan )
+{
+  gain_value = gain;
+  set_params();
+
+  return gain;
+}
+
+double plutosdr_source_c::get_gain( size_t chan )
+{
+  return gain_value;
+}
+
+double plutosdr_source_c::get_gain( const std::string & name, size_t chan )
+{
+  return gain_value;
+}
+
+std::vector< std::string > plutosdr_source_c::get_antennas( size_t chan )
+{
+  std::vector< std::string > antennas;
+
+  antennas += get_antenna( chan );
+
+  return antennas;
+}
+
+std::string plutosdr_source_c::set_antenna( const std::string & antenna, size_t chan )
+{
+  return get_antenna( chan );
+}
+
+std::string plutosdr_source_c::get_antenna( size_t chan )
+{
+  return "A_BALANCED";
+}
+
+double plutosdr_source_c::set_bandwidth( double bw, size_t chan )
+{
+  if (bw == 0.0)
+    bw = 0.8 * samplerate;  // auto bandwidth
+
+  bandwidth = (unsigned long)bw;
+  set_params();
+  return bandwidth;
+}
+
+double plutosdr_source_c::get_bandwidth( size_t chan )
+{
+  return bandwidth;
+}
+
+void plutosdr_source_c::set_params( void )
+{
+  unsigned long long freq = ((double)frequency * (1.0 + _freq_corr * 0.000001));
+
+  // FIXME: gain_mode string can be manual / slow_attack / fast_attack / hybrid
+  _src->set_params( freq, samplerate, bandwidth, quadrature, rfdc, bbdc,
+                    gain_auto ? "fast_attack" : "manual", gain_value,
+                    filter.c_str(), filter_auto );
+}
diff -urN gr-osmosdr-0.2.6.orig/lib/plutosdr/plutosdr_source_c.h gr-osmosdr-0.2.6/lib/plutosdr/plutosdr_source_c.h
--- gr-osmosdr-0.2.6.orig/lib/plutosdr/plutosdr_source_c.h	1970-01-01 01:00:00.000000000 +0100
+++ gr-osmosdr-0.2.6/lib/plutosdr/plutosdr_source_c.h	2024-07-24 21:25:21.492153290 +0200
@@ -0,0 +1,105 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2017 Dimitri Stolnikov <horiz0n@gmx.net>
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef PLUTOSDR_SOURCE_C_H
+#define PLUTOSDR_SOURCE_C_H
+
+#include <gnuradio/blocks/float_to_complex.h>
+#include <gnuradio/blocks/short_to_float.h>
+#include <gnuradio/hier_block2.h>
+#include <iio/pluto_source.h>
+
+#include "source_iface.h"
+
+class plutosdr_source_c;
+
+typedef std::shared_ptr< plutosdr_source_c > plutosdr_source_c_sptr;
+
+plutosdr_source_c_sptr make_plutosdr_source_c(const std::string &args = "");
+
+class plutosdr_source_c :
+    public gr::hier_block2,
+    public source_iface
+{
+private:
+  friend plutosdr_source_c_sptr make_plutosdr_source_c(const std::string &args);
+
+  plutosdr_source_c(const std::string &args);
+
+public:
+  ~plutosdr_source_c();
+
+  static std::vector< std::string > get_devices();
+
+  std::string name();
+
+  size_t get_num_channels( void );
+
+  osmosdr::meta_range_t get_sample_rates( void );
+  double set_sample_rate( double rate );
+  double get_sample_rate( void );
+
+  osmosdr::freq_range_t get_freq_range( size_t chan = 0 );
+  double set_center_freq( double freq, size_t chan = 0 );
+  double get_center_freq( size_t chan = 0 );
+
+  double set_freq_corr( double ppm, size_t chan = 0 );
+  double get_freq_corr( size_t chan = 0 );
+
+  std::vector<std::string> get_gain_names( size_t chan = 0 );
+  osmosdr::gain_range_t get_gain_range( size_t chan = 0 );
+  osmosdr::gain_range_t get_gain_range( const std::string & name, size_t chan = 0 );
+  bool set_gain_mode( bool automatic, size_t chan = 0 );
+  bool get_gain_mode( size_t chan = 0 );
+  double set_gain( double gain, size_t chan = 0 );
+  double set_gain( double gain, const std::string & name, size_t chan = 0 );
+  double get_gain( size_t chan = 0 );
+  double get_gain( const std::string & name, size_t chan = 0 );
+
+  std::vector< std::string > get_antennas( size_t chan = 0 );
+  std::string set_antenna( const std::string & antenna, size_t chan = 0 );
+  std::string get_antenna( size_t chan = 0 );
+
+  double set_bandwidth( double bw, size_t chan = 0 );
+  double get_bandwidth( size_t chan = 0 );
+
+private:
+
+  void set_params(void);
+
+  gr::iio::pluto_source::sptr       _src;
+
+  std::string   uri;
+  unsigned long long frequency;
+  unsigned long samplerate;
+  unsigned long decimation;
+  unsigned long bandwidth;
+  unsigned long buffer_size;
+  bool quadrature;
+  bool rfdc;
+  bool bbdc;
+  bool          gain_auto;
+  double        gain_value;
+  std::string   filter;
+  bool          filter_auto;
+
+  double _freq_corr;
+};
+
+#endif // PLUTOSDR_SOURCE_C_H
diff -urN gr-osmosdr-0.2.6.orig/lib/source_impl.cc gr-osmosdr-0.2.6/lib/source_impl.cc
--- gr-osmosdr-0.2.6.orig/lib/source_impl.cc	2024-05-15 19:40:15.000000000 +0200
+++ gr-osmosdr-0.2.6/lib/source_impl.cc	2024-07-24 21:25:21.492153290 +0200
@@ -56,6 +56,13 @@
 #include <miri_source_c.h>
 #endif
 
+#ifdef ENABLE_IIO
+#include <plutosdr_source_c.h>
+#include <hnchboard2_source_c.h>
+#include <hnchboard2u_source_c.h>
+#include <hnchbbboard_source_c.h>
+#endif
+
 #ifdef ENABLE_SDRPLAY
 #include <sdrplay_source_c.h>
 #endif
@@ -143,6 +150,12 @@
 #ifdef ENABLE_MIRI
   dev_types.push_back("miri");
 #endif
+#ifdef ENABLE_IIO
+  dev_types.push_back("plutosdr");
+  dev_types.push_back("hnchboard2");
+  dev_types.push_back("hnchboard2u");
+  dev_types.push_back("hnchbbboard");
+#endif
 #ifdef ENABLE_SDRPLAY
   dev_types.push_back("sdrplay");
 #endif
@@ -217,6 +230,16 @@
     for (std::string dev : miri_source_c::get_devices())
       dev_list.push_back( dev );
 #endif
+#ifdef ENABLE_IIO
+    for (std::string dev : plutosdr_source_c::get_devices())
+      dev_list.push_back( dev );
+    for (std::string dev : hnchboard2_source_c::get_devices())
+      dev_list.push_back( dev );      
+    for (std::string dev : hnchboard2u_source_c::get_devices())
+      dev_list.push_back( dev );
+    for (std::string dev : hnchbbboard_source_c::get_devices())
+      dev_list.push_back( dev );      
+#endif
 #ifdef ENABLE_SDRPLAY
     for (std::string dev : sdrplay_source_c::get_devices())
       dev_list.push_back( dev );
@@ -320,6 +343,25 @@
       block = src; iface = src.get();
     }
 #endif
+
+#ifdef ENABLE_IIO
+    if ( dict.count("plutosdr") ) {
+      plutosdr_source_c_sptr src = make_plutosdr_source_c( arg );
+      block = src; iface = src.get();
+    }
+    if ( dict.count("hnchboard2") ) {
+      hnchboard2_source_c_sptr src = make_hnchboard2_source_c( arg );
+      block = src; iface = src.get();
+    }
+    if ( dict.count("hnchboard2u") ) {
+      hnchboard2u_source_c_sptr src = make_hnchboard2u_source_c( arg );
+      block = src; iface = src.get();
+    }
+    if ( dict.count("hnchbbboard") ) {
+      hnchbbboard_source_c_sptr src = make_hnchbbboard_source_c( arg );
+      block = src; iface = src.get();
+    }
+#endif
 
 #ifdef ENABLE_SDRPLAY
     if ( dict.count("sdrplay") ) {
diff -urN gr-osmosdr-0.2.6.orig/README.md gr-osmosdr-0.2.6/README.md
--- gr-osmosdr-0.2.6.orig/README.md	2024-05-15 19:40:15.000000000 +0200
+++ gr-osmosdr-0.2.6/README.md	2024-07-24 21:27:08.516380414 +0200
@@ -22,6 +22,8 @@
  * Fairwaves XTRX through [libxtrx](https://github.com/myriadrf/libxtrx)
  * Red Pitaya SDR transceiver <http://bazaar.redpitaya.com>
  * FreeSRP through [libfreesrp](https://github.com/myriadrf/libfreesrp)
+ * ADALM-PLUTO through [libiio](https://github.com/analogdevicesinc/libiio)
+ * hennichodernich's experimental hnchboard2(u)/hnchbbboard SDRs
 
 By using the gr-osmosdr block you can take advantage of a common software API in
 your application(s) independent of the underlying radio hardware.
openSUSE Build Service is sponsored by