Fix OCC response checksum calculation
The OCC checksum calculation should be ignoring overflow.
Removed redundant trace of the occActive state:
'''
Aug 23 18:38:52 rain100bmc openpower-occ-control[6515]: updateOCCActive: OCC0 active=true
Aug 23 18:38:52 rain100bmc openpower-occ-control[6515]: Status::occActive OCC0 changed to true
'''
Added trace of first 4 bytes of data for pass-through commands:
'''
Aug 23 19:19:30 rain100bmc openpower-occ-control[27848]: PassThrough::send() Sending 0x00 command to OCC0 (data len=1, data=0x20)
Aug 23 19:19:40 rain100bmc openpower-occ-control[27848]: PassThrough::send() Sending 0x40 command to OCC0 (data len=5, data=0x07001000...)
'''
Change-Id: I632b0e0af214858e15f3d5c196723dc6ffe12445
Signed-off-by: Chris Cain <cjcain@us.ibm.com>
diff --git a/occ_pass_through.cpp b/occ_pass_through.cpp
index 5588e5a..8567784 100644
--- a/occ_pass_through.cpp
+++ b/occ_pass_through.cpp
@@ -83,10 +83,37 @@
return response;
}
- log<level::INFO>(
- std::format("PassThrough::send() Sending 0x{:02X} command to OCC{}",
- command.front(), occInstance)
- .c_str());
+ if (command.size() >= 3)
+ {
+ const uint16_t dataLen = command[1] << 8 | command[2];
+ std::string dataString = "";
+ if (command.size() > 3)
+ {
+ // Trace first 4 bytes of command data
+ size_t index = 3;
+ dataString = "0x";
+ for (; (index < 7) && (index < command.size()); ++index)
+ {
+ dataString += std::format("{:02X}", command[index]);
+ }
+ if (index < command.size())
+ {
+ dataString += "...";
+ }
+ }
+ log<level::INFO>(
+ std::format(
+ "PassThrough::send() Sending 0x{:02X} command to OCC{} (data len={}, data={})",
+ command.front(), occInstance, dataLen, dataString)
+ .c_str());
+ }
+ else
+ {
+ log<level::INFO>(
+ std::format("PassThrough::send() Sending 0x{:02X} command to OCC{}",
+ command.front(), occInstance)
+ .c_str());
+ }
CmdStatus status = occCmd.send(command, response);
if (status == CmdStatus::SUCCESS)
{