commit | af7321ebf1e68c842487782a366abcf683fcd292 | [log] [tgz] |
---|---|---|
author | Matt Spinler <spinler@us.ibm.com> | Tue Sep 16 13:01:21 2025 -0500 |
committer | Matt Spinler <spinler@us.ibm.com> | Tue Sep 16 13:10:22 2025 -0500 |
tree | 20bc2c6b3269901b470fa43f6cea55ef41487c51 | |
parent | 9ed0f38e1d59564106c6020b854416ece6753776 [diff] |
pmbus: Safely call std::filesystem::canonical() There are a few different places where CALLOUT_DEVICE_PATH elog metadata is used that passes in the result of a std::filesystem::canonical() call. That function will throw if the path passed in does not exist. Since that code isn't in a try/catch block, the application will crash. Fix that by using the version of the function that sets a std::error_code in an output parameter to indicate failure. If it does fail, then just use the original path given to it. As canonical() was used for a reason, there may be side affects such as proper error analysis not being done, but there is not much that can be done about that. Tested: The app doesn't crash, and can see: ``` Failed to read sysfs file errno=2 FILENAME=/sys/kernel/debug/pmbus/status0 Could not get canonical path from /sys/bus/i2c/devices/3-006a Failed to read from the device. ``` And in the event log ``` "CALLOUT_DEVICE_PATH" "/sys/bus/i2c/devices/3-006a" ``` Change-Id: I9ea374dc685cc325b40a1f2bb0c8ae0ce71df650 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
This repository contains applications for configuring and monitoring devices that deliver power to the system.
Actively-maintained applications:
Legacy applications:
To build all applications in this repository:
meson setup 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/<driver>.<instance>/
/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", }