History log of /openbmc/dbus-sensors/src/TachSensor.cpp (Results 1 – 25 of 69)
Revision Date Author Comments
# 83929002 06-Mar-2024 Chris Cain <cjcain@us.ibm.com>

Move GPIO presence object to its own files

This commit moves and renames the PresenceSensor to PresenceGpio
from TachSensors to its own file so that it can be used for more
than just fans.
It is cur

Move GPIO presence object to its own files

This commit moves and renames the PresenceSensor to PresenceGpio
from TachSensors to its own file so that it can be used for more
than just fans.
It is currently only used for GPIO presence monitoring for fans.

This commit maintains the same functionality as the original code.
Once the objects is created for a GPIO, it will be monitoring for
gpiod::line_request::EVENT_BOTH_EDGES changes. The user can call
isPresent() anytime to read the presence status.

Interface:
EventPresenceGpio(const std::string& iDeviceType,
const std::string& iDeviceName,
const std::string& gpioName, bool inverted,
boost::asio::io_context& io);
Sample usage:
presenceGpio = std::make_unique<EventPresenceGpio>(
"Fan", "Fan4b", "FAN4_PRESENCE_R_N", true, io);
if (presenceGpio->isPresent())
{
// Fan is present
}

Testing: Unable to test this update because no hardware supporting
event driven GPIO detection available.

Change-Id: I1f1a4cbab39d3e3ab38b30288f6aa199ee0cfe3c
Signed-off-by: Chris Cain <cjcain@us.ibm.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 ...


# 8b34f2c9 16-Jul-2024 Patrick Rudolph <patrick.rudolph@9elements.com>

TachSensor: Support multiple fans on the same GPIO

On IBM SBP1 two fans share the same enclosure, even though they can be
controlled independently as they have two distinct I2C PWM controllers
with

TachSensor: Support multiple fans on the same GPIO

On IBM SBP1 two fans share the same enclosure, even though they can be
controlled independently as they have two distinct I2C PWM controllers
with separate temperature sensors.
The fan enclosure occupies only one GPIO for presence detection.

Allow the same presence GPIO to be used within multiple TachSensors.

TEST: Used the same GPIO on two I2CFans, both disappear when unplugged.

Change-Id: I946e4579a361f00512eb707d2e5eb3b9ec7f2a55
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>

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>


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


# 6e6561d6 10-Jan-2024 Glukhov Mikhail <mikl@greenfil.ru>

tachsensor: Fix 'Associations' capitalization to register associations

Before patch:
```
# busctl introspect xyz.openbmc_project.FanSensor /xyz/openbmc_project/inventory/Fan1_0 xyz.openbmc_project.A

tachsensor: Fix 'Associations' capitalization to register associations

Before patch:
```
# busctl introspect xyz.openbmc_project.FanSensor /xyz/openbmc_project/inventory/Fan1_0 xyz.openbmc_project.Association.Definitions
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.associations property a(sss) 1 "sensors" "inventory" "/xyz/openbmc... emits-change

# busctl tree xyz.openbmc_project.ObjectMapper | grep Fan1_0
| | |- /xyz/openbmc_project/sensors/fan_tach/Fan1_0
| | | `- /xyz/openbmc_project/sensors/fan_tach/Fan1_0/chassis
```

After patch:
```
# busctl introspect xyz.openbmc_project.FanSensor /xyz/openbmc_project/inventory/Fan1_0 xyz.openbmc_project.Association.Definitions
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.Associations property a(sss) 1 "sensors" "inventory" "/xyz/openbmc... emits-change

# busctl tree xyz.openbmc_project.ObjectMapper | grep Fan1_0
| |- /xyz/openbmc_project/inventory/Fan1_0
| | `- /xyz/openbmc_project/inventory/Fan1_0/sensors
| | |- /xyz/openbmc_project/sensors/fan_tach/Fan1_0
| | | |- /xyz/openbmc_project/sensors/fan_tach/Fan1_0/chassis
| | | `- /xyz/openbmc_project/sensors/fan_tach/Fan1_0/inventory

```

Change-Id: Ie7fd69a4dc7216fb2dcfb1fdccc2b7885c7511ee
Signed-off-by: Glukhov Mikhail <mikl@greenfil.ru>

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


# 779c96a2 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: I0d10afa582342818b9d90b168f6f39f71ce4e0f4
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
[AJ: regenerate using .clang-format from openbmc/docs@f44abd66eca8]
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>

show more ...


# 83db50ca 01-Mar-2023 Ed Tanous <edtanous@google.com>

Don't use deprecated asio functions

This code used a number of asio functions that have been deprecated.
This patch replaces them with their new equivalents, and enabled
BOOST_ASIO_NO_DEPRECATED.

C

Don't use deprecated asio functions

This code used a number of asio functions that have been deprecated.
This patch replaces them with their new equivalents, and enabled
BOOST_ASIO_NO_DEPRECATED.

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

show more ...


# 1f978631 28-Feb-2023 Ed Tanous <edtanous@google.com>

Change io_service to io_context

This was renamed a while back in boost to be compliant with the
std::executors proposal.

Change-Id: Ib56544a0a7478990d18fe9e0bbbd8db1e52fa5b8
Signed-off-by: Ed Tanou

Change io_service to io_context

This was renamed a while back in boost to be compliant with the
std::executors proposal.

Change-Id: Ib56544a0a7478990d18fe9e0bbbd8db1e52fa5b8
Signed-off-by: Ed Tanous <edtanous@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 ...


# 9b4a20e9 06-Sep-2022 Ed Tanous <edtanous@google.com>

Move to steady_timer

deadline_timer and steady_timer have one important difference, the
former runs off CLOCK_REALTIME, and the later runs off CLOCK_MONOTONIC.
For a long time we've relied on deadli

Move to steady_timer

deadline_timer and steady_timer have one important difference, the
former runs off CLOCK_REALTIME, and the later runs off CLOCK_MONOTONIC.
For a long time we've relied on deadline_timer incorrectly, given that
dbus-sensors does not care in the least about the calendar time, and
only cares about the difference between sensor scans.

Fortunately, this likely has no effect on the behavior of the sensors
most of the time, and in general, in a time change, the clock generally
moves forward, so all timers would immediately expire, scan all sensors,
and move on. phosphor-pid-control is intentionally designed to handle
this case, so it's quite likely that a user would never notice it, and
even if they did, would have to be looking at a debug console the moment
it happened.

The other effect is that in most cases, sensors call clock_gettime more
than they probably need to, which might slow down the performance.

This commit moves all usages of sensor timing to steady_timer, which
should give us more consistent results, and (in theory at least) be
faster. Because of stdlib compliance things, this also has the effect
of us dropping our dependence on boost::posix_time, and move to
std::chrono::duration objects, per the coding standard.

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

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


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

TachSensor: Replace iterator pairs with structured bindings

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


# 5170fe63 03-Aug-2022 Josh Lehan <krellan@google.com>

tachsensor: Similar fixes from HwmonTempSensor

Ported the substance of the changes from here to TachSensor:
https://gerrit.openbmc.org/c/openbmc/dbus-sensors/+/56019

The goal is to provide similar

tachsensor: Similar fixes from HwmonTempSensor

Ported the substance of the changes from here to TachSensor:
https://gerrit.openbmc.org/c/openbmc/dbus-sensors/+/56019

The goal is to provide similar fixes to I/O and buffering, catching up
to similar changes made recently in HwmonTempSensor.

Tested: Fan RPM now shows up correctly on my machine again.

Signed-off-by: Josh Lehan <krellan@google.com>
Change-Id: I49c539e3713e9d02d4584f305e4ced6d4b2ba572

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


# 99c4409a 14-Jan-2022 Ed Tanous <edtanous@google.com>

Enable cppcoreguidelines-pro-type-vararg check

We only had one usage of printf in the code that was in violation of
this rule, so replace it with iostreams, and enable the check.

Signed-off-by: Ed

Enable cppcoreguidelines-pro-type-vararg check

We only had one usage of printf in the code that was in violation of
this rule, so replace it with iostreams, and enable the check.

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

show more ...


# 3928741a 04-Feb-2022 Andrei Kartashev <a.kartashev@yadro.com>

sensors: don't pass excess conn handler

We don't need to pass connection handler to setInitialProperties method
since it already part of the sensor class.

Tested: no changes in behaviour.
Signed-of

sensors: don't pass excess conn handler

We don't need to pass connection handler to setInitialProperties method
since it already part of the sensor class.

Tested: no changes in behaviour.
Signed-off-by: Andrei Kartashev <a.kartashev@yadro.com>
Change-Id: Icaaccbeaf14e22648a6a1bce381f0f0a606b0ddd

show more ...


# f69fbf99 14-Jan-2022 Ed Tanous <edtanous@google.com>

Consistently use std::pair<double, double> limits

There are a number of places in tach sensor where we jump from having a
pair of doubles, so having a pair of ints, then back. All sensors take
this

Consistently use std::pair<double, double> limits

There are a number of places in tach sensor where we jump from having a
pair of doubles, so having a pair of ints, then back. All sensors take
this as a double, so we should be consistent, even if tachsensor is only
expected to have integer units.

This was flagged by clang-tidy as part of the
bugprone-misplaced-widening-cast check.

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

show more ...


# 5667808a 04-Jan-2022 Jayashree Dhanapal <jayashree-d@hcl.com>

Move threshold interfaces to common function

Threshold Hardshutdown and Softshutdown interfaces needs to be
created for sensors. Therefore, created a common function
called getInterface() to access

Move threshold interfaces to common function

Threshold Hardshutdown and Softshutdown interfaces needs to be
created for sensors. Therefore, created a common function
called getInterface() to access all the threshold
interfaces from all the sensors source file and removed
hasCriticalInterface(), hasWarningInterface() functions.

Moreover, threshold interfaces from all the sensor constructor has
been refactored to avoid duplicating functions.

TESTED: Tested on Facebook YosemiteV2 hardware. Verified that the
Warning and Critical interfaces are created and displaying in
dbus objects.

Signed-off-by: Jayashree Dhanapal <jayashree-d@hcl.com>
Change-Id: I9c7d049c7d4445d7199bf63d8e729838990880e9

show more ...


# 00bd56d3 19-Nov-2021 Zhikui Ren <zhikui.ren@intel.com>

TachSensor: fix checkThresholds regression

Due to a merge mistake, the following commit
introduced an unintended change.

https://github.com/openbmc/dbus-sensors/commit/da98f095f

TachSensor: fix checkThresholds regression

Due to a merge mistake, the following commit
introduced an unintended change.

https://github.com/openbmc/dbus-sensors/commit/da98f095f25cc75af3c0268643bde2b21f5503e0#diff-33f4e0882e5eaea910f455ab4f5f22b2b9274ff46dd6120b6b23a092607174a0L187

Revert the code back.

Signed-off-by: Zhikui Ren <zhikui.ren@intel.com>
Change-Id: I17198e9cfece47022a437cdba12eea8c3e4b32e2

show more ...


# da98f095 01-Nov-2021 Zhikui Ren <zhikui.ren@intel.com>

psusensor: fix psu pwm sensor name

Current bug is that psusensor service does not create pwm sensor object
if pid fan configuration has spaces in Name field, like
{
...
"Name

psusensor: fix psu pwm sensor name

Current bug is that psusensor service does not create pwm sensor object
if pid fan configuration has spaces in Name field, like
{
...
"Name" : "PSU$BUS $ADDRESS Fan 1"
"Outputs": [
"Pwm PSU$BUS $ADDRESS Fan 1"
],
...
}

Fix:
Pwm name need to be escaped, which currently replaces " " with "_"
before being passed to CreatePwmSensor in PSUSensor service.
PwmSensor constructor takes the name as is.

Since the escape algorithm may change in the future,
add a helper function escapeName() and update dbus-sensors
to use this helper funtion when sensors are created.
escapeName() currently calls boost replace_all_copy(name," ", "_"),
so it does not introduce functional changes except the bug identified
above.

Tested:
No regression found for existing working sensors.
Sensors are created as before with the same sensor name.

Fix for non-working case works correctly now.
psu pwm sensor name with space are created correctly with the change.
busctl tree xyz.openbmc_project.PSUSensor
...
|-/xyz/openbmc_project/control
| `-/xyz/openbmc_project/control/fanpwm
| |-/xyz/openbmc_project/control/fanpwm/Pwm_PSU17_2_Fan_1
| |-/xyz/openbmc_project/control/fanpwm/Pwm_PSU17_2_Fan_2
...

Signed-off-by: Zhikui Ren <zhikui.ren@intel.com>
Change-Id: If3b60f93de324e59cc3d774285c23bf50a6f989c

show more ...


# 3291b9c7 29-Jul-2021 Jie Yang <jjy@google.com>

Sensor mutability interface

We proposed a ValueMutablity interface in
openbmc/phosphor-dbus-interfaces which was accepted here:
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-

Sensor mutability interface

We proposed a ValueMutablity interface in
openbmc/phosphor-dbus-interfaces which was accepted here:
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-dbus-interfaces/+/36333

It follows the IPMI fashion, checking
the sensor mutability before writing sensor values. The sensor
mutability used to be hardcoded in the ipmi sensor map yaml file.

This provides feature parity with that old YAML hardcoded
"mutability: Mutability::Write|Mutability::Read" setting.

As an example of implementation within dbus-sensors, ExternalSensor
always sets Mutable to true, given its purpose of accepting sensor
writes from an external source. PwmSensor accepts the "Mutable"
parameter, from entity-manager configuration (aka JSON file). All
other sensors always set Mutable to false, but it would be
straightforward to add similar code, like what was done for
PwmSensor, when mutability is desired.

This parameter will be used by the IPMI server here:
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-host-ipmid/+/45407

There is currently no Redfish equivalent, although that would
be a welcome task for the future. This is not IPMI-specific,
as the Redfish server can also use this as a hint, as to whether
to allow read-write access, or merely to allow read-only access.

This is not to be confused with the "manufacturing mode" option, which
is designed for use during manufacturing test, hence its name. This
feature is designed for production, and is intended to allow just a
few sensors to be writable, without needing to make them all writable.

Tested:
DBus call on fan sensors with configurable tree mutability:
busctl introspect xyz.openbmc_project.FanSensor /xyz/openbmc_project/sensors/fan_pwm/fan0
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
...
xyz.openbmc_project.Sensor.Value interface - - -
.MaxValue property x 100 emits-change
.MinValue property x 0 emits-change
.Unit property s "xyz.openbmc_project.Sensor.Value.Uni... emits-change
.Value property d 42.7451 emits-change writable
xyz.openbmc_project.Sensor.ValueMutability interface - - -
.Mutable property b true emits-change
...

DBus call on external sensors:
busctl introspect xyz.openbmc_project.ExternalSensor /xyz/openbmc_project/sensors/tempera
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
...
xyz.openbmc_project.Sensor.Value interface - - -
.MaxValue property d 127 emits-change
.MinValue property d -128 emits-change
.Unit property s "DegreesC" emits-change
.Value property d nan emits-change writable
xyz.openbmc_project.Sensor.ValueMutability interface - - -
.Mutable property b true emits-change
...

The ValueMutability interface, with "Mutable", is correctly created.

Signed-off-by: Jie Yang <jjy@google.com>
Change-Id: Ifa1cb51bb55cd6f00d2a2f79e9064d1a51354b06
Signed-off-by: Josh Lehan <krellan@google.com>

show more ...


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

catch exceptions as const

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


123