HwmonTempSensor: Thresholds for multi-temp devices

This commit adds support to be able to create the Threshold interfaces
for the additional temperature sensors on multi-sensor devices.
Previously, there could only be a threshold on the first sensor on
the device.  In some sensors, such as the TMP401 family, the remote
sensors which can be wired to other devices are the temp2+_input
values and it's likely those remote values are the interesting ones,
as opposed to just the local temp in temp1_input.

To specify thresholds for multiple sensors on the device, the 'Index'
property is added to the entity-manager JSON for the sensor.  When the
index is present, code matches that threshold entry with the sensor that
has an input file with that index number in the tempX prefix.  For
example, Index = 2 would be used for the sensor that has temp2_input as
the sensor value file.

Example JSON is:

    {
        "Index": 1 // This threshold is for the temp1_input sensor
        "Direction": "greater than",
        "Name": "upper critical",
        "Severity": 1,
        "Value": 70,
    },
    {
        "Index": 2 // This threshold is for the temp2_input sensor
        "Direction": "greater than",
        "Name": "upper critical",
        "Severity": 1,
        "Value": 80,
    }

If 'Index' is not present in the threshold data from entity-manager,
then just the first sensor will get the threshold, the same as before.

Tested:
Made sensors for a TMP423 which provides 4 temperature values.  Verified
thresholds showed up on each sensor when 'Index' was used.  Verified
when less then 4 thresholds were specified that they were placed
appropriately.  Also used just a single Threshold entry with no Index
value and verified the threshold just showed up on the first sensor.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: If787364761647088174cb72006727ee4e1d9225f
3 files changed
tree: ad9607a652f1d815d7ac955523879e2988f3b3e7
  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

sensor documentation