diff options
author | Dimitri Stolnikov <horiz0n@gmx.net> | 2012-06-09 16:00:24 +0200 |
---|---|---|
committer | Dimitri Stolnikov <horiz0n@gmx.net> | 2012-06-09 16:00:24 +0200 |
commit | 3c3bdc15cf3b351869cf9696ba41835e6a8ecb6a (patch) | |
tree | 1cd27c403d766b55a319cdb5e10106832377c0dd /lib | |
parent | 8099f783c039999e4f18e54169b1f2a43e7e9295 (diff) |
uhd: include type, name (if available) and serial in label property
Diffstat (limited to 'lib')
-rw-r--r-- | lib/uhd/uhd_source_c.cc | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/uhd/uhd_source_c.cc b/lib/uhd/uhd_source_c.cc index 958c421..9aa46fa 100644 --- a/lib/uhd/uhd_source_c.cc +++ b/lib/uhd/uhd_source_c.cc @@ -20,6 +20,7 @@ #include <boost/foreach.hpp> #include <boost/assign.hpp> +#include <boost/algorithm/string.hpp> //#include <uhd/property_tree.hpp> @@ -82,7 +83,26 @@ std::vector< std::string > uhd_source_c::get_devices() uhd::device_addr_t hint; BOOST_FOREACH(const uhd::device_addr_t &dev, uhd::device::find(hint)) { std::string args = "uhd=," + dev.to_string(); - args += ",label='Ettus USRP'"; + + std::string label = "Ettus"; + + std::string type = dev.cast< std::string >("type", "USRP"); + std::string name = dev.cast< std::string >("name", ""); + std::string serial = dev.cast< std::string >("serial", ""); + + if (type.length()) { + boost::to_upper(type); + label += " " + type; + } + + if (name.length()) + label += " " + name; + + if (serial.length()) + label += " " + serial; + + args += ",label='" + label + + "'"; + devices.push_back( args ); } |