DCMI Commands: Support Get DCMI Sensor Info Dynamically
When Dynamic SDR Feature is enabled the sensor record id should be get dynamically for DCMI Sensors.
Tested:
Case 1:Get inlet sensor information
$ipmitool raw 0x2c 0x07 0xdc 0x01 0x40 0x00 0x00
dc 01 01 1a 00
Case 2:Get Baseboard sensor information
ipmitool raw 0x2c 0x07 0xdc 0x01 0x41 0x00 0x00
dc 02 02 18 00 19 00
Case 3:Get CPU sensor information
ipmitool raw 0x2c 0x07 0xdc 0x01 0x42 0x00 0x00
dc 01 01 1b 00
Case 4: Give a invalid sensor instance number
$ipmitool raw 0x2c 0x07 0xdc 0x01 0x41 0x05 0x00
Unable to send RAW command (channel=0x0 netfn=0x2c lun=0x0 cmd=0x7 rsp=0xff): Unspecified error
Result : The command should throw error
Case 5:Get a specific sensor details by giving instance parameter 2 of CPU sensors
$ipmitool raw 0x2c 0x07 0xdc 0x01 0x41 0x02 0x00
dc 02 01 19 00
Signed-off-by: adarshgrami <adarshgr@ami.com>
Change-Id: Ib2099a49ecaebc16b5fae29a4c18ca3e788aabf1
diff --git a/dcmihandler.cpp b/dcmihandler.cpp
index 31f9224..3fd976f 100644
--- a/dcmihandler.cpp
+++ b/dcmihandler.cpp
@@ -1431,11 +1431,13 @@
// <Get Power Reading>
ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::GET_POWER_READING,
NULL, getPowerReading, PRIVILEGE_USER);
-
+// The Get sensor should get the senor details dynamically when
+// FEATURE_DYNAMIC_SENSORS is enabled.
+#ifndef FEATURE_DYNAMIC_SENSORS
// <Get Sensor Info>
ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::GET_SENSOR_INFO, NULL,
getSensorInfo, PRIVILEGE_USER);
-
+#endif
// <Get DCMI Configuration Parameters>
ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::GET_CONF_PARAMS, NULL,
getDCMIConfParams, PRIVILEGE_USER);