All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Tony Lee (李文富)" <Tony.Lee@quantatw.com>
To: "mutyalax.jayaprakash@intel.com" <mutyalax.jayaprakash@intel.com>
Cc: "openbmc@lists.ozlabs.org" <openbmc@lists.ozlabs.org>,
	"Buddy Huang (黃天鴻)" <Buddy.Huang@quantatw.com>
Subject: RE: Showing signed sensor value when the command "ipmitool sdr" is executed.
Date: Fri, 1 Nov 2019 09:23:27 +0000	[thread overview]
Message-ID: <bc2c7a6d88654d2fa33ad03084160bbc@quantatw.com> (raw)

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?


             reply	other threads:[~2019-11-01  9:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-01  9:23 Tony Lee (李文富) [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-10-23  1:45 Showing signed sensor value when the command "ipmitool sdr" is executed Tony Lee (李文富)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bc2c7a6d88654d2fa33ad03084160bbc@quantatw.com \
    --to=tony.lee@quantatw.com \
    --cc=Buddy.Huang@quantatw.com \
    --cc=mutyalax.jayaprakash@intel.com \
    --cc=openbmc@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.