diff options
-rw-r--r-- | host/include/uhd/usrp/dboard_manager.hpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/misc_utils.cpp | 20 | ||||
-rw-r--r-- | host/lib/usrp/subdev_spec.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/mboard_impl.cpp | 10 |
4 files changed, 23 insertions, 15 deletions
diff --git a/host/include/uhd/usrp/dboard_manager.hpp b/host/include/uhd/usrp/dboard_manager.hpp index e5831d4cf..c68f069f0 100644 --- a/host/include/uhd/usrp/dboard_manager.hpp +++ b/host/include/uhd/usrp/dboard_manager.hpp @@ -51,7 +51,7 @@ public: const dboard_id_t &dboard_id, dboard_ctor_t dboard_ctor, const std::string &name, - const prop_names_t &subdev_names = prop_names_t(1, "") + const prop_names_t &subdev_names = prop_names_t(1, "0") ); /*! diff --git a/host/lib/usrp/misc_utils.cpp b/host/lib/usrp/misc_utils.cpp index da22d79f1..930314fc2 100644 --- a/host/lib/usrp/misc_utils.cpp +++ b/host/lib/usrp/misc_utils.cpp @@ -127,14 +127,17 @@ static void verify_xx_subdev_spec( wax::obj mboard, std::string xx_type ){ + prop_names_t dboard_names = mboard[dboard_names_prop].as<prop_names_t>(); + UHD_ASSERT_THROW(dboard_names.size() > 0); //well i hope there is a dboard + //the subdevice specification is empty: handle automatic if (subdev_spec.empty()){ - BOOST_FOREACH(const std::string &db_name, mboard[dboard_names_prop].as<prop_names_t>()){ + BOOST_FOREACH(const std::string &db_name, dboard_names){ wax::obj dboard = mboard[named_prop_t(dboard_prop, db_name)]; //if the dboard slot is populated, take the first subdevice if (dboard[DBOARD_PROP_DBOARD_ID].as<dboard_id_t>() != dboard_id_t::none()){ - std::string sd_name = dboard[DBOARD_PROP_SUBDEV_NAMES].as<prop_names_t>().at(0); + std::string sd_name = dboard[DBOARD_PROP_SUBDEV_NAMES].as<prop_names_t>().front(); subdev_spec.push_back(subdev_spec_pair_t(db_name, sd_name)); break; } @@ -142,16 +145,23 @@ static void verify_xx_subdev_spec( //didnt find any populated dboards: add the first subdevice if (subdev_spec.empty()){ - std::string db_name = mboard[dboard_names_prop].as<prop_names_t>().at(0); + std::string db_name = dboard_names.front(); wax::obj dboard = mboard[named_prop_t(dboard_prop, db_name)]; - std::string sd_name = dboard[DBOARD_PROP_SUBDEV_NAMES].as<prop_names_t>().at(0); + std::string sd_name = dboard[DBOARD_PROP_SUBDEV_NAMES].as<prop_names_t>().front(); subdev_spec.push_back(subdev_spec_pair_t(db_name, sd_name)); } } //sanity check that the dboard/subdevice names exist for this mboard BOOST_FOREACH(const subdev_spec_pair_t &pair, subdev_spec){ - uhd::assert_has(mboard[dboard_names_prop].as<prop_names_t>(), pair.db_name, xx_type + " dboard name"); + //empty db name means select dboard automatically + if (pair.db_name.empty()){ + if (dboard_names.size() != 1) throw std::runtime_error( + "A daughterboard name must be provided for multi-slot boards: " + subdev_spec.to_string() + ); + pair.db_name == dboard_names.front(); + } + uhd::assert_has(dboard_names, pair.db_name, xx_type + " dboard name"); wax::obj dboard = mboard[named_prop_t(dboard_prop, pair.db_name)]; uhd::assert_has(dboard[DBOARD_PROP_SUBDEV_NAMES].as<prop_names_t>(), pair.sd_name, xx_type + " subdev name"); } diff --git a/host/lib/usrp/subdev_spec.cpp b/host/lib/usrp/subdev_spec.cpp index 765eecb3d..7a3e72867 100644 --- a/host/lib/usrp/subdev_spec.cpp +++ b/host/lib/usrp/subdev_spec.cpp @@ -53,13 +53,9 @@ std::string subdev_spec_t::to_pp_string(void) const{ size_t count = 0; ss << "Subdevice Specification:" << std::endl; BOOST_FOREACH(const subdev_spec_pair_t &pair, *this){ - std::string db_name = pair.db_name; - if (db_name == "") db_name = "0"; - std::string sd_name = pair.sd_name; - if (sd_name == "") sd_name = "0"; ss << boost::format( " Channel %d: Daughterboard %s, Subdevice %s" - ) % (count++) % db_name % sd_name << std::endl; + ) % (count++) % pair.db_name % pair.sd_name << std::endl; } return ss.str(); } diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index fe3ec6785..533b60bae 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -186,6 +186,8 @@ void usrp2_mboard_impl::issue_ddc_stream_cmd(const stream_cmd_t &stream_cmd){ /*********************************************************************** * MBoard Get Properties **********************************************************************/ +static const std::string dboard_name = "0"; + void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){ wax::obj key; std::string name; boost::tie(key, name) = extract_named_prop(key_); @@ -222,21 +224,21 @@ void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){ return; case MBOARD_PROP_RX_DBOARD: - UHD_ASSERT_THROW(name == ""); + UHD_ASSERT_THROW(name == dboard_name); val = _rx_dboard_proxy->get_link(); return; case MBOARD_PROP_RX_DBOARD_NAMES: - val = prop_names_t(1, ""); + val = prop_names_t(1, dboard_name); return; case MBOARD_PROP_TX_DBOARD: - UHD_ASSERT_THROW(name == ""); + UHD_ASSERT_THROW(name == dboard_name); val = _tx_dboard_proxy->get_link(); return; case MBOARD_PROP_TX_DBOARD_NAMES: - val = prop_names_t(1, ""); + val = prop_names_t(1, dboard_name); return; case MBOARD_PROP_RX_DSP: |