diff options
author | Brent Stapleton <brent.stapleton@ettus.com> | 2017-12-14 19:01:14 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:05:58 -0800 |
commit | a927a364c5b07387be3a849b74546b98ba84db84 (patch) | |
tree | e288fc58e2971af547a85fc943d96b838a496776 /host/lib/usrp/mpmd | |
parent | 0c94fff3300d2c1c1c98367d99e1457f073a1892 (diff) | |
download | uhd-a927a364c5b07387be3a849b74546b98ba84db84.tar.gz uhd-a927a364c5b07387be3a849b74546b98ba84db84.tar.bz2 uhd-a927a364c5b07387be3a849b74546b98ba84db84.zip |
mpm: mpmd: Add MPM compat number check
Reviewed-by: Martin Braun <martin.braun@ettus.com>
Diffstat (limited to 'host/lib/usrp/mpmd')
-rw-r--r-- | host/lib/usrp/mpmd/mpmd_impl.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/host/lib/usrp/mpmd/mpmd_impl.cpp b/host/lib/usrp/mpmd/mpmd_impl.cpp index d8d21a464..d020e3546 100644 --- a/host/lib/usrp/mpmd/mpmd_impl.cpp +++ b/host/lib/usrp/mpmd/mpmd_impl.cpp @@ -49,6 +49,8 @@ namespace { const double MPMD_FIND_TIMEOUT = 0.5; //! Most pessimistic time for a CHDR query to go to device and back const double MPMD_CHDR_MAX_RTT = 0.02; + //! MPM Compatibility number + const std::vector<size_t> MPM_COMPAT_NUM = {1, 0}; const std::string MPMD_MGMT_ADDR_KEY = "mgmt_addr"; @@ -361,6 +363,31 @@ mpmd_mboard_impl::uptr mpmd_impl::setup_mb( } auto mb = mpmd_mboard_impl::make(device_args, rpc_addr); + // Check the compatibility number + UHD_LOGGER_TRACE("MPMD") << boost::format( + "Checking MPM compat number against ours: %i.%i") + % MPM_COMPAT_NUM[0] % MPM_COMPAT_NUM[1]; + const auto compat_num = mb->rpc->request<std::vector<size_t>>("get_mpm_compat_num"); + UHD_LOGGER_TRACE("MPMD") << boost::format( + "Compat number received: %d.%d") + % compat_num[0] % compat_num[1]; + + const size_t c_major = compat_num[0], c_minor = compat_num[1]; + if (c_major != MPM_COMPAT_NUM[0]) { + UHD_LOGGER_ERROR("MPMD") << boost::format( + "MPM major compat number mismatch." + "Expected %i.%i Actual %i.%i") + % MPM_COMPAT_NUM[0] % MPM_COMPAT_NUM[1] % c_major % c_minor; + throw uhd::runtime_error("MPM compatibility number mismatch."); + } + if (c_minor < MPM_COMPAT_NUM[1]) { + UHD_LOGGER_ERROR("MPMD") << boost::format( + "MPM minor compat number mismatch." + "Expected %d.%d Actual %d.%d") + % MPM_COMPAT_NUM[0] % MPM_COMPAT_NUM[1] % c_major % c_minor; + throw uhd::runtime_error("MPM compatibility number mismatch."); + } + if (device_args.has_key("skip_init")) { return mb; } |