summaryrefslogtreecommitdiffstats
path: root/env.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Support indirections other than just "label"Matt Spinler2018-05-071-1/+2
| | | | | | | | | | | | | | | | | | | The current code only allowed the MODE_<type><Num> env var to be "label" when doing DBus naming indirection. Add support to allow it to be anything, and then use that value to do the lookup. For example, if MODE_temp1 = "foo", then the code will read the temp1_foo file to find the value to append to LABEL to find the DBus object name. So if temp1_foo contained a 42, then the code will use the LABEL_temp42 var to find the object name. Tested: Test on the OpenPower OCC device which use 'label' and now 'function_id' for the indirections. Change-Id: I1f3115a2d37d008efca74748ac7eff8434d8320a Signed-off-by: Matt Spinler <spinler@us.ibm.com>
* move calls to cstdlib::getenv to env::getEnvPatrick Venture2018-04-181-7/+7
| | | | | | | | | | | | | | Wrapped the cstdlib::getenv() call into env::getEnv so that it can be tested by mocking the env namespace, by just dropping in test_env.cpp which implements those methods and tying them a singleton upon which we can set expectations. Note: regardless of the approach taken to mock this, wrapping this method is a good fix. Change-Id: I65d22da08fc3dd76e6860f728c54e6c847ed07de Signed-off-by: Patrick Venture <venture@google.com>
* move getEnv methods into env namespacePatrick Venture2018-04-181-0/+4
| | | | | | | | Move the getEnv(...) methods into the env namespace, for consistency. Change-Id: I4055d9456c17f8b20071cdee1b8e531c10fb0c7e Signed-off-by: Patrick Venture <venture@google.com>
* Add fan pwm interface targetPatrick Venture2018-02-011-2/+2
| | | | | | | | | | | | | | The current daemon only supports RPM-based fan control, whereas the hwmon interface for PWM is often present. This implements the Fan Control PWM dbus interface. This CL is not the complete solution, but if mixed with a follow-on CL that does this, I think it'll be ideal. For instance, this assumes the pwm number matches, whereas the other CL lets you specify the corresponding PWM target for the fan. Change-Id: I23aaa0619cdefba0a004ac0d26dc6b928e78f1e8 Signed-off-by: Patrick Venture <venture@google.com>
* Remove getIndirectLabelEnvMatt Spinler2017-10-171-41/+0
| | | | | | | It is no longer used. Change-Id: I4713fbd9232dfeed045125cbb827b4fe98c53717 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
* Add getIndirectID functionMatt Spinler2017-10-171-0/+28
| | | | | | | | | | | | | This function will look up the sensor ID for a sensor when it is specified in a label file in hwmon sysfs. This functionality was previously all contained in getIndirectlLabelEnv(). A future commit will remove this function entirely and just use getIndirectID() and getEnv() to look up the label for the indirect case. Change-Id: Ifeb636eb0e58a6204f782f64e9aba839b812a967 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
* Add another version of getEnvMatt Spinler2017-10-171-0/+9
| | | | | | | | The new version takes the type and ID parameters separately as opposed to together in a key_type. Change-Id: I7796e8e6d680ffb640028e91eb3dcc8e7d99bc2e Signed-off-by: Matt Spinler <spinler@us.ibm.com>
* Add a level of indirection when naming the DBUS objectsTom Joseph2017-06-141-1/+44
| | | | | | | | | | | | The current design ignores the itemX_label sysfs attribute, if the environment variable is populated with the MODE_itemX="label", then fetch the label from itemX_label file.The actual label for the dbus object is fetched from the environment variable LABEL_item<label>. Resolves openbmc/openbmc#1633 Change-Id: I0d4baaa91073dd5db75ac62277d78ad9b3065e64 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* Add configuration discovery helper methodBrad Bishop2017-01-171-0/+40
Sensor configuration is passed to the application via the enviroment. Create a map of environment values for a given sensor. Change-Id: I8369eda27798fd9472166e898b8d6166c6997392 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
OpenPOWER on IntegriCloud