aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
Diffstat (limited to 'host')
-rw-r--r--host/include/uhd/device.hpp4
-rw-r--r--host/lib/device.cpp23
2 files changed, 17 insertions, 10 deletions
diff --git a/host/include/uhd/device.hpp b/host/include/uhd/device.hpp
index 1e88a4138..5ca48f8e9 100644
--- a/host/include/uhd/device.hpp
+++ b/host/include/uhd/device.hpp
@@ -77,7 +77,9 @@ public:
/*!
* \brief Create a new device from the device address hint.
*
- * The make routine will call find and pick one of the results.
+ * The method will go through the registered device types and pick one of
+ * the discovered devices.
+ *
* By default, the first result will be used to create a new device.
* Use the which parameter as an index into the list of results.
*
diff --git a/host/lib/device.cpp b/host/lib/device.cpp
index 006ea6ec8..3e84d5bea 100644
--- a/host/lib/device.cpp
+++ b/host/lib/device.cpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010-2011,2014 Ettus Research LLC
+// Copyright 2010-2011,2014-2015 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -90,9 +90,9 @@ device_addrs_t device::find(const device_addr_t &hint, device_filter_t filter){
device_addrs_t device_addrs;
- BOOST_FOREACH(const dev_fcn_reg_t &fcn, get_dev_fcn_regs()){
- try{
- if(filter == ANY or fcn.get<2>() == filter){
+ BOOST_FOREACH(const dev_fcn_reg_t &fcn, get_dev_fcn_regs()) {
+ try {
+ if (filter == ANY or fcn.get<2>() == filter) {
device_addrs_t discovered_addrs = fcn.get<0>()(hint);
device_addrs.insert(
device_addrs.begin(),
@@ -101,7 +101,7 @@ device_addrs_t device::find(const device_addr_t &hint, device_filter_t filter){
);
}
}
- catch(const std::exception &e){
+ catch (const std::exception &e) {
UHD_MSG(error) << "Device discovery error: " << e.what() << std::endl;
}
}
@@ -119,12 +119,17 @@ device::sptr device::make(const device_addr_t &hint, device_filter_t filter, siz
std::vector<dev_addr_make_t> dev_addr_makers;
BOOST_FOREACH(const dev_fcn_reg_t &fcn, get_dev_fcn_regs()){
- if(filter == ANY or fcn.get<2>() == filter){
- BOOST_FOREACH(device_addr_t dev_addr, fcn.get<0>()(hint)){
- //append the discovered address and its factory function
- dev_addr_makers.push_back(dev_addr_make_t(dev_addr, fcn.get<1>()));
+ try{
+ if(filter == ANY or fcn.get<2>() == filter){
+ BOOST_FOREACH(device_addr_t dev_addr, fcn.get<0>()(hint)){
+ //append the discovered address and its factory function
+ dev_addr_makers.push_back(dev_addr_make_t(dev_addr, fcn.get<1>()));
+ }
}
}
+ catch(const std::exception &e){
+ UHD_MSG(error) << "Device discovery error: " << e.what() << std::endl;
+ }
}
//check that we found any devices