diff options
author | bstapleton <brent.stapleton@ettus.com> | 2017-06-29 13:20:00 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-06-30 13:34:36 -0700 |
commit | fc0014a77681c6ab539ea6ed76fa3bccf52933dd (patch) | |
tree | de7e93d4b60197f79e2054fc3eadd90e2555ab22 /host/lib/usrp | |
parent | 533b7ea652ebe5acc2ec2a5434284af608a0f521 (diff) | |
download | uhd-fc0014a77681c6ab539ea6ed76fa3bccf52933dd.tar.gz uhd-fc0014a77681c6ab539ea6ed76fa3bccf52933dd.tar.bz2 uhd-fc0014a77681c6ab539ea6ed76fa3bccf52933dd.zip |
x300: Changed discovery to return early if we find the serial requested
Diffstat (limited to 'host/lib/usrp')
-rw-r--r-- | host/lib/usrp/x300/x300_impl.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index 71cb7f341..8f6e52523 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -333,7 +333,21 @@ device_addrs_t x300_find(const device_addr_t &hint_) //call discover with the new hint and append results device_addrs_t new_addrs = x300_find(new_hint); - addrs.insert(addrs.begin(), new_addrs.begin(), new_addrs.end()); + //if we are looking for a serial, only add the one device with a matching serial + if (hint.has_key("serial")) { + bool found_serial = false; //signal to break out of the interface loop + for (device_addrs_t::iterator new_addr_it=new_addrs.begin(); new_addr_it != new_addrs.end(); new_addr_it++) { + if ((*new_addr_it)["serial"] == hint["serial"]) { + addrs.emplace(addrs.begin(), *new_addr_it); + found_serial = true; + break; + } + } + if (found_serial) break; + } else { + // Otherwise, add all devices we find + addrs.insert(addrs.begin(), new_addrs.begin(), new_addrs.end()); + } } } |