From 5e5f40923974c94eaacccd46bd3ba19fb9955982 Mon Sep 17 00:00:00 2001 From: Brent Stapleton Date: Tue, 7 Nov 2017 15:28:38 -0800 Subject: mpm: added additional filtering to mpm find routine mpm_find now filters discovered devices using (if provided in args) name, serial, type, and product. This method follows the same logic as the x300 find routine. --- host/lib/usrp/mpmd/mpmd_impl.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'host/lib/usrp') diff --git a/host/lib/usrp/mpmd/mpmd_impl.cpp b/host/lib/usrp/mpmd/mpmd_impl.cpp index cada95345..58b5682c1 100644 --- a/host/lib/usrp/mpmd/mpmd_impl.cpp +++ b/host/lib/usrp/mpmd/mpmd_impl.cpp @@ -493,7 +493,19 @@ device_addrs_t mpmd_find_with_addr(const device_addr_t& hint_) boost::token_compress_on); new_addr[value[0]] = value[1]; } - addrs.push_back(new_addr); + // filter the discovered device below by matching optional keys + if ( + (not hint_.has_key("name") or hint_["name"] == new_addr["name"]) + and (not hint_.has_key("serial") or hint_["serial"] == new_addr["serial"]) + and (not hint_.has_key("type") or hint_["type"] == new_addr["type"]) + and (not hint_.has_key("product") or hint_["product"] == new_addr["product"]) + ){ + addrs.push_back(new_addr); + } else { + UHD_LOG_DEBUG("MPMD FIND", + "Found device, but does not match hint: " << recv_addr + ); + } } return addrs; }; -- cgit v1.2.3