hwmontemp: add labels attribute support

Adds Labels support to Hwmontemp. The behavior is meant to be identical
 to the behavior of Labels from PSUSensors.

Labels has the following behavior:
When discovering Name, Name1...NameX attributes from the configuration
and an associated temp is found
If tempX_label exists and its contents is in the Labels attribute then
create the sensor
If tempX_label does not exist but tempX is in the Labels attribute then
create the sensor
If Labels attribute is not present or is an empty list then create the
sensor

Tested:
Had a simple , publically available MAX6581 sensor that has
temp1, temp2, temp3, temp4, temp5
and tested with
Labels = ["temp1", "temp2", "temp3", "temp4", "temp5"]
       ├─/xyz/openbmc_project/sensors/temperature/max6581_1
        ├─/xyz/openbmc_project/sensors/temperature/max6581_2
        ├─/xyz/openbmc_project/sensors/temperature/max6581_3
        ├─/xyz/openbmc_project/sensors/temperature/max6581_4
        ├─/xyz/openbmc_project/sensors/temperature/max6581_5
Labels omitted
       ├─/xyz/openbmc_project/sensors/temperature/max6581_1
       ├─/xyz/openbmc_project/sensors/temperature/max6581_2
       ├─/xyz/openbmc_project/sensors/temperature/max6581_3
       ├─/xyz/openbmc_project/sensors/temperature/max6581_4
       ├─/xyz/openbmc_project/sensors/temperature/max6581_5

Labels containing temp2,temp5
Results:
       ├─/xyz/openbmc_project/sensors/temperature/max6581_2
       ├─/xyz/openbmc_project/sensors/temperature/max6581_5

And a similar test with a device that has temperature labels
                "Labels": [
                    "device_label_A",
                    "device_label_B",
                    "device_label_C"
                ],

        ├─/xyz/openbmc_project/sensors/temperature/device1_label_A
        ├─/xyz/openbmc_project/sensors/temperature/device1_label_B
        ├─/xyz/openbmc_project/sensors/temperature/device1_label_C

Signed-off-by: Jason Ling <jasonling@google.com>
Change-Id: I6cb9edb0c7ae68fe01663d4ee1be0070715e9f82
3 files changed
tree: fc91c8559339207130b4004920e5f9f94492a53a
  1. cmake/
  2. include/
  3. service_files/
  4. src/
  5. tests/
  6. .clang-format
  7. .clang-ignore
  8. .gitignore
  9. cmake-format.json
  10. CMakeLists.txt
  11. Jenkinsfile
  12. LICENSE
  13. MAINTAINERS
  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