bladerf: Accept 'loopback' parameter only on a source

To alleviate some confusion (described below), the 'loopback' parameter
may now only be applied to a bladeRF source. A warning will be printed
if it is applied to a sink.

This is intended to help users avoid the case where two different
loopback options are applied to the same device. In this case, the
loopback setting on whichever initializes last will be applied. This,
coupled with the fact that not specifying a loopback defaults to
loopback=none, yields rather unintuitive behavior.
soapy_support
Jon Szymaniak 9 years ago committed by Dimitri Stolnikov
parent 00b579532c
commit c65d205d3b
  1. 21
      lib/bladerf/bladerf_common.cc

@ -287,10 +287,23 @@ void bladerf_common::init(dict_t &dict, bladerf_module module)
throw std::runtime_error( oss.str() );
}
if ( dict.count("loopback") )
set_loopback_mode( dict["loopback"] );
else
set_loopback_mode( "none" );
if ( module == BLADERF_MODULE_RX )
{
if ( dict.count("loopback") )
set_loopback_mode( dict["loopback"] );
else
set_loopback_mode( "none" );
}
else if ( module == BLADERF_MODULE_TX && dict.count("loopback") )
{
std::cerr << _pfx
<< "Warning: 'loopback' has been specified on a bladeRF sink, "
"and will have no effect. This parameter should be "
"specified on the associated bladeRF source."
<< std::endl;
}
/* Show some info about the device we've opened */

Loading…
Cancel
Save