diff options
author | Josh Blum <josh@joshknows.com> | 2011-08-17 10:30:35 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-08-17 10:30:35 -0700 |
commit | 8315ab86b172b21f24ecf84ce472bcaffe245f99 (patch) | |
tree | 7767c617a7031c44e1f7eb25acffcda44cd24391 | |
parent | 06dc097530730621515863b40411581e1d3422b7 (diff) | |
download | uhd-8315ab86b172b21f24ecf84ce472bcaffe245f99.tar.gz uhd-8315ab86b172b21f24ecf84ce472bcaffe245f99.tar.bz2 uhd-8315ab86b172b21f24ecf84ce472bcaffe245f99.zip |
uhd: added readback of version and arbitrary string property to probe app
-rw-r--r-- | host/utils/uhd_usrp_probe.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/host/utils/uhd_usrp_probe.cpp b/host/utils/uhd_usrp_probe.cpp index 55b9e3ddd..1bd49a5ff 100644 --- a/host/utils/uhd_usrp_probe.cpp +++ b/host/utils/uhd_usrp_probe.cpp @@ -16,6 +16,7 @@ // #include <uhd/utils/safe_main.hpp> +#include <uhd/version.hpp> #include <uhd/device.hpp> #include <uhd/types/ranges.hpp> #include <uhd/property_tree.hpp> @@ -177,8 +178,10 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ po::options_description desc("Allowed options"); desc.add_options() ("help", "help message") + ("version", "print the version string and exit") ("args", po::value<std::string>()->default_value(""), "device address args") ("tree", "specify to print a complete property tree") + ("string", po::value<std::string>(), "query a string value from the properties tree") ; po::variables_map vm; @@ -191,9 +194,19 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ return ~0; } + if (vm.count("version")){ + std::cout << uhd::get_version_string() << std::endl; + return 0; + } + device::sptr dev = device::make(vm["args"].as<std::string>()); property_tree::sptr tree = dev->get_tree(); + if (vm.count("string")){ + std::cout << tree->access<std::string>(vm["string"].as<std::string>()).get() << std::endl; + return 0; + } + if (vm.count("tree") != 0) print_tree("/", tree); else std::cout << make_border(get_device_pp_string(tree)) << std::endl; |