aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp1/usrp1_impl.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-11-05 21:22:54 -0700
committerJosh Blum <josh@joshknows.com>2010-11-05 21:22:54 -0700
commit374f6ff05e66d10830a7567d2d793de2bf77c06b (patch)
treeca170bd9473de690ffff45b2041cf10f83fb0228 /host/lib/usrp/usrp1/usrp1_impl.cpp
parent92b5034cb5a6e17fe7ebc437f7ef26147d69eba3 (diff)
parentc2cc364f9fde9633e2d7c04fa5b07275e17ba093 (diff)
downloaduhd-374f6ff05e66d10830a7567d2d793de2bf77c06b.tar.gz
uhd-374f6ff05e66d10830a7567d2d793de2bf77c06b.tar.bz2
uhd-374f6ff05e66d10830a7567d2d793de2bf77c06b.zip
Merge branch 'master' into flow_ctrl
Conflicts: host/lib/usrp/usrp2/mboard_impl.cpp host/lib/usrp/usrp2/usrp2_impl.hpp
Diffstat (limited to 'host/lib/usrp/usrp1/usrp1_impl.cpp')
-rw-r--r--host/lib/usrp/usrp1/usrp1_impl.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp
index 314384e72..6016b0979 100644
--- a/host/lib/usrp/usrp1/usrp1_impl.cpp
+++ b/host/lib/usrp/usrp1/usrp1_impl.cpp
@@ -56,12 +56,14 @@ static device_addrs_t usrp1_find(const device_addr_t &hint)
//return an empty list of addresses when type is set to non-usrp1
if (hint.has_key("type") and hint["type"] != "usrp1") return usrp1_addrs;
+ //Return an empty list of addresses when an address is specified,
+ //since an address is intended for a different, non-USB, device.
+ if (hint.has_key("addr")) return usrp1_addrs;
+
//extract the firmware path for the USRP1
std::string usrp1_fw_image;
try{
- usrp1_fw_image = find_image_path(
- hint.has_key("fw")? hint["fw"] : "usrp1_fw.ihx"
- );
+ usrp1_fw_image = find_image_path(hint.get("fw", "usrp1_fw.ihx"));
}
catch(...){
uhd::warning::post(
@@ -91,11 +93,16 @@ static device_addrs_t usrp1_find(const device_addr_t &hint)
pid = USRP1_PRODUCT_ID;
BOOST_FOREACH(usb_device_handle::sptr handle, usb_device_handle::get_device_list(vid, pid)) {
+ usrp1_iface::sptr iface = usrp1_iface::make(usrp_ctrl::make(usb_control::make(handle)));
device_addr_t new_addr;
new_addr["type"] = "usrp1";
+ new_addr["name"] = iface->mb_eeprom["name"];
new_addr["serial"] = handle->get_serial();
- //this is a found usrp1 when a hint serial is not specified or it matches
- if (not hint.has_key("serial") or hint["serial"] == new_addr["serial"]){
+ //this is a found usrp1 when the hint serial and name match or blank
+ if (
+ (not hint.has_key("name") or hint["name"] == new_addr["name"]) and
+ (not hint.has_key("serial") or hint["serial"] == new_addr["serial"])
+ ){
usrp1_addrs.push_back(new_addr);
}
}
@@ -110,7 +117,7 @@ static device::sptr usrp1_make(const device_addr_t &device_addr){
//extract the FPGA path for the USRP1
std::string usrp1_fpga_image = find_image_path(
- device_addr.has_key("fpga")? device_addr["fpga"] : "usrp1_fpga.rbf"
+ device_addr.get("fpga", "usrp1_fpga.rbf")
);
//std::cout << "USRP1 FPGA image: " << usrp1_fpga_image << std::endl;