History log of /openbmc/dbus-sensors/src/Utils.cpp (Results 1 – 25 of 67)
Revision Date Author Comments
# 556e04b8 01-Feb-2025 Patrick Williams <patrick@stwcx.xyz>

clang-format: update latest spec and reformat

Copy the latest format file from the docs repository and apply.

Change-Id: I81aff1005be025ddb4405f384513c8e5e20bf6f4
Signed-off-by: Patrick Williams <p

clang-format: update latest spec and reformat

Copy the latest format file from the docs repository and apply.

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

show more ...


# 2e466967 30-Jan-2025 Ed Tanous <ed@tanous.net>

Deprecate std::filesystem namespace include

Clang-tidy is complaining about our using fs = ... directives. These
were originally added to handle boost::filesystem vs
std::experimental::filesystem v

Deprecate std::filesystem namespace include

Clang-tidy is complaining about our using fs = ... directives. These
were originally added to handle boost::filesystem vs
std::experimental::filesystem vs std::filesystem between the various
compilers. Now that we're all on std::filesystem, this redefinition can
be removed.

```
ChassisIntrusionSensor.hpp:11:11: error: namespace alias decl 'fs' is unused [misc-unused-alias-decls,-warnings-as-errors]
11 | namespace fs = std::filesystem;
```

Tested: code compiles

Change-Id: If4b968ff9cceb4038f526321d3c7c11563ffbce9
Signed-off-by: Ed Tanous <etanous@nvidia.com>

show more ...


# 2aaf7175 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: Ib7af6345a7b9e858700bd81645fe87d9d7e9d0fb
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...


# eacbfdd1 04-Apr-2024 Ed Tanous <ed@tanous.net>

Enable misc-include-cleaner

Change-Id: I22099a0f95b2eb884dec7d95cee0bdd0c159fd1f
Signed-off-by: Ed Tanous <ed@tanous.net>


# 9142343b 04-Apr-2024 Ed Tanous <ed@tanous.net>

Enable cppcoreguidelines-rvalue-reference-param-not-moved

and fix the one failure.

Change-Id: I62ddb9e3520b4f16331f605441740da5831ade51
Signed-off-by: Ed Tanous <ed@tanous.net>


# 201a1015 03-Apr-2024 Ed Tanous <ed@tanous.net>

Add modernize-redundant-void-arg

Enable this check and fix the failures.

Change-Id: I89b13daf1161be40564367562bb9c8c0c459e1d0
Signed-off-by: Ed Tanous <ed@tanous.net>


# 16d6f17b 28-Jan-2024 George Liu <liuxiwei@ieisystem.com>

Utils: Remove unused getSensorConfiguration method

Since dbus sensor only uses the getSensorConfiguration method with the
`useCache` parameter, this patch removes the getSensorConfiguration
method t

Utils: Remove unused getSensorConfiguration method

Since dbus sensor only uses the getSensorConfiguration method with the
`useCache` parameter, this patch removes the getSensorConfiguration
method that does not use the `useCache` parameter.

Tested: built dbus-sensors successfully and it works fine with this
patch.

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I1730df517e115de0625cfcca561f08af1d053b46

show more ...


# 278e177f 11-Dec-2023 Tom Tung <shes050117@gmail.com>

HwmonTempMain: revert the type of bus and address back to uint64_t

In I546e967abae7c0fb9fca645867e3037046037647, the type of bus and
address in HwmonTempMain were updated to size_t.

However, in som

HwmonTempMain: revert the type of bus and address back to uint64_t

In I546e967abae7c0fb9fca645867e3037046037647, the type of bus and
address in HwmonTempMain were updated to size_t.

However, in some systems using i3c, the device name is composed by bus
number and the provisioned ID [1]. The provisioned ID is a 48-bit value
(MIPI I3C Basic, v1.1.1, section 5.1.4.1.1), which is greater than the
range of size_t on e.g. 32-bit ARM platforms. Thus, reverting the type
back to uint64_t.

[1] Linux in-turn uses this Provisioned ID to identify the device, and
exposes the Provisioned ID in the device name:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/i3c/master.c?h=v6.6#n1521

Tested:
- added unit test passed.
- can read temperature of the i3c devices from our system.

Change-Id: I6f0e73aaf5f8d28e4bdedbe85646373463f6707f
Signed-off-by: Tom Tung <shes050117@gmail.com>

show more ...


# 597e8423 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: I73acd9daf41b52bcc3f6af9a1c38c5f162ae76b2
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...


# e98adf5b 11-Oct-2023 Andrew Jeffery <andrew@codeconstruct.com.au>

Utils: Include charconv to fix std::from_chars_result failure

Building `dbus-sensors` outside of a bitbake environment I see the
following:

```
../src/Utils.cpp: In function ‘bool getDeviceBusAddr(

Utils: Include charconv to fix std::from_chars_result failure

Building `dbus-sensors` outside of a bitbake environment I see the
following:

```
../src/Utils.cpp: In function ‘bool getDeviceBusAddr(const std::string&, size_t&, size_t&)’:
../src/Utils.cpp:865:10: error: ‘from_chars_result’ is not a member of ‘std’
865 | std::from_chars_result res{};
| ^~~~~~~~~~~~~~~~~
../src/Utils.cpp:866:5: error: ‘res’ was not declared in this scope
866 | res = std::from_chars(&*busStr.begin(), &*busStr.end(), bus);
| ^~~
../src/Utils.cpp:866:16: error: ‘from_chars’ is not a member of ‘std’
866 | res = std::from_chars(&*busStr.begin(), &*busStr.end(), bus);
| ^~~~~~~~~~
../src/Utils.cpp:872:16: error: ‘from_chars’ is not a member of ‘std’
872 | res = std::from_chars(&*addrStr.begin(), &*addrStr.end(), addr, 16);
| ^~~~~~~~~~
```

Include charconv to define the type.

Change-Id: I0e1aab8707f97f3acc3076fa8304dbafb27711de
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# 03d333e0 23-Aug-2023 Akshit Shah <shahakshit@google.com>

dbus-sensors: utils: Utility to get device bus & addr from dev name.

This is applicable to all the services which rely on "bus-addr" fmt.
1. FanSensor
2. HwmonTempSensor
3. IntelCPUSensor
4. PSUSens

dbus-sensors: utils: Utility to get device bus & addr from dev name.

This is applicable to all the services which rely on "bus-addr" fmt.
1. FanSensor
2. HwmonTempSensor
3. IntelCPUSensor
4. PSUSensor

In addition this would also fix Fansensor Daemon crashes due to
stoi() exceptions weren't caught earlier.

For example: In a FanSensor Daemon -
Device of f0103000.pwm-fan-controller would be classified as i2cfan
based on new way of defining fan type.
Hence when we parse string for bus-addr, bus=f0103000.pwm and
addr=fan-controller for which stoi() would crash.
This would be true for all non I2c devices defaulting to I2cFan type.

Solution is to use 'std::from_chars' which handles under/overflow
properly. Centralizing this now in Utils would also allow us to manage
this appropriatelty across various services.

Tested:
Tested sanity of all daemons in the system and they work as expected.

Change-Id: I546e967abae7c0fb9fca645867e3037046037647
Signed-off-by: Akshit Shah <shahakshit@google.com>

show more ...


# 8a28bf11 17-Oct-2022 Shounak Mitra <shounak@google.com>

dbus-sensors: Associate PSU sensors correctly

PSUSensors associate sensors with the inventory item that defined its
config in EM. It also needs to associate the sensor with the containing
chassis. T

dbus-sensors: Associate PSU sensors correctly

PSUSensors associate sensors with the inventory item that defined its
config in EM. It also needs to associate the sensor with the containing
chassis. Today, it associates the sensor with the object that defined
the config *and* with any all objects that implement Inventory.System.
In the situation where the sensor is defined in a PowerSupply
configuration, this works because the PowerSupply itself is not a
chassis. As a result, the "chassis" <-> "all_sensors" association
pointing to the power supply inventory object is ignored. However, if
the power supply is itself a chassis, this sensor is now associated with
at least two different chassis, which results in it showing up in two
different Redfish resources in bmcweb (the defining chassis and the
system chassis).

This change uses the defining object as the chassis if it is actually a
chassis or board (i.e. represented as a Redfish Chassis resource). If it
is not, it uses the system chassis. This will not work correctly if
there is more than one chassis which also implements Inventory.System,
but we presently assume that there is only one system in a number of
places. This should be fixed when we add support for multiple Systems.

Tested: Sensors on PSUs that are also chassis have a single "chassis"
association:

busctl get-property \
xyz.openbmc_project.PSUSensor \
/xyz/openbmc_project/sensors/power/hotswap_in_Input_Power \
xyz.openbmc_project.Association.Definitions Associations
a(sss) 2 "inventory" "sensors" "/xyz/openbmc_project/inventory/system/board/psu_chassis" "chassis" "all_sensors" "/xyz/openbmc_project/inventory/system/board/psu_chassis"

Changed PSU to PowerSupply type:
busctl get-property \
xyz.openbmc_project.PSUSensor \
/xyz/openbmc_project/sensors/power/hotswap_in_Input_Power \
xyz.openbmc_project.Association.Definitions Associations
a(sss) 2 "inventory" "sensors" "/xyz/openbmc_project/inventory/system/powersupply/psu_chassis" "chassis" "all_sensors" "/xyz/openbmc_project/inventory/system/board/mainboard"

Change-Id: I8a9e4191c427b441d96f0ab53ba59825eccee997
Signed-off-by: Shounak Mitra <shounak@google.com>

show more ...


# e73bd0a1 24-Jan-2023 Andrew Jeffery <andrew@aj.id.au>

sensors: Align source structure away from anti-patterns

The anti-patterns document comments on source structure, specifically
on placing internal headers in a parallel subtree[1]. dbus-sensors is an

sensors: Align source structure away from anti-patterns

The anti-patterns document comments on source structure, specifically
on placing internal headers in a parallel subtree[1]. dbus-sensors is an
example of violating this anti-pattern, so fix it.

[1]: https://github.com/openbmc/docs/blob/master/anti-patterns.md#placing-internal-headers-in-a-parallel-subtree

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I50ecaddd53fa9c9b7a0441af9de5e60bd94e47c6

show more ...


# 6db8aae4 03-Oct-2022 Thu Nguyen <thu@os.amperecomputing.com>

Support value "ChassisOn" for "powerState" option

There are some sensors need to be read when the chassis power is On
regardless the boot state of host. Even when the host is failed to
boot the valu

Support value "ChassisOn" for "powerState" option

There are some sensors need to be read when the chassis power is On
regardless the boot state of host. Even when the host is failed to
boot the values of these sensors can be used to debug the failure in
power rails.
The current code of dbus-sensors only supports the values "On",
"BiosPost" and "Always" for "powerState" option which can not used
for these kinds of sensors.
This commit adds "ChassisOn" value for "powerState" sensor option.
This value will be used for sensors which will only be read when the
CurrentPowerState is On.

Tested:
1. Add setting PowerState="ChassisOn" to some sensors.
2. Force the CurrentPowerState to
xyz.openbmc_project.State.Chassis.PowerState.Off.
3. The value D-Bus properties of those sensors should be nan.
4. Force the CurrentPowerState to
xyz.openbmc_project.State.Chassis.PowerState.On.
5. The value D-Bus properties of those sensors should be the real
sensor values.

Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com>
Change-Id: Icdb9d9cf1ac77c891113fa9b69b33b8bfdb082f7

show more ...


# 2c5a1f2d 05-Oct-2022 JeffLin <JeffLin2@quantatw.com>

Change EM's ObjectManager path

In newest Openbmc version, intelcpusensor will send error log:
intelcpusensor[2634]: While calling GetManagedObjects on
service:xyz.openbmc_project.EntityManager excep

Change EM's ObjectManager path

In newest Openbmc version, intelcpusensor will send error log:
intelcpusensor[2634]: While calling GetManagedObjects on
service:xyz.openbmc_project.EntityManager exception
name:org.freedesktop.DBus.Error.UnknownObjectand
description:Unknown object '/'. was thrown/.

After PR https://gerrit.openbmc.org/c/openbmc/entity-manager/+/57279
merged into Openbmc master, dbus path of "GetManagedObjects" is changed.

Refs:
https://gerrit.openbmc.org/c/openbmc/entity-manager/+/57279
https://gerrit.openbmc.org/c/openbmc/dbus-sensors/+/57291

Tested:
Check ADC, Hwmon, PSU and IntelCPU snesor works good with no
GetManagedObjects error.

Signed-off-by: JeffLin <JeffLin2@quantatw.com>
Change-Id: I9c4d9109377d5210fdd941efc051fa7021b40bd9

show more ...


# dabd48dd 03-Aug-2022 Zev Weiss <zev@bewilderbeest.net>

Add device-management infrastructure

We're moving toward having dbus-sensors take over sensor device
lifecycle management from entity-manager; this code (loosely based on
entity-manager's include/de

Add device-management infrastructure

We're moving toward having dbus-sensors take over sensor device
lifecycle management from entity-manager; this code (loosely based on
entity-manager's include/devices.hpp and src/overlay.cpp) provides some
general-purpose utilities for instantiating and destroying devices.

This also includes a variant of setupPropertiesChangedMatches() taking
an I2CDeviceTypeMap instead of a span of C strings, so that we can
support both existing sensor daemons and ones that get converted to use
that instead of the simple string arrays they currently employ.

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Change-Id: I39fcd0de2c70cd58b4d132cdcae5f82319732dbb

show more ...


# 054aad8f 18-Aug-2022 Zev Weiss <zev@bewilderbeest.net>

Remove Configuration interface prefix from utils APIs

This eliminates some repetitive verbosity from daemons that handle a lot
of different sensor types (such as hwmontempsensor and psusensor). It

Remove Configuration interface prefix from utils APIs

This eliminates some repetitive verbosity from daemons that handle a lot
of different sensor types (such as hwmontempsensor and psusensor). It
also positions us to more cleanly use a single data structure for both
existing APIs like GetSensorConfiguration() and
setupPropertiesChangedMatches(), as well as upcoming I2C
device-management support.

Tested: hwmontempsensor and adcsensor on romed8hm3 continue to behave as
they did previously.

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Change-Id: I9d80475ca4160c8d2ff0afab942709496d51238d

show more ...


# 79d8aef4 17-Aug-2022 Zev Weiss <zev@bewilderbeest.net>

Utils: simplify control flow in getSensorConfiguration()

The bool flag variables were only used for control flow that can be
expressed much more directly; let's do that instead. (Also removing a
re

Utils: simplify control flow in getSensorConfiguration()

The bool flag variables were only used for control flow that can be
expressed much more directly; let's do that instead. (Also removing a
redundant log message in the GetManagedObjects failure case.)

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Change-Id: Idb05b37dc7c7fe937f787507392554253d6b625c

show more ...


# 6c106d66 17-Aug-2022 Zev Weiss <zev@bewilderbeest.net>

Replace boost string predicate functions with stdlib ones

Now that we're on C++20 we no longer need boost for starts_with() and
ends_with() tests.

Also remove the predicate.hpp #include from files

Replace boost string predicate functions with stdlib ones

Now that we're on C++20 we no longer need boost for starts_with() and
ends_with() tests.

Also remove the predicate.hpp #include from files that weren't actually
using anything from it.

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Change-Id: Id68a019d5108a4646eb9b5fd18af33d60617e048

show more ...


# fd3d5f7e 12-Aug-2022 Zev Weiss <zev@bewilderbeest.net>

Utils: Replace iterator pairs with structured bindings

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Change-Id: Idc780ccf9ce1404aa5fde14b8ebe5e7f089f0f36


# 214d9717 12-Aug-2022 Zev Weiss <zev@bewilderbeest.net>

Refactor PropertiesChanged handler setup

Most sensor daemons had pretty much the same duplicated open-coded
pattern for setting up PropertiesChanged signal matches; introduce a
helper function to re

Refactor PropertiesChanged handler setup

Most sensor daemons had pretty much the same duplicated open-coded
pattern for setting up PropertiesChanged signal matches; introduce a
helper function to reduce the duplication and make things more readable.

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Change-Id: I803a21eea2f6d7fc71b50d54bb8fd57a104f3349

show more ...


# 88cb29d2 08-May-2022 Zev Weiss <zev@bewilderbeest.net>

Utils: add optional callback for power state changes

Some systems require sensors to be instantiated and destroyed on host
power state transitions; this plumbing provides infrastructure for
dbus-sen

Utils: add optional callback for power state changes

Some systems require sensors to be instantiated and destroyed on host
power state transitions; this plumbing provides infrastructure for
dbus-sensors daemons to be notified on power state changes so they can
respond appropriately.

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Change-Id: I2fc24c91e6d62bb3da71928ef0761760cc90e75f

show more ...


# 92f8f515 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: Ieb6587e32446a758676f67d9c868289cc02e50bf

show more ...


# 2049bd26 09-Jul-2022 Ed Tanous <edtanous@google.com>

Clang-tidy-14 fixes

Do as the robot commands. All changes made automatically by tidy.

Tested: (Thanks Zhikui)
Downloaded and run on system. Sensors scan normally.

Signed-off-by: Ed Tanous <edtan

Clang-tidy-14 fixes

Do as the robot commands. All changes made automatically by tidy.

Tested: (Thanks Zhikui)
Downloaded and run on system. Sensors scan normally.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I752f37c9e7a95aa3be8e6980ba6e4b2b48b3395a

show more ...


# bb67932a 16-May-2022 Ed Tanous <edtanous@google.com>

Apply LambdaBodyIndentation to dbus-sensors

Per the transform being done in bmcweb, do the same for dbus-sensors.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: If21489607759f3cdf20fad17

Apply LambdaBodyIndentation to dbus-sensors

Per the transform being done in bmcweb, do the same for dbus-sensors.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: If21489607759f3cdf20fad17eede50fb4e228e5e

show more ...


123