From 2ff0ef08dbb4246222cb3d3c1ddacc182b64edf4 Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Thu, 8 Sep 2011 12:27:07 -0700 Subject: USRP2: don't populate GPS sensors if no GPSDO found. Fixes bug #614. --- host/lib/usrp/usrp2/usrp2_impl.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'host') 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(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(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(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(root / "time_source/value").set("external"); _tree->access(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))); -- cgit v1.2.3