diff options
author | Josh Blum <josh@joshknows.com> | 2013-08-13 11:13:56 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2013-08-13 11:26:42 -0700 |
commit | c0678e2d864090fbdee16140d1355784c0714035 (patch) | |
tree | be301354d037c1687c81ec476eba56bf3531e292 /host/lib/usrp/b100 | |
parent | b53b3669216d34cb3940f5a6cf7cd79d71b837bb (diff) | |
download | uhd-c0678e2d864090fbdee16140d1355784c0714035.tar.gz uhd-c0678e2d864090fbdee16140d1355784c0714035.tar.bz2 uhd-c0678e2d864090fbdee16140d1355784c0714035.zip |
b100: reset fx2 on ctrl xport fail
Diffstat (limited to 'host/lib/usrp/b100')
-rw-r--r-- | host/lib/usrp/b100/b100_impl.cpp | 27 |
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); //////////////////////////////////////////////////////////////////// |