summaryrefslogtreecommitdiffstats
path: root/sensor.cpp
Commit message (Collapse)AuthorAgeFilesLines
* use filesystem instead of experimentalPatrick Venture2019-03-111-2/+2
| | | | | | | | Use filesystem now that it should be available instead of experimental::filesystem. Change-Id: I62838b343ce34f85a47661f1eaaff3c7e6338bbf Signed-off-by: Patrick Venture <venture@google.com>
* sensor: set scale to 0 in constructorPatrick Venture2019-01-251-1/+1
| | | | | | | | The _scale member will not be used without ::addValue() being called first, however, initialize it regardless to 0. Change-Id: I712e9192500a8a58db03bcbbaf0f0d736f1dfd23 Signed-off-by: Patrick Venture <venture@google.com>
* sensor: add underscore prefix to membersPatrick Venture2019-01-091-30/+32
| | | | | | | Add underscore prefix to members for sensor object. Change-Id: I5b59f9f45cc20bd700940bc3b0e5d2d4127b333d Signed-off-by: Patrick Venture <venture@google.com>
* sensor: to enable testing receive hwmonio interface pointerPatrick Venture2018-12-191-7/+8
| | | | | | | | | The sensor objects all share a reference to the mainloop's ioAccess object. To enable testing, the sensor object needs to expect the base pointer to this object. Change-Id: I1d7f2841528776c8d4f1166e20874ddeb4b8554a Signed-off-by: Patrick Venture <venture@google.com>
* Make hwmon work with double or int64 interfaceJames Feist2018-10-221-3/+25
| | | | | | | | | | | | | | Deduce type based on interface using decltype and if it is double apply scale to the value. Tested-by: Noticed that on dbus using busctl and debug server that doubles were produced and scaled. Also verifed that hwmon still produced int64_t values when building with current phosphor-dbus-interfaces. Change-Id: I00e21d5ef0ea6cee0eb30baa0b39cde95e7f4a86 Signed-off-by: James Feist <james.feist@linux.intel.com>
* Remove old experimental includesWilliam A. Kennington III2018-10-181-3/+1
| | | | | | | | We are now using c++17 so we no longer need experimental optional and any. We can use the standard any and optional now. Change-Id: I88fcb4258c69ac5ad9766e2c65463c52a3b7f05f Signed-off-by: William A. Kennington III <wak@google.com>
* cleanup: reduced scope of variablesPatrick Venture2018-10-121-5/+5
| | | | | | | Cppcheck CI tool identified many variables whose scope could be reduced. Change-Id: I1478b5680adc560d08bc74ffc91929b1d19e24fa Signed-off-by: Patrick Venture <venture@google.com>
* Use gpioplus for specifying gpio gatingPatrick Venture2018-09-211-0/+38
| | | | | | | | | | | | | | | | | | | | | A GPIO can control whether a hwmon sensor is readable. This module allows one to specify whether a sensor is gated and by what GPIO. This is often the case for battery voltages, such that the battery isn't drained constantly by being left open. For each sensor where you need GPIO locking: GPIOCHIP_in1=0 GPIO_in1=53 such that GPIOCHIP is the gpiochip: /sys/bus/gpio/devices/gpiochip{id} such that GPIO is the line offset. the value used to unlock the sensor via gpio is 1 after 1 is written to the gpio, it pauses for 500ms Tested: Verified the failure case for invalid gpio fields. Verified correct behavior on two platforms. Change-Id: I2fa12848972075cad0e0f69c0bfa6382e15d4f50 Signed-off-by: Patrick Venture <venture@google.com>
* add .clang-formatPatrick Venture2018-08-311-54/+40
| | | | | Change-Id: I94ce26d595367e08d6fb3734535bcd855f1b1473 Signed-off-by: Patrick Venture <venture@google.com>
* Move sensor adjust within sensor objectMatthew Barth2018-06-041-1/+14
| | | | | | | | | | | | | All sensor adjustments should be contained within the sensor object for the sensor. This allows the adjustments to be retrieved for a given sensor and applied accordingly. Tested: No change in adjusting a sensor value No change in removing a sensor given a removal return code Change-Id: I5e1e40fe41b4064422a47178aec1f297b781566d Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Move value iface creation into sensor objectMatthew Barth2018-05-241-0/+115
| | | | | | | | | | | | Create the Sensor.Value interface for a sensor within the sensor object. Each sensor must have an input sysfs file to get a Value property on the Sensor.Value interface and be included by hwmon. Tested: No change in value interface creation for sensors Change-Id: I09b1c79142ba2a34424f5ec29f41d19a987c84e7 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Move status iface creation into sensor objectMatthew Barth2018-05-241-7/+7
| | | | | | | | | | | | | For sensors that have a status interface created with a functional property set according to its fault sysfs file value, the object associated with the sensor should contain the creation of this interface. Tested: No change in status interface creation for sensors Change-Id: Ic3c0a81c661ac481b90ad9bd4c8bf415dae3520e Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add sensor object frameworkMatthew Barth2018-05-221-0/+5
| | | | | | | | | | Create a sensor object to store sensor monitoring specifications. Tested: Sensor objects are created and stored for each sensor Change-Id: Idfa982f1bb8da888abbd473881870df4beec6824 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add status interface to sensorsMatthew Barth2018-04-271-0/+83
When a fault sysfs file is present for a sensor, the OperationalStatus interface is attached to the sensor object. The functional property is initially set to the corresponding value read from the fault sysfs file when the sensor object is created. A follow-up commit will address updating the functional property based on reading the fault sysfs file during the polling interval. Tested: OperationalStatus interface created for sensors with fault files Interface not created for sensors without fault file Functional property set to correct value from sensor's fault file Change-Id: Id75b3711d048d4667d2173a3255512cf5482ab67 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
OpenPOWER on IntegriCloud