summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-11-11 11:27:01 -0800
committerJosh Blum <josh@joshknows.com>2010-11-11 11:27:01 -0800
commitbe3f1411c5c2ba7714b1531418a57f3be06829bf (patch)
tree24915b8d2dbd2d546aaeb3d87bc331f3a0078e9a
parent926fd69de88725f14c34062a81969a4a833a7f61 (diff)
downloaduhd-be3f1411c5c2ba7714b1531418a57f3be06829bf.tar.gz
uhd-be3f1411c5c2ba7714b1531418a57f3be06829bf.tar.bz2
uhd-be3f1411c5c2ba7714b1531418a57f3be06829bf.zip
usrp-e100: add serial and name checks to the usrp-e100 discovery routine
-rw-r--r--host/lib/usrp/usrp_e100/usrp_e100_impl.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp b/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp
index 8e40458d5..13d31e423 100644
--- a/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp
+++ b/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp
@@ -33,13 +33,6 @@ using namespace uhd::usrp;
namespace fs = boost::filesystem;
/***********************************************************************
- * Helper Functions
- **********************************************************************/
-static std::string abs_path(const std::string &file_path){
- return fs::system_complete(fs::path(file_path)).file_string();
-}
-
-/***********************************************************************
* Discovery
**********************************************************************/
static device_addrs_t usrp_e100_find(const device_addr_t &hint){
@@ -59,8 +52,24 @@ static device_addrs_t usrp_e100_find(const device_addr_t &hint){
if (fs::exists(hint["node"])){
device_addr_t new_addr;
new_addr["type"] = "usrp-e";
- new_addr["node"] = abs_path(hint["node"]);
- usrp_e100_addrs.push_back(new_addr);
+ new_addr["node"] = fs::system_complete(fs::path(hint["node"])).file_string();
+ try{
+ usrp_e100_iface::sptr iface = usrp_e100_iface::make(new_addr["node"]);
+ new_addr["name"] = iface->mb_eeprom["name"];
+ new_addr["serial"] = iface->mb_eeprom["serial"];
+ if (
+ (not hint.has_key("name") or hint["name"] == new_addr["name"]) and
+ (not hint.has_key("serial") or hint["serial"] == new_addr["serial"])
+ ){
+ usrp_e100_addrs.push_back(new_addr);
+ }
+ }
+ catch(const std::exception &e){
+ uhd::warning::post(
+ std::string("Ignoring discovered device\n")
+ + e.what()
+ );
+ }
}
return usrp_e100_addrs;