app: Support dump command
The dump command displays the contents of the VPDs that have been
parsed. It requires a --vpd file.
$ openpower-read-vpd --vpd /sys/class/i2c-dev/i2c-11/device/11-0051/eeprom --dump
OPFR:
VS : XXXXXXXXXXXX
VP : YYYYYYY
VN : IBM
DR : 0000000000000000
VINI:
PN : ZZZZZZZ
DR : BMC PLANAR
B1 : DE:AD:BE:EF:CA:FE
SN : 000000000000
CC : AAAA
HW : 0002
Change-Id: I081611ecdd4f4a88c5e20edc8e403c7bcb21b632
Signed-off-by: Joel Stanley <joel@jms.id.au>
diff --git a/app.cpp b/app.cpp
index e38936d..948decd 100644
--- a/app.cpp
+++ b/app.cpp
@@ -20,6 +20,7 @@
args::Args arguments = args::parse(argc, argv);
bool haveVpd = arguments.count("vpd");
+ bool doDump = arguments.count("dump");
bool doFru = arguments.count("fru") && arguments.count("object");
if (!haveVpd)
@@ -28,11 +29,12 @@
return -1;
}
- if (!doFru)
+ if (!doDump && !doFru)
{
std::cerr << "No task to perform\n\n";
std::cerr << " Update FRU: --fru <type> --object <path>\n";
std::cerr << " --fru <t1>,<t2> --object <p1>,<p2>\n\n";
+ std::cerr << " Dump VPD: --dump\n\n";
return -1;
}
@@ -45,6 +47,11 @@
// Parse VPD
auto vpdStore = parse(std::move(vpd));
+ if (doDump)
+ {
+ vpdStore.dump();
+ }
+
// Set FRU based on FRU type and object path
if (doFru)
{