From 4c7a66cfa0b84955fcd34b0e356c1141b21a7e17 Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Tue, 31 Aug 2010 17:52:10 -0700 Subject: Added serial number read. Renamed the usrp1-specific utilities. --- host/lib/usrp/usrp1/mboard_impl.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'host/lib') diff --git a/host/lib/usrp/usrp1/mboard_impl.cpp b/host/lib/usrp/usrp1/mboard_impl.cpp index 8555577f5..a90532cb8 100644 --- a/host/lib/usrp/usrp1/mboard_impl.cpp +++ b/host/lib/usrp/usrp1/mboard_impl.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include using namespace uhd; @@ -251,6 +252,20 @@ void usrp1_impl::mboard_get(const wax::obj &key_, wax::obj &val) { named_prop_t key = named_prop_t::extract(key_); + if(key_.type() == typeid(std::string)) { + if(key.as() == "serial") { + uhd::byte_vector_t buf; + buf.insert(buf.begin(), 248); + boost::this_thread::sleep(boost::posix_time::milliseconds(100)); + _iface->write_i2c(I2C_DEV_EEPROM, buf); + boost::this_thread::sleep(boost::posix_time::milliseconds(100)); + buf = _iface->read_i2c(I2C_DEV_EEPROM, 8); + val = std::string(buf.begin(), buf.end()); + } + + return; + } + //handle the get request conditioned on the key switch(key.as()){ case MBOARD_PROP_NAME: -- cgit v1.2.3