diff options
| author | Nick Foster <nick@ettus.com> | 2011-09-08 12:27:07 -0700 | 
|---|---|---|
| committer | Nick Foster <nick@ettus.com> | 2011-09-08 12:37:37 -0700 | 
| commit | c1a82d2578a9ab0e4d7e1821a8e05d856e6c757d (patch) | |
| tree | 10f9d7635e085fb2d42b5ad1ac6277add12ed9fb | |
| parent | abab513abcd750d73afbaf35bf81ecd2f0dbafcb (diff) | |
| download | uhd-c1a82d2578a9ab0e4d7e1821a8e05d856e6c757d.tar.gz uhd-c1a82d2578a9ab0e4d7e1821a8e05d856e6c757d.tar.bz2 uhd-c1a82d2578a9ab0e4d7e1821a8e05d856e6c757d.zip | |
USRP2: don't populate GPS sensors if no GPSDO found. Fixes bug #614.
| -rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.cpp | 10 | 
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))); | 
