diff options
author | Josh Blum <josh@joshknows.com> | 2010-03-11 18:37:34 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-03-11 18:37:34 -0800 |
commit | daed43a8a873ad5cc16ac8a3eb6db5a8fe126fa5 (patch) | |
tree | 72286b6649af0bf99e84edca08b584cb2e6af6ae /host/lib/device.cpp | |
parent | 9c0fb5e15da3c8ccbc1c8537671703411b210fcf (diff) | |
download | uhd-daed43a8a873ad5cc16ac8a3eb6db5a8fe126fa5.tar.gz uhd-daed43a8a873ad5cc16ac8a3eb6db5a8fe126fa5.tar.bz2 uhd-daed43a8a873ad5cc16ac8a3eb6db5a8fe126fa5.zip |
Cleaned up the gain handler (thing that gets and sets wildcard gains)
and made use of it in the dboard manager so it intercepts the sets and gets.
While doing this, fixed something with nested links in wax obj.
Added some useful macros and templates to the utils.
Diffstat (limited to 'host/lib/device.cpp')
-rw-r--r-- | host/lib/device.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/host/lib/device.cpp b/host/lib/device.cpp index 82052708a..4b64e4a15 100644 --- a/host/lib/device.cpp +++ b/host/lib/device.cpp @@ -32,9 +32,16 @@ using namespace uhd; * Create a new device from a device address. * Based on the address, call the appropriate make functions. * \param dev_addr the device address + * \param hint the device address that was used to find the device * \return a smart pointer to a device */ -static device::sptr make_device(const device_addr_t &dev_addr){ +static device::sptr make_device(const device_addr_t &dev_addr_, const device_addr_t &hint){ + //copy keys that were in hint but not in dev_addr + //this way, we can pass additional transport arguments + device_addr_t dev_addr = dev_addr_; + BOOST_FOREACH(std::string key, hint.get_keys()){ + if (not dev_addr.has_key(key)) dev_addr[key] = hint[key]; + } //create a usrp1e if (dev_addr["type"] == "usrp1e"){ @@ -46,7 +53,9 @@ static device::sptr make_device(const device_addr_t &dev_addr){ return usrp::usrp2::make(dev_addr); } - throw std::runtime_error("cant make a device"); + throw std::runtime_error(str( + boost::format("Cant make a device for %s") % device_addr::to_string(dev_addr) + )); } /*! @@ -126,7 +135,7 @@ device::sptr device::make(const device_addr_t &hint, size_t which){ } //create and register a new device catch(const std::assert_error &e){ - device::sptr dev = make_device(dev_addr); + device::sptr dev = make_device(dev_addr, hint); hash_to_device[dev_hash] = dev; return dev; } |