Showing signed sensor value when the command "ipmitool sdr" is executed.

Tony Lee (李文富) Tony.Lee at quantatw.com
Fri Nov 1 20:23:27 AEDT 2019


Hi jayaprakash,

I found the following problem:
If the sensor is discrete and the sensorReadingType is 0x6F,
the sensor will become "disabled" when the command "ipmitool sdr elist" is executed.
Because no matter what sensor type it is, the previous code will eventually enable scanning.
But now it seems to forget to enable scanning when the sensor is discrete (assertion).

Also, when the sensor value is negative in d-bus, the sensor reading will be 0.
Fix it by using a int32_t and add an overflow check.
 
"sensor_units_1", defined by ipmi SPEC "Table 43-, Full Sensor Record - SDR Type 01h" byte 21, "Sensor Units 1". 
Currently, "sensor_units_1" is always set to 0, so the signed sensor value cannot be displayed 
when the command "ipmitool sdr" is executed. To support that, we add the attribute "sensorUnits1" to the
sensor mapping yaml that it can be used to determine if the sensor is a signed value.

In conclusion, I've modified it in 
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-host-ipmid/+/26754

If you can give me some comments that would be great.

Thanks
Best Regards,
Tony

> Hi team,
> 
> The temperature sensor value may be negative when the command "ipmitool
> sdr" is executed.
> Sensor value can be a signed value according to ipmi SPEC "Table 43-, Full
> Sensor Record - SDR Type 01h" byte 21, "Sensor Units 1".
> 
> However, we can find that the sensor_units_1 is set to zero in
> https://github.com/openbmc/phosphor-host-ipmid/blob/master/sensorhandler.cpp#L712

> And the method "set_analog_data_format", althought it has been declared
> but it has never been used in
> https://github.com/openbmc/phosphor-host-ipmid/blob/master/sensorhandl
> er.hpp#L497.
> 
> In addition, since rawData has been converted to uint8_t by static_cast
> <uint8_t>, there is always a none negative value. in
> https://github.com/openbmc/phosphor-host-ipmid/blob/master/sensordatahandler.hpp#L227
> 
> Based on the above three points, it seems that the function needs to be
> modified  so that the sensor value can be displayed as a negative value when
> the "ipmitool sdr" command is executed.
> 
> Am I wrong, or I need to set it up somewhere?



More information about the openbmc mailing list