From a5fbf781a7b88c7e76b525ff0b04644e92a63ce9 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Wed, 13 Mar 2019 09:52:58 -0700 Subject: lib: Allow "0" and "1" as false/true values for constrained device args Example: $ uhd_usrp_probe --args type=x300,ignore_cal_file=0 is equivalent to (the currently supported): $ uhd_usrp_probe --args type=x300,ignore_cal_file=false --- host/lib/include/uhdlib/usrp/constrained_device_args.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'host') diff --git a/host/lib/include/uhdlib/usrp/constrained_device_args.hpp b/host/lib/include/uhdlib/usrp/constrained_device_args.hpp index b75fae75a..edb0dd2fc 100644 --- a/host/lib/include/uhdlib/usrp/constrained_device_args.hpp +++ b/host/lib/include/uhdlib/usrp/constrained_device_args.hpp @@ -202,11 +202,15 @@ namespace usrp { _value = true; } else if (boost::algorithm::to_lower_copy(str_rep) == "true" || boost::algorithm::to_lower_copy(str_rep) == "yes" || - boost::algorithm::to_lower_copy(str_rep) == "y") { + boost::algorithm::to_lower_copy(str_rep) == "y" || + str_rep == "1" + ) { _value = true; } else if (boost::algorithm::to_lower_copy(str_rep) == "false" || boost::algorithm::to_lower_copy(str_rep) == "no" || - boost::algorithm::to_lower_copy(str_rep) == "n") { + boost::algorithm::to_lower_copy(str_rep) == "n" || + str_rep == "0" + ) { _value = false; } else { throw uhd::value_error(str(boost::format( -- cgit v1.2.3