Fixes Units for Temperature & Pressure for Hwmon
For pressure the units are Pascals and was missing in SensorPaths.cpp
Also changed to align with the rest of dbus-sensors and set units
as sensor_paths::unitDegreesC and sensor_paths::unitPascals instead
of literal string constants.
Tested: on Everest's Storm King Op Panels with busctl introspect \
--no-pager xyz.openbmc_project.HwmonTempSensor /xyz/openbmc_project/\
sensors/temperature/Ambient_1_Temp and with
busctl introspect --no-pager xyz.openbmc_project.HwmonTempSensor \
/xyz/openbmc_project/sensors/pressure/Station_Pressure
the .Unit fields are now align with the rest of dbus-sensors
Signed-off-by: Bruce Mitchell <bruce.mitchell@linux.vnet.ibm.com>
Change-Id: I46ce300d1f04e05c65196d69f6201db8ba266ad9
diff --git a/src/HwmonTempMain.cpp b/src/HwmonTempMain.cpp
index de74c39..670947b 100644
--- a/src/HwmonTempMain.cpp
+++ b/src/HwmonTempMain.cpp
@@ -76,7 +76,8 @@
.maxValue = maxValueTemperature,
.offsetValue = 0.0,
.scaleValue = 1.0,
- .units = "DegreesC",
+ .units =
+ sensor_paths::unitDegreesC,
.typeName = "temperature"};
// For IIO RAW sensors we get a raw_value, an offset, and scale
@@ -126,7 +127,7 @@
// Pressures are read in kilopascal, we need Pascals.
tmpSensorParameters.scaleValue *= 1000.0;
tmpSensorParameters.typeName = "pressure";
- tmpSensorParameters.units = "Pascals";
+ tmpSensorParameters.units = sensor_paths::unitPascals;
}
else
{
diff --git a/src/SensorPaths.cpp b/src/SensorPaths.cpp
index b0cea9c..2e73012 100644
--- a/src/SensorPaths.cpp
+++ b/src/SensorPaths.cpp
@@ -45,6 +45,10 @@
{
return "Utilization";
}
+ if (units == "Pascals" || units == unitPascals)
+ {
+ return "pressure";
+ }
return "";
}