aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Szymaniak <jon.szymaniak@gmail.com>2014-05-05 21:58:57 -0400
committerDimitri Stolnikov <horiz0n@gmx.net>2014-05-06 22:39:06 +0200
commitc65d205d3b7cc734f97284b66054e16c90886df2 (patch)
treeaafaf68bfd4dcbd43f8adba6d688c44b3bdd8f32
parent00b579532ca738878e537f4849285b4c9076f582 (diff)
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.
-rw-r--r--lib/bladerf/bladerf_common.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/bladerf/bladerf_common.cc b/lib/bladerf/bladerf_common.cc
index 7fea7bb..7516020 100644
--- a/lib/bladerf/bladerf_common.cc
+++ b/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 */