forked from sdr/gr-osmosdr
uhd: improve device discovery
This commit is contained in:
parent
0923bcb687
commit
e394dd3922
|
@ -71,11 +71,11 @@ uhd_sink_c::uhd_sink_c(const std::string &args) :
|
||||||
|
|
||||||
if (dict.count("subdev")) {
|
if (dict.count("subdev")) {
|
||||||
_snk->set_subdev_spec( dict["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)
|
if (0.0 != _lo_offset)
|
||||||
std::cerr << "-- Using lo offset of " << _lo_offset << " Hz." << std::endl;
|
std::cerr << "-- Using lo offset of " << _lo_offset << " Hz." << std::endl;
|
||||||
|
|
||||||
|
@ -92,14 +92,18 @@ std::vector< std::string > uhd_sink_c::get_devices()
|
||||||
std::vector< std::string > devices;
|
std::vector< std::string > devices;
|
||||||
|
|
||||||
uhd::device_addr_t hint;
|
uhd::device_addr_t hint;
|
||||||
BOOST_FOREACH(const uhd::device_addr_t &dev, uhd::device::find(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 args = "uhd," + dev.to_string();
|
||||||
|
|
||||||
|
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";
|
std::string label = "Ettus";
|
||||||
|
|
||||||
std::string type = dev.cast< std::string >("type", "USRP");
|
if ( "umtrx" == type )
|
||||||
std::string name = dev.cast< std::string >("name", "");
|
label = "Fairwaves";
|
||||||
std::string serial = dev.cast< std::string >("serial", "");
|
|
||||||
|
|
||||||
if (type.length()) {
|
if (type.length()) {
|
||||||
boost::to_upper(type);
|
boost::to_upper(type);
|
||||||
|
@ -107,7 +111,7 @@ std::vector< std::string > uhd_sink_c::get_devices()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name.length())
|
if (name.length())
|
||||||
label += " " + name;
|
label += " (" + name + ")";
|
||||||
|
|
||||||
if (serial.length())
|
if (serial.length())
|
||||||
label += " " + serial;
|
label += " " + serial;
|
||||||
|
@ -117,9 +121,6 @@ std::vector< std::string > uhd_sink_c::get_devices()
|
||||||
devices.push_back( args );
|
devices.push_back( args );
|
||||||
}
|
}
|
||||||
|
|
||||||
//devices.clear();
|
|
||||||
//devices.push_back( "uhd,type=usrp1,label='Ettus USRP'" );
|
|
||||||
|
|
||||||
return devices;
|
return devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,11 +72,11 @@ uhd_source_c::uhd_source_c(const std::string &args) :
|
||||||
|
|
||||||
if (dict.count("subdev")) {
|
if (dict.count("subdev")) {
|
||||||
_src->set_subdev_spec( dict["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)
|
if (0.0 != _lo_offset)
|
||||||
std::cerr << "-- Using lo offset of " << _lo_offset << " Hz." << std::endl;
|
std::cerr << "-- Using lo offset of " << _lo_offset << " Hz." << std::endl;
|
||||||
|
|
||||||
|
@ -93,14 +93,18 @@ std::vector< std::string > uhd_source_c::get_devices()
|
||||||
std::vector< std::string > devices;
|
std::vector< std::string > devices;
|
||||||
|
|
||||||
uhd::device_addr_t hint;
|
uhd::device_addr_t hint;
|
||||||
BOOST_FOREACH(const uhd::device_addr_t &dev, uhd::device::find(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 args = "uhd," + dev.to_string();
|
||||||
|
|
||||||
|
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";
|
std::string label = "Ettus";
|
||||||
|
|
||||||
std::string type = dev.cast< std::string >("type", "USRP");
|
if ( "umtrx" == type )
|
||||||
std::string name = dev.cast< std::string >("name", "");
|
label = "Fairwaves";
|
||||||
std::string serial = dev.cast< std::string >("serial", "");
|
|
||||||
|
|
||||||
if (type.length()) {
|
if (type.length()) {
|
||||||
boost::to_upper(type);
|
boost::to_upper(type);
|
||||||
|
@ -108,7 +112,7 @@ std::vector< std::string > uhd_source_c::get_devices()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name.length())
|
if (name.length())
|
||||||
label += " " + name;
|
label += " (" + name + ")";
|
||||||
|
|
||||||
if (serial.length())
|
if (serial.length())
|
||||||
label += " " + serial;
|
label += " " + serial;
|
||||||
|
@ -118,9 +122,6 @@ std::vector< std::string > uhd_source_c::get_devices()
|
||||||
devices.push_back( args );
|
devices.push_back( args );
|
||||||
}
|
}
|
||||||
|
|
||||||
//devices.clear();
|
|
||||||
//devices.push_back( "uhd,type=usrp1,label='Ettus USRP'" );
|
|
||||||
|
|
||||||
return devices;
|
return devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue