apphandler: Fix Device Revision being 0
If the Device Revision is set later, and therefore when convertVersion
returns a negative return value at ipmid startup, we shouldn't be
setting the `haveBMCVersion` flag. Only when the convertVersion returned
a non-negative value and we received a proper Device ID, should we
set the flag.
Tested:
At boot, with a platform with Device Revision 1,
Without the change:
~# ipmitool mc info
Device ID : 0
Device Revision : 0
Firmware Revision : 16.03
With the change:
~# ipmitool mc info
Device ID : 0
Device Revision : 1
Firmware Revision : 16.03
Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: Ia7a4e2d21384bb840a082d7ec91ad0ed1722c0c7
diff --git a/apphandler.cpp b/apphandler.cpp
index d5a9527..6cdd78f 100644
--- a/apphandler.cpp
+++ b/apphandler.cpp
@@ -605,7 +605,6 @@
{
auto version = getActiveSoftwareVersionInfo(ctx);
r = convertVersion(version, rev);
- haveBMCVersion = true;
}
catch (const std::exception& e)
{
@@ -625,6 +624,7 @@
rev.minor = (rev.minor > 99 ? 99 : rev.minor);
devId.fw[1] = rev.minor % 10 + (rev.minor / 10) * 16;
std::memcpy(&devId.aux, rev.d, 4);
+ haveBMCVersion = true;
}
}
if (!dev_id_initialized)