History log of /openbmc/phosphor-fan-presence/json_config.hpp (Results 1 – 25 of 28)
Revision Date Author Comments
# dfddd648 16-Aug-2024 Patrick Williams <patrick@stwcx.xyz>

clang-format: re-format for clang-18

clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda forma

clang-format: re-format for clang-18

clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.

See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.

Change-Id: Ica590f8613f1fb89ab1ca676ac51c1cc7e38d67f
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...


# b99ce0ed 30-Nov-2023 Chau Ly <chaul@amperecomputing.com>

Use generic interface to look for configs

IBM has specific interface IBMCompatibleSystem to look for the
compatible system location under which the configs are placed. The
Entity Manager schema for

Use generic interface to look for configs

IBM has specific interface IBMCompatibleSystem to look for the
compatible system location under which the configs are placed. The
Entity Manager schema for the property under this interface and the
interface name itself can't be generic for other meta systems.
To find a more common interface, this should be the one that is probed
together with chassis and has its property value corresponding to
system's name.

This commit proposes the use of the property Names under the interface
xyz.openbmc_project.Inventory.Decorator.Compatible [1]. The property
can be configured in chassis's Entity Manager json configuration with
a list of one or more compatible system strings. The usage of this
interface was mentioned in document [2].

[1] https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/\
yaml/xyz/openbmc_project/Inventory/Decorator/Compatible.interface.yaml
[2] https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/\
yaml/xyz/openbmc_project/Software/README.md#compatibility

Tested in Ampere's Mt.Mitchell platform.

1. Configure the interface in Motherboard's Entity Manager config:
"xyz.openbmc_project.Inventory.Decorator.Compatible": {
"Names": ["com.ampere.Hardware.Chassis.Model.MtMitchell"]
}
2. Configs are already placed under
/usr/share/phosphor-fan-presence/<daemon>/\
com.ampere.Hardware.Chassis.Model.MtMitchell/
3. When Entity Manager config is probed:
$ busctl call -j xyz.openbmc_project.ObjectMapper \
/xyz/openbmc_project/object_mapper xyz.openbmc_project.ObjectMapper \
GetSubTreePaths sias / 0 1
xyz.openbmc_project.Inventory.Decorator.Compatible
{
"type": "a{sa{sas}}",
"data": [
[
"/xyz/openbmc_project/inventory/system/board/\
Mt_Mitchell_Motherboard" : {
"xyz.openbmc_project.EntityManager" : [
...
"xyz.openbmc_project.Inventory.Decorator.Compatible
]
}
]
]
}

$ busctl get-property xyz.openbmc_project.EntityManager \
/xyz/openbmc_project/inventory/system/board/Mt_Mitchell_Motherboard \
xyz.openbmc_project.Inventory.Decorator.Compatible Names
as 1 "com.ampere.Hardware.Chassis.Model.MtMitchell"
4. When phosphor-fan's daemon starts, it can successfully find
configs under the folder "com.ampere.Hardware.Chassis.Model.MtMitchell"

Signed-off-by: Chau Ly <chaul@amperecomputing.com>
Change-Id: I55107f1c2a78e78ba7cea650b8eaeaf4fd615d2b

show more ...


# 5e15c3ba 20-Oct-2023 Patrick Williams <patrick@stwcx.xyz>

clang-format: copy latest and re-format

clang-format-17 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest

clang-format: copy latest and re-format

clang-format-17 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.

Change-Id: I3e9e6350864ac267819a4b8d670bef7d3746976e
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...


# fbf4703f 17-Jul-2023 Patrick Williams <patrick@stwcx.xyz>

use std::format instead of fmt::format

The std::format is sufficient for the uses in this repository except
for in one file (override_fan_target.cpp, since P2286 isn't supported
by GCC yet). Switch

use std::format instead of fmt::format

The std::format is sufficient for the uses in this repository except
for in one file (override_fan_target.cpp, since P2286 isn't supported
by GCC yet). Switch to std::format whenever possible.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ib2576fb530a4d7ce238e1b0bd95b40b476ec2107

show more ...


# 61b73296 10-May-2023 Patrick Williams <patrick@stwcx.xyz>

clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest

clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.

Change-Id: I152f141a5e8343b92b5ce81d3ca16eec77b5606b
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...


# cb356d48 22-Jul-2022 Patrick Williams <patrick@stwcx.xyz>

sdbusplus: use shorter type aliases

The sdbusplus headers provide shortened aliases for many types.
Switch to using them to provide better code clarity and shorter
lines. Possible replacements are

sdbusplus: use shorter type aliases

The sdbusplus headers provide shortened aliases for many types.
Switch to using them to provide better code clarity and shorter
lines. Possible replacements are for:
* bus_t
* exception_t
* manager_t
* match_t
* message_t
* object_t
* slot_t

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I9029cc722e7712633c15436bd3868d8c3209f567

show more ...


# 808d7fe8 13-Jun-2022 Mike Capps <mikepcapps@gmail.com>

meson support: remove code warnings 1

This commit contains code changes necessary to support the increased
warning level from Meson builds. Most changes are for unused variables.

To keep the review

meson support: remove code warnings 1

This commit contains code changes necessary to support the increased
warning level from Meson builds. Most changes are for unused variables.

To keep the review size manageable, this commit contains only monitor
and presence changes (and top-level json_config.hpp).

Signed-off-by: Mike Capps <mikepcapps@gmail.com>
Change-Id: I7280b512c54e8d5aeba3300764a239f3dcbab14d

show more ...


# b4379a1e 11-Oct-2021 Mike Capps <mikepcapps@gmail.com>

Monitor : handle inventory service offline

Using nameHasOwner and nameOwnerChanged D-Bus signals, a callback is
activated when inventory is started.

There are two primary modes for operation: Compa

Monitor : handle inventory service offline

Using nameHasOwner and nameOwnerChanged D-Bus signals, a callback is
activated when inventory is started.

There are two primary modes for operation: Compatible Interfaces, the
inventory-detection callback will fail, however start() will be called a
second time after EntityManager starts and forces a reload of the proper
config for the machine type. Separately, if no EntityManager exists,
then the callback for Inventory-detection will succeed and use the
default configuration file.

To test: stop fan monitor and inventory services. start monitor, wait
10s, start Inventory, after about 15s you should see the online
detection.

Signed-off-by: Mike Capps <mikepcapps@gmail.com>
Change-Id: I289493a0aabb849abee8ce8de047513e94ee2219

show more ...


# d4c7fb7e 09-Nov-2021 Matt Spinler <spinler@us.ibm.com>

control: PCIe floors action

This action sets the PCIe floor index by looking up the highest floor
index of all the powered on PCIe cards that are recognized in the PCIe
card JSON files. If a PCIe c

control: PCIe floors action

This action sets the PCIe floor index by looking up the highest floor
index of all the powered on PCIe cards that are recognized in the PCIe
card JSON files. If a PCIe card has its own temperature sensor then it
doesn't provide a floor index. If a card isn't recognized then it's
just ignored as it isn't considered a hot card.

The class documentation contains additional details on how the action
behaves. It's JSON name is 'pcie_card_floors'.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I474916773476a6232d479119acb4ac2989909cb3

show more ...


# 3ea9ec2b 19-Nov-2021 Patrick Williams <patrick@stwcx.xyz>

sdbusplus: remove usage of deprecated alias

The alias `server::match` has been deprecated since 2016. Use the new
alias under bus.

Change-Id: I21baf6b70401d996519b5940d0cd68553

sdbusplus: remove usage of deprecated alias

The alias `server::match` has been deprecated since 2016. Use the new
alias under bus.

Change-Id: I21baf6b70401d996519b5940d0cd685535475a2f
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...


# ddb773b2 06-Oct-2021 Patrick Williams <patrick@stwcx.xyz>

catch exceptions as const

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Id1b5054d3147c39d98309bc11ed7016d6909e2a6


# 8d1193cb 14-Sep-2021 Matthew Barth <msbarth@us.ibm.com>

json: Handle compatible interface not existing yet

Catch the DBusMethodError exception that is thrown when the compatible
interface does not exist on any dbus object yet. When this occur

json: Handle compatible interface not existing yet

Catch the DBusMethodError exception that is thrown when the compatible
interface does not exist on any dbus object yet. When this occurs,
attempt to load the JSON config(s) from the override or default
locations, then wait for the interfacesAdded signal of the compatible
interface if still the JSON config(s) could not be found.

Change-Id: I3059e235b292818119523ed0fb219688141e39db
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>

show more ...


# 6eb603e8 01-Sep-2021 Matthew Barth <msbarth@us.ibm.com>

json: Use `NoConfigFound` exception when no config found

Throw a `NoConfigFound` exception when a JSON config that's not optional
is not found. This exception should be caught and loadin

json: Use `NoConfigFound` exception when no config found

Throw a `NoConfigFound` exception when a JSON config that's not optional
is not found. This exception should be caught and loading of the fan
app's configuration should wait for the compatible interfacesAdded
signal when the JSON config is not found in the override or default
locations.

Any other exceptions (i.e. JSON parsing exceptions) are not caught
during the parsing of those JSON config files by this `NoConfigFound`
exception.

Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Change-Id: I296a7a03c854459dc2439bed560511b6b819e4f7

show more ...


# 1689cb6c 27-Aug-2021 Matthew Barth <msbarth@us.ibm.com>

json: Remove extraneous try/catch

To mediate catching JSON parsing exception after the compatible
interface is already available an extraneous try/catch can be removed so
any JSON pa

json: Remove extraneous try/catch

To mediate catching JSON parsing exception after the compatible
interface is already available an extraneous try/catch can be removed so
any JSON parsing exceptions cause the fan apps to crash.

A follow up commit will better handle exceptions, such as JSON parsing
exceptions, in relation to catching and handling the exception thrown
when no config file is able to loaded (whether thru the compatible
interface or not).

Tested:
JSON exception not caught with compatible interface on dbus
Fan control waits for compatible interface when not on dbus and
JSON exception not caught after compatible interface appears on dbus

Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Change-Id: I683c7bb807319f7f0a175fd4c92e573c220bdec5

show more ...


# de72d5d1 16-Jul-2021 Matthew Barth <msbarth@us.ibm.com>

json: Enable ignoring `//` or `/* */` comments

The `basic_json::parse` method of nlohmann JSON allows for ignoring
comments within JSON files where it treats these comments as whitespace

json: Enable ignoring `//` or `/* */` comments

The `basic_json::parse` method of nlohmann JSON allows for ignoring
comments within JSON files where it treats these comments as whitespace.
This would be good to enable for the configuration files to be annotated
by users configuring the fan applications.

Change-Id: Ib8cd4b2d6d706e8469aa8ae522744a08bffb945f
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>

show more ...


# cde1beaa 21-Jun-2021 Matthew Barth <msbarth@us.ibm.com>

json: Remove unused JsonConfig object

Remove the unused JsonConfig constructor and associated functions and
variables.

Change-Id: Ib17c2611103bc71c39e753248397b00f01680f8d
S

json: Remove unused JsonConfig object

Remove the unused JsonConfig constructor and associated functions and
variables.

Change-Id: Ib17c2611103bc71c39e753248397b00f01680f8d
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>

show more ...


# 3770a1da 10-Jun-2021 Matthew Barth <msbarth@us.ibm.com>

control: Load config file(s) when available

Fan control's config file(s) are loaded when the fan control service
starts if found either in the override location, default location, or

control: Load config file(s) when available

Fan control's config file(s) are loaded when the fan control service
starts if found either in the override location, default location, or
the compatible interface is available. When the required config file(s)
are not found at startup, it waits to receive the interfacesAdded signal
that the compatible interface is available and then loads its config
file(s).

If at any point another interfacesAdded signal for the compatible
interface is received after successfully loading its config file(s),
this signal is ignored. So the only method to reload the config file(s)
is by providing the SIGHUP signal.

Change-Id: I14f93a684bb00a6a32f8cb228cbfb9ce3f022c92
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>

show more ...


# b370ab3b 10-Jun-2021 Matthew Barth <msbarth@us.ibm.com>

json: Add constructor for loading a fan app's config file(s)

Create a constructor that takes a void function from a fan app that is
called to have that fan app load its config file(s) if

json: Add constructor for loading a fan app's config file(s)

Create a constructor that takes a void function from a fan app that is
called to have that fan app load its config file(s) if the compatible
interface is found upon starting or after an intefacesAdded signal is
received. This will eventually replace the other constructor that's used
in a similar manner once all fan apps have been updated to use this
constructor.

Change-Id: I70a2d933b49f3c711a03cd2a8d555094e8449d17
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>

show more ...


# b67089bf 10-Jun-2021 Matthew Barth <msbarth@us.ibm.com>

json: Use a single list of compatible values

Create a single list of values set from the compatible interface when
getting a fan app's config file(s). Temporarily, populating this list i

json: Use a single list of compatible values

Create a single list of values set from the compatible interface when
getting a fan app's config file(s). Temporarily, populating this list is
needed for fan control until replaced with the use of a constructor that
will populate the list or subscribe to the interfacesAdded signal for
populating the list of compatible values.

Change-Id: I651185f233bc2388646325cb86806dd4c1d18317
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>

show more ...


# d80c8753 01-Jun-2021 Matthew Barth <msbarth@us.ibm.com>

Only load compatible interface objects once

Retrieve all the objects implementing the compatible interface once and
use that for each fan application's call to get its configuration

Only load compatible interface objects once

Retrieve all the objects implementing the compatible interface once and
use that for each fan application's call to get its configuration
file(s).

Change-Id: Ia1b502dda7443205e9abe807bd2bf56f0555b125
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>

show more ...


# 4031f106 22-Apr-2021 Matt Spinler <spinler@us.ibm.com>

json config: Trace when conf files can't be found

Add a trace to the journal when the IBMCompatibleSystem interface is
available but the JSON configuration file being looked for still ca

json config: Trace when conf files can't be found

Add a trace to the journal when the IBMCompatibleSystem interface is
available but the JSON configuration file being looked for still can't
be found.

This would indicate someone hasn't yet put the fan config files in the
driver for a particular system type.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I3caa223d8b5d56bfb903c7de06cdd3bc95a4b81a

show more ...


# 59850df3 06-Jan-2021 Matt Spinler <spinler@us.ibm.com>

monitor: Add ability to delay finding conf file

In the future, fan monitor will start as part of multi-user.target
starting, possibly before entity-manager starting. Since, when
con

monitor: Add ability to delay finding conf file

In the future, fan monitor will start as part of multi-user.target
starting, possibly before entity-manager starting. Since, when
configured to use JSON, an entity-manager provided D-Bus interface is
needed to find the config file, the code needs to be able to wait for
that to show up on D-Bus before starting monitoring.

This commit allows one to instantiate an instance of the JsonConfig
class, which before only had static methods. One of the arguments to
the constructor is a function to call when the config file is available.

The constructor will attempt to find the config file in the override and
default paths in the filesystem, followed by using the
IBMCompatibleSystem interface to build up the path to it. If a config
file with any of those paths exists, it will call the passed in function
right then, otherwise it will use an interfacesAdded D-Bus watch to wait
for the IBMCompatibleSystem interface to show up to try again.

Previously the code would check for a config file based on the
IBMCompatibleSystem data before looking for a default file, and this
commit swaps the order of that since only one of those should be there
anyway so it doesn't matter which is checked first.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I577b18df498f4d1526a9da83b3407cf55208419d

show more ...


# fcbdc0e4 28-Oct-2020 Matthew Barth <msbarth@us.ibm.com>

Support config location from compatible system interface

Update reading the `Names` property from the
`xyz.openbmc_project.Configuration.IBMCompatibleSystem` interface that
contains

Support config location from compatible system interface

Update reading the `Names` property from the
`xyz.openbmc_project.Configuration.IBMCompatibleSystem` interface that
contains a list of compatible subdirectories in priority order to find
the location of the configuration file to use. The first configuration
file found from checking these subdirectories is used. The order in
which configuration files are looked for remain unchanged and are:

1.) Override location: /etc/phosphor-fan-presence/[app]
2.) First config file found under one of these subdirectories
i.e.) `Names` = "rainier-2u" "rainier"
1.) /usr/share/phosphor-fan-presence/[app]/rainier-2u
2.) /usr/share/phosphor-fan-presence/[app]/rainier
3.) Default location: /usr/share/phosphor-fan-presence/[app]

Tested:
Verified location order above loads the expected config file

Change-Id: If6eb36e1a808544da0795db609658eb57db112c0
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>

show more ...


# 1826c730 28-Aug-2020 Matthew Barth <msbarth@us.ibm.com>

format: Include format lib and use on errors opening JSON files

Included the format library used to add more details to the journal
message without needing the verbose output and updated

format: Include format lib and use on errors opening JSON files

Included the format library used to add more details to the journal
message without needing the verbose output and updated the journal
logging when loading a JSON file. When loading a JSON file, now any
errors will produce a journal message atleast containing the JSON file
that failed to be loaded.

Tested:
Removed JSON configuration file and attempted to load it
Journal msg shows which JSON configuration file is loaded now
Failure to parse JSON shows file and exception in journal msg

Change-Id: I6bec9bb01d8e95c3dced467ea96163129c59619b
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>

show more ...


# a916f039 17-Aug-2020 Matthew Barth <msbarth@us.ibm.com>

Correct optional JSON config file check

Only clear the config file object when it does not exist and is
optional.

Change-Id: I13bc5a72ac353c0b16ff1557943189ddf1b928d3
Signed

Correct optional JSON config file check

Only clear the config file object when it does not exist and is
optional.

Change-Id: I13bc5a72ac353c0b16ff1557943189ddf1b928d3
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>

show more ...


12