dbus-sdr: check instance start value in getSensorInfo function
Issue: When users request to read DCMI sensor information via "ipmitool
raw 0x2c 0x07 0xdc 0x01 0x07 0x00 <Instance_start>", the return values
always are 8 first sensors even the "Instance_start" is not 0.
Root cause: In the getSensorInfo function, it does not check the
instance start parameter. It always returns 8 first sensors.
Solution: Update the getSensorInfo function as below:
- Get the list of Sensors based on the Entity ID.
- Sort the list of Sensors.
- Compare Sensor's Entity Instance with Instance start parameter
Tested:
1. Get the list of DCMI sensors information with Instance start
is not 0
"ipmitool raw 0x2c 0x07 0xdc 0x01 0x07 0x00 <Ins_Start>"
2. BMC returns sensor Record ID which have the Entity Instance
are greater than Instance start.
Change-Id: I10f7cf4e87cb5eb8fe1da81561263e1604418c45
Signed-off-by: Thang Tran <thuutran@amperecomputing.com>
diff --git a/include/dbus-sdr/sensorcommands.hpp b/include/dbus-sdr/sensorcommands.hpp
index 1e342d7..cde3ffb 100644
--- a/include/dbus-sdr/sensorcommands.hpp
+++ b/include/dbus-sdr/sensorcommands.hpp
@@ -169,4 +169,18 @@
std::optional<uint8_t> criticalHigh;
};
+namespace dcmi
+{
+
+struct sensorInfo
+{
+ std::string objectPath;
+ uint8_t type;
+ uint16_t recordId;
+ uint8_t entityId;
+ uint8_t entityInstance;
+};
+
+} // namespace dcmi
+
} // namespace ipmi