diff options
author | Josh Blum <josh@joshknows.com> | 2011-05-11 10:38:28 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-05-11 10:38:28 -0700 |
commit | 328599eec46fde6f16e8cdcfe3e8f096d9466b90 (patch) | |
tree | 221214f8c28beaa0f5de542a0ff07637cd7fdb5d /host/lib/usrp/dboard_eeprom.cpp | |
parent | 4e0b42afcbbf1067cef2ad530f3b162e5a35771b (diff) | |
parent | c9bf4798cc19e9ac9bf2fbcfeeae7ed26936b19d (diff) | |
download | uhd-328599eec46fde6f16e8cdcfe3e8f096d9466b90.tar.gz uhd-328599eec46fde6f16e8cdcfe3e8f096d9466b90.tar.bz2 uhd-328599eec46fde6f16e8cdcfe3e8f096d9466b90.zip |
Merge branch 'master' into next
Diffstat (limited to 'host/lib/usrp/dboard_eeprom.cpp')
-rw-r--r-- | host/lib/usrp/dboard_eeprom.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
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 <uhd/usrp/dboard_eeprom.hpp> #include <uhd/exception.hpp> +#include <uhd/utils/log.hpp> #include <boost/foreach.hpp> #include <boost/format.hpp> #include <algorithm> -#include <iostream> +#include <sstream> 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); |