diff options
author | Nicholas Corgan <nick.corgan@ettus.com> | 2012-11-16 13:42:05 -0800 |
---|---|---|
committer | Nicholas Corgan <nick.corgan@ettus.com> | 2012-11-16 15:53:28 -0800 |
commit | 3d01dec1aba85bb9fe936cbb1ca653a82961e181 (patch) | |
tree | 7fa5836c9e1c5effa1af18e25994280be6b05dc1 /host/utils/usrp_cal_utils.hpp | |
parent | 7b1f83fd55457903b626d47f173b64714c5bff2b (diff) | |
download | uhd-3d01dec1aba85bb9fe936cbb1ca653a82961e181.tar.gz uhd-3d01dec1aba85bb9fe936cbb1ca653a82961e181.tar.bz2 uhd-3d01dec1aba85bb9fe936cbb1ca653a82961e181.zip |
utils: cal apps immediately fail if dboard has no serial instead of after test runs
Diffstat (limited to 'host/utils/usrp_cal_utils.hpp')
-rw-r--r-- | host/utils/usrp_cal_utils.hpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/host/utils/usrp_cal_utils.hpp b/host/utils/usrp_cal_utils.hpp index 364b68bbe..4a2303d34 100644 --- a/host/utils/usrp_cal_utils.hpp +++ b/host/utils/usrp_cal_utils.hpp @@ -19,11 +19,14 @@ #include <uhd/property_tree.hpp> #include <uhd/usrp/multi_usrp.hpp> #include <uhd/usrp/dboard_eeprom.hpp> +#include <uhd/utils/paths.hpp> #include <boost/filesystem.hpp> +#include <boost/format.hpp> #include <iostream> #include <vector> #include <complex> #include <cmath> +#include <cstdlib> #include <fstream> namespace fs = boost::filesystem; @@ -99,6 +102,30 @@ static inline void set_optimum_defaults(uhd::usrp::multi_usrp::sptr usrp){ } /*********************************************************************** + * Check for empty serial + **********************************************************************/ + +void check_for_empty_serial( + uhd::usrp::multi_usrp::sptr usrp, + std::string XX, + std::string xx, + std::string uhd_args +){ + + //extract eeprom + uhd::property_tree::sptr tree = usrp->get_device()->get_tree(); + const uhd::fs_path db_path = "/mboards/0/dboards/A/" + xx + "_eeprom"; + const uhd::usrp::dboard_eeprom_t db_eeprom = tree->access<uhd::usrp::dboard_eeprom_t>(db_path).get(); + + std::string args_str = ""; + if(uhd_args != "") args_str = str(boost::format(" --args=%s") % uhd_args); + + std::string error_string = str(boost::format("This %s dboard has no serial!\n\nPlease see the Calibration documentation for details on how to fix this.") % XX); + + if (db_eeprom.serial.empty()) throw std::runtime_error(error_string); +} + +/*********************************************************************** * Sinusoid wave table **********************************************************************/ class wave_table{ @@ -160,7 +187,6 @@ static void store_results( uhd::property_tree::sptr tree = usrp->get_device()->get_tree(); const uhd::fs_path db_path = "/mboards/0/dboards/A/" + xx + "_eeprom"; const uhd::usrp::dboard_eeprom_t db_eeprom = tree->access<uhd::usrp::dboard_eeprom_t>(db_path).get(); - if (db_eeprom.serial.empty()) throw std::runtime_error(XX + " dboard has empty serial!"); //make the calibration file path fs::path cal_data_path = fs::path(uhd::get_app_path()) / ".uhd"; |