aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp1
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-11-05 01:01:51 -0700
committerJosh Blum <josh@joshknows.com>2010-11-05 01:01:51 -0700
commit144ebf29327981db8422049b451852744619678d (patch)
tree2658ee62cdbc60b62426e294ae803ec5b0cdf258 /host/lib/usrp/usrp1
parent0066ef2972f35d3d1ba7a9127f197fba9e754d88 (diff)
downloaduhd-144ebf29327981db8422049b451852744619678d.tar.gz
uhd-144ebf29327981db8422049b451852744619678d.tar.bz2
uhd-144ebf29327981db8422049b451852744619678d.zip
usrp: implement name checking on dicovery (all platforms), separate usb serial from serial (for now)
Diffstat (limited to 'host/lib/usrp/usrp1')
-rw-r--r--host/lib/usrp/usrp1/mboard_impl.cpp10
-rw-r--r--host/lib/usrp/usrp1/usrp1_iface.cpp4
-rw-r--r--host/lib/usrp/usrp1/usrp1_iface.hpp3
-rw-r--r--host/lib/usrp/usrp1/usrp1_impl.cpp13
-rw-r--r--host/lib/usrp/usrp1/usrp1_impl.hpp2
5 files changed, 21 insertions, 11 deletions
diff --git a/host/lib/usrp/usrp1/mboard_impl.cpp b/host/lib/usrp/usrp1/mboard_impl.cpp
index d7ab46eb1..86f78a7a9 100644
--- a/host/lib/usrp/usrp1/mboard_impl.cpp
+++ b/host/lib/usrp/usrp1/mboard_impl.cpp
@@ -208,8 +208,6 @@ bool usrp1_impl::has_tx_halfband(void){
**********************************************************************/
void usrp1_impl::mboard_init(void)
{
- _mb_eeprom = mboard_eeprom_t(*_iface, mboard_eeprom_t::MAP_BXXX);
-
_mboard_proxy = wax_obj_proxy::make(
boost::bind(&usrp1_impl::mboard_get, this, _1, _2),
boost::bind(&usrp1_impl::mboard_set, this, _1, _2));
@@ -267,7 +265,7 @@ void usrp1_impl::mboard_get(const wax::obj &key_, wax::obj &val)
//handle the get request conditioned on the key
switch(key.as<mboard_prop_t>()){
case MBOARD_PROP_NAME:
- val = std::string("usrp1 mboard - " + _mb_eeprom["serial"]);
+ val = std::string("usrp1 mboard - " + _iface->mb_eeprom["serial"]);
return;
case MBOARD_PROP_OTHERS:
@@ -325,7 +323,7 @@ void usrp1_impl::mboard_get(const wax::obj &key_, wax::obj &val)
return;
case MBOARD_PROP_EEPROM_MAP:
- val = _mb_eeprom;
+ val = _iface->mb_eeprom;
return;
default: UHD_THROW_PROP_GET_ERROR();
@@ -380,8 +378,8 @@ void usrp1_impl::mboard_set(const wax::obj &key, const wax::obj &val)
return;
case MBOARD_PROP_EEPROM_MAP:
- _mb_eeprom = val.as<mboard_eeprom_t>();
- _mb_eeprom.commit(*_iface, mboard_eeprom_t::MAP_BXXX);
+ _iface->mb_eeprom = val.as<mboard_eeprom_t>();
+ _iface->mb_eeprom.commit(*_iface, mboard_eeprom_t::MAP_BXXX);
return;
default: UHD_THROW_PROP_SET_ERROR();
diff --git a/host/lib/usrp/usrp1/usrp1_iface.cpp b/host/lib/usrp/usrp1/usrp1_iface.cpp
index 64ced2905..dcba3e819 100644
--- a/host/lib/usrp/usrp1/usrp1_iface.cpp
+++ b/host/lib/usrp/usrp1/usrp1_iface.cpp
@@ -25,6 +25,7 @@
#include <iomanip>
using namespace uhd;
+using namespace uhd::usrp;
using namespace uhd::transport;
static const bool iface_debug = false;
@@ -36,7 +37,8 @@ public:
******************************************************************/
usrp1_iface_impl(usrp_ctrl::sptr ctrl_transport)
{
- _ctrl_transport = ctrl_transport;
+ _ctrl_transport = ctrl_transport;
+ mb_eeprom = mboard_eeprom_t(*this, mboard_eeprom_t::MAP_BXXX);
}
~usrp1_iface_impl(void)
diff --git a/host/lib/usrp/usrp1/usrp1_iface.hpp b/host/lib/usrp/usrp1/usrp1_iface.hpp
index 3f608584a..34a2330b5 100644
--- a/host/lib/usrp/usrp1/usrp1_iface.hpp
+++ b/host/lib/usrp/usrp1/usrp1_iface.hpp
@@ -18,6 +18,7 @@
#ifndef INCLUDED_USRP1_IFACE_HPP
#define INCLUDED_USRP1_IFACE_HPP
+#include <uhd/usrp/mboard_eeprom.hpp>
#include <uhd/types/serial.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
@@ -81,6 +82,8 @@ public:
boost::uint16_t index,
unsigned char* buff,
boost::uint16_t length) = 0;
+
+ uhd::usrp::mboard_eeprom_t mb_eeprom;
};
#endif /* INCLUDED_USRP1_IFACE_HPP */
diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp
index bc478c7fb..6016b0979 100644
--- a/host/lib/usrp/usrp1/usrp1_impl.cpp
+++ b/host/lib/usrp/usrp1/usrp1_impl.cpp
@@ -56,6 +56,10 @@ 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{
@@ -89,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);
}
}
diff --git a/host/lib/usrp/usrp1/usrp1_impl.hpp b/host/lib/usrp/usrp1/usrp1_impl.hpp
index 3eb221a52..ff4d40762 100644
--- a/host/lib/usrp/usrp1/usrp1_impl.hpp
+++ b/host/lib/usrp/usrp1/usrp1_impl.hpp
@@ -26,7 +26,6 @@
#include <uhd/types/clock_config.hpp>
#include <uhd/types/stream_cmd.hpp>
#include <uhd/usrp/dboard_id.hpp>
-#include <uhd/usrp/mboard_eeprom.hpp>
#include <uhd/usrp/subdev_spec.hpp>
#include <uhd/usrp/dboard_eeprom.hpp>
#include <uhd/usrp/dboard_manager.hpp>
@@ -159,7 +158,6 @@ private:
void mboard_get(const wax::obj &, wax::obj &);
void mboard_set(const wax::obj &, const wax::obj &);
wax_obj_proxy::sptr _mboard_proxy;
- uhd::usrp::mboard_eeprom_t _mb_eeprom;
//xx dboard functions and settings
void dboard_init(void);