peltool: Print the Words6To9 'Description' field
Include the 'Description' field from the Words6To9 registry entry when printing
SRC error details.
Changed from this:
"Error Details": {
"Message": "There was a failure when reading a sensor device",
"CALLOUT_ERRNO": "0x5"
}
to this:
"Error Details": {
"Message": "There was a failure when reading a sensor device",
"CALLOUT_ERRNO": [
"0x5",
"errno of the failure"
]
}
Signed-off-by: Harisuddin Mohamed Isa <harisuddin@gmail.com>
Change-Id: Icc107b0516062eb891f14f3ff3f3cffd316c6d77
diff --git a/extensions/openpower-pels/src.cpp b/extensions/openpower-pels/src.cpp
index 643adec..5f6f121 100644
--- a/extensions/openpower-pels/src.cpp
+++ b/extensions/openpower-pels/src.cpp
@@ -342,8 +342,8 @@
return;
}
- // Save the AdditionalData value corresponding to the
- // adName key in _hexData[wordNum].
+ // Save the AdditionalData value corresponding to the first element of
+ // adName tuple into _hexData[wordNum].
for (const auto& [wordNum, adName] : *regEntry.src.hexwordADFields)
{
// Can only set words 6 - 9
@@ -355,7 +355,7 @@
continue;
}
- auto value = ad.getValue(adName);
+ auto value = ad.getValue(std::get<0>(adName));
if (value)
{
_hexData[getWordIndexFromWordNum(wordNum)] =
@@ -363,8 +363,8 @@
}
else
{
- std::string msg =
- "Source for user data SRC word not found: " + adName;
+ std::string msg = "Source for user data SRC word not found: " +
+ std::get<0>(adName);
addDebugData(msg);
}
}
@@ -454,15 +454,17 @@
}
if (entry->src.hexwordADFields)
{
- std::map<size_t, std::string> adFields =
- entry->src.hexwordADFields.value();
+ std::map<size_t, std::tuple<std::string, std::string>>
+ adFields = entry->src.hexwordADFields.value();
for (const auto& hexwordMap : adFields)
{
- jsonInsert(errorOut, hexwordMap.second,
- getNumberString("0x%X",
- _hexData[getWordIndexFromWordNum(
- hexwordMap.first)]),
- 2);
+ std::vector<std::string> valueDescr;
+ valueDescr.push_back(getNumberString(
+ "0x%X",
+ _hexData[getWordIndexFromWordNum(hexwordMap.first)]));
+ valueDescr.push_back(std::get<1>(hexwordMap.second));
+ jsonInsertArray(errorOut, std::get<0>(hexwordMap.second),
+ valueDescr, 2);
}
}
errorOut.erase(errorOut.size() - 2);