diff options
author | Martin Braun <martin.braun@ettus.com> | 2019-03-13 09:52:58 -0700 |
---|---|---|
committer | Brent Stapleton <brent.stapleton@ettus.com> | 2019-03-20 11:30:18 -0700 |
commit | a5fbf781a7b88c7e76b525ff0b04644e92a63ce9 (patch) | |
tree | a1ecf497ba4a23387c6e232cca92dd2f324b2493 /host/lib | |
parent | ac96d055091c29e2c6b08762b3b3d9da8db5b855 (diff) | |
download | uhd-a5fbf781a7b88c7e76b525ff0b04644e92a63ce9.tar.gz uhd-a5fbf781a7b88c7e76b525ff0b04644e92a63ce9.tar.bz2 uhd-a5fbf781a7b88c7e76b525ff0b04644e92a63ce9.zip |
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
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/include/uhdlib/usrp/constrained_device_args.hpp | 8 |
1 files changed, 6 insertions, 2 deletions
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( |