All of lore.kernel.org
 help / color / mirror / Atom feed
* Showing signed sensor value when the command "ipmitool sdr" is executed.
@ 2019-10-23  1:45 Tony Lee (李文富)
  0 siblings, 0 replies; 2+ messages in thread
From: Tony Lee (李文富) @ 2019-10-23  1:45 UTC (permalink / raw)
  To: openbmc; +Cc: Buddy Huang (黃天鴻)

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#L688.

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/sensorhandler.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#L229

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?

Thanks
Best Regards,
Tony


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: Showing signed sensor value when the command "ipmitool sdr" is executed.
@ 2019-11-01  9:23 Tony Lee (李文富)
  0 siblings, 0 replies; 2+ messages in thread
From: Tony Lee (李文富) @ 2019-11-01  9:23 UTC (permalink / raw)
  To: mutyalax.jayaprakash; +Cc: openbmc, Buddy Huang (黃天鴻)

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?


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-01  9:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-23  1:45 Showing signed sensor value when the command "ipmitool sdr" is executed Tony Lee (李文富)
2019-11-01  9:23 Tony Lee (李文富)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.