From 0ecc3d6d23f4ac6a92487f52c1a29827eae4ad13 Mon Sep 17 00:00:00 2001
From: "A. Maitland Bottoms" <bottoms@debian.org>
Date: Wed, 19 Feb 2020 23:16:06 -0500
Subject: [PATCH 1/3] restore fcd support

---
 CMakeLists.txt          |  3 ++-
 lib/CMakeLists.txt      | 12 +++++++++++-
 lib/fcd/CMakeLists.txt  | 10 +++++-----
 lib/fcd/fcd_source_c.cc |  2 +-
 lib/fcd/fcd_source_c.h  | 11 ++++-------
 5 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7a2cf9d..8a6324b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2012,2020 Free Software Foundation, Inc.
 #
 # This file is part of gr-osmosdr
 #
@@ -178,6 +178,7 @@ find_package(LibAIRSPYHF)
 find_package(LibbladeRF)
 find_package(SoapySDR NO_MODULE)
 find_package(LibFreeSRP)
+find_package(GnuradioFCDPP)
 find_package(Doxygen)
 
     # Python
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index d04cb1d..dd86003 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2020 Free Software Foundation, Inc.
 #
 # This file is part of gr-osmosdr
 #
@@ -135,6 +135,16 @@ if(ENABLE_OSMOSDR)
     add_subdirectory(osmosdr)
 endif(ENABLE_OSMOSDR)
 
+########################################################################
+# Setup FCD component
+########################################################################
+GR_REGISTER_COMPONENT("FUNcube Dongle" ENABLE_FCD GNURADIO_FCDPP_FOUND)
+if(ENABLE_FCD)
+  add_definitions(-DHAVE_FCD=1)
+  add_definitions(-DHAVE_FCDPP=1)
+  add_subdirectory(fcd)
+endif(ENABLE_FCD)
+
 ########################################################################
 # Setup File component
 ########################################################################
diff --git a/lib/fcd/CMakeLists.txt b/lib/fcd/CMakeLists.txt
index 146191f..a9755a0 100644
--- a/lib/fcd/CMakeLists.txt
+++ b/lib/fcd/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2012,2020 Free Software Foundation, Inc.
 #
 # This file is part of gr-osmosdr
 #
@@ -27,19 +27,19 @@ target_include_directories(gnuradio-osmosdr PRIVATE
 
 if(ENABLE_FCD)
     target_include_directories(gnuradio-osmosdr PRIVATE
-        ${Gnuradio-fcd_INCLUDE_DIRS}
+        ${GNURADIO_FCD_INCLUDE_DIRS}
     )
     target_link_libraries(gnuradio-osmosdr PRIVATE
-        ${Gnuradio-fcd_LIBRARIES}
+        ${GNURADIO_FCD_LIBRARIES}
     )
 endif(ENABLE_FCD)
 
 if(ENABLE_FCDPP)
     target_include_directories(gnuradio-osmosdr PRIVATE
-        ${Gnuradio-fcdpp_INCLUDE_DIRS}
+        ${GNURADIO_FCDPP_INCLUDE_DIRS}
     )
     target_link_libraries(gnuradio-osmosdr PRIVATE
-        ${Gnuradio-fcdpp_LIBRARIES}
+        ${GNURADIO_FCDPP_LIBRARIES}
     )
 endif(ENABLE_FCDPP)
 
diff --git a/lib/fcd/fcd_source_c.cc b/lib/fcd/fcd_source_c.cc
index 885d514..3c23b0b 100644
--- a/lib/fcd/fcd_source_c.cc
+++ b/lib/fcd/fcd_source_c.cc
@@ -145,7 +145,7 @@ fcd_source_c::fcd_source_c(const std::string &args) :
 #ifdef HAVE_FCD
   if ( FUNCUBE_V1 == _type )
   {
-    _src_v1 = gr::fcd::source_c::make( dev_name );
+    _src_v1 = gr::fcdproplus::fcd::make( dev_name );
     connect( _src_v1, 0, self(), 0 );
 
     set_gain( 20, "LNA" );
diff --git a/lib/fcd/fcd_source_c.h b/lib/fcd/fcd_source_c.h
index 70239f8..d7dd957 100644
--- a/lib/fcd/fcd_source_c.h
+++ b/lib/fcd/fcd_source_c.h
@@ -22,12 +22,11 @@
 
 #include <gnuradio/hier_block2.h>
 
-#ifdef HAVE_FCD
-#include <gnuradio/fcd/source_c.h>
-#endif
-
 #ifdef HAVE_FCDPP
+#include <fcdproplus/fcd.h>
 #include <fcdproplus/fcdproplus.h>
+#include <fcdproplus/fcd_control.h>
+#include <fcdproplus/fcdpp_control.h>
 #endif
 
 #include "source_iface.h"
@@ -86,10 +85,8 @@ public:
 
 private:
   dongle_type _type;
-#ifdef HAVE_FCD
-  gr::fcd::source_c::sptr _src_v1;
-#endif
 #ifdef HAVE_FCDPP
+  gr::fcdproplus::fcd::sptr _src_v1;
   gr::fcdproplus::fcdproplus::sptr _src_v2;
 #endif
   double _lna_gain, _mix_gain, _bb_gain, _freq;
-- 
2.20.1

