Change primary postcode interface to byte array
Change primary code to std::vector<uint8_t> to meet the changes in
phosphor-dbus-interface.
[1] https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/74633
Change-Id: Ib5822973a1dbc6aa8c52f4e81b56091dc33b5f08
Signed-off-by: Cosmo Chou <cosmo.chou@quantatw.com>
Signed-off-by: Potin Lai <potin.lai@quantatw.com>
diff --git a/7seg.cpp b/7seg.cpp
index 501c3f5..a9247d2 100644
--- a/7seg.cpp
+++ b/7seg.cpp
@@ -25,14 +25,14 @@
static void DisplayDbusValue(FILE* f, postcode_t postcodes)
{
- auto postcode = std::get<primary_post_code_t>(postcodes);
+ const auto& postcode = std::get<0>(postcodes);
// Uses cstdio instead of streams because the device file has
// very strict requirements about the data format and streaming
// abstractions tend to muck it up.
- if (f)
+ if (f && !postcode.empty())
{
- int rc = std::fprintf(f, "%d%02x\n", (postcode > 0xff),
- static_cast<uint8_t>(postcode & 0xff));
+ int rc =
+ std::fprintf(f, "%d%02x\n", postcode.size() > 1, postcode.back());
if (rc < 0)
{
std::fprintf(stderr, "failed to write 7seg value: rc=%d\n", rc);