aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2013-08-13 11:13:56 -0700
committerJosh Blum <josh@joshknows.com>2013-08-13 11:26:42 -0700
commitc0678e2d864090fbdee16140d1355784c0714035 (patch)
treebe301354d037c1687c81ec476eba56bf3531e292
parentb53b3669216d34cb3940f5a6cf7cd79d71b837bb (diff)
downloaduhd-c0678e2d864090fbdee16140d1355784c0714035.tar.gz
uhd-c0678e2d864090fbdee16140d1355784c0714035.tar.bz2
uhd-c0678e2d864090fbdee16140d1355784c0714035.zip
b100: reset fx2 on ctrl xport fail
-rw-r--r--host/lib/usrp/b100/b100_impl.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/host/lib/usrp/b100/b100_impl.cpp b/host/lib/usrp/b100/b100_impl.cpp
index 20933a2fe..19df3d6af 100644
--- a/host/lib/usrp/b100/b100_impl.cpp
+++ b/host/lib/usrp/b100/b100_impl.cpp
@@ -188,12 +188,27 @@ b100_impl::b100_impl(const device_addr_t &device_addr){
ctrl_xport_args["send_frame_size"] = "512";
ctrl_xport_args["num_send_frames"] = "16";
- _ctrl_transport = usb_zero_copy::make(
- handle,
- 4, 8, //interface, endpoint
- 3, 4, //interface, endpoint
- ctrl_xport_args
- );
+ //try to open ctrl transport
+ //this could fail with libusb_submit_transfer under some conditions
+ try{
+ _ctrl_transport = usb_zero_copy::make(
+ handle,
+ 4, 8, //interface, endpoint
+ 3, 4, //interface, endpoint
+ ctrl_xport_args
+ );
+ }
+ //try reset once in the case of failure
+ catch(const uhd::exception &ex){
+ if (initialization_count > 1) throw;
+ UHD_MSG(warning) <<
+ "The control endpoint was left in a bad state.\n"
+ "Attempting endpoint re-enumeration...\n" << ex.what() << std::endl;
+ _fifo_ctrl.reset();
+ _ctrl_transport.reset();
+ _fx2_ctrl->usrp_fx2_reset();
+ goto b100_impl_constructor_begin;
+ }
this->enable_gpif(true);
////////////////////////////////////////////////////////////////////