Changeset 9459

Show
Ignore:
Timestamp:
08/30/08 12:22:11
Author:
jcorgan
Message:

Improve error messages, remove unneeded code

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • usrp2/trunk/host/lib/usrp2.cc

    r9455 r9459  
    127127 
    128128    props_vector_t u2s = find(ifc, naddr); 
    129     if (u2s.size() != 1) 
    130       throw std::runtime_error("Unable to find requested USRP2."); 
     129    int n = u2s.size(); 
     130 
     131    if (n == 0) { 
     132      if (addr == "") 
     133        throw std::runtime_error("No USRPs found on interface."); 
     134      else 
     135        throw std::runtime_error("Specified USRP2 not found on interface."); 
     136    } 
     137 
     138    if (n > 1) 
     139      throw std::runtime_error("Multiple USRPs found on interface; must select by MAC address."); 
    131140 
    132141    return find_existing_or_make_new(ifc, &u2s[0]); 
     
    135144  // Private constructor.  Sole function is to create an impl. 
    136145  usrp2::usrp2(const std::string &ifc, props *p) 
    137     : d_impl(new usrp2::impl(ifc, p->addr)) 
     146    : d_impl(new usrp2::impl(ifc, p)) 
    138147  { 
    139148    // NOP 
  • usrp2/trunk/host/lib/usrp2_impl.cc

    r9409 r9459  
    119119 
    120120 
    121   usrp2::impl::impl(const std::string &ifc, const std::string &addr
     121  usrp2::impl::impl(const std::string &ifc, props *p
    122122    : d_eth_buf(new eth_buffer()), d_pf(0), d_bg_thread(0), d_bg_running(false), 
    123123      d_rx_decim(0), d_rx_seqno(-1), d_tx_seqno(0), d_next_rid(0), 
     
    126126      d_channel_rings(NCHANS) 
    127127  { 
    128     props_vector_t u2s = find(ifc, addr); 
    129     if (u2s.size() != 1) 
    130       throw std::runtime_error("Unable to find requested USRP2."); 
    131      
    132128    if (!d_eth_buf->open(ifc, htons(U2_ETHERTYPE))) 
    133129      throw std::runtime_error("Unable to register USRP2 protocol"); 
     
    137133      throw std::runtime_error("Unable to attach packet filter."); 
    138134     
    139     d_addr = u2s[0].addr; 
     135    d_addr = p->addr; 
    140136     
    141137    if (USRP2_IMPL_DEBUG) 
  • usrp2/trunk/host/lib/usrp2_impl.h

    r9455 r9459  
    9090 
    9191  public: 
    92     impl(const std::string &ifc, const std::string &addr); 
     92    impl(const std::string &ifc, props *p); 
    9393    ~impl(); 
    9494