aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2018-11-05 15:21:48 -0800
committerBrent Stapleton <bstapleton@g.hmc.edu>2018-11-16 12:00:02 -0800
commit1be93abaef6b9c64fb6bd04ab639166fec5af550 (patch)
tree23b44bcd8fd2dbc19bdb40cefc0674121928d00e /host
parent2df06060b57f33e095bfd08ce8143a7053c6fb6e (diff)
downloaduhd-1be93abaef6b9c64fb6bd04ab639166fec5af550.tar.gz
uhd-1be93abaef6b9c64fb6bd04ab639166fec5af550.tar.bz2
uhd-1be93abaef6b9c64fb6bd04ab639166fec5af550.zip
mpmd: Improve error message for compat number mismatches
Diffstat (limited to 'host')
-rw-r--r--host/lib/usrp/mpmd/mpmd_impl.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/host/lib/usrp/mpmd/mpmd_impl.cpp b/host/lib/usrp/mpmd/mpmd_impl.cpp
index 80061ede3..87e911e17 100644
--- a/host/lib/usrp/mpmd/mpmd_impl.cpp
+++ b/host/lib/usrp/mpmd/mpmd_impl.cpp
@@ -106,11 +106,14 @@ namespace {
* number.
* \param actual Tuple of 2 integers representing MAJOR.MINOR compat
* number.
+ * \param advice_on_failure A string that is appended to the error message
+ * when compat number mismatches have occurred.
*/
void assert_compat_number_throw(
const std::string &component,
const std::vector<size_t> &expected,
- const std::vector<size_t> &actual
+ const std::vector<size_t> &actual,
+ const std::string& advice_on_failure=""
) {
UHD_ASSERT_THROW(expected.size() == 2);
UHD_ASSERT_THROW(actual.size() == 2);
@@ -124,20 +127,24 @@ namespace {
if (actual[0] != expected[0]) {
const std::string err_msg =
str(boost::format("%s major compat number mismatch. "
- "Expected: %i.%i Actual: %i.%i")
+ "Expected: %i.%i Actual: %i.%i.%s%s")
% component
% expected[0] % expected[1]
- % actual[0] % actual[1]);
+ % actual[0] % actual[1]
+ % (advice_on_failure.empty() ? "" : " ")
+ % advice_on_failure);
UHD_LOG_ERROR("MPMD", err_msg);
throw uhd::runtime_error(err_msg);
}
if (actual[1] < expected[1]) {
const std::string err_msg =
str(boost::format("%s minor compat number mismatch. "
- "Expected: %i.%i Actual: %i.%i")
+ "Expected: %i.%i Actual: %i.%i.%s%s")
% component
% expected[0] % expected[1]
- % actual[0] % actual[1]);
+ % actual[0] % actual[1]
+ % (advice_on_failure.empty() ? "" : " ")
+ % advice_on_failure);
UHD_LOG_ERROR("MPMD", err_msg);
throw uhd::runtime_error(err_msg);
}
@@ -279,7 +286,8 @@ void mpmd_impl::setup_mb(
assert_compat_number_throw(
"MPM",
MPM_COMPAT_NUM,
- mb->rpc->request<std::vector<size_t>>("get_mpm_compat_num")
+ mb->rpc->request<std::vector<size_t>>("get_mpm_compat_num"),
+ "Please update the version of MPM on your USRP device."
);
UHD_LOG_DEBUG("MPMD", "Initializing mboard " << mb_index);