Sensor value calculation formula

Patrick Venture venture at google.com
Sat Mar 16 03:50:28 AEDT 2019


On Thu, Mar 14, 2019 at 4:46 AM Deng Tyler <tyler.sabdon at gmail.com> wrote:
>
> Hi all:
>     Thank for your kindly reply and that really help me. I meat same problem discussed before by Patrick and Qianlihu as below. I add
>
> EXTRA_OECONF_append = " --enable-remove-from-dbus-on-fail" in hwmon append, but it still not working. Hwmon monitor service still terminated  after init() called exit(0). I also try add "EXTRA_OECONF_append = " --enable-negative-errno-on-fail"" and still not working.
>
> What do I miss configuration or understand?

"""
when host powerd off
        1. echo add > /sys/class/hwmon/hwmon0/uevent
         2. failed to start phosphor-hwmon.
"""

After you run that add, what is the state of the sysfs path?  And what
is the configuration starting phosphor-hwmon.

What are you seeing on the journal (journalctrl --no-pager|grep hwmon)

>
> > On my board,when host powed off, the fan would stop.
> >
> > then,phosphor-hwmon failed to start
> >
> > debug:
> >
> > cat /sys/class/hwmon/hwmon0/fan1_input
> >         read error Connection timedout.
> >
> > edit the config file,
> >         LABEL_fan1 = fan1
> >         REMOVERCS = 110 // 110 means ETIMEDOUT
> >
> > when host powerd on
> >         1. echo add > /sys/class/hwmon/hwmon0/uevent
> >         2. phosphor-hwmon started
> >         3. host power off
> >         4. phosphor-hwmon did not exit.
> >         5. cpu usage of hwmon-read would be 4%
> >
> > when host powerd off
> >         1. echo add > /sys/class/hwmon/hwmon0/uevent
> >         2. failed to start phosphor-hwmon.
> >
> > I found when phosphor-hwmon init
> >
> >    Sensor::addValue would read fan1_input(there is no fan1_fault in sysfs),
> >    and it caused read timedout unexpection.
> >
> >    so init failed.
> >
> > On my board,I  want to boot the bmc with phosphor-hwmon when host powered off.
> >
> > what should I do ?
>
> You have a couple options, one will basically remove the sensor from
> dbus on read failure, the other just leaves it but sets the value to
> -errno (in this case ETIMEDOUT).
>
> There are two configuration option switches for these, you can add it
> to your bbappend:
>
> EXTRA_OECONF_append = " --enable-remove-from-dbus-on-fail"
>
>
> EXTRA_OECONF_append = " --enable-negative-errno-on-fail"
>
> Milton Miller II <miltonm at us.ibm.com> 於 2019年3月9日 週六 上午12:34寫道:
>>
>> On  03/06/2019 around 11:36PM in some timezone,  Deng Tyler wrote:
>>
>> >Hi Emily
>> >    I found it hardcoded in phosphor-hwmon for different sensor type.
>> >I think that scale value may be customized for more flexible to fit
>> >custom platform.
>>
>> Assuming that the sensor is exposed though a kernel sysfs hwmon
>> file, you should be looking to specify a gain for the file in sysfs instead.
>> Many sense devices already support a scale in the device tree.
>>
>> >
>> >Tyler
>> >Emily Shaffer <emilyshaffer at google.com> 於 2019年3月7日 週四 下午1:22寫道:
>> >Tyler,
>> >
>> >Sorry that I forgot. Yes, the scale is hardcoded for certain sensor
>> >types, ie voltage is always millivolts. I have asked about this
>> >before but maybe someone else on the list can give a better answer
>> >why that's the case.
>> >
>>
>> The Linux kernel hwmon API specifies the units for different sensors
>> as they are exposed in sysfs.  Hence the hwmon to dbus bridge can
>> hard code the unit for a given type of sensor.
>>
>> The hwmon API is documented at
>> https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface
>> or
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/hwmon/sysfs-interface
>>
>> The above spec is linked as "HWMon interface" under the headings
>> "D-BUS" then "Path Definitions" headings in
>> https://github.com/openbmc/docs/blob/master/sensor-architecture.md
>>
>> milton
>>
>> Speaking for myself only.
>>


More information about the openbmc mailing list