aboutsummaryrefslogtreecommitdiffstats
path: root/host/utils/uhd_usrp_probe.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/utils/uhd_usrp_probe.cpp')
-rw-r--r--host/utils/uhd_usrp_probe.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/host/utils/uhd_usrp_probe.cpp b/host/utils/uhd_usrp_probe.cpp
index dc0f98832..fc66b7107 100644
--- a/host/utils/uhd_usrp_probe.cpp
+++ b/host/utils/uhd_usrp_probe.cpp
@@ -74,7 +74,9 @@ static std::string get_frontend_pp_string(const std::string &type, property_tree
ss << boost::format("Name: %s") % (tree->access<std::string>(path / "name").get()) << std::endl;
ss << boost::format("Antennas: %s") % prop_names_to_pp_string(tree->access<std::vector<std::string> >(path / "antenna/options").get()) << std::endl;
- ss << boost::format("Sensors: %s") % prop_names_to_pp_string(tree->list(path / "sensors")) << std::endl;
+ if (tree->exists(path/ "sensors")) {
+ ss << boost::format("Sensors: %s") % prop_names_to_pp_string(tree->list(path / "sensors")) << std::endl;
+ }
meta_range_t freq_range = tree->access<meta_range_t>(path / "freq/range").get();
ss << boost::format("Freq range: %.3f to %.3f MHz") % (freq_range.start()/1e6) % (freq_range.stop()/1e6) << std::endl;
@@ -92,22 +94,25 @@ static std::string get_frontend_pp_string(const std::string &type, property_tree
}
ss << boost::format("Connection Type: %s") % (tree->access<std::string>(path / "connection").get()) << std::endl;
- ss << boost::format("Uses LO offset: %s") % ((tree->access<bool>(path / "use_lo_offset").get())? "Yes" : "No") << std::endl;
+ ss << boost::format("Uses LO offset: %s")
+ % ((tree->exists(path / "use_lo_offset") and tree->access<bool>(path / "use_lo_offset").get())? "Yes" : "No")
+ << std::endl;
return ss.str();
}
static std::string get_codec_pp_string(const std::string &type, property_tree::sptr tree, const fs_path &path){
std::stringstream ss;
- ss << boost::format("%s Codec: %s") % type % path.leaf() << std::endl;
- //ss << std::endl;
-
- ss << boost::format("Name: %s") % (tree->access<std::string>(path / "name").get()) << std::endl;
- std::vector<std::string> gain_names = tree->list(path / "gains");
- if (gain_names.size() == 0) ss << "Gain Elements: None" << std::endl;
- for(const std::string &name: gain_names){
- meta_range_t gain_range = tree->access<meta_range_t>(path / "gains" / name / "range").get();
- ss << boost::format("Gain range %s: %.1f to %.1f step %.1f dB") % name % gain_range.start() % gain_range.stop() % gain_range.step() << std::endl;
+ if (tree->exists(path / "name")) {
+ ss << boost::format("%s Codec: %s") % type % path.leaf() << std::endl;
+
+ ss << boost::format("Name: %s") % (tree->access<std::string>(path / "name").get()) << std::endl;
+ std::vector<std::string> gain_names = tree->list(path / "gains");
+ if (gain_names.size() == 0) ss << "Gain Elements: None" << std::endl;
+ for(const std::string &name: gain_names){
+ meta_range_t gain_range = tree->access<meta_range_t>(path / "gains" / name / "range").get();
+ ss << boost::format("Gain range %s: %.1f to %.1f step %.1f dB") % name % gain_range.start() % gain_range.stop() % gain_range.step() << std::endl;
+ }
}
return ss.str();
}
@@ -128,8 +133,10 @@ static std::string get_dboard_pp_string(const std::string &type, property_tree::
if (not gdb_eeprom.serial.empty()) ss << boost::format("Serial: %s") % gdb_eeprom.serial << std::endl;
}
}
- for(const std::string &name: tree->list(path / (prefix + "_frontends"))){
- ss << make_border(get_frontend_pp_string(type, tree, path / (prefix + "_frontends") / name));
+ if (tree->exists(path / (prefix + "_frontends"))) {
+ for(const std::string &name: tree->list(path / (prefix + "_frontends"))){
+ ss << make_border(get_frontend_pp_string(type, tree, path / (prefix + "_frontends") / name));
+ }
}
ss << make_border(get_codec_pp_string(type, tree, path.branch_path().branch_path() / (prefix + "_codecs") / path.leaf()));
return ss.str();
@@ -204,8 +211,8 @@ static std::string get_mboard_pp_string(property_tree::sptr tree, const fs_path
ss << make_border(get_rfnoc_pp_string(tree, path / "xbar"));
}
}
- catch (const uhd::lookup_error&) {
- /* nop */
+ catch (const uhd::lookup_error& ex) {
+ std::cout << "Exited device probe on " << ex.what() << std::endl;
}
return ss.str();
}