Export the part number and serial number
This commit exposes the eMMC's part name and serial number over the
appropriate D-Bus interface, so that it can be exposed over Redfish in
bmcweb.
Tested:
$ busctl introspect xyz.openbmc_project.eStoraged \
/xyz/openbmc_project/inventory/storage/mmcblk0
...
xyz.openbmc_project.Inventory.Decorator.Asset interface - - -
.PartNumber property s "ABCDEF" emits-change
.SerialNumber property s "123456abcd" emits-change
...
$ wget -qO- http://localhost:80/redfish/v1/Chassis/DC_SCM/Drives/mmcblk0
{
"@odata.id": "/redfish/v1/Chassis/DC_SCM/Drives/mmcblk0",
"@odata.type": "#Drive.v1_7_0.Drive",
"CapacityBytes": 15634268160,
"Id": "mmcblk0",
"Links": {
"Chassis": {
"@odata.id": "/redfish/v1/Chassis/DC_SCM"
}
},
"Name": "Name",
"PartNumber": "ABCDEF",
"PhysicalLocation": {
"PartLocation": {
"LocationType": "Embedded"
}
},
"SerialNumber": "123456abcd",
"Status": {
"State": "Enabled"
}
}
Signed-off-by: John Wedig <johnwedig@google.com>
Change-Id: I1d17f08b99907620b5f2c73fdaeacc84950ce64e
diff --git a/src/main.cpp b/src/main.cpp
index 380d17d..2f93899 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -94,9 +94,14 @@
uint8_t lifeleft =
estoraged::util::findPredictedMediaLifeLeftPercent(
sysfsDir);
+ std::string partNumber =
+ estoraged::util::getPartNumber(sysfsDir);
+ std::string serialNumber =
+ estoraged::util::getSerialNumber(sysfsDir);
/* Create the storage object. */
storageObjects[path] = std::make_unique<estoraged::EStoraged>(
- objectServer, path, deviceFile, luksName, size, lifeleft);
+ objectServer, path, deviceFile, luksName, size, lifeleft,
+ partNumber, serialNumber);
lg2::info("Created eStoraged object for path {PATH}", "PATH",
path, "REDFISH_MESSAGE_ID",
std::string("OpenBMC.0.1.CreateStorageObjects"));