aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2020-03-06 14:28:37 -0800
committerAaron Rossetto <aaron.rossetto@ni.com>2020-03-12 07:35:15 -0500
commit3b2f712ff9ceb6875f9e875d8e3424cd858d0a10 (patch)
treeb9cc959df9abb6c8e81561b2512a01574fb12e02 /host
parente806238b272b050e7de5ddcd9f793209837d0c2d (diff)
downloaduhd-3b2f712ff9ceb6875f9e875d8e3424cd858d0a10.tar.gz
uhd-3b2f712ff9ceb6875f9e875d8e3424cd858d0a10.tar.bz2
uhd-3b2f712ff9ceb6875f9e875d8e3424cd858d0a10.zip
utils/C API: Fix property tree access
The introduction of multi_usrp_rfnoc caused multi_usrp::get_device()->get_tree() to segfault for gen3 devices. In defcb174, we introduced a fix for this (multi_usrp::get_tree()) but we didn't apply it to internal utilities. That means the uhd_cal_* utilties were broken, along with certain sections of the C API, and the latency test suite. This fixes the segfault issue.
Diffstat (limited to 'host')
-rw-r--r--host/lib/usrp/usrp_c.cpp8
-rw-r--r--host/utils/latency/lib/Responder.cpp2
-rw-r--r--host/utils/usrp_cal_utils.hpp6
3 files changed, 8 insertions, 8 deletions
diff --git a/host/lib/usrp/usrp_c.cpp b/host/lib/usrp/usrp_c.cpp
index e94b49fc8..bda9454b6 100644
--- a/host/lib/usrp/usrp_c.cpp
+++ b/host/lib/usrp/usrp_c.cpp
@@ -507,7 +507,7 @@ uhd_error uhd_usrp_get_mboard_eeprom(
UHD_SAFE_C_SAVE_ERROR(
h, uhd::fs_path eeprom_path = str(boost::format("/mboards/%d/eeprom") % mboard);
- uhd::property_tree::sptr ptree = USRP(h)->get_device()->get_tree();
+ uhd::property_tree::sptr ptree = USRP(h)->get_tree();
mb_eeprom->mboard_eeprom_cpp =
ptree->access<uhd::usrp::mboard_eeprom_t>(eeprom_path).get();)
}
@@ -518,7 +518,7 @@ uhd_error uhd_usrp_set_mboard_eeprom(
UHD_SAFE_C_SAVE_ERROR(
h, uhd::fs_path eeprom_path = str(boost::format("/mboards/%d/eeprom") % mboard);
- uhd::property_tree::sptr ptree = USRP(h)->get_device()->get_tree();
+ uhd::property_tree::sptr ptree = USRP(h)->get_tree();
ptree->access<uhd::usrp::mboard_eeprom_t>(eeprom_path)
.set(mb_eeprom->mboard_eeprom_cpp);)
}
@@ -534,7 +534,7 @@ uhd_error uhd_usrp_get_dboard_eeprom(uhd_usrp_handle h,
uhd::fs_path eeprom_path =
str(boost::format("/mboards/%d/dboards/%s/%s_eeprom") % mboard % slot % unit);
- uhd::property_tree::sptr ptree = USRP(h)->get_device()->get_tree();
+ uhd::property_tree::sptr ptree = USRP(h)->get_tree();
db_eeprom->dboard_eeprom_cpp =
ptree->access<uhd::usrp::dboard_eeprom_t>(eeprom_path).get();)
}
@@ -550,7 +550,7 @@ uhd_error uhd_usrp_set_dboard_eeprom(uhd_usrp_handle h,
uhd::fs_path eeprom_path =
str(boost::format("/mboards/%d/dboards/%s/%s_eeprom") % mboard % slot % unit);
- uhd::property_tree::sptr ptree = USRP(h)->get_device()->get_tree();
+ uhd::property_tree::sptr ptree = USRP(h)->get_tree();
ptree->access<uhd::usrp::dboard_eeprom_t>(eeprom_path)
.set(db_eeprom->dboard_eeprom_cpp);)
}
diff --git a/host/utils/latency/lib/Responder.cpp b/host/utils/latency/lib/Responder.cpp
index 0d7a307dd..c2f224d00 100644
--- a/host/utils/latency/lib/Responder.cpp
+++ b/host/utils/latency/lib/Responder.cpp
@@ -284,7 +284,7 @@ void Responder::print_test_parameters()
// available
void Responder::set_usrp_rx_dc_offset(uhd::usrp::multi_usrp::sptr usrp, bool ena)
{
- uhd::property_tree::sptr tree = usrp->get_device()->get_tree();
+ uhd::property_tree::sptr tree = usrp->get_tree();
// FIXME: Path needs to be build in a programmatic way.
bool dc_offset_exists =
tree->exists(uhd::fs_path("/mboards/0/rx_frontends/A/dc_offset"));
diff --git a/host/utils/usrp_cal_utils.hpp b/host/utils/usrp_cal_utils.hpp
index 76a79c86e..fee45ccdc 100644
--- a/host/utils/usrp_cal_utils.hpp
+++ b/host/utils/usrp_cal_utils.hpp
@@ -46,7 +46,7 @@ static constexpr size_t MAX_NUM_TX_ERRORS = 10;
**********************************************************************/
static inline void set_optimum_defaults(uhd::usrp::multi_usrp::sptr usrp)
{
- uhd::property_tree::sptr tree = usrp->get_device()->get_tree();
+ auto tree = usrp->get_tree();
// Will work on 1st subdev, top-level must make sure it's the right one
uhd::usrp::subdev_spec_t subdev_spec = usrp->get_rx_subdev_spec();
@@ -103,7 +103,7 @@ void check_for_empty_serial(uhd::usrp::multi_usrp::sptr usrp)
uhd::usrp::subdev_spec_t subdev_spec = usrp->get_rx_subdev_spec();
// extract eeprom
- uhd::property_tree::sptr tree = usrp->get_device()->get_tree();
+ uhd::property_tree::sptr tree = usrp->get_tree();
// This only works with transceiver boards, so we can always check rx side
const uhd::fs_path db_path =
"/mboards/0/dboards/" + subdev_spec[0].db_name + "/rx_eeprom";
@@ -170,7 +170,7 @@ static inline void write_samples_to_file(
**********************************************************************/
static std::string get_serial(uhd::usrp::multi_usrp::sptr usrp, const std::string& tx_rx)
{
- uhd::property_tree::sptr tree = usrp->get_device()->get_tree();
+ uhd::property_tree::sptr tree = usrp->get_tree();
// Will work on 1st subdev, top-level must make sure it's the right one
uhd::usrp::subdev_spec_t subdev_spec = usrp->get_rx_subdev_spec();
const uhd::fs_path db_path =