From 75738ff113bf88568c6cb741be413aa8b9268e57 Mon Sep 17 00:00:00 2001 From: Aaron Rossetto Date: Mon, 17 May 2021 13:20:21 -0500 Subject: multi_usrp, x300: Relax LO set API strictness This PR relaxes the set_{rx|tx}_lo_{source|sources|export_enabled}() functions to allow them to be called with 'internal'/ALL_LOS or false/ALL_LOS on devices which do not support changing their LO source or exporting. This makes the get and set functions for those LOs settings more symmetrical in that the values returned from the get function can be successfully passed to the set function. Prior to this change, calling the set functions would throw an error indicating that the device does not support manual configuration of the LO. --- host/lib/usrp/multi_usrp.cpp | 24 ++++++++++++++++-------- host/lib/usrp/x300/x300_radio_control.cpp | 12 ++++++++---- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index b80790f64..bb5b9e5fc 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -1145,8 +1145,10 @@ public: } } } else { - throw uhd::runtime_error( - "This device does not support manual configuration of LOs"); + if (not(src == "internal" and name == ALL_LOS)) { + throw uhd::runtime_error( + "This device only supports setting internal source on all LOs"); + } } } @@ -1232,8 +1234,10 @@ public: } } } else { - throw uhd::runtime_error( - "This device does not support manual configuration of LOs"); + if (not(enabled == false and name == ALL_LOS)) { + throw uhd::runtime_error("This device only supports setting LO export " + "enabled to false on all LOs"); + } } } @@ -1374,8 +1378,10 @@ public: } } } else { - throw uhd::runtime_error("This device does not support manual " - "configuration of LOs"); + if (not(src == "internal" and name == ALL_LOS)) { + throw uhd::runtime_error( + "This device only supports setting internal source on all LOs"); + } } } @@ -1456,8 +1462,10 @@ public: } } } else { - throw uhd::runtime_error( - "This device does not support manual configuration of LOs"); + if (not(enabled == false and name == ALL_LOS)) { + throw uhd::runtime_error("This device only supports setting LO export " + "enabled to false on all LOs"); + } } } diff --git a/host/lib/usrp/x300/x300_radio_control.cpp b/host/lib/usrp/x300/x300_radio_control.cpp index c6750e397..73006a7c8 100644 --- a/host/lib/usrp/x300/x300_radio_control.cpp +++ b/host/lib/usrp/x300/x300_radio_control.cpp @@ -630,8 +630,10 @@ public: } } } else { - throw uhd::runtime_error( - "This device does not support manual configuration of LOs"); + if (not(src == "internal" and name == ALL_LOS)) { + throw uhd::runtime_error( + "This device only supports setting internal source on all LOs"); + } } } @@ -691,8 +693,10 @@ public: } } } else { - throw uhd::runtime_error( - "This device does not support manual configuration of LOs"); + if (not(enabled == false and name == ALL_LOS)) { + throw uhd::runtime_error("This device only supports setting LO export " + "enabled to false on all LOs"); + } } } -- cgit v1.2.3