diff options
-rw-r--r-- | host/lib/usrp/usrp1/mboard_impl.cpp | 15 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_impl.cpp | 4 | ||||
-rw-r--r-- | host/utils/CMakeLists.txt | 12 | ||||
-rw-r--r-- | host/utils/usrp1_init_eeprom.cpp (renamed from host/utils/usrp_init_eeprom.cpp) | 0 | ||||
-rw-r--r-- | host/utils/usrp1_serial_burner.cpp (renamed from host/utils/usrp_serial_burner.cpp) | 1 |
5 files changed, 24 insertions, 8 deletions
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 <boost/assign/list_of.hpp> #include <boost/foreach.hpp> #include <boost/bind.hpp> +#include <boost/thread/thread.hpp> #include <iostream> 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<std::string>() == "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<mboard_prop_t>()){ case MBOARD_PROP_NAME: diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index a18b697fb..a6806dbc3 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.cpp @@ -69,7 +69,7 @@ static device_addrs_t usrp1_find(const device_addr_t &hint) ); return usrp1_addrs; } - std::cout << "USRP1 firmware image: " << usrp1_fw_image << std::endl; + //std::cout << "USRP1 firmware image: " << usrp1_fw_image << std::endl; boost::uint16_t vid = hint.has_key("uninit") ? FX2_VENDOR_ID : USRP1_VENDOR_ID; boost::uint16_t pid = hint.has_key("uninit") ? FX2_PRODUCT_ID : USRP1_PRODUCT_ID; @@ -111,7 +111,7 @@ static device::sptr usrp1_make(const device_addr_t &device_addr) std::string usrp1_fpga_image = find_image_path( device_addr.has_key("fpga")? device_addr["fpga"] : "usrp1_fpga.rbf" ); - std::cout << "USRP1 FPGA image: " << usrp1_fpga_image << std::endl; + //std::cout << "USRP1 FPGA image: " << usrp1_fpga_image << std::endl; //try to match the given device address with something on the USB bus std::vector<usb_device_handle::sptr> device_list = diff --git a/host/utils/CMakeLists.txt b/host/utils/CMakeLists.txt index 48f91aaa7..a95864ca7 100644 --- a/host/utils/CMakeLists.txt +++ b/host/utils/CMakeLists.txt @@ -39,17 +39,17 @@ TARGET_LINK_LIBRARIES(usrp2_addr_burner uhd) ADD_EXECUTABLE(usrp_burn_db_eeprom usrp_burn_db_eeprom.cpp) TARGET_LINK_LIBRARIES(usrp_burn_db_eeprom uhd) -ADD_EXECUTABLE(usrp_init_eeprom usrp_init_eeprom.cpp) -TARGET_LINK_LIBRARIES(usrp_init_eeprom uhd) +ADD_EXECUTABLE(usrp1_init_eeprom usrp1_init_eeprom.cpp) +TARGET_LINK_LIBRARIES(usrp1_init_eeprom uhd) -ADD_EXECUTABLE(usrp_serial_burner usrp_serial_burner.cpp) -TARGET_LINK_LIBRARIES(usrp_serial_burner uhd) +ADD_EXECUTABLE(usrp1_serial_burner usrp1_serial_burner.cpp) +TARGET_LINK_LIBRARIES(usrp1_serial_burner uhd) INSTALL(TARGETS usrp2_addr_burner usrp_burn_db_eeprom - usrp_init_eeprom - usrp_serial_burner + usrp1_init_eeprom + usrp1_serial_burner RUNTIME DESTINATION ${PKG_DATA_DIR}/utils ) diff --git a/host/utils/usrp_init_eeprom.cpp b/host/utils/usrp1_init_eeprom.cpp index b05e400b1..b05e400b1 100644 --- a/host/utils/usrp_init_eeprom.cpp +++ b/host/utils/usrp1_init_eeprom.cpp diff --git a/host/utils/usrp_serial_burner.cpp b/host/utils/usrp1_serial_burner.cpp index cdb6eff65..bf7d3d3bb 100644 --- a/host/utils/usrp_serial_burner.cpp +++ b/host/utils/usrp1_serial_burner.cpp @@ -66,6 +66,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ wax::obj mb = (*dev)[uhd::usrp::DEVICE_PROP_MBOARD]; std::cout << "Writing serial number..." << std::endl; mb[std::string("serial")] = vm["new"].as<std::string>(); + std::cout << "Reading back serial number: " << mb[std::string("serial")].as<std::string>() << std::endl; } |