From e4c12fbfb2a928574b33260f04f9622e3c876700 Mon Sep 17 00:00:00 2001 From: Thomas Tsou Date: Tue, 17 Aug 2010 17:38:23 -0700 Subject: usrp1: Return unknown (0xff) on invalid I2C read This allows a dboard eeprom read to continue when reading from an empty slot. --- host/lib/usrp/usrp1/usrp1_iface.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'host/lib/usrp/usrp1/usrp1_iface.cpp') diff --git a/host/lib/usrp/usrp1/usrp1_iface.cpp b/host/lib/usrp/usrp1/usrp1_iface.cpp index b175ba21f..d228161f1 100644 --- a/host/lib/usrp/usrp1/usrp1_iface.cpp +++ b/host/lib/usrp/usrp1/usrp1_iface.cpp @@ -129,11 +129,7 @@ public: { UHD_ASSERT_THROW(num_bytes < max_i2c_data_bytes); - byte_vector_t out_bytes; - byte_vector_t::iterator it = out_bytes.begin(); - unsigned char buff[max_i2c_data_bytes]; - int ret = _ctrl_transport->usrp_control_read(VRQ_I2C_READ, addr & 0xff, 0, @@ -142,9 +138,10 @@ public: if ((ret < 0) || (unsigned)ret < (num_bytes)) { std::cerr << "USRP: failed i2c read: " << ret << std::endl; - return out_bytes; + return byte_vector_t(num_bytes, 0xff); } + byte_vector_t out_bytes; for (size_t i = 0; i < num_bytes; i++) out_bytes.push_back(buff[i]); -- cgit v1.2.3