Sensor mutability interface

We proposed a ValueMutablity interface in
openbmc/phosphor-dbus-interfaces which was accepted here:
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-dbus-interfaces/+/36333

It follows the IPMI fashion, checking
the sensor mutability before writing sensor values. The sensor
mutability used to be hardcoded in the ipmi sensor map yaml file.

This provides feature parity with that old YAML hardcoded
"mutability: Mutability::Write|Mutability::Read" setting.

As an example of implementation within dbus-sensors, ExternalSensor
always sets Mutable to true, given its purpose of accepting sensor
writes from an external source. PwmSensor accepts the "Mutable"
parameter, from entity-manager configuration (aka JSON file). All
other sensors always set Mutable to false, but it would be
straightforward to add similar code, like what was done for
PwmSensor, when mutability is desired.

This parameter will be used by the IPMI server here:
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-host-ipmid/+/45407

There is currently no Redfish equivalent, although that would
be a welcome task for the future. This is not IPMI-specific,
as the Redfish server can also use this as a hint, as to whether
to allow read-write access, or merely to allow read-only access.

This is not to be confused with the "manufacturing mode" option, which
is designed for use during manufacturing test, hence its name. This
feature is designed for production, and is intended to allow just a
few sensors to be writable, without needing to make them all writable.

Tested:
DBus call on fan sensors with configurable tree mutability:
busctl introspect  xyz.openbmc_project.FanSensor /xyz/openbmc_project/sensors/fan_pwm/fan0
NAME                                        TYPE      SIGNATURE RESULT/VALUE                             FLAGS
...
xyz.openbmc_project.Sensor.Value            interface -         -                                        -
.MaxValue                                   property  x         100                                      emits-change
.MinValue                                   property  x         0                                        emits-change
.Unit                                       property  s         "xyz.openbmc_project.Sensor.Value.Uni... emits-change
.Value                                      property  d         42.7451                                  emits-change writable
xyz.openbmc_project.Sensor.ValueMutability  interface -         -                                        -
.Mutable                                    property  b         true                                     emits-change
...

DBus call on external sensors:
busctl introspect  xyz.openbmc_project.ExternalSensor /xyz/openbmc_project/sensors/tempera
NAME                                                  TYPE      SIGNATURE RESULT/VALUE                             FLAGS
...
xyz.openbmc_project.Sensor.Value                      interface -         -                                        -
.MaxValue                                             property  d         127                                      emits-change
.MinValue                                             property  d         -128                                     emits-change
.Unit                                                 property  s         "DegreesC"                               emits-change
.Value                                                property  d         nan                                      emits-change writable
xyz.openbmc_project.Sensor.ValueMutability            interface -         -                                        -
.Mutable                                              property  b         true                                     emits-change
...

The ValueMutability interface, with "Mutable", is correctly created.

Signed-off-by: Jie Yang <jjy@google.com>
Change-Id: Ifa1cb51bb55cd6f00d2a2f79e9064d1a51354b06
Signed-off-by: Josh Lehan <krellan@google.com>
14 files changed
tree: 871d4632fcc593861e4d35512552d49265f664fd
  1. include/
  2. service_files/
  3. src/
  4. subprojects/
  5. tests/
  6. .clang-format
  7. .clang-ignore
  8. .clang-tidy
  9. .gitignore
  10. Jenkinsfile
  11. LICENSE
  12. MAINTAINERS
  13. meson.build
  14. meson_options.txt
  15. OWNERS
  16. 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