diff options
author | Michael West <michael.west@ettus.com> | 2013-11-19 14:42:08 -0800 |
---|---|---|
committer | Michael West <michael.west@ettus.com> | 2013-11-19 14:42:08 -0800 |
commit | 0fe2a9aec4202a6b7aa2ee88aa2551690f4c21ff (patch) | |
tree | 327dfd5e752974808b2e8583261051c7d2067806 /host/utils | |
parent | 8ea2653ba57415380bfed9ff67080502a842e1b8 (diff) | |
parent | 9a45063077f27140367ccb749c8d794f60729526 (diff) | |
download | uhd-0fe2a9aec4202a6b7aa2ee88aa2551690f4c21ff.tar.gz uhd-0fe2a9aec4202a6b7aa2ee88aa2551690f4c21ff.tar.bz2 uhd-0fe2a9aec4202a6b7aa2ee88aa2551690f4c21ff.zip |
BUG #182: Merged with Corgan's fix for the Win32 error.
Diffstat (limited to 'host/utils')
-rw-r--r-- | host/utils/b2xx_fx3_utils.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/host/utils/b2xx_fx3_utils.cpp b/host/utils/b2xx_fx3_utils.cpp index 4d6d8c5a5..3bf4e1117 100644 --- a/host/utils/b2xx_fx3_utils.cpp +++ b/host/utils/b2xx_fx3_utils.cpp @@ -35,6 +35,7 @@ #include <boost/functional/hash.hpp> #include <b200_iface.hpp> +#include <uhd/config.hpp> #include <uhd/transport/usb_control.hpp> #include <uhd/transport/usb_device_handle.hpp> #include <uhd/exception.hpp> @@ -195,7 +196,6 @@ boost::int32_t main(boost::int32_t argc, char *argv[]) { } uhd::transport::usb_device_handle::sptr handle; - uhd::transport::usb_control::sptr usb_ctrl; b200_iface::sptr b200; vid = B200_VENDOR_ID; // Default @@ -217,7 +217,7 @@ boost::int32_t main(boost::int32_t argc, char *argv[]) { return -1; std::cout << " Control of B2xx granted..." << std::endl << std::endl; - // if we are supposed to load a new firmware image and one already exists, reset and load the new one + // if we are supposed to load a new firmware image and one already exists, reset the FX3 so we can load the new one if (vm.count("load-fw") && handle->firmware_loaded()) { std::cout << "Overwriting existing firmware" << std::endl; @@ -227,7 +227,6 @@ boost::int32_t main(boost::int32_t argc, char *argv[]) { // re-open device b200.reset(); - usb_ctrl.reset(); handle.reset(); usleep(2000000); // wait 2 seconds for FX3 to reset handle = open_device(vid, pid); @@ -251,14 +250,21 @@ boost::int32_t main(boost::int32_t argc, char *argv[]) { // re-open device b200.reset(); - usb_ctrl.reset(); handle.reset(); - handle = open_device(vid, pid); - if (!handle) - return -1; - b200 = make_b200_iface(handle); - if (!b200) + try { + handle = open_device(vid, pid); + if (!handle) + return -1; + b200 = make_b200_iface(handle); + if (!b200) + return -1; + } catch(const std::exception &e) { + std::cerr << "Failed to communicate with the device!" << std::endl; + #ifdef UHD_PLATFORM_WIN32 + std::cerr << "The necessary drivers are not installed. Read the UHD Transport Application Notes for details." << std::endl; + #endif /* UHD_PLATFORM_WIN32 */ return -1; + } } // Added for testing purposes - not exposed |