pldmtool: fix GetFruRecordTable request fail
1. Use PLDM_GET_FIRSTPART for TransferOperationFlag to fix request
failed due to CC code 0x81 (INVALID_TRANSFER_OPERATION_FLAG).
2. Move fruFieldValuestring() to else part to avoid IANA print issue.
Tested result:
```
[
[
{
"FRU Record Set Identifier": 1,
"FRU Record Type": "General(1)",
"Number of FRU fields": 11,
"Encoding Type for FRU fields": "ASCII(1)"
},
......
{
"FRU Field Type": "Vendor IANA(15)",
"FRU Field Length": 4,
"FRU Field Value": "33049"
}
]
]
```
Change-Id: I1a711ee05c49e35cb76c104ab9b11b5b1ac97118
Signed-off-by: Potin Lai <potin.lai@quantatw.com>
diff --git a/pldmtool/pldm_fru_cmd.cpp b/pldmtool/pldm_fru_cmd.cpp
index 14025aa..5d012da 100644
--- a/pldmtool/pldm_fru_cmd.cpp
+++ b/pldmtool/pldm_fru_cmd.cpp
@@ -132,12 +132,15 @@
fruFieldValue =
fruFieldParserTimestamp(tlv->value, tlv->length);
}
+ else
+ {
+ fruFieldValue =
+ fruFieldValuestring(tlv->value, tlv->length);
+ }
frudata["FRU Field Type"] =
typeToString(FruFieldTypeMap, tlv->type);
frudata["FRU Field Length"] = (int)(tlv->length);
- fruFieldValue =
- fruFieldValuestring(tlv->value, tlv->length);
frudata["FRU Field Value"] = fruFieldValue;
frufielddata.emplace_back(frudata);
}
@@ -415,7 +418,7 @@
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_get_fru_record_table_req(
- instanceId, 0, PLDM_START_AND_END, request,
+ instanceId, 0, PLDM_GET_FIRSTPART, request,
requestMsg.size() - sizeof(pldm_msg_hdr));
return {rc, requestMsg};
}