diff options
author | Lane Kolbly <lane.kolbly@ni.com> | 2020-03-31 13:39:54 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-04-08 15:32:50 -0500 |
commit | 843527d303b4407f273b10a8986d6a51f5eeb389 (patch) | |
tree | 4ec4f68b7a3af44bec3c4e5c8f36361bcdfb307c | |
parent | a2ce2facc7330fca15f0bac374563f79fb3e85fb (diff) | |
download | uhd-843527d303b4407f273b10a8986d6a51f5eeb389.tar.gz uhd-843527d303b4407f273b10a8986d6a51f5eeb389.tar.bz2 uhd-843527d303b4407f273b10a8986d6a51f5eeb389.zip |
uhd: mpm: Query prefs per-device for multi-device queries
If a user specifies a multi-device query, such as "serial0=1234,serial1=4321",
we have to look up the preferences for each device. To minimize the
impact to non-x400 devices, I simply push the get_usrp_args call down
into mpmd_impl and mpmd_find.
-rw-r--r-- | host/lib/device.cpp | 5 | ||||
-rw-r--r-- | host/lib/usrp/mpmd/mpmd_find.cpp | 9 | ||||
-rw-r--r-- | host/lib/usrp/mpmd/mpmd_impl.cpp | 8 |
3 files changed, 16 insertions, 6 deletions
diff --git a/host/lib/device.cpp b/host/lib/device.cpp index 9fdbc03ed..7bf362753 100644 --- a/host/lib/device.cpp +++ b/host/lib/device.cpp @@ -114,14 +114,11 @@ device::sptr device::make(const device_addr_t& hint, device_filter_t filter, siz typedef std::tuple<device_addr_t, make_t> dev_addr_make_t; std::vector<dev_addr_make_t> dev_addr_makers; - device_addr_t hint_with_prefs = prefs::get_usrp_args(hint); - UHD_LOGGER_DEBUG("UHD") << "Looking for device with hint: " - << hint_with_prefs.to_string(); for (const dev_fcn_reg_t& fcn : get_dev_fcn_regs()) { try { if (filter == ANY or std::get<2>(fcn) == filter) { - for (device_addr_t dev_addr : std::get<0>(fcn)(hint_with_prefs)) { + for (device_addr_t dev_addr : std::get<0>(fcn)(hint)) { // append the discovered address and its factory function dev_addr_makers.push_back( dev_addr_make_t(dev_addr, std::get<1>(fcn))); diff --git a/host/lib/usrp/mpmd/mpmd_find.cpp b/host/lib/usrp/mpmd/mpmd_find.cpp index c04615587..9c7ea8958 100644 --- a/host/lib/usrp/mpmd/mpmd_find.cpp +++ b/host/lib/usrp/mpmd/mpmd_find.cpp @@ -13,6 +13,7 @@ #include <uhd/transport/if_addrs.hpp> #include <uhd/transport/udp_simple.hpp> #include <uhd/types/device_addr.hpp> +#include <uhdlib/utils/prefs.hpp> #include <boost/algorithm/string.hpp> #include <boost/asio.hpp> #include <future> @@ -206,7 +207,13 @@ device_addrs_t mpmd_find(const device_addr_t& hint_) } } #endif - device_addrs_t hints = separate_device_addr(hint_); + device_addrs_t hints_without_prefs = separate_device_addr(hint_); + device_addrs_t hints; + for (size_t i = 0; i < hints_without_prefs.size(); i++) + { + hints.push_back(prefs::get_usrp_args(hints_without_prefs[i])); + } + if (hint_.has_key("type")) { if (std::find(MPM_DEVICE_TYPES.cbegin(), MPM_DEVICE_TYPES.cend(), hint_["type"]) == MPM_DEVICE_TYPES.cend()) { diff --git a/host/lib/usrp/mpmd/mpmd_impl.cpp b/host/lib/usrp/mpmd/mpmd_impl.cpp index d685b93b2..bd5ea8540 100644 --- a/host/lib/usrp/mpmd/mpmd_impl.cpp +++ b/host/lib/usrp/mpmd/mpmd_impl.cpp @@ -9,6 +9,7 @@ #include <uhd/types/component_file.hpp> #include <uhd/utils/static.hpp> #include <uhd/utils/tasks.hpp> +#include <uhdlib/utils/prefs.hpp> #include <boost/algorithm/string.hpp> #include <boost/thread.hpp> #include <chrono> @@ -149,7 +150,12 @@ const std::string mpmd_impl::MPM_ECHO_CMD = "MPM-ECHO"; mpmd_impl::mpmd_impl(const device_addr_t& device_args) : rfnoc_device(), _device_args(device_args) { - const device_addrs_t mb_args = separate_device_addr(device_args); + const device_addrs_t mb_args_without_prefs = separate_device_addr(device_args); + device_addrs_t mb_args; + for (size_t i = 0; i < mb_args_without_prefs.size(); ++i) + { + mb_args.push_back(prefs::get_usrp_args(mb_args_without_prefs[i])); + } const size_t num_mboards = mb_args.size(); _mb.reserve(num_mboards); const bool serialize_init = device_args.has_key("serialize_init"); |