diff options
Diffstat (limited to 'host/utils/uhd_usrp_probe.cpp')
-rw-r--r-- | host/utils/uhd_usrp_probe.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/host/utils/uhd_usrp_probe.cpp b/host/utils/uhd_usrp_probe.cpp index 5b3702fb4..98ed84850 100644 --- a/host/utils/uhd_usrp_probe.cpp +++ b/host/utils/uhd_usrp_probe.cpp @@ -30,6 +30,7 @@ #include <iostream> #include <sstream> #include <vector> +#include <cstdlib> namespace po = boost::program_options; using namespace uhd; @@ -114,13 +115,16 @@ static std::string get_dboard_pp_string(const std::string &type, property_tree:: ss << boost::format("%s Dboard: %s") % type % path.leaf() << std::endl; //ss << std::endl; const std::string prefix = (type == "RX")? "rx" : "tx"; - usrp::dboard_eeprom_t db_eeprom = tree->access<usrp::dboard_eeprom_t>(path / (prefix + "_eeprom")).get(); - if (db_eeprom.id != usrp::dboard_id_t::none()) ss << boost::format("ID: %s") % db_eeprom.id.to_pp_string() << std::endl; - if (not db_eeprom.serial.empty()) ss << boost::format("Serial: %s") % db_eeprom.serial << std::endl; - if (type == "TX"){ - usrp::dboard_eeprom_t gdb_eeprom = tree->access<usrp::dboard_eeprom_t>(path / "gdb_eeprom").get(); - if (gdb_eeprom.id != usrp::dboard_id_t::none()) ss << boost::format("ID: %s") % gdb_eeprom.id.to_pp_string() << std::endl; - if (not gdb_eeprom.serial.empty()) ss << boost::format("Serial: %s") % gdb_eeprom.serial << std::endl; + if (tree->exists(path / (prefix + "_eeprom"))) + { + usrp::dboard_eeprom_t db_eeprom = tree->access<usrp::dboard_eeprom_t>(path / (prefix + "_eeprom")).get(); + if (db_eeprom.id != usrp::dboard_id_t::none()) ss << boost::format("ID: %s") % db_eeprom.id.to_pp_string() << std::endl; + if (not db_eeprom.serial.empty()) ss << boost::format("Serial: %s") % db_eeprom.serial << std::endl; + if (type == "TX"){ + usrp::dboard_eeprom_t gdb_eeprom = tree->access<usrp::dboard_eeprom_t>(path / "gdb_eeprom").get(); + if (gdb_eeprom.id != usrp::dboard_id_t::none()) ss << boost::format("ID: %s") % gdb_eeprom.id.to_pp_string() << std::endl; + if (not gdb_eeprom.serial.empty()) ss << boost::format("Serial: %s") % gdb_eeprom.serial << std::endl; + } } BOOST_FOREACH(const std::string &name, tree->list(path / (prefix + "_frontends"))){ ss << make_border(get_frontend_pp_string(type, tree, path / (prefix + "_frontends") / name)); @@ -197,12 +201,12 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //print the help message if (vm.count("help")){ std::cout << boost::format("UHD USRP Probe %s") % desc << std::endl; - return ~0; + return EXIT_FAILURE; } if (vm.count("version")){ std::cout << uhd::get_version_string() << std::endl; - return 0; + return EXIT_SUCCESS; } device::sptr dev = device::make(vm["args"].as<std::string>()); @@ -210,11 +214,11 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ if (vm.count("string")){ std::cout << tree->access<std::string>(vm["string"].as<std::string>()).get() << std::endl; - return 0; + return EXIT_SUCCESS; } if (vm.count("tree") != 0) print_tree("/", tree); else std::cout << make_border(get_device_pp_string(tree)) << std::endl; - return 0; + return EXIT_SUCCESS; } |