diff options
author | Josh Blum <josh@joshknows.com> | 2010-11-04 21:25:25 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-11-04 21:25:25 -0700 |
commit | 9dff7952f618360943470711636db64fe2376b40 (patch) | |
tree | ccc41cd091e67160483d70acc81dd192fc78f3b9 | |
parent | fcf9f6ba329df2538286aabe20dd26628fc4ab43 (diff) | |
download | uhd-9dff7952f618360943470711636db64fe2376b40.tar.gz uhd-9dff7952f618360943470711636db64fe2376b40.tar.bz2 uhd-9dff7952f618360943470711636db64fe2376b40.zip |
usrp: print eeprom key/value pairs in the probe app, fixed mac addr size
-rw-r--r-- | host/lib/usrp/mboard_eeprom.cpp | 6 | ||||
-rw-r--r-- | host/utils/uhd_usrp_probe.cpp | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/host/lib/usrp/mboard_eeprom.cpp b/host/lib/usrp/mboard_eeprom.cpp index a19210206..2f5d41c95 100644 --- a/host/lib/usrp/mboard_eeprom.cpp +++ b/host/lib/usrp/mboard_eeprom.cpp @@ -65,7 +65,7 @@ static const boost::uint8_t NXXX_EEPROM_ADDR = 0x50; static const uhd::dict<std::string, boost::uint8_t> USRP_NXXX_OFFSETS = boost::assign::map_list_of ("rev-lsb-msb", 0x00) ("mac-addr", 0x02) - ("ip-addr", 0x02 + sizeof(mac_addr_t)) + ("ip-addr", 0x08) //leave space here for other addresses (perhaps) ("serial", 0x18) ("name", 0x18 + SERIAL_LEN) @@ -74,12 +74,12 @@ static const uhd::dict<std::string, boost::uint8_t> USRP_NXXX_OFFSETS = boost::a static void load_nxxx(mboard_eeprom_t &mb_eeprom, i2c_iface &iface){ //extract the revision number byte_vector_t rev_lsb_msb = iface.read_eeprom(NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["rev-lsb-msb"], 2); - boost::uint16_t rev = (boost::uint16_t(rev_lsb_msb[0]) << 0) | (boost::uint16_t(rev_lsb_msb[1]) << 8); + boost::uint16_t rev = (boost::uint16_t(rev_lsb_msb.at(0)) << 0) | (boost::uint16_t(rev_lsb_msb.at(1)) << 8); mb_eeprom["rev"] = boost::lexical_cast<std::string>(rev); //extract the addresses mb_eeprom["mac-addr"] = mac_addr_t::from_bytes(iface.read_eeprom( - NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["mac-addr"], sizeof(mac_addr_t) + NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["mac-addr"], 6 )).to_string(); boost::asio::ip::address_v4::bytes_type ip_addr_bytes; diff --git a/host/utils/uhd_usrp_probe.cpp b/host/utils/uhd_usrp_probe.cpp index 8947034d7..8cea52fa6 100644 --- a/host/utils/uhd_usrp_probe.cpp +++ b/host/utils/uhd_usrp_probe.cpp @@ -26,6 +26,7 @@ #include <uhd/usrp/dsp_props.hpp> #include <uhd/usrp/subdev_props.hpp> #include <uhd/usrp/dboard_id.hpp> +#include <uhd/usrp/mboard_eeprom.hpp> #include <boost/program_options.hpp> #include <boost/format.hpp> #include <boost/foreach.hpp> @@ -123,10 +124,9 @@ static std::string get_mboard_pp_string(wax::obj mboard){ std::stringstream ss; ss << boost::format("Mboard: %s") % mboard[usrp::MBOARD_PROP_NAME].as<std::string>() << std::endl; //ss << std::endl; - BOOST_FOREACH(const std::string &other_name, mboard[usrp::MBOARD_PROP_OTHERS].as<prop_names_t>()){ - try{ - ss << boost::format("%s: %s") % other_name % mboard[other_name].as<std::string>() << std::endl; - } catch(...){} + usrp::mboard_eeprom_t mb_eeprom = mboard[usrp::MBOARD_PROP_EEPROM_MAP].as<usrp::mboard_eeprom_t>(); + BOOST_FOREACH(const std::string &key, mb_eeprom.keys()){ + if (not mb_eeprom[key].empty()) ss << boost::format("%s: %s") % key % mb_eeprom[key] << std::endl; } BOOST_FOREACH(const std::string &dsp_name, mboard[usrp::MBOARD_PROP_RX_DSP_NAMES].as<prop_names_t>()){ ss << make_border(get_dsp_pp_string("RX", mboard[named_prop_t(usrp::MBOARD_PROP_RX_DSP, dsp_name)])); |