<div dir="ltr">Hi all:<div>    Thank for your kindly reply and that really help me. I meat same problem discussed before by Patrick and <font color="#000000"><span style="white-space:pre-wrap">Qianlihu as below. I add </span></font></div><div><pre style="white-space:pre-wrap;color:rgb(0,0,0)">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.</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)">What do I miss configuration or understand?</pre></div><pre style="white-space:pre-wrap;color:rgb(0,0,0)">><i> On my board,when host powed off, the fan would stop.
</i>><i>
</i>><i> then,phosphor-hwmon failed to start
</i>><i>
</i>><i> debug:
</i>><i>
</i>><i> cat /sys/class/hwmon/hwmon0/fan1_input
</i>><i>         read error Connection timedout.
</i>><i>
</i>><i> edit the config file,
</i>><i>         LABEL_fan1 = fan1
</i>><i>         REMOVERCS = 110 // 110 means ETIMEDOUT
</i>><i>
</i>><i> when host powerd on
</i>><i>         1. echo add > /sys/class/hwmon/hwmon0/uevent
</i>><i>         2. phosphor-hwmon started
</i>><i>         3. host power off
</i>><i>         4. phosphor-hwmon did not exit.
</i>><i>         5. cpu usage of hwmon-read would be 4%
</i>><i>
</i>><i> when host powerd off
</i>><i>         1. echo add > /sys/class/hwmon/hwmon0/uevent
</i>><i>         2. failed to start phosphor-hwmon.
</i>><i>
</i>><i> I found when phosphor-hwmon init
</i>><i>
</i>><i>    Sensor::addValue would read fan1_input(there is no fan1_fault in sysfs),
</i>><i>    and it caused read timedout unexpection.
</i>><i>
</i>><i>    so init failed.
</i>><i>
</i>><i> On my board,I  want to boot the bmc with phosphor-hwmon when host powered off.
</i>><i>
</i>><i> what should I do ?
</i>
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"
 </pre><div><span style="color:rgb(0,0,0);white-space:pre-wrap">EXTRA_OECONF_append = " --enable-negative-errno-on-fail"</span> </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Milton Miller II <<a href="mailto:miltonm@us.ibm.com">miltonm@us.ibm.com</a>> 於 2019年3月9日 週六 上午12:34寫道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On  03/06/2019 around 11:36PM in some timezone,  Deng Tyler wrote:<br>
<br>
>Hi Emily<br>
>    I found it hardcoded in phosphor-hwmon for different sensor type.<br>
>I think that scale value may be customized for more flexible to fit<br>
>custom platform. <br>
<br>
Assuming that the sensor is exposed though a kernel sysfs hwmon<br>
file, you should be looking to specify a gain for the file in sysfs instead.<br>
Many sense devices already support a scale in the device tree.<br>
<br>
><br>
>Tyler<br>
>Emily Shaffer <<a href="mailto:emilyshaffer@google.com" target="_blank">emilyshaffer@google.com</a>> 於 2019年3月7日 週四 下午1:22寫道:<br>
>Tyler,<br>
><br>
>Sorry that I forgot. Yes, the scale is hardcoded for certain sensor<br>
>types, ie voltage is always millivolts. I have asked about this<br>
>before but maybe someone else on the list can give a better answer<br>
>why that's the case.<br>
><br>
<br>
The Linux kernel hwmon API specifies the units for different sensors<br>
as they are exposed in sysfs.  Hence the hwmon to dbus bridge can<br>
hard code the unit for a given type of sensor.<br>
<br>
The hwmon API is documented at <br>
<a href="https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface" rel="noreferrer" target="_blank">https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface</a><br>
or <br>
<a href="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/hwmon/sysfs-interface" rel="noreferrer" target="_blank">https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/hwmon/sysfs-interface</a><br>
<br>
The above spec is linked as "HWMon interface" under the headings<br>
"D-BUS" then "Path Definitions" headings in<br>
<a href="https://github.com/openbmc/docs/blob/master/sensor-architecture.md" rel="noreferrer" target="_blank">https://github.com/openbmc/docs/blob/master/sensor-architecture.md</a><br>
<br>
milton<br>
<br>
Speaking for myself only.<br>
<br>
</blockquote></div>