aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDimitri Stolnikov <horiz0n@gmx.net>2013-10-25 23:32:58 +0200
committerDimitri Stolnikov <horiz0n@gmx.net>2013-10-25 23:32:58 +0200
commit55d005e28d21bda0d20afd3796c822aa65bb0c35 (patch)
tree7e8599474e2ebddfaa24a377a9649e705f4cd545 /lib
parentc744a7b35a6d0d777a0c52b5bcd1dcb4c9ef3c6b (diff)
uhd: improve device discovery
Diffstat (limited to 'lib')
-rw-r--r--lib/uhd/uhd_sink_c.cc25
-rw-r--r--lib/uhd/uhd_source_c.cc25
2 files changed, 26 insertions, 24 deletions
diff --git a/lib/uhd/uhd_sink_c.cc b/lib/uhd/uhd_sink_c.cc
index 3eb9d93..20272fb 100644
--- a/lib/uhd/uhd_sink_c.cc
+++ b/lib/uhd/uhd_sink_c.cc
@@ -71,11 +71,11 @@ uhd_sink_c::uhd_sink_c(const std::string &args) :
if (dict.count("subdev")) {
_snk->set_subdev_spec( dict["subdev"] );
-
- std::cerr << "-- Using subdev spec '" << _snk->get_subdev_spec() << "'."
- << std::endl;
}
+ std::cerr << "-- Using subdev spec '" << _snk->get_subdev_spec() << "'."
+ << std::endl;
+
if (0.0 != _lo_offset)
std::cerr << "-- Using lo offset of " << _lo_offset << " Hz." << std::endl;
@@ -92,22 +92,26 @@ std::vector< std::string > uhd_sink_c::get_devices()
std::vector< std::string > devices;
uhd::device_addr_t hint;
- BOOST_FOREACH(const uhd::device_addr_t &dev, uhd::device::find(hint)) {
- std::string args = "uhd,subdev='A:0'," + dev.to_string();
-
- std::string label = "Ettus";
+ BOOST_FOREACH(const uhd::device_addr_t &dev, uhd::device::find(hint))
+ {
+ std::string args = "uhd," + dev.to_string();
- std::string type = dev.cast< std::string >("type", "USRP");
+ 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", "");
+ std::string label = "Ettus";
+
+ if ( "umtrx" == type )
+ label = "Fairwaves";
+
if (type.length()) {
boost::to_upper(type);
label += " " + type;
}
if (name.length())
- label += " " + name;
+ label += " (" + name + ")";
if (serial.length())
label += " " + serial;
@@ -117,9 +121,6 @@ std::vector< std::string > uhd_sink_c::get_devices()
devices.push_back( args );
}
- //devices.clear();
- //devices.push_back( "uhd,type=usrp1,label='Ettus USRP'" );
-
return devices;
}
diff --git a/lib/uhd/uhd_source_c.cc b/lib/uhd/uhd_source_c.cc
index 2ca5c33..d8c5e0f 100644
--- a/lib/uhd/uhd_source_c.cc
+++ b/lib/uhd/uhd_source_c.cc
@@ -72,11 +72,11 @@ uhd_source_c::uhd_source_c(const std::string &args) :
if (dict.count("subdev")) {
_src->set_subdev_spec( dict["subdev"] );
-
- std::cerr << "-- Using subdev spec '" << _src->get_subdev_spec() << "'."
- << std::endl;
}
+ std::cerr << "-- Using subdev spec '" << _src->get_subdev_spec() << "'."
+ << std::endl;
+
if (0.0 != _lo_offset)
std::cerr << "-- Using lo offset of " << _lo_offset << " Hz." << std::endl;
@@ -93,22 +93,26 @@ std::vector< std::string > uhd_source_c::get_devices()
std::vector< std::string > devices;
uhd::device_addr_t hint;
- BOOST_FOREACH(const uhd::device_addr_t &dev, uhd::device::find(hint)) {
- std::string args = "uhd,subdev='A:0'," + dev.to_string();
-
- std::string label = "Ettus";
+ BOOST_FOREACH(const uhd::device_addr_t &dev, uhd::device::find(hint))
+ {
+ std::string args = "uhd," + dev.to_string();
- std::string type = dev.cast< std::string >("type", "USRP");
+ 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", "");
+ std::string label = "Ettus";
+
+ if ( "umtrx" == type )
+ label = "Fairwaves";
+
if (type.length()) {
boost::to_upper(type);
label += " " + type;
}
if (name.length())
- label += " " + name;
+ label += " (" + name + ")";
if (serial.length())
label += " " + serial;
@@ -118,9 +122,6 @@ std::vector< std::string > uhd_source_c::get_devices()
devices.push_back( args );
}
- //devices.clear();
- //devices.push_back( "uhd,type=usrp1,label='Ettus USRP'" );
-
return devices;
}