commit | a588eafec450a1efcfd0d14b819f703e0e4e8d8d | [log] [tgz] |
---|---|---|
author | Adriana Kobylak <anoo@us.ibm.com> | Mon Sep 20 20:05:25 2021 +0000 |
committer | Adriana Kobylak <anoo@us.ibm.com> | Mon Oct 04 20:40:27 2021 +0000 |
tree | 5870d5846cf67a4e79097baf7ffa707bcabf7320 | |
parent | 4c88a4c2c0420735b737c8641c51b34d1cfbb0c3 [diff] |
psu-ng: Throw if gpio line is not found The find_line() API does not throw if errno is ENOENT and instead returns an empty line: https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/tree/bindings/cxx/chip.cpp?h=v1.6.x#n131 Add a throw if the line is empty to signal the caller that an error occurred, otherwise the caller won't know that the line is empty until a read() request returns an error, in which case is unknown if the read() failed because the line didn't exist or because of some other error. This change also serves as a test to determine if a gpio exists. For gpios that are not expected to exist on all systems, it can be determined at the time the gpio is constructed and avoid making read() calls to it that would be expected to fail. Tested: Tried to initialize a non-existent gpio and verified an exception was thrown: Oct 04 14:30:10 rain111bmc phosphor-psu-monitor[1744]: Failed to find line: Line does not exist: test-exception Oct 04 14:30:10 rain111bmc phosphor-psu-monitor[1744]: Line does not exist: test-exception Oct 04 14:30:10 rain111bmc systemd[1]: phosphor-psu-monitor.service: Main process exited, code=exited, status=254/n/a Oct 04 14:30:10 rain111bmc systemd[1]: phosphor-psu-monitor.service: Failed with result 'exit-code'. Change-Id: Ic48eec566f5fb6e15ea8f553744cbd33dc49ec69 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
This repository contains applications for configuring and monitoring devices that deliver power to the system.
To build all applications in this repository:
meson build ninja -C build
To clean the repository and remove all build output:
rm -rf build
You can specify meson options to customize the build process. For example, you can specify:
Several applications in this repository require a PSU JSON config to run. The JSON config file provides information for:
There is an example psu.json to describe the necessary configurations.
inventoryPMBusAccessType
defines the pmbus access type, which tells the service which sysfs type to use to read the attributes. The possible values are:/sys/bus/i2c/devices/3-0069/
/sys/bus/i2c/devices/3-0069/hwmon/hwmonX/
/sys/kernel/debug/pmbus/hwmonX/
/sys/kernel/debug/pmbus/hwmonX/cffps1/
fruConfigs
defines the mapping between the attribute file and the FRU inventory interface and property. The configuration example below indicates that the service will read part_number
attribute file from a directory specified by the above pmbus access type, and assign to PartNumber
property in xyz.openbmc_project.Inventory.Decorator.Asset
interface."fruConfigs": [ { "propertyName": "PartNumber", "fileName": "part_number", "interface": "xyz.openbmc_project.Inventory.Decorator.Asset" } ]
psuDevices
defines the kernel device dir for each PSU in inventory. The configuration example below indicates that powersupply0
's device is located in /sys/bus/i2c/devices/3-0069
."psuDevices": { "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" : "/sys/bus/i2c/devices/3-0069", }