From 75e66226c3ece1f5f8f5b390f67857211afdef11 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Fri, 13 Sep 2024 23:02:30 +0200 Subject: [PATCH] finish fobossdr source + add rigexpert to hardware donor list + fix source module default instantiation --- .github/workflows/build_all.yml | 10 +- core/src/core.cpp | 12 +- core/src/credits.cpp | 1 + docker_builds/debian_bookworm/do_build.sh | 12 +- docker_builds/debian_bullseye/do_build.sh | 12 +- docker_builds/debian_buster/do_build.sh | 12 +- docker_builds/debian_sid/do_build.sh | 12 +- docker_builds/ubuntu_bionic/do_build.sh | 12 +- docker_builds/ubuntu_focal/do_build.sh | 12 +- docker_builds/ubuntu_jammy/do_build.sh | 12 +- docker_builds/ubuntu_mantic/do_build.sh | 12 +- docker_builds/ubuntu_noble/do_build.sh | 12 +- readme.md | 7 +- source_modules/fobossdr_source/src/main.cpp | 247 +++++++++++++++++--- 14 files changed, 335 insertions(+), 50 deletions(-) diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index 0c8a824f..c8233186 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -127,12 +127,15 @@ jobs: - name: Install librfnm run: git clone https://github.com/AlexandreRouma/librfnm && cd librfnm && mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release && make && sudo make install && cd .. + - name: Install libfobos + run: git clone https://github.com/rigexpert/libfobos && cd libfobos && mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release && make && sudo make install && cd .. + - name: Install more recent librtlsdr run: git clone https://github.com/osmocom/rtl-sdr && cd rtl-sdr && mkdir build && cd build && cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_BUILD_TYPE=Release .. && make -j3 LIBRARY_PATH=$(pkg-config --libs-only-L libusb-1.0 | sed 's/\-L//') && sudo make install && cd ../../ - name: Prepare CMake working-directory: ${{runner.workspace}}/build - run: cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 $GITHUB_WORKSPACE -DOPT_BUILD_PLUTOSDR_SOURCE=ON -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_AUDIO_SINK=OFF -DOPT_BUILD_PORTAUDIO_SINK=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_AUDIO_SOURCE=OFF -DOPT_BUILD_RFNM_SOURCE=ON -DUSE_BUNDLE_DEFAULTS=ON -DCMAKE_BUILD_TYPE=Release + run: cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 $GITHUB_WORKSPACE -DOPT_BUILD_PLUTOSDR_SOURCE=ON -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_AUDIO_SINK=OFF -DOPT_BUILD_PORTAUDIO_SINK=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_AUDIO_SOURCE=OFF -DOPT_BUILD_RFNM_SOURCE=ON -DOPT_BUILD_FOBOSSDR_SOURCE=ON -DUSE_BUNDLE_DEFAULTS=ON -DCMAKE_BUILD_TYPE=Release - name: Build working-directory: ${{runner.workspace}}/build @@ -181,12 +184,15 @@ jobs: - name: Install librfnm run: git clone https://github.com/AlexandreRouma/librfnm && cd librfnm && mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release && make && sudo make install && cd .. + - name: Install libfobos + run: git clone https://github.com/rigexpert/libfobos && cd libfobos && mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release && make && sudo make install && cd .. + - name: Install more recent librtlsdr run: git clone https://github.com/osmocom/rtl-sdr && cd rtl-sdr && mkdir build && cd build && cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_BUILD_TYPE=Release .. && make -j3 LIBRARY_PATH=$(pkg-config --libs-only-L libusb-1.0 | sed 's/\-L//') && sudo make install && cd ../../ - name: Prepare CMake working-directory: ${{runner.workspace}}/build - run: cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 $GITHUB_WORKSPACE -DOPT_BUILD_PLUTOSDR_SOURCE=ON -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_AUDIO_SINK=OFF -DOPT_BUILD_PORTAUDIO_SINK=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=OFF -DOPT_BUILD_PERSEUS_SOURCE=OFF -DOPT_BUILD_AUDIO_SOURCE=OFF -DOPT_BUILD_RFNM_SOURCE=ON -DUSE_BUNDLE_DEFAULTS=ON -DCMAKE_BUILD_TYPE=Release + run: cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 $GITHUB_WORKSPACE -DOPT_BUILD_PLUTOSDR_SOURCE=ON -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_AUDIO_SINK=OFF -DOPT_BUILD_PORTAUDIO_SINK=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=OFF -DOPT_BUILD_PERSEUS_SOURCE=OFF -DOPT_BUILD_AUDIO_SOURCE=OFF -DOPT_BUILD_RFNM_SOURCE=ON -DOPT_BUILD_FOBOSSDR_SOURCE=ON -DUSE_BUNDLE_DEFAULTS=ON -DCMAKE_BUILD_TYPE=Release - name: Build working-directory: ${{runner.workspace}}/build diff --git a/core/src/core.cpp b/core/src/core.cpp index 1fcbf956..fcf76f96 100644 --- a/core/src/core.cpp +++ b/core/src/core.cpp @@ -173,16 +173,20 @@ int sdrpp_main(int argc, char* argv[]) { defConfig["moduleInstances"]["BladeRF Source"]["enabled"] = true; defConfig["moduleInstances"]["File Source"]["module"] = "file_source"; defConfig["moduleInstances"]["File Source"]["enabled"] = true; + defConfig["moduleInstances"]["FobosSDR Source"]["module"] = "fobossdr_source"; + defConfig["moduleInstances"]["FobosSDR Source"]["enabled"] = true; defConfig["moduleInstances"]["HackRF Source"]["module"] = "hackrf_source"; defConfig["moduleInstances"]["HackRF Source"]["enabled"] = true; + defConfig["moduleInstances"]["Harogic Source"]["module"] = "harogic_source"; + defConfig["moduleInstances"]["Harogic Source"]["enabled"] = true; defConfig["moduleInstances"]["Hermes Source"]["module"] = "hermes_source"; defConfig["moduleInstances"]["Hermes Source"]["enabled"] = true; defConfig["moduleInstances"]["LimeSDR Source"]["module"] = "limesdr_source"; defConfig["moduleInstances"]["LimeSDR Source"]["enabled"] = true; - defConfig["moduleInstances"]["PlutoSDR Source"]["module"] = "plutosdr_source"; - defConfig["moduleInstances"]["PlutoSDR Source"]["enabled"] = true; defConfig["moduleInstances"]["PerseusSDR Source"]["module"] = "perseus_source"; defConfig["moduleInstances"]["PerseusSDR Source"]["enabled"] = true; + defConfig["moduleInstances"]["PlutoSDR Source"]["module"] = "plutosdr_source"; + defConfig["moduleInstances"]["PlutoSDR Source"]["enabled"] = true; defConfig["moduleInstances"]["RFNM Source"]["module"] = "rfnm_source"; defConfig["moduleInstances"]["RFNM Source"]["enabled"] = true; defConfig["moduleInstances"]["RFspace Source"]["module"] = "rfspace_source"; @@ -195,8 +199,12 @@ int sdrpp_main(int argc, char* argv[]) { defConfig["moduleInstances"]["SDRplay Source"]["enabled"] = true; defConfig["moduleInstances"]["SDR++ Server Source"]["module"] = "sdrpp_server_source"; defConfig["moduleInstances"]["SDR++ Server Source"]["enabled"] = true; + defConfig["moduleInstances"]["Spectran HTTP Source"]["module"] = "spectran_http_source"; + defConfig["moduleInstances"]["Spectran HTTP Source"]["enabled"] = true; defConfig["moduleInstances"]["SpyServer Source"]["module"] = "spyserver_source"; defConfig["moduleInstances"]["SpyServer Source"]["enabled"] = true; + defConfig["moduleInstances"]["USRP Source"]["module"] = "usrp_source"; + defConfig["moduleInstances"]["USRP Source"]["enabled"] = true; defConfig["moduleInstances"]["Audio Sink"] = "audio_sink"; defConfig["moduleInstances"]["Network Sink"] = "network_sink"; diff --git a/core/src/credits.cpp b/core/src/credits.cpp index 31664893..c0d182ed 100644 --- a/core/src/credits.cpp +++ b/core/src/credits.cpp @@ -50,6 +50,7 @@ namespace sdrpp_credits { "Nuand", "RFNM", "RFspace", + "RigExpert", "RTL-SDRblog", "SDRplay" }; diff --git a/docker_builds/debian_bookworm/do_build.sh b/docker_builds/debian_bookworm/do_build.sh index a3275518..e267cb8a 100644 --- a/docker_builds/debian_bookworm/do_build.sh +++ b/docker_builds/debian_bookworm/do_build.sh @@ -35,10 +35,20 @@ make -j2 make install cd ../../ +# Install libfobos +git clone https://github.com/rigexpert/libfobos +cd libfobos +mkdir build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr +make -j2 +make install +cd ../../ + cd SDRPlusPlus mkdir build cd build -cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_RFNM_SOURCE=ON +cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_RFNM_SOURCE=ON -DOPT_BUILD_FOBOSSDR_SOURCE=ON make VERBOSE=1 -j2 cd .. diff --git a/docker_builds/debian_bullseye/do_build.sh b/docker_builds/debian_bullseye/do_build.sh index a3275518..e267cb8a 100644 --- a/docker_builds/debian_bullseye/do_build.sh +++ b/docker_builds/debian_bullseye/do_build.sh @@ -35,10 +35,20 @@ make -j2 make install cd ../../ +# Install libfobos +git clone https://github.com/rigexpert/libfobos +cd libfobos +mkdir build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr +make -j2 +make install +cd ../../ + cd SDRPlusPlus mkdir build cd build -cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_RFNM_SOURCE=ON +cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_RFNM_SOURCE=ON -DOPT_BUILD_FOBOSSDR_SOURCE=ON make VERBOSE=1 -j2 cd .. diff --git a/docker_builds/debian_buster/do_build.sh b/docker_builds/debian_buster/do_build.sh index 0389e480..15d63fae 100644 --- a/docker_builds/debian_buster/do_build.sh +++ b/docker_builds/debian_buster/do_build.sh @@ -35,10 +35,20 @@ make -j2 make install cd ../../ +# Install libfobos +git clone https://github.com/rigexpert/libfobos +cd libfobos +mkdir build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr +make -j2 +make install +cd ../../ + cd SDRPlusPlus mkdir build cd build -cmake .. -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_BLADERF_SOURCE=OFF -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_RFNM_SOURCE=ON +cmake .. -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_BLADERF_SOURCE=OFF -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_RFNM_SOURCE=ON -DOPT_BUILD_FOBOSSDR_SOURCE=ON make VERBOSE=1 -j2 cd .. diff --git a/docker_builds/debian_sid/do_build.sh b/docker_builds/debian_sid/do_build.sh index c1446d1d..e7599ea3 100644 --- a/docker_builds/debian_sid/do_build.sh +++ b/docker_builds/debian_sid/do_build.sh @@ -35,10 +35,20 @@ make -j2 make install cd ../../ +# Install libfobos +git clone https://github.com/rigexpert/libfobos +cd libfobos +mkdir build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr +make -j2 +make install +cd ../../ + cd SDRPlusPlus mkdir build cd build -cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_RFNM_SOURCE=ON +cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_RFNM_SOURCE=ON -DOPT_BUILD_FOBOSSDR_SOURCE=ON make VERBOSE=1 -j2 cd .. diff --git a/docker_builds/ubuntu_bionic/do_build.sh b/docker_builds/ubuntu_bionic/do_build.sh index a6b54171..6af7bf92 100644 --- a/docker_builds/ubuntu_bionic/do_build.sh +++ b/docker_builds/ubuntu_bionic/do_build.sh @@ -61,6 +61,16 @@ make -j2 make install cd ../../ +# Install libfobos +git clone https://github.com/rigexpert/libfobos +cd libfobos +mkdir build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr +make -j2 +make install +cd ../../ + # Fix missing .pc file for codec2 echo 'prefix=/usr/' >> /usr/share/pkgconfig/codec2.pc echo 'libdir=/usr/include/x86_64-linux-gnu/' >> /usr/share/pkgconfig/codec2.pc @@ -76,7 +86,7 @@ echo 'Cflags: -I/usr/include/codec2' >> /usr/share/pkgconfig/codec2.pc cd SDRPlusPlus mkdir build cd build -cmake .. -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_BLADERF_SOURCE=OFF -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_OVERRIDE_STD_FILESYSTEM=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_RFNM_SOURCE=ON +cmake .. -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_BLADERF_SOURCE=OFF -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_OVERRIDE_STD_FILESYSTEM=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_RFNM_SOURCE=ON -DOPT_BUILD_FOBOSSDR_SOURCE=ON make VERBOSE=1 -j2 # Generate package diff --git a/docker_builds/ubuntu_focal/do_build.sh b/docker_builds/ubuntu_focal/do_build.sh index a3275518..e267cb8a 100644 --- a/docker_builds/ubuntu_focal/do_build.sh +++ b/docker_builds/ubuntu_focal/do_build.sh @@ -35,10 +35,20 @@ make -j2 make install cd ../../ +# Install libfobos +git clone https://github.com/rigexpert/libfobos +cd libfobos +mkdir build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr +make -j2 +make install +cd ../../ + cd SDRPlusPlus mkdir build cd build -cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_RFNM_SOURCE=ON +cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_RFNM_SOURCE=ON -DOPT_BUILD_FOBOSSDR_SOURCE=ON make VERBOSE=1 -j2 cd .. diff --git a/docker_builds/ubuntu_jammy/do_build.sh b/docker_builds/ubuntu_jammy/do_build.sh index a3275518..e267cb8a 100644 --- a/docker_builds/ubuntu_jammy/do_build.sh +++ b/docker_builds/ubuntu_jammy/do_build.sh @@ -35,10 +35,20 @@ make -j2 make install cd ../../ +# Install libfobos +git clone https://github.com/rigexpert/libfobos +cd libfobos +mkdir build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr +make -j2 +make install +cd ../../ + cd SDRPlusPlus mkdir build cd build -cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_RFNM_SOURCE=ON +cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_RFNM_SOURCE=ON -DOPT_BUILD_FOBOSSDR_SOURCE=ON make VERBOSE=1 -j2 cd .. diff --git a/docker_builds/ubuntu_mantic/do_build.sh b/docker_builds/ubuntu_mantic/do_build.sh index c1446d1d..e7599ea3 100644 --- a/docker_builds/ubuntu_mantic/do_build.sh +++ b/docker_builds/ubuntu_mantic/do_build.sh @@ -35,10 +35,20 @@ make -j2 make install cd ../../ +# Install libfobos +git clone https://github.com/rigexpert/libfobos +cd libfobos +mkdir build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr +make -j2 +make install +cd ../../ + cd SDRPlusPlus mkdir build cd build -cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_RFNM_SOURCE=ON +cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_RFNM_SOURCE=ON -DOPT_BUILD_FOBOSSDR_SOURCE=ON make VERBOSE=1 -j2 cd .. diff --git a/docker_builds/ubuntu_noble/do_build.sh b/docker_builds/ubuntu_noble/do_build.sh index c1446d1d..e7599ea3 100644 --- a/docker_builds/ubuntu_noble/do_build.sh +++ b/docker_builds/ubuntu_noble/do_build.sh @@ -35,10 +35,20 @@ make -j2 make install cd ../../ +# Install libfobos +git clone https://github.com/rigexpert/libfobos +cd libfobos +mkdir build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr +make -j2 +make install +cd ../../ + cd SDRPlusPlus mkdir build cd build -cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_RFNM_SOURCE=ON +cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_RFNM_SOURCE=ON -DOPT_BUILD_FOBOSSDR_SOURCE=ON make VERBOSE=1 -j2 cd .. diff --git a/readme.md b/readme.md index b4b2926a..37496b47 100644 --- a/readme.md +++ b/readme.md @@ -324,8 +324,9 @@ Modules in beta are still included in releases for the most part but not enabled | audio_source | Working | rtaudio | OPT_BUILD_AUDIO_SOURCE | ✅ | ✅ | ✅ | | bladerf_source | Working | libbladeRF | OPT_BUILD_BLADERF_SOURCE | ⛔ | ✅ (not Debian Buster) | ✅ | | file_source | Working | - | OPT_BUILD_FILE_SOURCE | ✅ | ✅ | ✅ | +| fobossdr_source | Beta | libfobos | OPT_BUILD_FOBOSSDR_SOURCE | ✅ | ✅ | ✅ | | hackrf_source | Working | libhackrf | OPT_BUILD_HACKRF_SOURCE | ✅ | ✅ | ✅ | -| harogic_source | Unfinished | htra_api | OPT_BUILD_HAROGIC_SOURCE | ⛔ | ⛔ | ⛔ | +| harogic_source | Beta | htra_api | OPT_BUILD_HAROGIC_SOURCE | ⛔ | ⛔ | ✅ | | hermes_source | Beta | - | OPT_BUILD_HERMES_SOURCE | ✅ | ✅ | ✅ | | limesdr_source | Working | liblimesuite | OPT_BUILD_LIMESDR_SOURCE | ⛔ | ✅ | ✅ | | network_source | Unfinished | - | OPT_BUILD_NETWORK_SOURCE | ✅ | ✅ | ⛔ | @@ -339,9 +340,9 @@ Modules in beta are still included in releases for the most part but not enabled | sdrpp_server_source | Working | - | OPT_BUILD_SDRPP_SERVER_SOURCE | ✅ | ✅ | ✅ | | soapy_source | Deprecated | soapysdr | OPT_BUILD_SOAPY_SOURCE | ⛔ | ⛔ | ⛔ | | spectran_source | Unfinished | RTSA Suite | OPT_BUILD_SPECTRAN_SOURCE | ⛔ | ⛔ | ⛔ | -| spectran_http_source | Beta | - | OPT_BUILD_SPECTRAN_HTTP_SOURCE | ✅ | ✅ | ⛔ | +| spectran_http_source | Beta | - | OPT_BUILD_SPECTRAN_HTTP_SOURCE | ✅ | ✅ | ✅ | | spyserver_source | Working | - | OPT_BUILD_SPYSERVER_SOURCE | ✅ | ✅ | ✅ | -| usrp_source | Beta | libuhd | OPT_BUILD_USRP_SOURCE | ⛔ | ⛔ | ⛔ | +| usrp_source | Beta | libuhd | OPT_BUILD_USRP_SOURCE | ⛔ | ⛔ | ✅ | ## Sinks diff --git a/source_modules/fobossdr_source/src/main.cpp b/source_modules/fobossdr_source/src/main.cpp index b41b2a6e..a7f7c1ad 100644 --- a/source_modules/fobossdr_source/src/main.cpp +++ b/source_modules/fobossdr_source/src/main.cpp @@ -16,8 +16,16 @@ SDRPP_MOD_INFO{ /* Max instances */ -1 }; +ConfigManager config; + #define CONCAT(a, b) ((std::string(a) + b).c_str()) +// Work around for the fobos API not including +#define FOBOS_LNA_GAIN_MIN 1 +#define FOBOS_LNA_GAIN_MAX 3 +#define FOBOS_VGA_GAIN_MIN 0 +#define FOBOS_VGA_GAIN_MAX 31 + class FobosSDRSourceModule : public ModuleManager::Instance { public: FobosSDRSourceModule(std::string name) { @@ -25,6 +33,9 @@ public: sampleRate = 50000000.0; + // Initialize the DDC + ddc.init(&ddcIn, 50e6, 50e6, 50e6, 0.0); + handler.ctx = this; handler.selectHandler = menuSelected; handler.deselectHandler = menuDeselected; @@ -32,19 +43,22 @@ public: handler.startHandler = start; handler.stopHandler = stop; handler.tuneHandler = tune; - handler.stream = &stream; + handler.stream = &ddc.out; // Refresh devices refresh(); - // Select first (TODO: Select from config) - select(""); + // Select device from config + config.acquire(); + std::string devSerial = config.conf["device"]; + config.release(); + select(devSerial); sigpath::sourceManager.registerSource("FobosSDR", &handler); } ~FobosSDRSourceModule() { - + // Nothing to do } void postInit() {} @@ -160,6 +174,11 @@ private: samplerates.define(srList[i], str, srList[i]); } + // Add some custom samplerates + samplerates.define(5e6, "5.0MHz", 5e6); + samplerates.define(2.5e6, "2.5MHz", 2.5e6); + samplerates.define(1.25e6, "1.25MHz", 1.25e6); + // Define the ports ports.clear(); ports.define("rf", "RF", PORT_RF); @@ -174,12 +193,51 @@ private: // Close the device fobos_rx_close(dev); - // Update the samplerate - core::setInputSampleRate(sampleRate); - // Save serial number selectedSerial = serial; devId = id; + + // Load default options + sampleRate = 50e6; + srId = samplerates.valueId(sampleRate); + port = PORT_RF; + portId = ports.valueId(port); + clkSrcId = clockSources.nameId("Internal"); + lnaGain = 0; + vgaGain = 0; + + // Load config + config.acquire(); + if (config.conf["devices"][selectedSerial].contains("samplerate")) { + int desiredSr = config.conf["devices"][selectedSerial]["samplerate"]; + if (samplerates.keyExists(desiredSr)) { + srId = samplerates.keyId(desiredSr); + sampleRate = samplerates[srId]; + } + } + if (config.conf["devices"][selectedSerial].contains("port")) { + std::string desiredPort = config.conf["devices"][selectedSerial]["port"]; + if (ports.keyExists(desiredPort)) { + portId = ports.keyId(desiredPort); + port = ports[portId]; + } + } + if (config.conf["devices"][selectedSerial].contains("clkSrc")) { + std::string desiredClkSrc = config.conf["devices"][selectedSerial]["clkSrc"]; + if (clockSources.keyExists(desiredClkSrc)) { + clkSrcId = clockSources.keyId(desiredClkSrc); + } + } + if (config.conf["devices"][selectedSerial].contains("lnaGain")) { + lnaGain = std::clamp(config.conf["devices"][selectedSerial]["lnaGain"], FOBOS_LNA_GAIN_MIN, FOBOS_LNA_GAIN_MAX); + } + if (config.conf["devices"][selectedSerial].contains("vgaGain")) { + vgaGain = std::clamp(config.conf["devices"][selectedSerial]["vgaGain"], FOBOS_VGA_GAIN_MIN, FOBOS_VGA_GAIN_MAX); + } + config.release(); + + // Update the samplerate + core::setInputSampleRate(sampleRate); } static void menuSelected(void* ctx) { @@ -209,15 +267,38 @@ private: // Configure the device double actualSr, actualFreq; - fobos_rx_set_samplerate(_this->openDev, _this->sampleRate, &actualSr); + fobos_rx_set_samplerate(_this->openDev, (_this->sampleRate >= 50e6) ? _this->sampleRate : 50e6, &actualSr); fobos_rx_set_frequency(_this->openDev, _this->freq, &actualFreq); fobos_rx_set_direct_sampling(_this->openDev, _this->port != PORT_RF); fobos_rx_set_clk_source(_this->openDev, _this->clockSources[_this->clkSrcId]); fobos_rx_set_lna_gain(_this->openDev, _this->lnaGain); fobos_rx_set_vga_gain(_this->openDev, _this->vgaGain); - // Compute buffer size - _this->bufferSize = _this->sampleRate / 200.0; + // Configure the DDC + if (_this->port == PORT_RF && _this->sampleRate >= 50e6) { + // Set the frequency + fobos_rx_set_frequency(_this->openDev, _this->freq, &actualFreq); + } + else if (_this->port == PORT_RF) { + // Set the frequency + fobos_rx_set_frequency(_this->openDev, _this->freq, &actualFreq); + + // Configure and start the DDC for decimation only + _this->ddc.setInSamplerate(actualSr); + _this->ddc.setOutSamplerate(_this->sampleRate, _this->sampleRate); + _this->ddc.setOffset(0.0); + _this->ddc.start(); + } + else { + // Configure and start the DDC + _this->ddc.setInSamplerate(actualSr); + _this->ddc.setOutSamplerate(_this->sampleRate, _this->sampleRate); + _this->ddc.setOffset(_this->freq); + _this->ddc.start(); + } + + // Compute buffer size (Lower than usual, but it's a workaround for their API having broken streaming) + _this->bufferSize = _this->sampleRate / 400.0; // Start streaming err = fobos_rx_start_sync(_this->openDev, _this->bufferSize); @@ -241,13 +322,23 @@ private: // Stop worker _this->run = false; - _this->stream.stopWriter(); - if (_this->workerThread.joinable()) { _this->workerThread.join(); } - _this->stream.clearWriteStop(); + if (_this->port == PORT_RF && _this->sampleRate >= 50e6) { + _this->ddc.out.stopWriter(); + if (_this->workerThread.joinable()) { _this->workerThread.join(); } + _this->ddc.out.clearWriteStop(); + } + else { + _this->ddcIn.stopWriter(); + if (_this->workerThread.joinable()) { _this->workerThread.join(); } + _this->ddcIn.clearWriteStop(); + } // Stop streaming fobos_rx_stop_sync(_this->openDev); + // Stop the DDC + _this->ddc.stop(); + // Close the device fobos_rx_close(_this->openDev); @@ -257,8 +348,13 @@ private: static void tune(double freq, void* ctx) { FobosSDRSourceModule* _this = (FobosSDRSourceModule*)ctx; if (_this->running) { - double actual; // Dummy, don't care - fobos_rx_set_frequency(_this->openDev, freq, &actual); + if (_this->port == PORT_RF) { + double actual; // Dummy, don't care + fobos_rx_set_frequency(_this->openDev, freq, &actual); + } + else { + _this->ddc.setOffset(freq); + } } _this->freq = freq; flog::info("FobosSDRSourceModule '{0}': Tune: {1}!", _this->name, freq); @@ -274,13 +370,19 @@ private: if (SmGui::Combo(CONCAT("##_fobossdr_dev_sel_", _this->name), &_this->devId, _this->devices.txt)) { _this->select(_this->devices.key(_this->devId)); core::setInputSampleRate(_this->sampleRate); - // TODO: Save + config.acquire(); + config.conf["device"] = _this->selectedSerial; + config.release(true); } if (SmGui::Combo(CONCAT("##_fobossdr_sr_sel_", _this->name), &_this->srId, _this->samplerates.txt)) { _this->sampleRate = _this->samplerates.value(_this->srId); core::setInputSampleRate(_this->sampleRate); - // TODO: Save + if (!_this->selectedSerial.empty()) { + config.acquire(); + config.conf["devices"][_this->selectedSerial]["samplerate"] = _this->samplerates.key(_this->srId); + config.release(true); + } } SmGui::SameLine(); @@ -294,50 +396,118 @@ private: SmGui::LeftLabel("Antenna Port"); SmGui::FillWidth(); - if (SmGui::Combo(CONCAT("##_fobossdr_port_", _this->name), &_this->portId, _this->ports.txt)); + if (SmGui::Combo(CONCAT("##_fobossdr_port_", _this->name), &_this->portId, _this->ports.txt)) { + if (!_this->selectedSerial.empty()) { + config.acquire(); + config.conf["devices"][_this->selectedSerial]["port"] = _this->ports.key(_this->portId); + config.release(true); + } + } if (_this->running) { SmGui::EndDisabled(); } SmGui::LeftLabel("Clock Source"); SmGui::FillWidth(); - if (SmGui::Combo(CONCAT("##_fobossdr_clk_", _this->name), &_this->clkSrcId, _this->clockSources.txt)); + if (SmGui::Combo(CONCAT("##_fobossdr_clk_", _this->name), &_this->clkSrcId, _this->clockSources.txt)) { + if (_this->running) { + fobos_rx_set_clk_source(_this->openDev, _this->clockSources[_this->clkSrcId]); + } + if (!_this->selectedSerial.empty()) { + config.acquire(); + config.conf["devices"][_this->selectedSerial]["clkSrc"] = _this->clockSources.key(_this->clkSrcId); + config.release(true); + } + } if (_this->port == PORT_RF) { SmGui::LeftLabel("LNA Gain"); SmGui::FillWidth(); - if (SmGui::SliderInt(CONCAT("##_fobossdr_lna_gain_", _this->name), &_this->lnaGain, 0, 2)) { + if (SmGui::SliderInt(CONCAT("##_fobossdr_lna_gain_", _this->name), &_this->lnaGain, FOBOS_LNA_GAIN_MIN, FOBOS_LNA_GAIN_MAX)) { if (_this->running) { fobos_rx_set_lna_gain(_this->openDev, _this->lnaGain); } - // TODO: Save + if (!_this->selectedSerial.empty()) { + config.acquire(); + config.conf["devices"][_this->selectedSerial]["lnaGain"] = _this->lnaGain; + config.release(true); + } } SmGui::LeftLabel("VGA Gain"); SmGui::FillWidth(); - if (SmGui::SliderInt(CONCAT("##_fobossdr_vga_gain_", _this->name), &_this->vgaGain, 0, 15)) { + if (SmGui::SliderInt(CONCAT("##_fobossdr_vga_gain_", _this->name), &_this->vgaGain, FOBOS_VGA_GAIN_MIN, FOBOS_VGA_GAIN_MAX)) { if (_this->running) { fobos_rx_set_vga_gain(_this->openDev, _this->vgaGain); } - // TODO: Save + if (!_this->selectedSerial.empty()) { + config.acquire(); + config.conf["devices"][_this->selectedSerial]["vgaGain"] = _this->vgaGain; + config.release(true); + } } } } void worker() { - // Worker loop - while (run) { - // Read samples - unsigned int sampCount = 0; - int err = fobos_rx_read_sync(openDev, (float*)stream.writeBuf, &sampCount); - - // TODO: Send to DSP - if (!stream.swap(sampCount)) { break; } + // Select different processing depending on the mode + if (port == PORT_RF && sampleRate >= 50e6) { + while (run) { + // Read samples + unsigned int sampCount = 0; + int err = fobos_rx_read_sync(openDev, (float*)ddc.out.writeBuf, &sampCount); + if (err) { break; } + + // Send out samples to the core + if (!ddc.out.swap(sampCount)) { break; } + } + } + else if (port == PORT_RF) { + while (run) { + // Read samples + unsigned int sampCount = 0; + int err = fobos_rx_read_sync(openDev, (float*)ddcIn.writeBuf, &sampCount); + if (err) { break; } + + // Send samples to the DDC + if (!ddcIn.swap(sampCount)) { break; } + } + } + else if (port == PORT_HF1) { + while (run) { + // Read samples + unsigned int sampCount = 0; + int err = fobos_rx_read_sync(openDev, (float*)ddcIn.writeBuf, &sampCount); + if (err) { break; } + + // Null out the HF2 samples + for (int i = 0; i < sampCount; i++) { + ddcIn.writeBuf[i].im = 0.0f; + } + + // Send samples to the DDC + if (!ddcIn.swap(sampCount)) { break; } + } + } + else if (port == PORT_HF2) { + while (run) { + // Read samples + unsigned int sampCount = 0; + int err = fobos_rx_read_sync(openDev, (float*)ddcIn.writeBuf, &sampCount); + if (err) { break; } + + // Null out the HF2 samples + for (int i = 0; i < sampCount; i++) { + ddcIn.writeBuf[i].re = 0.0f; + } + + // Send samples to the DDC + if (!ddcIn.swap(sampCount)) { break; } + } } } std::string name; bool enabled = true; - dsp::stream stream; double sampleRate; SourceManager::SourceHandler handler; bool running = false; @@ -362,10 +532,18 @@ private: int bufferSize; std::thread workerThread; std::atomic run = false; + + dsp::stream ddcIn; + dsp::channel::RxVFO ddc; }; MOD_EXPORT void _INIT_() { - // Nothing here + json def = json({}); + def["devices"] = json({}); + def["device"] = ""; + config.setPath(core::args["root"].s() + "/fobossdr_config.json"); + config.load(def); + config.enableAutoSave(); } MOD_EXPORT ModuleManager::Instance* _CREATE_INSTANCE_(std::string name) { @@ -377,5 +555,6 @@ MOD_EXPORT void _DELETE_INSTANCE_(void* instance) { } MOD_EXPORT void _END_() { - // Nothing here + config.disableAutoSave(); + config.save(); } \ No newline at end of file