History log of /openbmc/phosphor-hwmon/mainloop.cpp (Results 1 – 25 of 119)
Revision Date Author Comments
# 64129937 13-Feb-2024 Patrick Williams <patrick@stwcx.xyz>

prefer std::format over fmt

Since C++20, std::format has existed so prefer that. For the single
fmt::print call we can use stdplus::print until GCC supports the std
one.

Signed-off-by: Patrick Wil

prefer std::format over fmt

Since C++20, std::format has existed so prefer that. For the single
fmt::print call we can use stdplus::print until GCC supports the std
one.

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

show more ...


# 47fb49ac 19-Oct-2023 Lakshmi Yadlapati <lakshmiy@us.ibm.com>

sensor: Implement sensor "PRIORITY"

This commit introduces the `xyz.openbmc_project.Common.Priority`
interface to define the priority of sensors. If a sensor's priority
attribute is specified, this

sensor: Implement sensor "PRIORITY"

This commit introduces the `xyz.openbmc_project.Common.Priority`
interface to define the priority of sensors. If a sensor's priority
attribute is specified, this interface is created with the 'priority'
attribute. However, if the priority attribute is not specified, this
interface is not created.

The `xyz.openbmc_project.Common.Priority` interface is used to indicate
the priority level of fan sensors. It provides information about
primary and secondary RPM sensors for dual rotor fans, allowing for a
more specific description of the sensor's priority.

phosphor-dbus-interfaces commit:
https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/66779

Tested: Build phosphor-hwmon successfully

'''
1. Retrieve the priority level of the secondary sensor

busctl introspect xyz.openbmc_project.Hwmon-xxx .Hwmon1 \
/xyz/openbmc_project/sensors/fan_tach/fan1_1 xyz.openbmc_project.Common.Priority

NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.Priority property u 1 emits-change writable

2. If the "PRIORITY" is not specified in the sensor's configuration file

busctl introspect xyz.openbmc_project.Hwmon-xxx .Hwmon1 \
/xyz/openbmc_project/sensors/fan_tach/fan1_0 xyz.openbmc_project.Common.Priority
NAME TYPE SIGNATURE RESULT/VALUE FLAGS

3. Change the sensor priority

busctl set-property xyz.openbmc_project.Hwmon-xxx.Hwmon1 \
/xyz/openbmc_project/sensors/fan_tach/fan1_1 xyz.openbmc_project.Common.Priority \
Priority u 0

busctl introspect xyz.openbmc_project.Hwmon-xxx .Hwmon1 \
/xyz/openbmc_project/sensors/fan_tach/fan1_1 xyz.openbmc_project.Common.Priority
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.Priority property u 0 emits-change writable
'''

Change-Id: I7a226cf105756bc32e04f6724428d93e84dfb72a
Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>

show more ...


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

show more ...


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

show more ...


# c9d61613 12-Oct-2022 George Liu <liuxiwei@inspur.com>

sensor: Implement sensor "ACCURACY"

Support the accuracy attribute of the sensor. Since the latest
Redfish spec needs to support the accuracy attribute of the sensor,
extend the configuration file s

sensor: Implement sensor "ACCURACY"

Support the accuracy attribute of the sensor. Since the latest
Redfish spec needs to support the accuracy attribute of the sensor,
extend the configuration file syntax to support the accuracy value,
read the value and publish it to the new D-Bus Accuracy interface.

Also, This function will be synchronized to the dbus sensors repo in
the future.

Tested: Build phosphor-hwmon successfully
eg: The configuration accuracy in power supply is 1
~# busctl get-property xyz.openbmc_project.Hwmon-xxx.Hwmon1
/xyz/openbmc_project/sensors/power/ps0_input_power
xyz.openbmc_project.Sensor.Accuracy Accuracy
d 1

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Idd0159b75a7506001cf886f4ae8a22dbd38b1135

show more ...


# ad6043f6 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: I86dfa77a53a306b0e868eeb82de30b270704c455

show more ...


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

build: switch to C++20

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


# 6d50c3e9 09-Aug-2019 Brandon Kim <brandonkim@google.com>

sensor: Implement sensor "ASYNC_READ_TIMEOUT"

This change will prevent sensors from blocking all other sensor reads
and D-Bus if they do not report failures quickly enough.

If "

sensor: Implement sensor "ASYNC_READ_TIMEOUT"

This change will prevent sensors from blocking all other sensor reads
and D-Bus if they do not report failures quickly enough.

If "ASYNC_READ_TIMEOUT" environment variable is defined in the
sensor's config file for a key_type, the sensor read will be
asynchronous with timeout set in milliseconds.

For example for "sensor1":
ASYNC_READ_TIMEOUT_sensor1="1000" // Timeout will be set to 1 sec

If the read times out, the sensor read will be skipped and the
sensor's functional property will be set to 'false'. Timed out futures
will be placed in a map to prevent their destructor from running and
blocking until the read completes (limitation of std::async).

Tested: This patch has been running downstream for over a year to
solve a slow I2C sensor reads causing IPMI slowdown.

Change-Id: I3d9ed4d5c9cc87d3196fc281451834f3001d0b48
Signed-off-by: Brandon Kim <brandonkim@google.com>

show more ...


# d46d0818 03-Feb-2021 Anton D. Kachalov <gmouse@google.com>

Add sensor instance id command line argument.

Introduce `-i|--sensor-id` flag to explicitly set sensor
suffix for dbus name.

Sample usage:

phosphor-hwmon-readd -i te

Add sensor instance id command line argument.

Introduce `-i|--sensor-id` flag to explicitly set sensor
suffix for dbus name.

Sample usage:

phosphor-hwmon-readd -i test_sensor_id -o /apb/...

Will register the service with the following busname:

xyz.openbmc_project.Hwmon-test_sensor_id.Hwmon1

This change required as a part of privilege separation work:
https://github.com/openbmc/openbmc/issues/3383

Signed-off-by: Anton D. Kachalov <gmouse@google.com>
Change-Id: I48ff9c3efe0edb84718ff8f695e7e932af5445de

show more ...


# d8cacfd4 26-Apr-2021 Matt Spinler <spinler@us.ibm.com>

Change #ifdef to #if after move to meson

Unlike with autotools, meson options negative-errno-on-fail and
update-functional-on-fail are written to the generated config.h file
regardle

Change #ifdef to #if after move to meson

Unlike with autotools, meson options negative-errno-on-fail and
update-functional-on-fail are written to the generated config.h file
regardless of if they are enabled are not, such as

#define NEGATIVE_ERRNO_ON_FAIL 1
and
#define NEGATIVE_ERRNO_ON_FAIL 0

That means the code that checks the values needs to be an #if and not an

The bitbake recipe has now switched over to building with meson, so
right now openbmc master may not be building with the correct options
depending on how these are set in the various bbappends.

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

show more ...


# 73769099 14-Apr-2021 Duke Du <Duke.Du@quantatw.com>

Send high/low alarm signal when sensor reading exceeds threshold

The change to the xyz.openbmc_project.Sensor.Threshold.Warning and
xyz.openbmc_project.Sensor.Threshold.Critical interfac

Send high/low alarm signal when sensor reading exceeds threshold

The change to the xyz.openbmc_project.Sensor.Threshold.Warning and
xyz.openbmc_project.Sensor.Threshold.Critical interface that add
the new signals WarningHighAlarmAsserted, WarningHighAlarmDeasserted,
WarningLowAlarmAsserted, WarningLowAlarmDeasserted,
CriticalHighAlarmAsserted, CriticalHighAlarmDeasserted,
CriticalLowAlarmAsserted and CriticalLowAlarmDeasserted.

When sensor reading exceeds the threshold, hwmon would send the signal
with the sensor reading value at that time.

Tested:
Use dbus-monitor command to check the signal is captured, when hwmon
send signals.

Signed-off-by: Duke Du <Duke.Du@quantatw.com>
Change-Id: Ibf050b8bcff128cf77fd103c6d2bd1f30700b27b

show more ...


# 6a391de4 08-Jul-2020 Matt Spinler <spinler@us.ibm.com>

Print the errno from a fail in the journal

When a file access fails, print the errno of the failure in the same
journal entry the filename is already printed.

Signed-off-by: Mat

Print the errno from a fail in the journal

When a file access fails, print the errno of the failure in the same
journal entry the filename is already printed.

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

show more ...


# ecac0ae2 08-Jul-2020 Matt Spinler <spinler@us.ibm.com>

Fixes for when sensor value is a double

The change to the xyz.openbmc_project.Sensor.Value interface that moves
the Value property to a double from an int64_t has merged, which
uncov

Fixes for when sensor value is a double

The change to the xyz.openbmc_project.Sensor.Value interface that moves
the Value property to a double from an int64_t has merged, which
uncovered some problems in the code that was trying to detect the type
and handle it accordingly.

This does remove support for the Scale property on the Value interface,
as meson CI won't even compile with it since the double version of it is
empty and so the function has unused parameters, which meson doesn't
like.

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

show more ...


# 5e034afc 24-Jun-2020 Matt Spinler <spinler@us.ibm.com>

Print the failing filename in the journal msg

Instead of hiding the name of the file that had the failed access in the
journal metadata, put it in the journal message so debug is easier.

Print the failing filename in the journal msg

Instead of hiding the name of the file that had the failed access in the
journal metadata, put it in the journal message so debug is easier.

Uses the fmt library.

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

show more ...


# 94a04c4e 21-Aug-2019 Kun Yi <kunyi731@gmail.com>

Suppress clang-format on one case

Newer version of clang-format will format this pair of braces differently
than clang-format-8, which is the version used in upstream CI. Turn off
cl

Suppress clang-format on one case

Newer version of clang-format will format this pair of braces differently
than clang-format-8, which is the version used in upstream CI. Turn off
clang-format to avoid a clang version update in CI breaking us.
Difference shown below.

```

Change-Id: I1633522f0c028af3cfd395bb143a5ea00410648e
--- a/mainloop.cpp (clang 8.0)
+++ b/mainloop.cpp (clang 10.0)
@@ -80,8 +80,7 @@ void updateSensorInterfaces(InterfaceMap& ifaces, int64_t value)
{
switch (iface.first)
{
- case InterfaceType::VALUE:
- {
+ case InterfaceType::VALUE: {
```

Signed-off-by: Kun Yi <kunyi731@gmail.com>
Change-Id: I1339a10173a4632decbe1be6c4d7ab8a397a9f38

show more ...


# 9bbe6026 01-Aug-2019 Carol Wang <wangkair@cn.ibm.com>

Support averaging power values

Support new env variables 'AVERAGE_power* = "true"' in hwmon config file.
When this env variable is set, power value is the calculated average value.
O

Support averaging power values

Support new env variables 'AVERAGE_power* = "true"' in hwmon config file.
When this env variable is set, power value is the calculated average value.
Otherwise, power value is from power*_input by default.
The new average of power is calculated since the last time the sensor's
values were changed and read.

average =
(cur_average*cur_average_interval - pre_average*pre_average_interval) /
(cur_average_interval - pre_average_interval)

hwmon config example:
AVERAGE_power2 = "true"
AVERAGE_power3 = "true"
AVERAGE_power4 = "true"

Tested: Set AVERAGE_power* in p0 OCC hwmon conf but not in p1 OCC hwmon conf,
then get power sensor info with restapi to check the values.
1. The values of p0*power are all average values.
2. The values of p1*power are all input values.

Note:
Delete $(CODE_COVERAGE_CPPFLAGS) in AM_CPPFLAGS in test/Makefile.am.
This option will define NDEBUG during configuration, then assert in
code doesn't work.

Resolves: openbmc/openbmc#3187
Signed-off-by: Carol Wang <wangkair@cn.ibm.com>
Change-Id: I8d97a7b2905c79cd4f2c276b32e7f5590ffc0483

show more ...


# 2227bd52 19-Jun-2019 William A. Kennington III <wak@google.com>

sensor: Replace GpioLock with stdplus RAII helper

The old RAII helper was not move safe, although it was never moved in
the current code so it didn't have any effect on runtime safety.

sensor: Replace GpioLock with stdplus RAII helper

The old RAII helper was not move safe, although it was never moved in
the current code so it didn't have any effect on runtime safety.

Change-Id: Ica19ed7e60d699d86d0166b356cedb82e4a28b61
Signed-off-by: William A. Kennington III <wak@google.com>

show more ...


# 501ade24 15-Jul-2019 Kun Yi <kunyi731@gmail.com>

[cleanup] mainloop: simplify with structured bindings

This somewhat avoids cryptic names when looping through maps. Still
doesn't help with type checking which can be fixed later.

[cleanup] mainloop: simplify with structured bindings

This somewhat avoids cryptic names when looping through maps. Still
doesn't help with type checking which can be fixed later.

Signed-off-by: Kun Yi <kunyi731@gmail.com>
Change-Id: Iee69605211580e2f95005480bae2812ef1bc0d09

show more ...


# 553552c4 16-Jul-2019 Kun Yi <kunyi731@gmail.com>

[cleanup] mainloop: continue early

Do an early continue if hwmon input attr file is not there, which would
save one nested loop.

Signed-off-by: Kun Yi <kunyi731@gmail.com>
C

[cleanup] mainloop: continue early

Do an early continue if hwmon input attr file is not there, which would
save one nested loop.

Signed-off-by: Kun Yi <kunyi731@gmail.com>
Change-Id: I03795240355f96503d62aaf267f168862c298bba

show more ...


# 79205b2c 20-Jun-2019 Brandon Kim <brandonkim@google.com>

sensor: Add UPDATE_FUNCTIONAL_ON_FAIL and its behavior

Add the build switch UPDATE_FUNCTIONAL_ON_FAIL. When enabled, sensor
read failures will not exit the mainloop. Instead, mainloop wi

sensor: Add UPDATE_FUNCTIONAL_ON_FAIL and its behavior

Add the build switch UPDATE_FUNCTIONAL_ON_FAIL. When enabled, sensor
read failures will not exit the mainloop. Instead, mainloop will update
the Functional property and skip the read of that sensor.

This will skip the "Remove RCs" check during value interface creation in
MainLoop::getObject. However, it will perform the "Remove RCs" checks
during MainLoop::read.

Tested: I was able to use busctl to read the Functional property of a
custom driver to test with UPDATE_FUNCTIONAL_ON_FAIL defined.
1. Negative values were reported, Functional was true
2. Sensor reporting errors had stale values, Functional was set to false

Resolves: openbmc/phosphor-hwmon#10
Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: I0984dad12250e9587ec36de2f9212de0b0e1cda6

show more ...


# 0892c3fb 27-Jun-2019 Patrick Venture <venture@google.com>

drop remove_from_dbus_on_fail option

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I8af40d0db98c2d995542cbc46821b0f6cf602de0


# feb744a7 26-Jun-2019 Patrick Venture <venture@google.com>

mainloop: move out the interface update method

Move the interface update method out of the read() loop.

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I430d20ded

mainloop: move out the interface update method

Move the interface update method out of the read() loop.

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I430d20ded4efd89c691eff368d005791f0138929

show more ...


# 1fc55df8 26-Jun-2019 Patrick Venture <venture@google.com>

mainloop: delete unused local empty pointer instances

Delete local variables that are not used.

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I1e805ac7d474ac9b2

mainloop: delete unused local empty pointer instances

Delete local variables that are not used.

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I1e805ac7d474ac9b2bc4dd89ec4a9b166bf067a2

show more ...


# 86dcac85 18-Jun-2019 Brandon Kim <brandonkim@google.com>

sensor: Always add status interface, track fault file with class member

Always add the status interface regardless of whether there is a
fault file or not and update the functional prope

sensor: Always add status interface, track fault file with class member

Always add the status interface regardless of whether there is a
fault file or not and update the functional property accordingly.

Added a new sensor class member to track the presence of fault file.

Resolves: openbmc/phosphor-hwmon#10
Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: I4480541691ccfa853d85151965428c564db8ba52

show more ...


# 16805a6a 21-Jun-2019 Patrick Venture <venture@google.com>

mainloop: Make HwmonIO injectable dependency

HwmonIO was make into a interface object implementation. This patch
transitions mainloop to receive a pointer to this interface to allow for

mainloop: Make HwmonIO injectable dependency

HwmonIO was make into a interface object implementation. This patch
transitions mainloop to receive a pointer to this interface to allow for
injection testing.

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Iaa470fafccb42c4d7fbabac0dc92f96c8075faf2

show more ...


12345