aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--host/include/uhd/types/device_addr.hpp7
-rw-r--r--host/lib/types/device_addr.cpp9
-rw-r--r--host/lib/usrp/b100/b100_impl.cpp8
-rw-r--r--host/lib/usrp/b200/b200_impl.cpp8
-rw-r--r--host/lib/usrp/mpmd/mpmd_find.cpp6
-rw-r--r--host/lib/usrp/usrp1/usrp1_impl.cpp10
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp5
-rw-r--r--host/lib/usrp/x300/x300_impl.cpp6
-rw-r--r--host/lib/usrp_clock/octoclock/octoclock_impl.cpp5
9 files changed, 56 insertions, 8 deletions
diff --git a/host/include/uhd/types/device_addr.hpp b/host/include/uhd/types/device_addr.hpp
index 869f4a862..035715bf9 100644
--- a/host/include/uhd/types/device_addr.hpp
+++ b/host/include/uhd/types/device_addr.hpp
@@ -50,6 +50,13 @@ public:
device_addr_t(const std::map<std::string, std::string>& info);
/*!
+ * Looks for any key that matches the prefix.
+ * \param prefix string to compare keys to
+ * \return a bool true if found else false
+ */
+ bool has_key_with_prefix(const std::string& prefix) const;
+
+ /*!
* Convert a device address into a pretty print string.
* \return a printable string representing the device address
*/
diff --git a/host/lib/types/device_addr.cpp b/host/lib/types/device_addr.cpp
index d5e9ce0d4..3a7f80ed9 100644
--- a/host/lib/types/device_addr.cpp
+++ b/host/lib/types/device_addr.cpp
@@ -9,6 +9,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
#include <boost/tokenizer.hpp>
+#include <algorithm>
#include <regex>
#include <sstream>
#include <stdexcept>
@@ -51,6 +52,14 @@ device_addr_t::device_addr_t(const std::map<std::string, std::string>& info)
}
}
+bool device_addr_t::has_key_with_prefix(const std::string& prefix) const
+{
+ auto dev_keys = this->keys();
+ return std::any_of(dev_keys.begin(), dev_keys.end(), [prefix](const auto& key) {
+ return key.substr(0, prefix.size()) == prefix;
+ });
+}
+
std::string device_addr_t::to_pp_string(void) const
{
if (this->size() == 0)
diff --git a/host/lib/usrp/b100/b100_impl.cpp b/host/lib/usrp/b100/b100_impl.cpp
index 4d72e4f04..02a23ec38 100644
--- a/host/lib/usrp/b100/b100_impl.cpp
+++ b/host/lib/usrp/b100/b100_impl.cpp
@@ -44,9 +44,15 @@ static device_addrs_t b100_find(const device_addr_t& hint)
// Return an empty list of addresses when an address or resource is specified,
// since an address and resource is intended for a different, non-USB, device.
- if (hint.has_key("addr") || hint.has_key("resource"))
+ if (hint.has_key("addr"))
return b100_addrs;
+ if (hint.has_key_with_prefix("resource")) {
+ UHD_LOG_TRACE(
+ "B100 FIND", "Returning early, PCIe is not supported with b100 devices.");
+ return b100_addrs;
+ }
+
uint16_t vid, pid;
if (hint.has_key("vid") && hint.has_key("pid") && hint.has_key("type")
diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp
index 7f250fd42..139dd9362 100644
--- a/host/lib/usrp/b200/b200_impl.cpp
+++ b/host/lib/usrp/b200/b200_impl.cpp
@@ -182,8 +182,14 @@ static device_addrs_t b200_find(const device_addr_t& hint)
// Return an empty list of addresses when an address or resource is specified,
// since an address and resource is intended for a different, non-USB, device.
for (device_addr_t hint_i : separate_device_addr(hint)) {
- if (hint_i.has_key("addr") || hint_i.has_key("resource"))
+ if (hint_i.has_key("addr"))
return b200_addrs;
+
+ if (hint.has_key_with_prefix("resource")) {
+ UHD_LOG_TRACE(
+ "B200 FIND", "Returning early, PCIe is not supported with b200 devices.");
+ return b200_addrs;
+ }
}
// Important note:
diff --git a/host/lib/usrp/mpmd/mpmd_find.cpp b/host/lib/usrp/mpmd/mpmd_find.cpp
index c08e23fa7..77f7486dd 100644
--- a/host/lib/usrp/mpmd/mpmd_find.cpp
+++ b/host/lib/usrp/mpmd/mpmd_find.cpp
@@ -224,6 +224,12 @@ device_addrs_t mpmd_find(const device_addr_t& hint_)
return {};
}
}
+ if (hint_.has_key_with_prefix("resource")) {
+ UHD_LOG_TRACE(
+ "MPMD FIND", "Returning early, PCIe is not support with mpm devices.");
+ return {};
+ }
+
UHD_LOG_TRACE("MPMD FIND", "Finding with " << hints.size() << " different hint(s).");
// Scenario 1): User gave us at least one address
diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp
index d86bf6d56..37bd4a4a2 100644
--- a/host/lib/usrp/usrp1/usrp1_impl.cpp
+++ b/host/lib/usrp/usrp1/usrp1_impl.cpp
@@ -47,9 +47,15 @@ static device_addrs_t usrp1_find(const device_addr_t& hint)
// Return an empty list of addresses when an address or resource is specified,
// since an address and resource is intended for a different, non-USB, device.
- if (hint.has_key("addr") || hint.has_key("resource"))
+ if (hint.has_key("addr"))
return usrp1_addrs;
+ if (hint.has_key_with_prefix("resource")) {
+ UHD_LOG_TRACE(
+ "USRP1 FIND", "Returning early, PCIe is not supported with usrp1 devices.");
+ return usrp1_addrs;
+ }
+
uint16_t vid, pid;
if (hint.has_key("vid") && hint.has_key("pid") && hint.has_key("type")
@@ -121,7 +127,7 @@ static device_addrs_t usrp1_find(const device_addr_t& hint)
// this is a found usrp1 when the hint serial and name match or blank
if ((not hint.has_key("name") or hint["name"] == new_addr["name"])
and (not hint.has_key("serial")
- or hint["serial"] == new_addr["serial"])) {
+ or hint["serial"] == new_addr["serial"])) {
usrp1_addrs.push_back(new_addr);
}
}
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index c2514ae02..8ca503aa9 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -68,8 +68,11 @@ device_addrs_t usrp2_find(const device_addr_t& hint_)
// Return an empty list of addresses when a resource is specified,
// since a resource is intended for a different, non-USB, device.
- if (hint.has_key("resource"))
+ if (hint.has_key_with_prefix("resource")) {
+ UHD_LOG_TRACE(
+ "USRP2 FIND", "Returning early, PCIe is not supported with usrp2 devices.");
return usrp2_addrs;
+ }
// if no address was specified, send a broadcast on each interface
if (not hint.has_key("addr")) {
diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp
index fa8425fac..663b951a1 100644
--- a/host/lib/usrp/x300/x300_impl.cpp
+++ b/host/lib/usrp/x300/x300_impl.cpp
@@ -100,7 +100,9 @@ device_addrs_t x300_find(const device_addr_t& hint_)
return reply_addrs;
}
- if (!hint.has_key("resource")) {
+ bool has_resource_key = hint.has_key_with_prefix("resource");
+
+ if (!has_resource_key) {
// otherwise, no address was specified, send a broadcast on each interface
for (const transport::if_addrs_t& if_addrs : transport::get_if_addrs()) {
// avoid the loopback device
@@ -135,7 +137,7 @@ device_addrs_t x300_find(const device_addr_t& hint_)
}
}
- device_addrs_t pcie_addrs = pcie_manager::find(hint, hint.has_key("resource"));
+ device_addrs_t pcie_addrs = pcie_manager::find(hint, has_resource_key);
if (not pcie_addrs.empty()) {
addrs.insert(addrs.end(), pcie_addrs.begin(), pcie_addrs.end());
}
diff --git a/host/lib/usrp_clock/octoclock/octoclock_impl.cpp b/host/lib/usrp_clock/octoclock/octoclock_impl.cpp
index b4185eded..24032c33f 100644
--- a/host/lib/usrp_clock/octoclock/octoclock_impl.cpp
+++ b/host/lib/usrp_clock/octoclock/octoclock_impl.cpp
@@ -71,8 +71,11 @@ device_addrs_t octoclock_find(const device_addr_t& hint)
// Return an empty list of addresses when a resource is specified,
// since a resource is intended for a different, non-USB, device.
- if (hint.has_key("resource"))
+ if (hint.has_key_with_prefix("resource")) {
+ UHD_LOG_TRACE("OCTOCLOCK FIND",
+ "Returning early, PCIe is not supported with octoclock devices.");
return octoclock_addrs;
+ }
// If no address was specified, send a broadcast on each interface
if (not _hint.has_key("addr")) {