commit | 190f6d06f563000eb0970d96247c453c00452933 | [log] [tgz] |
---|---|---|
author | Jiaqing Zhao <jiaqing.zhao@intel.com> | Sat May 21 23:26:15 2022 +0800 |
committer | Patrick Williams <patrick@stwcx.xyz> | Wed May 25 13:42:49 2022 +0000 |
tree | 60dfd10e4e3ed64a4d7a1b250801ae813f767ecc | |
parent | aedd2e2bb93b8b714d6c9fc3707ad5f9e8464447 [diff] |
Fix default ValidInput values for DBus configuration {Min,Max}ValidInput are optional properties defined in entity-manager schema, currently they are initialized to NaN by default, causing failure when comparing MinValidInput <= InputValue <= MaxValidInput in sensorInRange(). This patch fixes it by setting the default value to +/-NaN. Tested: Verified sensorInRange() no longer returns false when valid reading value is given and virtual sensor reading is successfully updated. Change-Id: If48a07eea95c8c971565e6e5ed429a1272ad824f Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
phosphor-virtual-sensor reads in virtual_sensor_config.json There are two types of data in this file:
See virtual_sensor_config.json in this repository for an example. Sensors added this way can use any expression that is accepted by exprtk.
For example:
{ "Desc": { "Config": "D-Bus", "Type": "ModifiedMedian" } }
Sensors added this way can only use a set of restricted calculations. At this stage the only type supported is modifiedMedian.
The virtual sensor configuration information needs to be added into the relevant hardware configuration file in entity-manager. This method of adding a virtual sensor allows a recipe that builds for different hardware configurations to have different virtual sensors for each configuration.
The virtual sensor configuration in entity manager follows a different format to the JSON in virtual_sensor_config.json (specified in entity-manager/schemas/VirtualSensor.json).