ExternalSensor: Further refinements

Further refinements, learned after more testing.

Moved the writeHook lambda out of the ExternalSensor constructor,
and into separate initWriteHook() function, to reduce the bloat of
an already extremely large argument list to the constructor,
and solve a nasty gotcha regarding enable_shared_from_this usage:

https://stackoverflow.com/a/63579750/3063879

Adding a few more useful debugging messages, to be printed when
debugging is enabled (set the "debug" constants to true).

Tested: Interrupted external source of data, values changed to NaN
as expected. Resumed external source, values changed from NaN to the
correctly updated values. Timer durations appear correct. Also sent
many configuration change messages, forcing sensor objects to be
reconstructed. No errors noted during processing, even when messages
sent quickly, and also with random delays, and left to run a while.

To check sensor data value:

busctl --no-pager introspect xyz.openbmc_project.ExternalSensor \
 /xyz/openbmc_project/sensors/temperature/mysensor \
 xyz.openbmc_project.Sensor.Value

To send a configuration change message:

dbus-send --system \
/xyz/openbmc_project/inventory/system/board/myboard/mysensor \
x.x.x.PropertiesChanged \
string:xyz.openbmc_project.Configuration.ExternalSensor

Change-Id: I7bd515fed8ddf391df3fabadab61321a446c1b9f
Signed-off-by: Josh Lehan <krellan@google.com>
3 files changed
tree: efccc21d342563f6a745bb4fb953ac5eab99f362
  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