diff options
author | Thomas Tsou <ttsou@vt.edu> | 2010-08-17 17:38:23 -0700 |
---|---|---|
committer | Thomas Tsou <ttsou@vt.edu> | 2010-08-17 17:43:25 -0700 |
commit | e4c12fbfb2a928574b33260f04f9622e3c876700 (patch) | |
tree | 0c6e77296bcd6dd84b14836bb2184e530b75df91 /host/lib/usrp/usrp1/usrp1_iface.cpp | |
parent | fa7cf1f297dc6a6d04b550f9a6211caeb0a87074 (diff) | |
download | uhd-e4c12fbfb2a928574b33260f04f9622e3c876700.tar.gz uhd-e4c12fbfb2a928574b33260f04f9622e3c876700.tar.bz2 uhd-e4c12fbfb2a928574b33260f04f9622e3c876700.zip |
usrp1: Return unknown (0xff) on invalid I2C read
This allows a dboard eeprom read to continue when reading
from an empty slot.
Diffstat (limited to 'host/lib/usrp/usrp1/usrp1_iface.cpp')
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_iface.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
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]); |