aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-01-27 19:09:58 -0800
committerJosh Blum <josh@joshknows.com>2012-01-27 19:09:58 -0800
commite30cf4ec6d3c5e5c83fdb8e4ee39632fdb46c0df (patch)
treeccd0633e16c3d378f1e49f4c22e088dcda3f2cd2 /host
parent837437c65ce36d418cceb3df5b093f9497b3af5f (diff)
downloaduhd-e30cf4ec6d3c5e5c83fdb8e4ee39632fdb46c0df.tar.gz
uhd-e30cf4ec6d3c5e5c83fdb8e4ee39632fdb46c0df.tar.bz2
uhd-e30cf4ec6d3c5e5c83fdb8e4ee39632fdb46c0df.zip
usrp1/b100: reenumeration loop with timeout only when found
Diffstat (limited to 'host')
-rw-r--r--host/lib/usrp/b100/b100_impl.cpp4
-rw-r--r--host/lib/usrp/usrp1/usrp1_impl.cpp4
2 files changed, 6 insertions, 2 deletions
diff --git a/host/lib/usrp/b100/b100_impl.cpp b/host/lib/usrp/b100/b100_impl.cpp
index 83f54046a..61bc58bce 100644
--- a/host/lib/usrp/b100/b100_impl.cpp
+++ b/host/lib/usrp/b100/b100_impl.cpp
@@ -77,6 +77,7 @@ static device_addrs_t b100_find(const device_addr_t &hint)
// This requirement is a courtesy of libusb1.0 on windows.
//find the usrps and load firmware
+ size_t found = 0;
BOOST_FOREACH(usb_device_handle::sptr handle, usb_device_handle::get_device_list(vid, pid)) {
//extract the firmware path for the b100
std::string b100_fw_image;
@@ -97,6 +98,7 @@ static device_addrs_t b100_find(const device_addr_t &hint)
catch(const uhd::exception &){continue;} //ignore claimed
fx2_ctrl::make(control)->usrp_load_firmware(b100_fw_image);
+ found++;
}
//get descriptors again with serial number, but using the initialized VID/PID now since we have firmware
@@ -106,7 +108,7 @@ static device_addrs_t b100_find(const device_addr_t &hint)
const boost::system_time timeout_time = boost::get_system_time() + REENUMERATION_TIMEOUT_MS;
//search for the device until found or timeout
- while (boost::get_system_time() < timeout_time and b100_addrs.empty())
+ while (boost::get_system_time() < timeout_time and b100_addrs.empty() and found != 0)
{
BOOST_FOREACH(usb_device_handle::sptr handle, usb_device_handle::get_device_list(vid, pid))
{
diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp
index e40dd001d..ef8ae950d 100644
--- a/host/lib/usrp/usrp1/usrp1_impl.cpp
+++ b/host/lib/usrp/usrp1/usrp1_impl.cpp
@@ -81,6 +81,7 @@ static device_addrs_t usrp1_find(const device_addr_t &hint)
// This requirement is a courtesy of libusb1.0 on windows.
//find the usrps and load firmware
+ size_t found = 0;
BOOST_FOREACH(usb_device_handle::sptr handle, usb_device_handle::get_device_list(vid, pid)) {
//extract the firmware path for the USRP1
std::string usrp1_fw_image;
@@ -101,6 +102,7 @@ static device_addrs_t usrp1_find(const device_addr_t &hint)
catch(const uhd::exception &){continue;} //ignore claimed
fx2_ctrl::make(control)->usrp_load_firmware(usrp1_fw_image);
+ found++;
}
//get descriptors again with serial number, but using the initialized VID/PID now since we have firmware
@@ -110,7 +112,7 @@ static device_addrs_t usrp1_find(const device_addr_t &hint)
const boost::system_time timeout_time = boost::get_system_time() + REENUMERATION_TIMEOUT_MS;
//search for the device until found or timeout
- while (boost::get_system_time() < timeout_time and usrp1_addrs.empty())
+ while (boost::get_system_time() < timeout_time and usrp1_addrs.empty() and found != 0)
{
BOOST_FOREACH(usb_device_handle::sptr handle, usb_device_handle::get_device_list(vid, pid))
{