aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorBrent Stapleton <brent.stapleton@ettus.com>2018-02-02 11:48:35 -0800
committerMartin Braun <martin.braun@ettus.com>2018-02-19 16:58:52 -0800
commitbd2a51855589a939159b42e702dd01684c7b1d80 (patch)
tree9f3df6d77f02636a5e15e4d31e2621388d6bdb4b /host
parenta9ba8a9fd912be63e3816cded0c9c80b29a3d557 (diff)
downloaduhd-bd2a51855589a939159b42e702dd01684c7b1d80.tar.gz
uhd-bd2a51855589a939159b42e702dd01684c7b1d80.tar.bz2
uhd-bd2a51855589a939159b42e702dd01684c7b1d80.zip
mpmd: add getter for components in property tree
Adding a publisher for updateable components listed in the property tree. This calls MPM.get_component_info for the desired component, and returns a dictionary containing that metadata.
Diffstat (limited to 'host')
-rw-r--r--host/lib/usrp/mpmd/mpmd_impl.cpp2
-rw-r--r--host/lib/usrp/mpmd/mpmd_prop_tree.cpp34
2 files changed, 32 insertions, 4 deletions
diff --git a/host/lib/usrp/mpmd/mpmd_impl.cpp b/host/lib/usrp/mpmd/mpmd_impl.cpp
index 064b73893..4d3fba8a1 100644
--- a/host/lib/usrp/mpmd/mpmd_impl.cpp
+++ b/host/lib/usrp/mpmd/mpmd_impl.cpp
@@ -31,7 +31,7 @@ namespace {
//! Most pessimistic time for a CHDR query to go to device and back
const double MPMD_CHDR_MAX_RTT = 0.02;
//! MPM Compatibility number
- const std::vector<size_t> MPM_COMPAT_NUM = {1, 1};
+ const std::vector<size_t> MPM_COMPAT_NUM = {1, 2};
/*************************************************************************
* Helper functions
diff --git a/host/lib/usrp/mpmd/mpmd_prop_tree.cpp b/host/lib/usrp/mpmd/mpmd_prop_tree.cpp
index 64e68c486..a087b02dd 100644
--- a/host/lib/usrp/mpmd/mpmd_prop_tree.cpp
+++ b/host/lib/usrp/mpmd/mpmd_prop_tree.cpp
@@ -62,6 +62,28 @@ namespace {
return all_comps_copy;
}
+ /*
+ * Query the device to get the metadata for desired component
+ *
+ * \param comp_name String component name
+ * \param mb Reference to the actual device
+ * \return component files containing the component metadata
+ */
+ uhd::usrp::component_files_t _get_component_info(
+ const std::string &comp_name,
+ mpmd_mboard_impl *mb
+ ) {
+ UHD_LOG_TRACE("MPMD", "Getting component info for " << comp_name);
+ const auto component_metadata = mb->rpc->request<std::map<std::string, std::string>>(
+ "get_component_info", comp_name);
+ // Copy the contents of the component metadata into a object we can return
+ uhd::usrp::component_file_t return_component;
+ auto &return_metadata = return_component.metadata;
+ for (auto item : component_metadata) {
+ return_metadata[item.first] = item.second;
+ }
+ return uhd::usrp::component_files_t {return_component};
+ }
}
void mpmd_impl::init_property_tree(
@@ -210,13 +232,19 @@ void mpmd_impl::init_property_tree(
UHD_LOG_TRACE("MPMD",
"Adding motherboard component: " << comp_name);
tree->create<uhd::usrp::component_files_t>(mb_path / "components" / comp_name)
- .set_coercer([mb](const uhd::usrp::component_files_t& comp_files) {
+ .set_coercer([mb](const uhd::usrp::component_files_t& comp_files){
return _update_component(
comp_files,
mb
);
- })
- ;
+ })
+ .set_publisher([mb, comp_name](){
+ return _get_component_info(
+ comp_name,
+ mb
+ );
+ })
+ ; // Done adding component to property tree
}
/*** MTUs ***********************************************************/