Commit 0bbf2fa8 authored by Martin Braun's avatar Martin Braun Committed by michael-west

mpmd: Improve error message for compat number mismatches

parent 3d27a3d3
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment