Revision 89989fdb

b/host/lib/usrp/usrp2/io_impl.cpp
306 306
    _io_impl->send_handler.set_samp_rate(rate);
307 307
}
308 308

  
309
void usrp2_impl::update_rx_subdev_spec(const std::string &which_mb, const subdev_spec_t &spec){
309
static subdev_spec_t replace_zero_in_spec(const std::string &type, const subdev_spec_t &spec){
310
    subdev_spec_t new_spec;
311
    BOOST_FOREACH(const subdev_spec_pair_t &pair, spec){
312
        if (pair.db_name == "0"){
313
            UHD_MSG(warning)
314
                << boost::format("In the %s subdevice specification: %s") % type % spec.to_string() << std::endl
315
                << "Accepting dboard slot name \"0\" for backward compatibility." << std::endl
316
                << "The official name of the dboard slot on USRP2/N-Series is \"A\"." << std::endl
317
            ;
318
            new_spec.push_back(subdev_spec_pair_t("A", pair.sd_name));
319
        }
320
        else new_spec.push_back(pair);
321
    }
322
    return new_spec;
323
}
324

  
325
subdev_spec_t usrp2_impl::update_rx_subdev_spec(const std::string &which_mb, const subdev_spec_t &spec_){
326
    const subdev_spec_t spec = replace_zero_in_spec("RX", spec_);
310 327
    boost::mutex::scoped_lock recv_lock = _io_impl->recv_handler.get_scoped_lock();
311 328
    property_tree::path_type root = "/mboards/" + which_mb + "/dboards";
312 329

  
......
336 353
            ));
337 354
        }
338 355
    }
356
    return spec;
339 357
}
340 358

  
341
void usrp2_impl::update_tx_subdev_spec(const std::string &which_mb, const subdev_spec_t &spec){
359
subdev_spec_t usrp2_impl::update_tx_subdev_spec(const std::string &which_mb, const subdev_spec_t &spec_){
360
    const subdev_spec_t spec = replace_zero_in_spec("TX", spec_);
342 361
    boost::mutex::scoped_lock send_lock = _io_impl->send_handler.get_scoped_lock();
343 362
    property_tree::path_type root = "/mboards/" + which_mb + "/dboards";
344 363

  
......
364 383
            ));
365 384
        }
366 385
    }
386
    return spec;
367 387
}
368 388

  
369 389
/***********************************************************************
b/host/lib/usrp/usrp2/usrp2_impl.cpp
431 431
        );
432 432
        //TODO lots of properties to expose here for frontends
433 433
        _tree->create<subdev_spec_t>(mb_path / "rx_subdev_spec")
434
            .subscribe(boost::bind(&usrp2_impl::update_rx_subdev_spec, this, mb, _1));
434
            .coerce(boost::bind(&usrp2_impl::update_rx_subdev_spec, this, mb, _1));
435 435
        _tree->create<subdev_spec_t>(mb_path / "tx_subdev_spec")
436
            .subscribe(boost::bind(&usrp2_impl::update_tx_subdev_spec, this, mb, _1));
436
            .coerce(boost::bind(&usrp2_impl::update_tx_subdev_spec, this, mb, _1));
437 437

  
438 438
        ////////////////////////////////////////////////////////////////
439 439
        // create rx dsp control objects
b/host/lib/usrp/usrp2/usrp2_impl.hpp
124 124
    void update_tick_rate(const double rate);
125 125
    void update_rx_samp_rate(const double rate);
126 126
    void update_tx_samp_rate(const double rate);
127
    void update_rx_subdev_spec(const std::string &, const uhd::usrp::subdev_spec_t &);
128
    void update_tx_subdev_spec(const std::string &, const uhd::usrp::subdev_spec_t &);
127
    //update spec methods are coercers until we only accept db_name == A
128
    uhd::usrp::subdev_spec_t update_rx_subdev_spec(const std::string &, const uhd::usrp::subdev_spec_t &);
129
    uhd::usrp::subdev_spec_t update_tx_subdev_spec(const std::string &, const uhd::usrp::subdev_spec_t &);
129 130
    double set_tx_dsp_freq(const std::string &, const double);
130 131
    uhd::meta_range_t get_tx_dsp_freq_range(const std::string &);
131 132
    void update_clock_source(const std::string &, const std::string &);

Also available in: Unified diff