ADCSensor: Add PollRate and fix PowerState Always

    If set "PowerState" as "On" then there will create the handler to
check the host state is running or not. However, "PowerState" with
default "always" will not create the handler and cause ADCSensor crashed
by function isPowerOn when calling function checkThresholdsPowerDelay.
    For example, in our platform, we have only one ADCSensor which is
for p3v battery and need to be updated once per day.

Tested:
Test the threshold low/high for the following test case by using
"busctl set-property" to trigger threshold event and checking the
time in "ipmitool sel elist".
1. one sensor with PowerState is Always:
   When trigger low threshold it will delay 5 seconds to assert
   threshold event and the service is still alive.
   When trigger high threshold it will immediately assert the threshold
   event.
2. one sensor with other PowerState("On","BiosPost") will have the same
   behavior with case 1.

Test the following polling time by adding log in function updateValue:
PollRate not write in configuration: polling time is 0.5 sec.
PollRate with zero (value 0): polling time is 0.5 sec.
PollRate with negative value (value -1.0): polling time is 0.5 sec.
PollRate with positive value (value 2.0): polling time is 2.0 sec.

Signed-off-by: Jeff Lin <JeffLin2@quantatw.com>
Change-Id: I9044dd3b3844161721134f30a4de3229602a9172
5 files changed
tree: 6507f79f84c6c47cabc57d4afb9b273868688564
  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