The label field for temperature sensors is decimal
It turns out that the OCC driver displays the value of the
tempX_label file as a decimal as opposed to the hex format we just
speculated it would be.
For example, a 0xC0000001 value will read as 3221225473.
Change the code to read that as a uint32_t and then extract that type
and instance fields directly from it.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I64db4670cf8a48030cca041fad8892de6188f89e
diff --git a/occ_manager.cpp b/occ_manager.cpp
index 4b5df04..a6d18ac 100644
--- a/occ_manager.cpp
+++ b/occ_manager.cpp
@@ -220,7 +220,7 @@
continue;
}
- std::string labelValue;
+ uint32_t labelValue{0};
fileOpen >> labelValue;
fileOpen.close();
@@ -250,13 +250,8 @@
}
else
{
- auto sensorTypeID =
- open_power::occ::utils::checkLabelValue(labelValue);
- if (sensorTypeID == std::nullopt)
- {
- continue;
- }
- auto& [type, instanceID] = *sensorTypeID;
+ uint16_t type = (labelValue & 0xFF000000) >> 24;
+ uint16_t instanceID = labelValue & 0x0000FFFF;
if (type == OCC_DIMM_TEMP_SENSOR_TYPE)
{