diff options
author | Martin Braun <martin.braun@ettus.com> | 2018-01-23 18:12:55 -0800 |
---|---|---|
committer | Brent Stapleton <brent.stapleton@ettus.com> | 2018-02-07 15:46:43 -0800 |
commit | be0df323ca8eccee6abb19d54ebdd0cbbe12d9a4 (patch) | |
tree | 4f037227e281a4ef4ccedb58c99554b70b479bb9 /host | |
parent | 14babab1bd54e1ecd9de9153db58a655833a0e4a (diff) | |
download | uhd-be0df323ca8eccee6abb19d54ebdd0cbbe12d9a4.tar.gz uhd-be0df323ca8eccee6abb19d54ebdd0cbbe12d9a4.tar.bz2 uhd-be0df323ca8eccee6abb19d54ebdd0cbbe12d9a4.zip |
utils: Use find_all in uhd_find_devices
This enables finding all N310 devices, even if they're not available
Reviewed-by: Brent Stapleton <brent.stapleton@ettus.com>
Diffstat (limited to 'host')
-rw-r--r-- | host/utils/uhd_find_devices.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/host/utils/uhd_find_devices.cpp b/host/utils/uhd_find_devices.cpp index 697a482fb..8454afb4d 100644 --- a/host/utils/uhd_find_devices.cpp +++ b/host/utils/uhd_find_devices.cpp @@ -10,6 +10,20 @@ #include <boost/format.hpp> #include <iostream> #include <cstdlib> + +namespace { + //! Conditionally append find_all=1 if the key isn't there yet + uhd::device_addr_t append_findall(const uhd::device_addr_t& device_args) + { + uhd::device_addr_t new_device_args(device_args); + if (!new_device_args.has_key("find_all")) { + new_device_args["find_all"] = "1"; + } + + return new_device_args; + } +} + namespace po = boost::program_options; int UHD_SAFE_MAIN(int argc, char *argv[]){ @@ -26,13 +40,14 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //print the help message if (vm.count("help")){ std::cout << boost::format("UHD Find Devices %s") % desc << std::endl; - return EXIT_FAILURE; + return EXIT_SUCCESS; } //discover the usrps and print the results - uhd::device_addrs_t device_addrs = uhd::device::find(vm["args"].as<std::string>()); - - if (device_addrs.size() == 0){ + const uhd::device_addr_t args(vm["args"].as<std::string>()); + uhd::device_addrs_t device_addrs = + uhd::device::find(append_findall(args)); + if (device_addrs.empty()) { std::cerr << "No UHD Devices Found" << std::endl; return EXIT_FAILURE; } |