[hamradio-commits] [soapyuhd] 01/06: New upstream version 0.3.4

Andreas E. Bombe aeb at moszumanska.debian.org
Wed Dec 20 22:00:39 UTC 2017


This is an automated email from the git hooks/post-receive script.

aeb pushed a commit to annotated tag debian/0.3.4-1
in repository soapyuhd.

commit c0a77467f2247038bca148999f0e6ea6f16a2fc2
Author: Andreas Bombe <aeb at debian.org>
Date:   Wed Dec 20 22:33:54 2017 +0100

    New upstream version 0.3.4
---
 CMakeLists.txt     |  7 +++++++
 Changelog.txt      |  9 +++++++++
 SoapyUHDDevice.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++++++++------
 UHDSoapyDevice.cpp | 36 ++++++++++++++++++++++++++++++++--
 debian/changelog   |  6 ++++++
 5 files changed, 107 insertions(+), 8 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4ed970b..3831d6e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -93,6 +93,13 @@ else()
     message(STATUS "  has set_publisher() API")
 endif()
 
+if (EXISTS "${UHD_INCLUDE_DIRS}/uhd/utils/msg.hpp")
+    add_definitions(-DUHD_HAS_MSG_HPP)
+    message(STATUS "  use msg.hpp for logging")
+else()
+    message(STATUS "  use log.hpp for logging")
+endif()
+
 ########################################################################
 # Setup boost
 ########################################################################
diff --git a/Changelog.txt b/Changelog.txt
index 26963fe..01a463f 100644
--- a/Changelog.txt
+++ b/Changelog.txt
@@ -1,3 +1,12 @@
+Release 0.3.4 (2017-12-14)
+==========================
+
+- Optional check for dsp freq range in property tree
+- Tx de/activateStream() return 0 for NOP, not an error
+- Support timestamp for deactivateStream() stream command
+- Conditional support for new logging API (replaces msg.hpp)
+- Tx stream activation hooks based on start and end of burst
+
 Release 0.3.3 (2017-04-29)
 ==========================
 
diff --git a/SoapyUHDDevice.cpp b/SoapyUHDDevice.cpp
index 8ab352a..6855cc1 100644
--- a/SoapyUHDDevice.cpp
+++ b/SoapyUHDDevice.cpp
@@ -11,7 +11,11 @@
 #include <SoapySDR/Logger.hpp>
 #include <uhd/version.hpp>
 #include <uhd/device.hpp>
+#ifdef UHD_HAS_MSG_HPP
 #include <uhd/utils/msg.hpp>
+#else
+#include <uhd/utils/log_add.hpp>
+#endif
 #include <uhd/usrp/multi_usrp.hpp>
 #include <uhd/property_tree.hpp>
 #include <cctype>
@@ -236,7 +240,7 @@ public:
     int activateStream(SoapySDR::Stream *handle, const int flags, const long long timeNs, const size_t numElems)
     {
         SoapyUHDStream *stream = reinterpret_cast<SoapyUHDStream *>(handle);
-        if (not stream->rx) return SoapySDR::Device::activateStream(handle, flags, timeNs, numElems);
+        if (not stream->rx) return 0; //NOP, does nothing, but not an error
 
         //determine stream mode
         uhd::stream_cmd_t::stream_mode_t mode;
@@ -258,11 +262,15 @@ public:
     int deactivateStream(SoapySDR::Stream *handle, const int flags, const long long timeNs)
     {
         SoapyUHDStream *stream = reinterpret_cast<SoapyUHDStream *>(handle);
-        if (not stream->rx) return SoapySDR::Device::deactivateStream(handle, flags, timeNs);
-        if (flags != 0) return SOAPY_SDR_NOT_SUPPORTED;
+        if (not stream->rx) return 0; //NOP, does nothing, but not an error
 
-        //stop the stream
-        stream->rx->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);
+        //stop the stream (stop mode might support a timestamp)
+        uhd::stream_cmd_t cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);
+        cmd.stream_now = (flags & SOAPY_SDR_HAS_TIME) == 0;
+        cmd.time_spec = uhd::time_spec_t::from_ticks(timeNs, 1e9);
+
+        //issue command
+        stream->rx->issue_stream_cmd(cmd);
         return 0;
     }
 
@@ -580,7 +588,8 @@ public:
             //read the range from the property tree
             uhd::property_tree::sptr tree = _dev->get_device()->get_tree();
             const std::string path = str(boost::format("/mboards/0/%s_dsps/%u/freq/range") % ((dir == SOAPY_SDR_TX)?"tx":"rx") % channel);
-            return metaRangeToRangeList(tree->access<uhd::meta_range_t>(path).get());
+            if (tree->exists(path)) return metaRangeToRangeList(tree->access<uhd::meta_range_t>(path).get());
+            else return SoapySDR::RangeList(1, SoapySDR::Range(-getSampleRate(dir, channel)/2, getSampleRate(dir, channel)/2));
         }
         return SoapySDR::Device::getFrequencyRange(dir, channel, name);
     }
@@ -825,6 +834,7 @@ private:
 /***********************************************************************
  * Register into logger
  **********************************************************************/
+#ifdef UHD_HAS_MSG_HPP
 static void SoapyUHDLogger(uhd::msg::type_t t, const std::string &s)
 {
     if (s.empty()) return;
@@ -837,6 +847,37 @@ static void SoapyUHDLogger(uhd::msg::type_t t, const std::string &s)
     case uhd::msg::fastpath: SoapySDR::log(SOAPY_SDR_SSI, s); break;
     }
 }
+#else
+static void SoapyUHDLogger(const uhd::log::logging_info &info)
+{
+    //build a log message formatted from the information
+    std::string message;
+
+    if (not info.file.empty())
+    {
+        std::string shortfile = info.file.substr(info.file.find_last_of("/\\") + 1);
+        message += "[" + shortfile + ":" + std::to_string(info.line) + "] ";
+    }
+
+    if (not info.component.empty())
+    {
+        message += "[" + info.component + "] ";
+    }
+
+    message += info.message;
+
+    switch(info.verbosity)
+    {
+    case uhd::log::trace:   SoapySDR::log(SOAPY_SDR_TRACE, message); break;
+    case uhd::log::debug:   SoapySDR::log(SOAPY_SDR_DEBUG, message); break;
+    case uhd::log::info:    SoapySDR::log(SOAPY_SDR_INFO, message); break;
+    case uhd::log::warning: SoapySDR::log(SOAPY_SDR_WARNING, message); break;
+    case uhd::log::error:   SoapySDR::log(SOAPY_SDR_ERROR, message); break;
+    case uhd::log::fatal:   SoapySDR::log(SOAPY_SDR_FATAL, message); break;
+    default: break;
+    }
+}
+#endif
 
 /***********************************************************************
  * Registration
@@ -886,7 +927,11 @@ SoapySDR::Device *make_uhd(const SoapySDR::Kwargs &args)
         "Suggestion: install an ABI compatible version of UHD,\n"
         "or rebuild SoapySDR UHD support against this ABI version.\n"
     ) % UHD_VERSION_ABI_STRING % uhd::get_abi_string()));
+    #ifdef UHD_HAS_MSG_HPP
     uhd::msg::register_handler(&SoapyUHDLogger);
+    #else
+    uhd::log::add_logger("SoapyUHDDevice", &SoapyUHDLogger);
+    #endif
     return new SoapyUHDDevice(uhd::usrp::multi_usrp::make(kwargsToDict(args)), args);
 }
 
diff --git a/UHDSoapyDevice.cpp b/UHDSoapyDevice.cpp
index ea12ee7..104128b 100644
--- a/UHDSoapyDevice.cpp
+++ b/UHDSoapyDevice.cpp
@@ -15,7 +15,11 @@
 #include <uhd/property_tree.hpp>
 #include <uhd/device.hpp>
 #include <uhd/convert.hpp>
+#ifdef UHD_HAS_MSG_HPP
 #include <uhd/utils/msg.hpp>
+#else
+#include <uhd/utils/log.hpp>
+#endif
 #include <uhd/types/sensors.hpp>
 #include <uhd/types/ranges.hpp>
 #include <uhd/usrp/mboard_eeprom.hpp>
@@ -690,18 +694,18 @@ class UHDSoapyTxStream : public uhd::tx_streamer
 {
 public:
     UHDSoapyTxStream(SoapySDR::Device *d, const uhd::stream_args_t &args):
+        _active(false),
         _device(d),
         _stream(make_stream(d, SOAPY_SDR_TX, args)),
         _nchan(std::max<size_t>(1, args.channels.size())),
         _elemSize(uhd::convert::get_bytes_per_item(args.cpu_format))
     {
         _offsetBuffs.resize(_nchan);
-        _device->activateStream(_stream);
     }
 
     ~UHDSoapyTxStream(void)
     {
-        _device->deactivateStream(_stream);
+        if (_active) _device->deactivateStream(_stream);
         _device->closeStream(_stream);
     }
 
@@ -722,6 +726,13 @@ public:
         const double timeout = 0.1
     )
     {
+        //perform activation at the latest/on the first call to send
+        if (not _active)
+        {
+            _device->activateStream(_stream);
+            _active = true;
+        }
+
         size_t total = 0;
         const long long timeNs(md.time_spec.to_ticks(1e9));
 
@@ -738,6 +749,13 @@ public:
             total += ret;
         }
 
+        //implement deactivation hook for very last sample consumed on end of burst
+        if (_active and md.end_of_burst and total == nsamps_per_buff)
+        {
+            _device->deactivateStream(_stream);
+            _active = false;
+        }
+
         return total;
     }
 
@@ -793,6 +811,7 @@ public:
     }
 
 private:
+    bool _active;
     SoapySDR::Device *_device;
     SoapySDR::Stream *_stream;
     const size_t _nchan;
@@ -820,8 +839,10 @@ bool UHDSoapyDevice::recv_async_msg(uhd::async_metadata_t &md, double timeout)
  **********************************************************************/
 static void UHDSoapyLogger(const SoapySDR::LogLevel logLevel, const char *message)
 {
+    #define component "UHDSoapyDevice"
     switch(logLevel)
     {
+    #ifdef UHD_HAS_MSG_HPP
     case SOAPY_SDR_FATAL:
     case SOAPY_SDR_CRITICAL:
     case SOAPY_SDR_ERROR: UHD_MSG(error) << message << std::endl; break;
@@ -831,6 +852,17 @@ static void UHDSoapyLogger(const SoapySDR::LogLevel logLevel, const char *messag
     case SOAPY_SDR_DEBUG:
     case SOAPY_SDR_TRACE: UHD_MSG(status) << message << std::endl; break;
     case SOAPY_SDR_SSI: UHD_MSG(fastpath) << message << std::flush; break;
+    #else
+    case SOAPY_SDR_FATAL:
+    case SOAPY_SDR_CRITICAL:  UHD_LOG_FATAL(component, message); break;
+    case SOAPY_SDR_ERROR:     UHD_LOG_FATAL(component, message); break;
+    case SOAPY_SDR_WARNING:   UHD_LOG_WARNING(component, message); break;
+    case SOAPY_SDR_NOTICE:
+    case SOAPY_SDR_INFO:      UHD_LOG_INFO(component, message); break;
+    case SOAPY_SDR_DEBUG:
+    case SOAPY_SDR_TRACE:     UHD_LOG_TRACE(component, message); break;
+    case SOAPY_SDR_SSI:       UHD_LOG_FASTPATH(message); break;
+    #endif
     }
 }
 
diff --git a/debian/changelog b/debian/changelog
index 9ce0325..bfc8183 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+soapyuhd (0.3.4-1) unstable; urgency=low
+
+  * Release 0.3.4 (2017-12-14)
+
+ -- Josh Blum <josh at pothosware.com>  Thu, 14 Dec 2017 19:43:38 -0000
+
 soapyuhd (0.3.3-1) unstable; urgency=low
 
   * Release 0.3.3 (2017-04-29)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/soapyuhd.git



More information about the pkg-hamradio-commits mailing list