summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Foster <nick@ettus.com>2011-09-08 12:27:07 -0700
committerJosh Blum <josh@joshknows.com>2011-09-08 15:07:00 -0700
commit2ff0ef08dbb4246222cb3d3c1ddacc182b64edf4 (patch)
tree57e9aa9908f7235ff0b084c9cb6b559b67e71448
parent00cedaea7dfd6c400b265f381d0da070c0950bf0 (diff)
downloaduhd-2ff0ef08dbb4246222cb3d3c1ddacc182b64edf4.tar.gz
uhd-2ff0ef08dbb4246222cb3d3c1ddacc182b64edf4.tar.bz2
uhd-2ff0ef08dbb4246222cb3d3c1ddacc182b64edf4.zip
USRP2: don't populate GPS sensors if no GPSDO found. Fixes bug #614.
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 168beccbf..03a9d09fe 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -442,9 +442,11 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){
_mbc[mb].iface->get_gps_write_fn(),
_mbc[mb].iface->get_gps_read_fn()
);
- BOOST_FOREACH(const std::string &name, _mbc[mb].gps->get_sensors()){
- _tree->create<sensor_value_t>(mb_path / "sensors" / name)
- .publish(boost::bind(&gps_ctrl::get_sensor, _mbc[mb].gps, name));
+ if(_mbc[mb].gps->gps_detected()) {
+ BOOST_FOREACH(const std::string &name, _mbc[mb].gps->get_sensors()){
+ _tree->create<sensor_value_t>(mb_path / "sensors" / name)
+ .publish(boost::bind(&gps_ctrl::get_sensor, _mbc[mb].gps, name));
+ }
}
}
@@ -621,7 +623,7 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){
_tree->access<std::string>(root / "time_source/value").set("none");
//GPS installed: use external ref, time, and init time spec
- if (_mbc[mb].gps.get() != NULL){
+ if (_mbc[mb].gps.get() and _mbc[mb].gps->gps_detected()){
_tree->access<std::string>(root / "time_source/value").set("external");
_tree->access<std::string>(root / "clock_source/value").set("external");
_mbc[mb].time64->set_time_next_pps(time_spec_t(time_t(_mbc[mb].gps->get_sensor("gps_time").to_int()+1)));