aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/b200
diff options
context:
space:
mode:
authorBalint Seeber <balint@ettus.com>2014-03-19 16:06:28 -0700
committerBalint Seeber <balint@ettus.com>2014-03-19 16:06:28 -0700
commit416c1ff1841a9a744f9c41816f4156171ad4528f (patch)
tree64d624aa0b91c806b9c845a42979cb678a34771c /host/lib/usrp/b200
parentea66e24a96abcfcb49b907eeebf2f4944118f50e (diff)
downloaduhd-416c1ff1841a9a744f9c41816f4156171ad4528f.tar.gz
uhd-416c1ff1841a9a744f9c41816f4156171ad4528f.tar.bz2
uhd-416c1ff1841a9a744f9c41816f4156171ad4528f.zip
b200: explicitly detect libusb timeout
Diffstat (limited to 'host/lib/usrp/b200')
-rw-r--r--host/lib/usrp/b200/b200_iface.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/host/lib/usrp/b200/b200_iface.cpp b/host/lib/usrp/b200/b200_iface.cpp
index 63f01cea7..2ed4eb9ae 100644
--- a/host/lib/usrp/b200/b200_iface.cpp
+++ b/host/lib/usrp/b200/b200_iface.cpp
@@ -19,6 +19,7 @@
#include <uhd/config.hpp>
#include <uhd/utils/msg.hpp>
+#include <uhd/utils/log.hpp>
#include <uhd/exception.hpp>
#include <boost/functional/hash.hpp>
#include <boost/thread/thread.hpp>
@@ -301,7 +302,7 @@ public:
void ad9361_transact(const unsigned char in_buff[64], unsigned char out_buff[64]) {
const int bytes_to_write = 64;
const int bytes_to_read = 64;
- const size_t read_retries = 3;
+ const size_t read_retries = 5;
int ret = fx3_control_write(B200_VREQ_AD9361_CTRL_WRITE, 0x00, 0x00, (unsigned char *)in_buff, bytes_to_write);
if (ret < 0)
@@ -311,15 +312,25 @@ public:
for (size_t i = 0; i < read_retries; i++)
{
- ret = fx3_control_read(B200_VREQ_AD9361_CTRL_READ, 0x00, 0x00, out_buff, bytes_to_read, 5000);
+ ret = fx3_control_read(B200_VREQ_AD9361_CTRL_READ, 0x00, 0x00, out_buff, bytes_to_read, 3000);
if (ret < 0)
{
- UHD_MSG(warning) << (boost::format("Failed to read AD9361 (%d: %s). Retrying (%d of %d)...")
- % ret
- % libusb_error_name(ret)
- % (i+1)
- % read_retries)
- << std::endl;
+ if (ret == LIBUSB_ERROR_TIMEOUT)
+ {
+ UHD_LOG << (boost::format("Failed to read AD9361 (%d: %s). Retrying (%d of %d)...")
+ % ret
+ % libusb_error_name(ret)
+ % (i+1)
+ % read_retries
+ ) << std::endl;
+ }
+ else
+ {
+ throw uhd::io_error((boost::format("Failed to read AD9361 (%d: %s)")
+ % ret
+ % libusb_error_name(ret)
+ ).str());
+ }
}
if (ret == bytes_to_read)