From marco.cimato at gmail.com Sat May 2 11:02:14 2020 From: marco.cimato at gmail.com (Marco Domenico Cimato) Date: Sat, 2 May 2020 13:02:14 +0200 Subject: PS Name and PI code modification In-Reply-To: <017880bb-f966-ba96-30dd-2bb3de273155@steve-m.de> References: <017880bb-f966-ba96-30dd-2bb3de273155@steve-m.de> Message-ID: Hi, I have already done it, but I'll implement every new feature (i.e.PTY) introduced by miegl on the fork of PiFmRDS (https://github.com/Miegl/PiFmAdv ). But now I'm facing another problem after some seconds audio stream and I think also all the FM signal is stopped seems with no error message. Testing I have 130Ms/s but the oscillator error are high. What do you think about this? Kind regards, Marco Il giorno sab 25 apr 2020 alle ore 13:11 Steve Markgraf ha scritto: > Hi, > > On 25.04.20 13:04, Marco Domenico Cimato wrote: > > thanks in advance for the support, where I can modify the subject value. > > I have found the variable inside rds_mod.c but I didn't find anywhere > > they are set. > > The request is made because seems the windows binaries has them but they > > were set and compiled or it's me that I didn't find where they are? > > They are hardcoded here: > https://cgit.osmocom.org/osmo-fl2k/tree/src/fl2k_fm.c#n581 > > Should be quite easy to add commandline options to override them if > needed, feel free to submit a patch. > > Regards, > Steve > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gwenhael.goavec-merou at trabucayre.com Fri May 15 14:24:14 2020 From: gwenhael.goavec-merou at trabucayre.com (Gwenhael Goavec-Merou) Date: Fri, 15 May 2020 16:24:14 +0200 Subject: [PATCH] librtlsdr: cmake: add options to enable/disable static or shared target in build Message-ID: <20200515142414.17370-1-gwenhael.goavec-merou@trabucayre.com> When librtlsdr is build with an environment with static libraries, the build fails with messages like: /buildroot/librtl/output/host/lib/gcc/aarch64-buildroot-linux-uclibc/8.4.0/../../../../aarch64-buildroot-linux-uclibc/bin/ld: /buildroot/librtl/output/host/aarch64-buildroot-linux-uclibc/sysroot/usr/lib/libusb-1.0.a(libusb_1_0_la-core.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `stderr' which may bind externally can not be used when making a shared object; recompile with -fPIC /buildroot/librtl/output/host/aarch64-buildroot-linux-uclibc/sysroot/usr/lib/libusb-1.0.a(libusb_1_0_la-core.o): in function `usbi_log_str': core.c:(.text+0xf8): dangerous relocation: unsupported relocation This patch add options to select if librtlsdr must be build in static mode, shared mode or both. Adapted from https://github.com/steve-m/librtlsdr/pull/46 and https://git.buildroot.net/buildroot/tree/package/librtlsdr/0001-disable_shared_library_target_in_build.patch?h=2020.02.x Signed-off-by: Yuvaraj Patil Signed-off-by: Fabrice Fontaine Signed-off-by: Gwenhael Goavec-Merou --- src/CMakeLists.txt | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 33faee7..d82fc87 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,6 +18,8 @@ ######################################################################## # Setup shared library variant ######################################################################## +option(BUILD_SHARED_LIBS "Build shared library" ON) +if(BUILD_SHARED_LIBS) add_library(rtlsdr SHARED librtlsdr.c tuner_e4k.c tuner_fc0012.c tuner_fc0013.c tuner_fc2580.c tuner_r82xx.c) target_link_libraries(rtlsdr PkgConfig::LIBUSB) @@ -30,10 +32,14 @@ set_target_properties(rtlsdr PROPERTIES OUTPUT_NAME rtlsdr) set_target_properties(rtlsdr PROPERTIES SOVERSION ${MAJOR_VERSION}) set_target_properties(rtlsdr PROPERTIES VERSION ${LIBVER}) generate_export_header(rtlsdr) +list(APPEND rtlsdr_lib rtlsdr) +endif() ######################################################################## # Setup static library variant ######################################################################## +option(BUILD_STATIC_LIBS "Build static library" ON) +if(BUILD_STATIC_LIBS) add_library(rtlsdr_static STATIC librtlsdr.c tuner_e4k.c tuner_fc0012.c tuner_fc0013.c tuner_fc2580.c tuner_r82xx.c) target_link_libraries(rtlsdr_static PkgConfig::LIBUSB) @@ -47,6 +53,8 @@ if(NOT WIN32) set_target_properties(rtlsdr_static PROPERTIES OUTPUT_NAME rtlsdr) endif() generate_export_header(rtlsdr_static) +list(APPEND rtlsdr_lib rtlsdr_static) +endif() ######################################################################## # Set up Windows DLL resource files @@ -90,37 +98,37 @@ add_executable(rtl_eeprom rtl_eeprom.c) add_executable(rtl_adsb rtl_adsb.c) add_executable(rtl_power rtl_power.c) add_executable(rtl_biast rtl_biast.c) -set(INSTALL_TARGETS rtlsdr rtlsdr_static rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power rtl_biast) +set(INSTALL_TARGETS ${rtlsdr_lib} rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power rtl_biast) -target_link_libraries(rtl_sdr rtlsdr convenience_static +target_link_libraries(rtl_sdr ${rtlsdr_lib} convenience_static ${LIBUSB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ) -target_link_libraries(rtl_tcp rtlsdr convenience_static +target_link_libraries(rtl_tcp ${rtlsdr_lib} convenience_static ${LIBUSB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ) -target_link_libraries(rtl_test rtlsdr convenience_static +target_link_libraries(rtl_test ${rtlsdr_lib} convenience_static ${LIBUSB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ) -target_link_libraries(rtl_fm rtlsdr convenience_static +target_link_libraries(rtl_fm ${rtlsdr_lib} convenience_static ${LIBUSB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ) -target_link_libraries(rtl_eeprom rtlsdr convenience_static +target_link_libraries(rtl_eeprom ${rtlsdr_lib} convenience_static ${LIBUSB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ) -target_link_libraries(rtl_adsb rtlsdr convenience_static +target_link_libraries(rtl_adsb ${rtlsdr_lib} convenience_static ${LIBUSB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ) -target_link_libraries(rtl_power rtlsdr convenience_static +target_link_libraries(rtl_power ${rtlsdr_lib} convenience_static ${LIBUSB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ) -target_link_libraries(rtl_biast rtlsdr convenience_static +target_link_libraries(rtl_biast ${rtlsdr_lib} convenience_static ${LIBUSB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ) @@ -156,12 +164,16 @@ endif() ######################################################################## # Install built library files & utilities ######################################################################## +if(BUILD_SHARED_LIBS) install(TARGETS rtlsdr EXPORT RTLSDR-export LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # .so/.dylib file ) +endif() +if(BUILD_STATIC_LIBS) install(TARGETS rtlsdr_static EXPORT RTLSDR-export ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # .so/.dylib file ) +endif() install(TARGETS rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power DESTINATION ${CMAKE_INSTALL_BINDIR} ) -- 2.26.2 From anton at ozlabs.org Thu May 21 08:29:54 2020 From: anton at ozlabs.org (Anton Blanchard) Date: Thu, 21 May 2020 18:29:54 +1000 Subject: [PATCH] Loop in soapy_source_c::work() when readStream() returns SOAPY_SDR_OVERFLOW In-Reply-To: <20200416093031.2b07f1e6@kryten.localdomain> References: <20200415223813.41a6399b@kryten.localdomain> <20200415134655.GI4127396@nataraja> <20200416093031.2b07f1e6@kryten.localdomain> Message-ID: <20200521182954.39d04a69@kryten.localdomain> Hi Sylvain, On Thu, 16 Apr 2020 09:30:31 +1000 Anton Blanchard wrote: > Hi Sylvain, > > > Looks to me like this has the potential to just hang and prevent the > > thread from terminating. > > This needs bounds. One retry is fine, infinite ones not so much. > > Good idea, how does this look? Just checking to see if this is OK to be merged? Thanks, Anton > Anton > -- > > I'm using an Airspy HF+ Discovery with the Soapy driver. Whenever I > turn AGC off it stops receiving samples. > > On closer inspection, switching AGC off results in samples stalling > for an extended period (hundreds of milliseconds). As such, we hit the > timeout in SoapyAirspyHF::readStream() and return SOAPY_SDR_TIMEOUT > (-1). > > Things go wrong at this point. It takes a long time before > readStream() is called again, presumably because we returned 0 from > work(). By this time our buffers have overflown, readStream() returns > SOAPY_SDR_OVERFLOW (-2) and work() returns 0. We loop forever, > continually overflowing buffers. > > Fix this by looping in soapy_source_c::work() when ->readStream > returns SOAPY_SDR_OVERFLOW so that we consume the buffers straight > away. > > Signed-off-by: Anton Blanchard > --- > lib/soapy/soapy_source_c.cc | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/lib/soapy/soapy_source_c.cc b/lib/soapy/soapy_source_c.cc > index a645361..5c683c9 100644 > --- a/lib/soapy/soapy_source_c.cc > +++ b/lib/soapy/soapy_source_c.cc > @@ -96,9 +96,14 @@ int soapy_source_c::work( int noutput_items, > { > int flags = 0; > long long timeNs = 0; > - int ret = _device->readStream( > - _stream, &output_items[0], > - noutput_items, flags, timeNs); > + int ret; > + int retries = 1; > + > + do { > + ret = _device->readStream( > + _stream, &output_items[0], > + noutput_items, flags, timeNs); > + } while (retries-- && (ret == SOAPY_SDR_OVERFLOW)); > > if (ret < 0) return 0; //call again > return ret; From fredrik at kyla.kiruna.se Fri May 22 19:40:37 2020 From: fredrik at kyla.kiruna.se (Carl-Fredrik Enell) Date: Fri, 22 May 2020 21:40:37 +0200 Subject: fl2k on rpi4: no more USB error Message-ID: <87pnavyczu.fsf@fenix.lan> Dear all, I found that the fix for the USB issue on ARM systems has finally made it into the Linux kernel, 5.6.14 and 5.7-rc6. Today I installed the latest Manjaro 64 unstable mainline kernel on my rpi4 and made some quick tests with fl-wspr (https://github.com/tejeez/fl2k-tool). There are no more USB errors*, but I still get underflow errors at high sample rates. In my quick tests the maximum reliable sample rate was about 20 MHz when running in an X session with other programs. When I stopped the X server and ran in a text console I could go above 30 MHz without underflows. This means that the rpi4 is fine as an SDR transceiver for many purposes- but it would be nice to know if it is possible to tune the system for a bit higher sample rates! All the best SM2YHP Fredrik * Installed AUR package libosmo-fl2k-git to fix other USB device issues -- ------------------ Carl-Fredrik Enell F?raregatan 26B SE-98139 Kiruna +46705508256 ----------------- From argilo at gmail.com Sun May 31 03:43:18 2020 From: argilo at gmail.com (argilo at gmail.com) Date: Sat, 30 May 2020 23:43:18 -0400 Subject: [PATCH] fcd: restore support for FUNcube Dongle and Pro+ Message-ID: <20200531034318.141656-1-argilo@gmail.com> From: Clayton Smith Support for the original FUNcube Dongle used to live in GNU Radio's gr-fcd module, which was removed in version 3.8. As a result, gr-osmosdr lost support for both FUNcube Dongle and FUNcube Dongle Pro+. The gr-fcdproplus out-of-tree module subsequently added support for the original FUNcube Dongle, meaning that it now supports both types. As a result, FUNcube support can easily be restored in gr-osmosdr. The #ifdefs are no longer required, since everything is in a single module now. --- CMakeLists.txt | 1 + cmake/Modules/FindGnuradioFCDPP.cmake | 27 +++++++++++++++++++++++++++ lib/CMakeLists.txt | 8 ++++++++ lib/fcd/CMakeLists.txt | 21 ++++----------------- lib/fcd/fcd_source_c.cc | 18 +----------------- lib/fcd/fcd_source_c.h | 13 ++----------- 6 files changed, 43 insertions(+), 45 deletions(-) create mode 100644 cmake/Modules/FindGnuradioFCDPP.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a2cf9df3d..14a9ddda7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -176,6 +176,7 @@ find_package(LibHackRF) find_package(LibAIRSPY) find_package(LibAIRSPYHF) find_package(LibbladeRF) +find_package(GnuradioFCDPP) find_package(SoapySDR NO_MODULE) find_package(LibFreeSRP) find_package(Doxygen) diff --git a/cmake/Modules/FindGnuradioFCDPP.cmake b/cmake/Modules/FindGnuradioFCDPP.cmake new file mode 100644 index 0000000000..f81fe8aa41 --- /dev/null +++ b/cmake/Modules/FindGnuradioFCDPP.cmake @@ -0,0 +1,27 @@ +if(NOT GNURADIO_FCDPP_FOUND) + pkg_check_modules (GNURADIO_FCDPP_PKG libgnuradio-fcdproplus) + find_path(GNURADIO_FCDPP_INCLUDE_DIRS NAMES fcdproplus/api.h + PATHS + ${GNURADIO_FCDPP_PKG_INCLUDE_DIRS} + /usr/include + /usr/local/include + ) + + find_library(GNURADIO_FCDPP_LIBRARIES NAMES gnuradio-fcdproplus + PATHS + ${GNURADIO_FCDPP_PKG_LIBRARY_DIRS} + /usr/lib + /usr/local/lib + ) + +if(GNURADIO_FCDPP_INCLUDE_DIRS AND GNURADIO_FCDPP_LIBRARIES) + set(GNURADIO_FCDPP_FOUND TRUE CACHE INTERNAL "gnuradio-fcdproplus found") + message(STATUS "Found gnuradio-fcdproplus: ${GNURADIO_FCDPP_INCLUDE_DIRS}, ${GNURADIO_FCDPP_LIBRARIES}") +else(GNURADIO_FCDPP_INCLUDE_DIRS AND GNURADIO_FCDPP_LIBRARIES) + set(GNURADIO_FCDPP_FOUND FALSE CACHE INTERNAL "gnuradio-fcdproplus found") + message(STATUS "gnuradio-fcdproplus not found.") +endif(GNURADIO_FCDPP_INCLUDE_DIRS AND GNURADIO_FCDPP_LIBRARIES) + +mark_as_advanced(GNURADIO_FCDPP_LIBRARIES GNURADIO_FCDPP_INCLUDE_DIRS) + +endif(NOT GNURADIO_FCDPP_FOUND) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index d04cb1d402..3199ef3d79 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -135,6 +135,14 @@ 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_subdirectory(fcd) +endif(ENABLE_FCD) + ######################################################################## # Setup File component ######################################################################## diff --git a/lib/fcd/CMakeLists.txt b/lib/fcd/CMakeLists.txt index 146191f7ac..7a515c71fc 100644 --- a/lib/fcd/CMakeLists.txt +++ b/lib/fcd/CMakeLists.txt @@ -23,25 +23,12 @@ target_include_directories(gnuradio-osmosdr PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + ${GNURADIO_FCDPP_INCLUDE_DIRS} ) -if(ENABLE_FCD) - target_include_directories(gnuradio-osmosdr PRIVATE - ${Gnuradio-fcd_INCLUDE_DIRS} - ) - target_link_libraries(gnuradio-osmosdr PRIVATE - ${Gnuradio-fcd_LIBRARIES} - ) -endif(ENABLE_FCD) - -if(ENABLE_FCDPP) - target_include_directories(gnuradio-osmosdr PRIVATE - ${Gnuradio-fcdpp_INCLUDE_DIRS} - ) - target_link_libraries(gnuradio-osmosdr PRIVATE - ${Gnuradio-fcdpp_LIBRARIES} - ) -endif(ENABLE_FCDPP) +target_link_libraries(gnuradio-osmosdr + ${GNURADIO_FCDPP_LIBRARIES} +) list(APPEND gr_osmosdr_srcs ${CMAKE_CURRENT_SOURCE_DIR}/fcd_source_c.cc diff --git a/lib/fcd/fcd_source_c.cc b/lib/fcd/fcd_source_c.cc index 885d514787..744fa69553 100644 --- a/lib/fcd/fcd_source_c.cc +++ b/lib/fcd/fcd_source_c.cc @@ -142,18 +142,15 @@ fcd_source_c::fcd_source_c(const std::string &args) : std::cerr << "Using " << name() << " (" << dev_name << ")" << std::endl; -#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" ); set_gain( 12, "MIX" ); } -#endif -#ifdef HAVE_FCDPP if ( FUNCUBE_V2 == _type ) { _src_v2 = gr::fcdproplus::fcdproplus::make( dev_name ); @@ -163,7 +160,6 @@ fcd_source_c::fcd_source_c(const std::string &args) : set_gain( 1, "MIX" ); set_gain( 15, "BB" ); } -#endif } fcd_source_c::~fcd_source_c() @@ -241,15 +237,11 @@ osmosdr::freq_range_t fcd_source_c::get_freq_range( size_t chan ) double fcd_source_c::set_center_freq( double freq, size_t chan ) { -#ifdef HAVE_FCD if ( FUNCUBE_V1 == _type ) _src_v1->set_freq( float(freq) ); -#endif -#ifdef HAVE_FCDPP if ( FUNCUBE_V2 == _type ) _src_v2->set_freq( float(freq) ); -#endif _freq = freq; @@ -263,15 +255,11 @@ double fcd_source_c::get_center_freq( size_t chan ) double fcd_source_c::set_freq_corr( double ppm, size_t chan ) { -#ifdef HAVE_FCD if ( FUNCUBE_V1 == _type ) _src_v1->set_freq_corr( ppm ); -#endif -#ifdef HAVE_FCDPP if ( FUNCUBE_V2 == _type ) _src_v2->set_freq_corr( ppm ); -#endif _correct = ppm; @@ -343,7 +331,6 @@ double fcd_source_c::set_gain( double gain, size_t chan ) double fcd_source_c::set_gain( double gain, const std::string & name, size_t chan ) { -#ifdef HAVE_FCD if ( FUNCUBE_V1 == _type ) { if ( "LNA" == name ) @@ -357,9 +344,7 @@ double fcd_source_c::set_gain( double gain, const std::string & name, size_t cha _src_v1->set_mixer_gain(_mix_gain); } } -#endif -#ifdef HAVE_FCDPP if ( FUNCUBE_V2 == _type ) { if ( "LNA" == name ) @@ -378,7 +363,6 @@ double fcd_source_c::set_gain( double gain, const std::string & name, size_t cha _src_v2->set_if_gain(_bb_gain); } } -#endif return get_gain( name, chan ); } diff --git a/lib/fcd/fcd_source_c.h b/lib/fcd/fcd_source_c.h index 70239f8533..2b02eb1052 100644 --- a/lib/fcd/fcd_source_c.h +++ b/lib/fcd/fcd_source_c.h @@ -22,13 +22,8 @@ #include -#ifdef HAVE_FCD -#include -#endif - -#ifdef HAVE_FCDPP +#include #include -#endif #include "source_iface.h" @@ -86,12 +81,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; int _correct; }; -- 2.25.1 From argilo at gmail.com Sun May 31 13:36:41 2020 From: argilo at gmail.com (argilo at gmail.com) Date: Sun, 31 May 2020 09:36:41 -0400 Subject: [PATCH] Replace some Boost classes with C++11 Message-ID: <20200531133641.156495-1-argilo@gmail.com> From: Clayton Smith A lot of Boost functionality is available in C++11. Since GNU Radio is moving away from Boost, it probably makes sense to do so in gr-osmosdr as well. This change removes all usage of boost::mutex, boost::mutex::scoped_lock, boost::unique_lock, and boost::condition_variable. It also removes usage of boost::shared_ptr and boost::weak_ptr outside of block definitions (which must continue to use Boost until GNU Radio 3.9). --- include/osmosdr/pimpl.h | 6 +++--- lib/airspy/airspy_source_c.cc | 2 +- lib/airspy/airspy_source_c.h | 9 +++++---- lib/airspyhf/airspyhf_source_c.cc | 2 +- lib/airspyhf/airspyhf_source_c.h | 9 +++++---- lib/bladerf/bladerf_common.cc | 15 +++++++-------- lib/bladerf/bladerf_common.h | 11 +++++------ lib/device.cc | 6 +++--- lib/freesrp/freesrp_common.cc | 3 +-- lib/freesrp/freesrp_common.h | 3 ++- lib/hackrf/hackrf_sink_c.cc | 4 ++-- lib/hackrf/hackrf_source_c.cc | 4 ++-- lib/miri/miri_source_c.cc | 6 +++--- lib/miri/miri_source_c.h | 9 +++++---- lib/osmosdr/osmosdr_src_c.cc | 6 +++--- lib/osmosdr/osmosdr_src_c.h | 9 +++++---- lib/rfspace/rfspace_source_c.cc | 6 +++--- lib/rfspace/rfspace_source_c.h | 15 ++++++++------- lib/rtl/rtl_source_c.cc | 6 +++--- lib/rtl/rtl_source_c.h | 9 +++++---- lib/sdrplay/sdrplay_source_c.h | 7 ++++--- lib/soapy/soapy_common.cc | 4 ++-- lib/soapy/soapy_common.h | 5 +++-- lib/soapy/soapy_sink_c.cc | 4 ++-- lib/soapy/soapy_source_c.cc | 4 ++-- 25 files changed, 85 insertions(+), 79 deletions(-) diff --git a/include/osmosdr/pimpl.h b/include/osmosdr/pimpl.h index e1985b4392..3a99994879 100644 --- a/include/osmosdr/pimpl.h +++ b/include/osmosdr/pimpl.h @@ -18,7 +18,7 @@ #ifndef INCLUDED_OSMOSDR_PIMPL_H #define INCLUDED_OSMOSDR_PIMPL_H -#include +#include /*! \file pimpl.h * "Pimpl idiom" (pointer to implementation idiom). @@ -39,7 +39,7 @@ * \param _name the name of the pimpl class */ #define OSMOSDR_PIMPL_DECL(_name) \ - struct _name; boost::shared_ptr<_name> + struct _name; std::shared_ptr<_name> /*! * Make an instance of a pimpl in a source file. @@ -49,6 +49,6 @@ * \param _args the constructor args for the pimpl */ #define OSMOSDR_PIMPL_MAKE(_name, _args) \ - boost::shared_ptr<_name>(new _name _args) + std::shared_ptr<_name>(new _name _args) #endif /* INCLUDED_OSMOSDR_PIMPL_H */ diff --git a/lib/airspy/airspy_source_c.cc b/lib/airspy/airspy_source_c.cc index 50150e510a..af578d0379 100644 --- a/lib/airspy/airspy_source_c.cc +++ b/lib/airspy/airspy_source_c.cc @@ -291,7 +291,7 @@ int airspy_source_c::work( int noutput_items, if ( ! running ) return WORK_DONE; - boost::unique_lock lock(_fifo_lock); + std::unique_lock lock(_fifo_lock); /* Wait until we have the requested number of samples */ int n_samples_avail = _fifo->size(); diff --git a/lib/airspy/airspy_source_c.h b/lib/airspy/airspy_source_c.h index f8617e62d0..a7d817fc61 100644 --- a/lib/airspy/airspy_source_c.h +++ b/lib/airspy/airspy_source_c.h @@ -23,8 +23,9 @@ #define INCLUDED_AIRSPY_SOURCE_C_H #include -#include -#include + +#include +#include #include @@ -128,8 +129,8 @@ private: airspy_device *_dev; boost::circular_buffer *_fifo; - boost::mutex _fifo_lock; - boost::condition_variable _samp_avail; + std::mutex _fifo_lock; + std::condition_variable _samp_avail; std::vector< std::pair > _sample_rates; double _sample_rate; diff --git a/lib/airspyhf/airspyhf_source_c.cc b/lib/airspyhf/airspyhf_source_c.cc index 327fe19b8d..f90b60b22d 100644 --- a/lib/airspyhf/airspyhf_source_c.cc +++ b/lib/airspyhf/airspyhf_source_c.cc @@ -239,7 +239,7 @@ int airspyhf_source_c::work( int noutput_items, if ( ! running ) return WORK_DONE; - boost::unique_lock lock(_fifo_lock); + std::unique_lock lock(_fifo_lock); /* Wait until we have the requested number of samples */ int n_samples_avail = _fifo->size(); diff --git a/lib/airspyhf/airspyhf_source_c.h b/lib/airspyhf/airspyhf_source_c.h index cfb8c89a7f..dbdd87ae0e 100644 --- a/lib/airspyhf/airspyhf_source_c.h +++ b/lib/airspyhf/airspyhf_source_c.h @@ -23,8 +23,9 @@ #define INCLUDED_AIRSPYHF_SOURCE_C_H #include -#include -#include + +#include +#include #include @@ -105,8 +106,8 @@ private: airspyhf_device *_dev; boost::circular_buffer *_fifo; - boost::mutex _fifo_lock; - boost::condition_variable _samp_avail; + std::mutex _fifo_lock; + std::condition_variable _samp_avail; std::vector< std::pair > _sample_rates; double _sample_rate; diff --git a/lib/bladerf/bladerf_common.cc b/lib/bladerf/bladerf_common.cc index 4327d44cb5..19b8a021a0 100644 --- a/lib/bladerf/bladerf_common.cc +++ b/lib/bladerf/bladerf_common.cc @@ -38,7 +38,6 @@ #include #include #include -#include #include "bladerf_common.h" @@ -50,8 +49,8 @@ static size_t const STREAM_TIMEOUT_MS = 3000; using namespace boost::assign; -boost::mutex bladerf_common::_devs_mutex; -std::list> bladerf_common::_devs; +std::mutex bladerf_common::_devs_mutex; +std::list> bladerf_common::_devs; /* name for system-wide gain (which is not its own libbladeRF gain stage) */ static const char *SYSTEM_GAIN_NAME = "system"; @@ -1079,7 +1078,7 @@ bladerf_sptr bladerf_common::open(std::string const &device_name) struct bladerf *raw_dev = NULL; struct bladerf_devinfo devinfo; - boost::unique_lock lock(_devs_mutex); + std::lock_guard lock(_devs_mutex); /* Initialize the information used to identify the desired device * to all wildcard (i.e., "any device") values */ @@ -1109,15 +1108,15 @@ bladerf_sptr bladerf_common::open(std::string const &device_name) /* Add the device handle to our cache */ bladerf_sptr dev = bladerf_sptr(raw_dev, bladerf_common::close); - _devs.push_back(static_cast>(dev)); + _devs.push_back(static_cast>(dev)); return dev; } void bladerf_common::close(void *dev) { - boost::unique_lock lock(_devs_mutex); - std::list>::iterator it(_devs.begin()); + std::lock_guard lock(_devs_mutex); + std::list>::iterator it(_devs.begin()); /* Prune expired entries from device cache */ while (it != _devs.end()) { @@ -1137,7 +1136,7 @@ bladerf_sptr bladerf_common::get_cached_device(struct bladerf_devinfo devinfo) int status; struct bladerf_devinfo other_devinfo; - BOOST_FOREACH(boost::weak_ptr dev, _devs) { + BOOST_FOREACH(std::weak_ptr dev, _devs) { status = bladerf_get_devinfo(bladerf_sptr(dev).get(), &other_devinfo); if (status < 0) { BLADERF_THROW_STATUS(status, "Failed to get devinfo for cached device"); diff --git a/lib/bladerf/bladerf_common.h b/lib/bladerf/bladerf_common.h index 27afa83f45..741b1e75b4 100644 --- a/lib/bladerf/bladerf_common.h +++ b/lib/bladerf/bladerf_common.h @@ -23,12 +23,11 @@ #include #include +#include +#include #include #include -#include -#include - #include #include "osmosdr/ranges.h" @@ -43,7 +42,7 @@ typedef ptrdiff_t ssize_t; #define BLADERF_DEBUG_ENABLE -typedef boost::shared_ptr bladerf_sptr; +typedef std::shared_ptr bladerf_sptr; /* Identification of the bladeRF hardware in use */ typedef enum { @@ -287,8 +286,8 @@ private: /***************************************************************************** * Private members ****************************************************************************/ - static boost::mutex _devs_mutex; /**< mutex for access to _devs */ - static std::list> _devs; /**< dev cache */ + static std::mutex _devs_mutex; /**< mutex for access to _devs */ + static std::list> _devs; /**< dev cache */ }; #endif diff --git a/lib/device.cc b/lib/device.cc index 586062fa89..015383dbd4 100644 --- a/lib/device.cc +++ b/lib/device.cc @@ -22,8 +22,8 @@ #include #include #include -#include #include +#include #include #ifdef HAVE_CONFIG_H @@ -102,7 +102,7 @@ static const std::string args_delim = " "; static const std::string pairs_delim = ","; static const std::string pair_delim = "="; -static boost::mutex _device_mutex; +static std::mutex _device_mutex; device_t::device_t(const std::string &args) { @@ -141,7 +141,7 @@ std::string device_t::to_string(void) const devices_t device::find(const device_t &hint) { - boost::mutex::scoped_lock lock(_device_mutex); + std::lock_guard lock(_device_mutex); bool fake = true; diff --git a/lib/freesrp/freesrp_common.cc b/lib/freesrp/freesrp_common.cc index d60fbb84b0..57bbdbba0a 100644 --- a/lib/freesrp/freesrp_common.cc +++ b/lib/freesrp/freesrp_common.cc @@ -2,7 +2,6 @@ #include -#include #include #include @@ -11,7 +10,7 @@ using namespace FreeSRP; using namespace std; using namespace boost::assign; -boost::shared_ptr<::FreeSRP::FreeSRP> freesrp_common::_srp; +std::shared_ptr<::FreeSRP::FreeSRP> freesrp_common::_srp; freesrp_common::freesrp_common(const string &args) { diff --git a/lib/freesrp/freesrp_common.h b/lib/freesrp/freesrp_common.h index 9a5687ca46..8d13c47cef 100644 --- a/lib/freesrp/freesrp_common.h +++ b/lib/freesrp/freesrp_common.h @@ -1,6 +1,7 @@ #ifndef INCLUDED_FREESRP_COMMON_H #define INCLUDED_FREESRP_COMMON_H +#include #include #include @@ -22,7 +23,7 @@ public: double set_freq_corr( double ppm, size_t chan = 0 ); double get_freq_corr( size_t chan = 0 ); protected: - static boost::shared_ptr<::FreeSRP::FreeSRP> _srp; + static std::shared_ptr<::FreeSRP::FreeSRP> _srp; bool _ignore_overflow = false; }; diff --git a/lib/hackrf/hackrf_sink_c.cc b/lib/hackrf/hackrf_sink_c.cc index 7271109b15..1762934443 100644 --- a/lib/hackrf/hackrf_sink_c.cc +++ b/lib/hackrf/hackrf_sink_c.cc @@ -196,7 +196,7 @@ int hackrf_sink_c::hackrf_tx_callback(unsigned char *buffer, uint32_t length) *buffer++ = rand() % 255; #else { - std::unique_lock lock(_buf_mutex); + std::lock_guard lock(_buf_mutex); if ( ! cb_pop_front( &_cbuf, buffer ) ) { memset(buffer, 0, length); @@ -372,7 +372,7 @@ int hackrf_sink_c::work( int noutput_items, if((unsigned int)noutput_items >= remaining) { { - std::unique_lock lock(_buf_mutex); + std::lock_guard lock(_buf_mutex); if ( ! cb_push_back( &_cbuf, _buf ) ) { _buf_used = prev_buf_used; diff --git a/lib/hackrf/hackrf_source_c.cc b/lib/hackrf/hackrf_source_c.cc index eea5caafda..0c0ae21eb6 100644 --- a/lib/hackrf/hackrf_source_c.cc +++ b/lib/hackrf/hackrf_source_c.cc @@ -151,7 +151,7 @@ int hackrf_source_c::_hackrf_rx_callback(hackrf_transfer *transfer) int hackrf_source_c::hackrf_rx_callback(unsigned char *buf, uint32_t len) { { - std::unique_lock lock(_buf_mutex); + std::lock_guard lock(_buf_mutex); int buf_tail = (_buf_head + _buf_used) % _buf_num; memcpy(_buf[buf_tail], buf, len); @@ -231,7 +231,7 @@ int hackrf_source_c::work( int noutput_items, *out++ = _lut[ *(buf + i) ]; { - std::unique_lock lock(_buf_mutex); + std::lock_guard lock(_buf_mutex); _buf_head = (_buf_head + 1) % _buf_num; _buf_used--; diff --git a/lib/miri/miri_source_c.cc b/lib/miri/miri_source_c.cc index c9f81fac3b..c1b9428fbb 100644 --- a/lib/miri/miri_source_c.cc +++ b/lib/miri/miri_source_c.cc @@ -182,7 +182,7 @@ void miri_source_c::mirisdr_callback(unsigned char *buf, uint32_t len) } { - boost::mutex::scoped_lock lock( _buf_mutex ); + std::lock_guard lock( _buf_mutex ); if (len > BUF_SIZE) throw std::runtime_error("Buffer too small."); @@ -226,7 +226,7 @@ int miri_source_c::work( int noutput_items, gr_complex *out = (gr_complex *)output_items[0]; { - boost::mutex::scoped_lock lock( _buf_mutex ); + std::unique_lock lock( _buf_mutex ); while (_buf_used < 3 && _running) // collect at least 3 buffers _buf_cond.wait( lock ); @@ -250,7 +250,7 @@ int miri_source_c::work( int noutput_items, float(*(buf + i * 2 + 1)) * (1.0f/4096.0f) ); { - boost::mutex::scoped_lock lock( _buf_mutex ); + std::lock_guard lock( _buf_mutex ); _buf_head = (_buf_head + 1) % _buf_num; _buf_used--; diff --git a/lib/miri/miri_source_c.h b/lib/miri/miri_source_c.h index 5363db5382..1ea906f27a 100644 --- a/lib/miri/miri_source_c.h +++ b/lib/miri/miri_source_c.h @@ -23,8 +23,9 @@ #include #include -#include -#include + +#include +#include #include "source_iface.h" @@ -120,8 +121,8 @@ private: unsigned int _buf_num; unsigned int _buf_head; unsigned int _buf_used; - boost::mutex _buf_mutex; - boost::condition_variable _buf_cond; + std::mutex _buf_mutex; + std::condition_variable _buf_cond; bool _running; unsigned int _buf_offset; diff --git a/lib/osmosdr/osmosdr_src_c.cc b/lib/osmosdr/osmosdr_src_c.cc index de65373cb6..e4f8b89944 100644 --- a/lib/osmosdr/osmosdr_src_c.cc +++ b/lib/osmosdr/osmosdr_src_c.cc @@ -179,7 +179,7 @@ void osmosdr_src_c::osmosdr_callback(unsigned char *buf, uint32_t len) } { - boost::mutex::scoped_lock lock( _buf_mutex ); + std::lock_guard lock( _buf_mutex ); int buf_tail = (_buf_head + _buf_used) % _buf_num; memcpy(_buf[buf_tail], buf, len); @@ -219,7 +219,7 @@ int osmosdr_src_c::work( int noutput_items, gr_complex *out = (gr_complex *)output_items[0]; { - boost::mutex::scoped_lock lock( _buf_mutex ); + std::unique_lock lock( _buf_mutex ); while (_buf_used < 3 && _running) // collect at least 3 buffers _buf_cond.wait( lock ); @@ -243,7 +243,7 @@ int osmosdr_src_c::work( int noutput_items, float(*(buf + i * 2 + 1)) * (1.0f/32767.5f) ); { - boost::mutex::scoped_lock lock( _buf_mutex ); + std::lock_guard lock( _buf_mutex ); _buf_head = (_buf_head + 1) % _buf_num; _buf_used--; diff --git a/lib/osmosdr/osmosdr_src_c.h b/lib/osmosdr/osmosdr_src_c.h index 0f62b09b2c..f8f18ec776 100644 --- a/lib/osmosdr/osmosdr_src_c.h +++ b/lib/osmosdr/osmosdr_src_c.h @@ -23,8 +23,9 @@ #include #include -#include -#include + +#include +#include #include "source_iface.h" @@ -124,8 +125,8 @@ private: unsigned int _buf_len; unsigned int _buf_head; unsigned int _buf_used; - boost::mutex _buf_mutex; - boost::condition_variable _buf_cond; + std::mutex _buf_mutex; + std::condition_variable _buf_cond; bool _running; unsigned int _buf_offset; diff --git a/lib/rfspace/rfspace_source_c.cc b/lib/rfspace/rfspace_source_c.cc index 80f34df3c6..121dcde032 100644 --- a/lib/rfspace/rfspace_source_c.cc +++ b/lib/rfspace/rfspace_source_c.cc @@ -590,7 +590,7 @@ bool rfspace_source_c::transaction( const unsigned char *cmd, size_t size, if ( write(_usb, cmd, size) != (int)size ) return false; - boost::unique_lock lock(_resp_lock); + std::unique_lock lock(_resp_lock); _resp_avail.wait(lock); rx_bytes = _resp.size(); @@ -598,7 +598,7 @@ bool rfspace_source_c::transaction( const unsigned char *cmd, size_t size, } else { - boost::mutex::scoped_lock lock(_tcp_lock); + std::lock_guard lock(_tcp_lock); #ifdef USE_ASIO _t.write_some( boost::asio::buffer(cmd, size) ); @@ -829,7 +829,7 @@ int rfspace_source_c::work( int noutput_items, { gr_complex *out = (gr_complex *)output_items[0]; - boost::unique_lock lock(_fifo_lock); + std::unique_lock lock(_fifo_lock); /* Wait until we have the requested number of samples */ int n_samples_avail = _fifo->size(); diff --git a/lib/rfspace/rfspace_source_c.h b/lib/rfspace/rfspace_source_c.h index c65606348b..a51bfc6f8a 100644 --- a/lib/rfspace/rfspace_source_c.h +++ b/lib/rfspace/rfspace_source_c.h @@ -30,8 +30,9 @@ #include #include -#include -#include + +#include +#include #include "osmosdr/ranges.h" #include "source_iface.h" @@ -164,15 +165,15 @@ private: /* members */ gr::thread::thread _thread; bool _run_usb_read_task; bool _run_tcp_keepalive_task; - boost::mutex _tcp_lock; + std::mutex _tcp_lock; boost::circular_buffer *_fifo; - boost::mutex _fifo_lock; - boost::condition_variable _samp_avail; + std::mutex _fifo_lock; + std::condition_variable _samp_avail; std::vector< unsigned char > _resp; - boost::mutex _resp_lock; - boost::condition_variable _resp_avail; + std::mutex _resp_lock; + std::condition_variable _resp_avail; }; #endif /* INCLUDED_RFSPACE_SOURCE_C_H */ diff --git a/lib/rtl/rtl_source_c.cc b/lib/rtl/rtl_source_c.cc index a37146402a..e312ed79ec 100644 --- a/lib/rtl/rtl_source_c.cc +++ b/lib/rtl/rtl_source_c.cc @@ -298,7 +298,7 @@ void rtl_source_c::rtlsdr_callback(unsigned char *buf, uint32_t len) } { - boost::mutex::scoped_lock lock( _buf_mutex ); + std::lock_guard lock( _buf_mutex ); int buf_tail = (_buf_head + _buf_used) % _buf_num; memcpy(_buf[buf_tail], buf, len); @@ -338,7 +338,7 @@ int rtl_source_c::work( int noutput_items, gr_complex *out = (gr_complex *)output_items[0]; { - boost::mutex::scoped_lock lock( _buf_mutex ); + std::unique_lock lock( _buf_mutex ); while (_buf_used < 3 && _running) // collect at least 3 buffers _buf_cond.wait( lock ); @@ -359,7 +359,7 @@ int rtl_source_c::work( int noutput_items, if (!_samp_avail) { { - boost::mutex::scoped_lock lock( _buf_mutex ); + std::lock_guard lock( _buf_mutex ); _buf_head = (_buf_head + 1) % _buf_num; _buf_used--; diff --git a/lib/rtl/rtl_source_c.h b/lib/rtl/rtl_source_c.h index 902b386ae8..de3e349b26 100644 --- a/lib/rtl/rtl_source_c.h +++ b/lib/rtl/rtl_source_c.h @@ -25,8 +25,9 @@ #include #include -#include -#include + +#include +#include #include "source_iface.h" @@ -131,8 +132,8 @@ private: unsigned int _buf_len; unsigned int _buf_head; unsigned int _buf_used; - boost::mutex _buf_mutex; - boost::condition_variable _buf_cond; + std::mutex _buf_mutex; + std::condition_variable _buf_cond; bool _running; unsigned int _buf_offset; diff --git a/lib/sdrplay/sdrplay_source_c.h b/lib/sdrplay/sdrplay_source_c.h index 2e4631ea8c..b59f44a754 100644 --- a/lib/sdrplay/sdrplay_source_c.h +++ b/lib/sdrplay/sdrplay_source_c.h @@ -24,8 +24,9 @@ #include #include -#include -#include + +#include +#include #include "osmosdr/ranges.h" @@ -126,7 +127,7 @@ private: std::vector< short > _bufi; std::vector< short > _bufq; int _buf_offset; - boost::mutex _buf_mutex; + std::mutex _buf_mutex; bool _running; bool _uninit; diff --git a/lib/soapy/soapy_common.cc b/lib/soapy/soapy_common.cc index 0e277e4e21..e241967bb9 100644 --- a/lib/soapy/soapy_common.cc +++ b/lib/soapy/soapy_common.cc @@ -36,8 +36,8 @@ osmosdr::gain_range_t soapy_range_to_gain_range(const SoapySDR::Range &r) return osmosdr::gain_range_t(r.minimum(), r.maximum(), step); } -boost::mutex &get_soapy_maker_mutex(void) +std::mutex &get_soapy_maker_mutex(void) { - static boost::mutex m; + static std::mutex m; return m; } diff --git a/lib/soapy/soapy_common.h b/lib/soapy/soapy_common.h index 87e46a5730..8adb0db515 100644 --- a/lib/soapy/soapy_common.h +++ b/lib/soapy/soapy_common.h @@ -23,7 +23,8 @@ #include #include -#include + +#include /*! * Convert a soapy range to a gain range. @@ -35,6 +36,6 @@ osmosdr::gain_range_t soapy_range_to_gain_range(const SoapySDR::Range &r); * Global mutex to protect factory routines. * (optional under 0.5 release above) */ -boost::mutex &get_soapy_maker_mutex(void); +std::mutex &get_soapy_maker_mutex(void); #endif /* INCLUDED_SOAPY_COMMON_H */ diff --git a/lib/soapy/soapy_sink_c.cc b/lib/soapy/soapy_sink_c.cc index b12b8daca2..e4422f7f45 100644 --- a/lib/soapy/soapy_sink_c.cc +++ b/lib/soapy/soapy_sink_c.cc @@ -63,7 +63,7 @@ soapy_sink_c::soapy_sink_c (const std::string &args) gr::io_signature::make (0, 0, 0)) { { - boost::mutex::scoped_lock l(get_soapy_maker_mutex()); + std::lock_guard l(get_soapy_maker_mutex()); _device = SoapySDR::Device::make(params_to_dict(args)); } _nchan = std::max(1, args_to_io_signature(args)->max_streams()); @@ -75,7 +75,7 @@ soapy_sink_c::soapy_sink_c (const std::string &args) soapy_sink_c::~soapy_sink_c(void) { _device->closeStream(_stream); - boost::mutex::scoped_lock l(get_soapy_maker_mutex()); + std::lock_guard l(get_soapy_maker_mutex()); SoapySDR::Device::unmake(_device); } diff --git a/lib/soapy/soapy_source_c.cc b/lib/soapy/soapy_source_c.cc index a6453618ab..3f65b2766c 100644 --- a/lib/soapy/soapy_source_c.cc +++ b/lib/soapy/soapy_source_c.cc @@ -64,7 +64,7 @@ soapy_source_c::soapy_source_c (const std::string &args) args_to_io_signature(args)) { { - boost::mutex::scoped_lock l(get_soapy_maker_mutex()); + std::lock_guard l(get_soapy_maker_mutex()); _device = SoapySDR::Device::make(params_to_dict(args)); } _nchan = std::max(1, args_to_io_signature(args)->max_streams()); @@ -76,7 +76,7 @@ soapy_source_c::soapy_source_c (const std::string &args) soapy_source_c::~soapy_source_c(void) { _device->closeStream(_stream); - boost::mutex::scoped_lock l(get_soapy_maker_mutex()); + std::lock_guard l(get_soapy_maker_mutex()); SoapySDR::Device::unmake(_device); } -- 2.25.1