Regression fix: use pwm number from configuration

pwm number is specified in fan sensor configuration
Use this number to construct pwm fs path that is used
to create pwm sensor. No pwm sensor is created if pwm
field is not specified in configuration.

This fixes the regression introduced in the below CL, which
incorrectly assume pwm* and fan*_input always use the same
index number.

commit 77b3add2db57918b3f425ca6e147e9505563b867
Author: Yong Zhao <yozhao@google.com>
Date:   Sat Jan 9 04:25:18 2021 +0000

    Fan: Optimize the pwm sensor creation


Tested:
pwm sensors are successfully created and mapped with the
following configuration:
(note: number in configuration is zero based)
{
            "Name": "System Fan connector 7",
            "Pwm": 12,
            "Tachs": [
                6
            ],
            "Type": "IntelFanConnector"
        },

ipmitool sensor output
Pwm 13           | 49.784     | unspecified | ok    | na        | na        | na        | na        | na        | na
Fan 7            | 12382.000  | RPM        | ok    | na        | 1722.000  | 1968.000  | na        | na        | na

Signed-off-by: Zhikui Ren <zhikui.ren@intel.com>
Signed-off-by: Yong Zhao <yozhao@google.com>
Change-Id: Ie5b44317285378a3e59951deeacd35108c71500d
1 file changed
tree: 0dc1bfe2794ce80281ffdf7b6005d542b2822508
  1. include/
  2. service_files/
  3. src/
  4. tests/
  5. .clang-format
  6. .clang-ignore
  7. .clang-tidy
  8. .gitignore
  9. Jenkinsfile
  10. LICENSE
  11. MAINTAINERS
  12. meson.build
  13. meson_options.txt
  14. README.md
README.md

dbus-sensors

dbus-sensors is a collection of sensor applications that provide the xyz.openbmc_project.Sensor collection of interfaces. They read sensor values from hwmon, d-bus, or direct driver access to provide readings. Some advance non-sensor features such as fan presence, pwm control, and automatic cpu detection (x86) are also supported.

key features

  • runtime re-configurable from d-bus (entity-manager or the like)

  • isolated: each sensor type is isolated into its own daemon, so a bug in one sensor is unlikely to affect another, and single sensor modifications are possible

  • async single-threaded: uses sdbusplus/asio bindings

  • multiple data inputs: hwmon, d-bus, direct driver access