From c8dca30d72eb733d154ab9dd193631c42b8e4788 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 4 May 2011 15:27:11 -0700 Subject: uhd: replaced many conditional prints with UHD_LOG usage --- host/lib/usrp/dboard_eeprom.cpp | 20 +++++++++----------- host/lib/usrp/dboard_manager.cpp | 4 ++-- 2 files changed, 11 insertions(+), 13 deletions(-) (limited to 'host/lib/usrp') diff --git a/host/lib/usrp/dboard_eeprom.cpp b/host/lib/usrp/dboard_eeprom.cpp index c1e44fb74..0dc3471f7 100644 --- a/host/lib/usrp/dboard_eeprom.cpp +++ b/host/lib/usrp/dboard_eeprom.cpp @@ -17,16 +17,15 @@ #include #include +#include #include #include #include -#include +#include using namespace uhd; using namespace uhd::usrp; -static const bool _dboard_eeprom_debug = false; - /*********************************************************************** * Utility functions **********************************************************************/ @@ -91,8 +90,7 @@ static boost::uint8_t checksum(const byte_vector_t &bytes){ for (size_t i = 0; i < std::min(bytes.size(), size_t(DB_EEPROM_CHKSUM)); i++){ sum -= int(bytes.at(i)); } - if (_dboard_eeprom_debug) - std::cout << boost::format("sum: 0x%02x") % sum << std::endl; + UHD_LOGV(often) << boost::format("sum: 0x%02x") % sum << std::endl; return boost::uint8_t(sum); } @@ -104,13 +102,13 @@ dboard_eeprom_t::dboard_eeprom_t(void){ void dboard_eeprom_t::load(i2c_iface &iface, boost::uint8_t addr){ byte_vector_t bytes = iface.read_eeprom(addr, 0, DB_EEPROM_CLEN); - if (_dboard_eeprom_debug){ - for (size_t i = 0; i < bytes.size(); i++){ - std::cout << boost::format( - "eeprom byte[0x%02x] = 0x%02x") % i % int(bytes.at(i) - ) << std::endl; - } + std::ostringstream ss; + for (size_t i = 0; i < bytes.size(); i++){ + ss << boost::format( + "eeprom byte[0x%02x] = 0x%02x") % i % int(bytes.at(i) + ) << std::endl; } + UHD_LOGV(often) << ss.str() << std::endl; try{ UHD_ASSERT_THROW(bytes.size() >= DB_EEPROM_CLEN); diff --git a/host/lib/usrp/dboard_manager.cpp b/host/lib/usrp/dboard_manager.cpp index 2e8b39311..cd934dd0d 100644 --- a/host/lib/usrp/dboard_manager.cpp +++ b/host/lib/usrp/dboard_manager.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -27,7 +28,6 @@ #include #include #include -#include using namespace uhd; using namespace uhd::usrp; @@ -91,7 +91,7 @@ static void register_dboard_key( const std::string &name, const prop_names_t &subdev_names ){ - //std::cout << "registering: " << name << std::endl; + UHD_LOGV(always) << "registering: " << name << std::endl; if (get_id_to_args_map().has_key(dboard_key)){ if (dboard_key.is_xcvr()) throw uhd::key_error(str(boost::format( -- cgit v1.2.3