History log of /openbmc/phosphor-hwmon/sensor.cpp (Results 1 – 25 of 33)
Revision Date Author Comments
# 02e598ab 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: Iabfeec3ff53427c317ef9c0b5bf06326ab9a1e17
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...


# 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 ...


# 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 ...


# d273b1e0 30-Mar-2022 Patrick Williams <patrick@stwcx.xyz>

sdbusplus: object: don't use 'bool' argument constructor

`sdbusplus::server::object_t` has long had an enum-based parameter for
signal action, but maintained a backwards compatible boolean mapping.

sdbusplus: object: don't use 'bool' argument constructor

`sdbusplus::server::object_t` has long had an enum-based parameter for
signal action, but maintained a backwards compatible boolean mapping.
It is time to remove this boolean to make it more observable which
actions are being used in applications. Map all `true` occurrences to
`action::defer_emit` or `action::emit_no_signals` as appropriate.

- Value: defer_emit (primary object)
- Others: emit_no_signals (secondary objects)

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

show more ...


# 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 "ASYNC_READ_TIMEOUT"

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 ...


# 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
regardless of if they ar

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 ...


# 7ab1b25b 22-Jul-2020 Matt Spinler <spinler@us.ibm.com>

Fix applying sensor scale on first read

In Sensor::addValue(), the adjustValue() function was being called
before the _scale member was getting set. So until the first interval
timer expired the se

Fix applying sensor scale on first read

In Sensor::addValue(), the adjustValue() function was being called
before the _scale member was getting set. So until the first interval
timer expired the sensor value would be unscaled. For example it could
show a temperature of 27000.0 instead of 27.0.

To fix this, reorder the code so that first _scale would get set, then
the sensor value would get adjusted based on _scale, and finally the
value could be set on the Value interface.

Tested:
Use a big INTERVAL config value so that I can check the first read of a
sensor does leave it unscaled. Then test with fix and check that it
is correct.

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

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: Matt Spinler <spinler@u

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
uncovered some proble

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.

Uses the f

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 ...


# 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.

Change-Id: I

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 ...


# 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 will update
th

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 ...


# 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 property accordin

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 ...


# 3ebaa3e6 21-Jun-2019 Patrick Venture <venture@google.com>

sensor: remove redundant condition

[sensor.cpp:147]: (style) Redundant condition: statusIface.
'!statusIface || (statusIface && statusIface->functional())' is
equivalent to '!statusIface || statusIf

sensor: remove redundant condition

[sensor.cpp:147]: (style) Redundant condition: statusIface.
'!statusIface || (statusIface && statusIface->functional())' is
equivalent to '!statusIface || statusIface->functional()'

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

show more ...


# 6206723d 19-Jun-2019 Patrick Venture <venture@google.com>

rename Object type to InterfaceMap

Rename the Object type to InterfaceMap to give it a less opaque name.
The word object is somewhat overloaded.

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

rename Object type to InterfaceMap

Rename the Object type to InterfaceMap to give it a less opaque name.
The word object is somewhat overloaded.

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

show more ...


# db76d49c 17-Jun-2019 Brandon Kim <brandonkim@google.com>

sensor: Implement RAII object for GPIO unlock and lock

There is a bug where GPIO lock may not be called if there is an
exception after GPIO unlock. Adding an RAII object for GPIO lock
and replacing

sensor: Implement RAII object for GPIO unlock and lock

There is a bug where GPIO lock may not be called if there is an
exception after GPIO unlock. Adding an RAII object for GPIO lock
and replacing the current usage of gpioUnlock, gpioLock in
sensor.cpp and mainloop.cpp.

Bug: openbmc/phosphor-hwmon#11
Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: Ica094e716a6ff9dc99165651f83fc496d5ed5a17

show more ...


# 9e997b4d 08-Mar-2019 Patrick Venture <venture@google.com>

use filesystem instead of experimental

Use filesystem now that it should be available instead of
experimental::filesystem.

Change-Id: I62838b343ce34f85a47661f1eaaff3c7e6338bbf
Signed-off-by: Patric

use filesystem instead of experimental

Use filesystem now that it should be available instead of
experimental::filesystem.

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

show more ...


# e9764ff4 24-Jan-2019 Patrick Venture <venture@google.com>

sensor: set scale to 0 in constructor

The _scale member will not be used without ::addValue() being called
first, however, initialize it regardless to 0.

Change-Id: I712e9192500a8a58db03bcbbaf0f0d7

sensor: set scale to 0 in constructor

The _scale member will not be used without ::addValue() being called
first, however, initialize it regardless to 0.

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

show more ...


# 12659aa1 19-Dec-2018 Patrick Venture <venture@google.com>

sensor: add underscore prefix to members

Add underscore prefix to members for sensor object.

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


# 2864b063 19-Dec-2018 Patrick Venture <venture@google.com>

sensor: to enable testing receive hwmonio interface pointer

The sensor objects all share a reference to the mainloop's ioAccess
object. To enable testing, the sensor object needs to expect the base

sensor: to enable testing receive hwmonio interface pointer

The sensor objects all share a reference to the mainloop's ioAccess
object. To enable testing, the sensor object needs to expect the base
pointer to this object.

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

show more ...


# ee73f5bd 01-Aug-2018 James Feist <james.feist@linux.intel.com>

Make hwmon work with double or int64 interface

Deduce type based on interface using decltype
and if it is double apply scale to the value.

Tested-by: Noticed that on dbus using busctl and debug
ser

Make hwmon work with double or int64 interface

Deduce type based on interface using decltype
and if it is double apply scale to the value.

Tested-by: Noticed that on dbus using busctl and debug
server that doubles were produced and scaled.

Also verifed that hwmon still produced int64_t values when
building with current phosphor-dbus-interfaces.

Change-Id: I00e21d5ef0ea6cee0eb30baa0b39cde95e7f4a86
Signed-off-by: James Feist <james.feist@linux.intel.com>

show more ...


# 4cbdfef2 18-Oct-2018 William A. Kennington III <wak@google.com>

Remove old experimental includes

We are now using c++17 so we no longer need experimental optional and
any. We can use the standard any and optional now.

Change-Id: I88fcb4258c69ac5ad9766e2c65463c5

Remove old experimental includes

We are now using c++17 so we no longer need experimental optional and
any. We can use the standard any and optional now.

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

show more ...


12