James Feist | 2a408b9 | 2019-01-31 10:02:07 -0800 | [diff] [blame] | 1 | # dbus-sensors |
| 2 | |
| 3 | dbus-sensors is a collection of sensor applications that provide the |
| 4 | xyz.openbmc_project.Sensor collection of interfaces. They read sensor values |
| 5 | from hwmon, d-bus, or direct driver access to provide readings. Some advance |
| 6 | non-sensor features such as fan presence, pwm control, and automatic cpu |
| 7 | detection (x86) are also supported. |
| 8 | |
| 9 | ## key features |
| 10 | |
Patrick Williams | 1e38425 | 2022-12-08 06:12:58 -0600 | [diff] [blame] | 11 | - runtime re-configurable from d-bus (entity-manager or the like) |
James Feist | 2a408b9 | 2019-01-31 10:02:07 -0800 | [diff] [blame] | 12 | |
Patrick Williams | 1e38425 | 2022-12-08 06:12:58 -0600 | [diff] [blame] | 13 | - isolated: each sensor type is isolated into its own daemon, so a bug in one |
| 14 | sensor is unlikely to affect another, and single sensor modifications are |
| 15 | possible |
James Feist | 2a408b9 | 2019-01-31 10:02:07 -0800 | [diff] [blame] | 16 | |
Patrick Williams | 1e38425 | 2022-12-08 06:12:58 -0600 | [diff] [blame] | 17 | - async single-threaded: uses sdbusplus/asio bindings |
James Feist | 2a408b9 | 2019-01-31 10:02:07 -0800 | [diff] [blame] | 18 | |
Patrick Williams | 1e38425 | 2022-12-08 06:12:58 -0600 | [diff] [blame] | 19 | - multiple data inputs: hwmon, d-bus, direct driver access |
Josh Lehan | 0947d7c | 2021-03-30 15:04:22 -0700 | [diff] [blame] | 20 | |
Zhikui Ren | e1a18f3 | 2021-11-05 14:47:40 -0700 | [diff] [blame] | 21 | ## dbus interfaces |
| 22 | |
| 23 | A typical dbus-sensors object support the following dbus interfaces: |
| 24 | |
| 25 | ``` |
| 26 | Path /xyz/openbmc_project/sensors/<type>/<sensor_name> |
| 27 | |
| 28 | Interfaces xyz.openbmc_project.Sensor.Value |
| 29 | xyz.openbmc_project.Sensor.Threshold.Critical |
| 30 | xyz.openbmc_project.Sensor.Threshold.Warning |
| 31 | xyz.openbmc_project.State.Decorator.Availability |
| 32 | xyz.openbmc_project.State.Decorator.OperationalStatus |
| 33 | xyz.openbmc_project.Association.Definitions |
| 34 | |
| 35 | ``` |
Zhikui Ren | e1a18f3 | 2021-11-05 14:47:40 -0700 | [diff] [blame] | 36 | |
Patrick Williams | 1e38425 | 2022-12-08 06:12:58 -0600 | [diff] [blame] | 37 | Sensor interfaces collection are described |
| 38 | [here](https://github.com/openbmc/phosphor-dbus-interfaces/tree/master/yaml/xyz/openbmc_project/Sensor). |
| 39 | |
| 40 | Consumer examples of these interfaces are |
| 41 | [Redfish](https://github.com/openbmc/bmcweb/blob/master/redfish-core/lib/sensors.hpp), |
| 42 | [Phosphor-Pid-Control](https://github.com/openbmc/phosphor-pid-control), |
| 43 | [IPMI SDR](https://github.com/openbmc/phosphor-host-ipmid/blob/master/dbus-sdr/sensorcommands.cpp). |
| 44 | |
Zhikui Ren | e1a18f3 | 2021-11-05 14:47:40 -0700 | [diff] [blame] | 45 | ## Reactor |
Patrick Williams | 1e38425 | 2022-12-08 06:12:58 -0600 | [diff] [blame] | 46 | |
Zhikui Ren | e1a18f3 | 2021-11-05 14:47:40 -0700 | [diff] [blame] | 47 | dbus-sensor daemons are [reactors](https://github.com/openbmc/entity-manager) |
Patrick Williams | 1e38425 | 2022-12-08 06:12:58 -0600 | [diff] [blame] | 48 | that dynamically create and update sensors configuration when system |
| 49 | configuration gets updated. |
Zhikui Ren | e1a18f3 | 2021-11-05 14:47:40 -0700 | [diff] [blame] | 50 | |
Patrick Williams | 1e38425 | 2022-12-08 06:12:58 -0600 | [diff] [blame] | 51 | Using asio timers and async calls, dbus-sensor daemons read sensor values and |
| 52 | check thresholds periodically. PropertiesChanged signals will be broadcasted for |
| 53 | other services to consume when value or threshold status change. OperationStatus |
| 54 | is set to false if the sensor is determined to be faulty. |
Zhikui Ren | e1a18f3 | 2021-11-05 14:47:40 -0700 | [diff] [blame] | 55 | |
Patrick Williams | 1e38425 | 2022-12-08 06:12:58 -0600 | [diff] [blame] | 56 | A simple sensor example can be found |
| 57 | [here](https://github.com/openbmc/entity-manager/blob/master/docs/my_first_sensors.md). |
Zhikui Ren | e1a18f3 | 2021-11-05 14:47:40 -0700 | [diff] [blame] | 58 | |
| 59 | ## configuration |
Patrick Williams | 1e38425 | 2022-12-08 06:12:58 -0600 | [diff] [blame] | 60 | |
| 61 | Sensor devices are described using Exposes records in configuration file. Name |
| 62 | and Type fields are required. Different sensor types have different fields. |
| 63 | Refer to entity manager |
| 64 | [schema](https://github.com/openbmc/entity-manager/blob/master/schemas/legacy.json) |
| 65 | for complete list. |
| 66 | |
Josh Lehan | 0947d7c | 2021-03-30 15:04:22 -0700 | [diff] [blame] | 67 | ## sensor documentation |
| 68 | |
Patrick Williams | 1e38425 | 2022-12-08 06:12:58 -0600 | [diff] [blame] | 69 | - [ExternalSensor](https://github.com/openbmc/docs/blob/master/designs/external-sensor.md) |
| 70 | virtual sensor |