aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/mpmd
diff options
context:
space:
mode:
authorLane Kolbly <lane.kolbly@ni.com>2020-04-06 11:17:29 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2020-04-08 15:13:53 -0500
commitabf025f0a5c537f0b2ab07da933ffb82f62418ef (patch)
treebd877c33a6264794c2b92d96970d2984b25c7cba /host/lib/usrp/mpmd
parentd398fe465724a3c2efb6abb1c720fc9f3a037701 (diff)
downloaduhd-abf025f0a5c537f0b2ab07da933ffb82f62418ef.tar.gz
uhd-abf025f0a5c537f0b2ab07da933ffb82f62418ef.tar.bz2
uhd-abf025f0a5c537f0b2ab07da933ffb82f62418ef.zip
uhd: Add fuzzy serial number checking
We have integer 32-bit serial numbers for MPM devices, for example "1234abcd". For serial numbers which have less than eight digits, e.g. "123abcd", a user may feel inclined to prefix this number with a 0 when they are searching for devices, e.g. "0123abcd". This change makes it so that specifying "0123abcd" will match a device with serial number "123ABCD".
Diffstat (limited to 'host/lib/usrp/mpmd')
-rw-r--r--host/lib/usrp/mpmd/mpmd_find.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/host/lib/usrp/mpmd/mpmd_find.cpp b/host/lib/usrp/mpmd/mpmd_find.cpp
index 501b250b0..c04615587 100644
--- a/host/lib/usrp/mpmd/mpmd_find.cpp
+++ b/host/lib/usrp/mpmd/mpmd_find.cpp
@@ -9,6 +9,7 @@
#include "mpmd_devices.hpp"
#include "mpmd_impl.hpp"
#include "mpmd_link_if_mgr.hpp"
+#include <uhdlib/utils/serial_number.hpp>
#include <uhd/transport/if_addrs.hpp>
#include <uhd/transport/udp_simple.hpp>
#include <uhd/types/device_addr.hpp>
@@ -110,7 +111,7 @@ device_addrs_t mpmd_find_with_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("serial") or uhd::serial_numbers_match(hint_["serial"], new_addr["serial"]))
and (not hint_.has_key("type") or hint_["type"] == new_addr["type"]
or hint_["type"] == MPM_CATCHALL_DEVICE_TYPE)
and (not hint_.has_key("product")