From 7a8224bcb83a2d350e0e6af9d0a1102ad14e5e52 Mon Sep 17 00:00:00 2001 From: Dimitri Stolnikov Date: Tue, 21 Oct 2014 21:44:29 +0200 Subject: [PATCH] source/sink: don't discover devices if already specified via args --- lib/sink_impl.cc | 22 +++++++++++----------- lib/source_impl.cc | 46 +++++++++++++++++++++++----------------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/lib/sink_impl.cc b/lib/sink_impl.cc index 3f4db4b..6b8f1bd 100644 --- a/lib/sink_impl.cc +++ b/lib/sink_impl.cc @@ -104,25 +104,25 @@ sink_impl::sink_impl( const std::string &args ) #ifdef WORKAROUND_GR_HIER_BLOCK2_BUG try { #endif - std::vector< std::string > dev_list; + if ( ! device_specified ) { + std::vector< std::string > dev_list; #ifdef ENABLE_UHD - BOOST_FOREACH( std::string dev, uhd_sink_c::get_devices() ) - dev_list.push_back( dev ); + BOOST_FOREACH( std::string dev, uhd_sink_c::get_devices() ) + dev_list.push_back( dev ); #endif #ifdef ENABLE_BLADERF - BOOST_FOREACH( std::string dev, bladerf_sink_c::get_devices() ) - dev_list.push_back( dev ); + BOOST_FOREACH( std::string dev, bladerf_sink_c::get_devices() ) + dev_list.push_back( dev ); #endif #ifdef ENABLE_HACKRF - BOOST_FOREACH( std::string dev, hackrf_sink_c::get_devices() ) - dev_list.push_back( dev ); + BOOST_FOREACH( std::string dev, hackrf_sink_c::get_devices() ) + dev_list.push_back( dev ); #endif -// std::cerr << std::endl; -// BOOST_FOREACH( std::string dev, dev_list ) -// std::cerr << "'" << dev << "'" << std::endl; +// std::cerr << std::endl; +// BOOST_FOREACH( std::string dev, dev_list ) +// std::cerr << "'" << dev << "'" << std::endl; - if (!device_specified) { if ( dev_list.size() ) arg_list.push_back( dev_list.front() ); else diff --git a/lib/source_impl.cc b/lib/source_impl.cc index 1e9af47..68a8423 100644 --- a/lib/source_impl.cc +++ b/lib/source_impl.cc @@ -168,49 +168,49 @@ source_impl::source_impl( const std::string &args ) #ifdef WORKAROUND_GR_HIER_BLOCK2_BUG try { #endif - std::vector< std::string > dev_list; + if ( ! device_specified ) { + std::vector< std::string > dev_list; #ifdef ENABLE_OSMOSDR - BOOST_FOREACH( std::string dev, osmosdr_src_c::get_devices() ) - dev_list.push_back( dev ); + BOOST_FOREACH( std::string dev, osmosdr_src_c::get_devices() ) + dev_list.push_back( dev ); #endif #ifdef ENABLE_FCD - BOOST_FOREACH( std::string dev, fcd_source_c::get_devices() ) - dev_list.push_back( dev ); + BOOST_FOREACH( std::string dev, fcd_source_c::get_devices() ) + dev_list.push_back( dev ); #endif #ifdef ENABLE_RTL - BOOST_FOREACH( std::string dev, rtl_source_c::get_devices() ) - dev_list.push_back( dev ); + BOOST_FOREACH( std::string dev, rtl_source_c::get_devices() ) + dev_list.push_back( dev ); #endif #ifdef ENABLE_UHD - BOOST_FOREACH( std::string dev, uhd_source_c::get_devices() ) - dev_list.push_back( dev ); + BOOST_FOREACH( std::string dev, uhd_source_c::get_devices() ) + dev_list.push_back( dev ); #endif #ifdef ENABLE_MIRI - BOOST_FOREACH( std::string dev, miri_source_c::get_devices() ) - dev_list.push_back( dev ); + BOOST_FOREACH( std::string dev, miri_source_c::get_devices() ) + dev_list.push_back( dev ); #endif #ifdef ENABLE_BLADERF - BOOST_FOREACH( std::string dev, bladerf_source_c::get_devices() ) - dev_list.push_back( dev ); + BOOST_FOREACH( std::string dev, bladerf_source_c::get_devices() ) + dev_list.push_back( dev ); #endif #ifdef ENABLE_RFSPACE - BOOST_FOREACH( std::string dev, rfspace_source_c::get_devices() ) - dev_list.push_back( dev ); + BOOST_FOREACH( std::string dev, rfspace_source_c::get_devices() ) + dev_list.push_back( dev ); #endif #ifdef ENABLE_HACKRF - BOOST_FOREACH( std::string dev, hackrf_source_c::get_devices() ) - dev_list.push_back( dev ); + BOOST_FOREACH( std::string dev, hackrf_source_c::get_devices() ) + dev_list.push_back( dev ); #endif #ifdef ENABLE_AIRSPY - BOOST_FOREACH( std::string dev, airspy_source_c::get_devices() ) - dev_list.push_back( dev ); + BOOST_FOREACH( std::string dev, airspy_source_c::get_devices() ) + dev_list.push_back( dev ); #endif -// std::cerr << std::endl; -// BOOST_FOREACH( std::string dev, dev_list ) -// std::cerr << "'" << dev << "'" << std::endl; +// std::cerr << std::endl; +// BOOST_FOREACH( std::string dev, dev_list ) +// std::cerr << "'" << dev << "'" << std::endl; - if (!device_specified) { if ( dev_list.size() ) arg_list.push_back( dev_list.front() ); else