diff options
| author | Josh Blum <josh@joshknows.com> | 2010-09-28 10:21:11 -0700 | 
|---|---|---|
| committer | Josh Blum <josh@joshknows.com> | 2010-09-28 10:21:11 -0700 | 
| commit | 852f5c5f7b31bfb2e7561a86ca9f5380bd53d130 (patch) | |
| tree | 138657eadb3d45d038c4273d8a8d11128b9b2cdf | |
| parent | cd83b1664dc68666d182f771452819d2b0c60ea6 (diff) | |
| download | uhd-852f5c5f7b31bfb2e7561a86ca9f5380bd53d130.tar.gz uhd-852f5c5f7b31bfb2e7561a86ca9f5380bd53d130.tar.bz2 uhd-852f5c5f7b31bfb2e7561a86ca9f5380bd53d130.zip | |
dboard: better warnings for invalid IDs and invalid ID combinations
| -rw-r--r-- | host/lib/usrp/dboard_manager.cpp | 25 | 
1 files changed, 19 insertions, 6 deletions
| diff --git a/host/lib/usrp/dboard_manager.cpp b/host/lib/usrp/dboard_manager.cpp index ab80875f5..181f843a0 100644 --- a/host/lib/usrp/dboard_manager.cpp +++ b/host/lib/usrp/dboard_manager.cpp @@ -18,6 +18,7 @@  #include "dboard_ctor_args.hpp"  #include <uhd/usrp/dboard_manager.hpp>  #include <uhd/usrp/subdev_props.hpp> +#include <uhd/utils/warning.hpp>  #include <uhd/utils/static.hpp>  #include <uhd/utils/assert.hpp>  #include <uhd/types/dict.hpp> @@ -176,10 +177,6 @@ static args_t get_dboard_args(  ){      //special case, the none id was provided, use the following ids      if (dboard_id == dboard_id_t::none() or force_to_unknown){ -        std::cerr << boost::format( -            "Warning: unknown dboard-id or dboard-id combination: %s\n" -            "    -> defaulting to the unknown board type" -        ) % dboard_id.to_pp_string() << std::endl;          UHD_ASSERT_THROW(get_id_to_args_map().has_key(0xfff1));          UHD_ASSERT_THROW(get_id_to_args_map().has_key(0xfff0));          switch(unit){ @@ -191,6 +188,9 @@ static args_t get_dboard_args(      //verify that there is a registered constructor for this id      if (not get_id_to_args_map().has_key(dboard_id)){ +        uhd::print_warning(str(boost::format( +            "Unknown dboard ID: %s.\n" +        ) % dboard_id.to_pp_string()));          return get_dboard_args(unit, dboard_id, true);      } @@ -214,12 +214,25 @@ dboard_manager_impl::dboard_manager_impl(          (get_xcvr_id_to_id_map()[tx_dboard_id] == rx_dboard_id)      ); +    //warn for invalid dboard id xcvr combinations +    if (rx_dboard_is_xcvr != this_dboard_is_xcvr or tx_dboard_is_xcvr != this_dboard_is_xcvr){ +        uhd::print_warning(str(boost::format( +            "Unknown transceiver board ID combination...\n" +            "RX dboard ID: %s\n" +            "TX dboard ID: %s\n" +        ) % rx_dboard_id.to_pp_string() % tx_dboard_id.to_pp_string())); +    } +      //extract dboard constructor and settings (force to unknown for messed up xcvr status)      dboard_ctor_t rx_dboard_ctor; std::string rx_name; prop_names_t rx_subdevs; -    boost::tie(rx_dboard_ctor, rx_name, rx_subdevs) = get_dboard_args(dboard_iface::UNIT_RX, rx_dboard_id, rx_dboard_is_xcvr != this_dboard_is_xcvr); +    boost::tie(rx_dboard_ctor, rx_name, rx_subdevs) = get_dboard_args( +        dboard_iface::UNIT_RX, rx_dboard_id, rx_dboard_is_xcvr != this_dboard_is_xcvr +    );      dboard_ctor_t tx_dboard_ctor; std::string tx_name; prop_names_t tx_subdevs; -    boost::tie(tx_dboard_ctor, tx_name, tx_subdevs) = get_dboard_args(dboard_iface::UNIT_TX, tx_dboard_id, tx_dboard_is_xcvr != this_dboard_is_xcvr); +    boost::tie(tx_dboard_ctor, tx_name, tx_subdevs) = get_dboard_args( +        dboard_iface::UNIT_TX, tx_dboard_id, tx_dboard_is_xcvr != this_dboard_is_xcvr +    );      //initialize the gpio pins before creating subdevs      set_nice_dboard_if(); | 
