summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-03-26 12:00:48 -0700
committerJosh Blum <josh@joshknows.com>2010-03-26 12:00:48 -0700
commitfaaee09fbea080cf543ccd2ae96e37a390ec7fad (patch)
tree894ed27baaf47e1db863e448d7e567f45b833459 /host/lib/usrp/usrp2
parentaf586ae149fe6f7aa12d4d6766e4216f3f00d1c0 (diff)
parent08f6b21ce7cc4aa4069b4461785fc7173bed2998 (diff)
downloaduhd-faaee09fbea080cf543ccd2ae96e37a390ec7fad.tar.gz
uhd-faaee09fbea080cf543ccd2ae96e37a390ec7fad.tar.bz2
uhd-faaee09fbea080cf543ccd2ae96e37a390ec7fad.zip
Merge branch 'addrs' of git@ettus.sourcerepo.com:ettus/uhd into timing
Conflicts: host/lib/usrp/usrp2/usrp2_impl.hpp
Diffstat (limited to 'host/lib/usrp/usrp2')
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp20
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.hpp2
2 files changed, 20 insertions, 2 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 85d73e83a..f04ae8d2c 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -15,9 +15,11 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
+#include <uhd/transport/if_addrs.hpp>
+#include <uhd/utils.hpp>
#include <boost/format.hpp>
+#include <boost/foreach.hpp>
#include <boost/bind.hpp>
-#include <uhd/utils.hpp>
#include <iostream>
#include "usrp2_impl.hpp"
@@ -36,7 +38,21 @@ STATIC_BLOCK(register_usrp2_device){
uhd::device_addrs_t usrp2::discover(const device_addr_t &hint){
device_addrs_t usrp2_addrs;
- if (not hint.has_key("addr")) return usrp2_addrs;
+ //if no address was specified, send a broadcast on each interface
+ if (not hint.has_key("addr")){
+ BOOST_FOREACH(const if_addrs_t &if_addrs, get_if_addrs()){
+ //create a new hint with this broadcast address
+ device_addr_t new_hint = hint;
+ new_hint["addr"] = if_addrs.bcast;
+
+ //call discover with the new hint and append results
+ device_addrs_t new_usrp2_addrs = usrp2::discover(new_hint);
+ usrp2_addrs.insert(usrp2_addrs.begin(),
+ new_usrp2_addrs.begin(), new_usrp2_addrs.end()
+ );
+ }
+ return usrp2_addrs;
+ }
//create a udp transport to communicate
//TODO if an addr is not provided, search all interfaces?
diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp
index 2794cc666..3a2963c5a 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.hpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.hpp
@@ -21,6 +21,8 @@
#include <uhd/usrp/usrp2.hpp>
#include <uhd/dict.hpp>
#include <uhd/types.hpp>
+#include <uhd/time_spec.hpp>
+#include <boost/asio.hpp>
#include <boost/thread.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>