openbmc / phosphor-pid-control

OpenBMC PID-based Thermal Control Daemon
Apache License 2.0
16 stars 21 forks source link

Passive D-Bus sensor built from json got incorrectly scaled #14

Closed kunyi731 closed 5 years ago

kunyi731 commented 5 years ago

D-Bus passive fan sensors read over D-Bus are meant to be scaled only if MinValue/MaxValue properties present in the sensor D-Bus object. However if they are built from json, they will inherit the "min=0, max=255" PWM min/max values.

processFans read fan0 returns 64.9059 read fan1 returns 16551 read fan2 returns 16458 read fan4 returns 64.9059 read fan5 returns 64.9059 read fan6 returns 64.9059 read fan3 returns 71.3569

for example, in this case the fan sensor has min = 0, max = 255,

the RPM is 16551, and then the scaled value is

16551 / (255 - 0) = 64.9

due to https://github.com/openbmc/phosphor-pid-control/blob/98b704e179f12d987179fe6b0ea6234d1bace48f/dbus/dbuspassive.cpp#L167

This is a meaningless value and made the PID loop almost didn't respond at all.

Instead, sensors built from json should only set min/max to [0, 255] if it's the write interface, and leave the read interface min/max to be inherited from D-Bus.