Allow decoding MAC addresses in some FRUs
Some motherboards store their mac address in a zlib compressed chunk at
a known location in the FRU. Decode that section, and pull the mac
address into the appropriate field.
This requires some refactoring so that the indexing can now have the
indexes passed through the various parse functions.
To use this functionality requires the use of libxml and zlib, which are
added as new dependencies.
Change-Id: Icb5c2e46e2a08ca83b3559892169ee2b3f319b2e
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/src/fru_device/fru_device.cpp b/src/fru_device/fru_device.cpp
index 324afcd..2363477 100644
--- a/src/fru_device/fru_device.cpp
+++ b/src/fru_device/fru_device.cpp
@@ -958,7 +958,6 @@
return false;
}
- std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData{};
std::string errorMessage = "eeprom at " + std::to_string(bus) +
" address " + std::to_string(address);
auto readFunc = [eeprom](off_t offset, size_t length, uint8_t* outbuf) {
@@ -966,10 +965,15 @@
};
FRUReader reader(std::move(readFunc));
- if (!findFRUHeader(reader, errorMessage, blockData, offset))
+ auto sections = findFRUHeader(reader, errorMessage, 0);
+ if (!sections)
{
offset = 0;
}
+ else
+ {
+ offset = sections->IpmiFruOffset;
+ }
if (lseek(eeprom, offset, SEEK_SET) < 0)
{