History log of /openbmc/phosphor-buttons/src/button_handler.cpp (Results 1 – 25 of 26)
Revision Date Author Comments
# 971312ab 12-Apr-2024 Patrick Williams <patrick@stwcx.xyz>

button: convert long-press time to std::chrono

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


# 15c60e2f 12-Apr-2024 Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>

meson: switch config.h to config.hpp

Enable a transition of this file from C to C++ so that we
can use C++ constants instead of #defines in future commits.

Change-Id: I1149ebdaaeb99b7e7974ca846b9b0

meson: switch config.h to config.hpp

Enable a transition of this file from C to C++ so that we
can use C++ constants instead of #defines in future commits.

Change-Id: I1149ebdaaeb99b7e7974ca846b9b07a3399edea0
Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...


# 3610608c 26-Feb-2024 Patrick Williams <patrick@stwcx.xyz>

lg2: use direct enum conversion

lg2 now has the ability to directly convert enums for which there is
not any other conversion. Leverage that to simplify the code.

Signed-off-by: Patrick Williams <

lg2: use direct enum conversion

lg2 now has the ability to directly convert enums for which there is
not any other conversion. Leverage that to simplify the code.

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

show more ...


# 9456ffc9 22-Jun-2023 HuyLe <hule@amperecomputing.com>

Add warm-reboot option support for reset button

Pressing reset button currently issues a reboot transion. However, some
platforms might expect to have force warm reboot instead. This commit
adds new

Add warm-reboot option support for reset button

Pressing reset button currently issues a reboot transion. However, some
platforms might expect to have force warm reboot instead. This commit
adds new reset-button-do-warm-reboot option to configure the expected
action for reset button on those platforms.

Tested:
- By default, on release of reset button, the Host is powered cycle.
- Enable reset-button-do-warm-reboot meson option. On release of reset
button, the Host is reset while Host power does not change.

Change-Id: I5d5f754f8b848fa0faef97354ef0dab7c47645f4
Signed-off-by: HuyLe <hule@amperecomputing.com>

show more ...


# 1a309f77 04-Apr-2023 Matt Spinler <spinler@us.ibm.com>

Create a custom power button handler

IBM has specific requirements on how the power button must behave, which
are different than what the button handler currently does.

These requirements are:
If

Create a custom power button handler

IBM has specific requirements on how the power button must behave, which
are different than what the button handler currently does.

These requirements are:
If power is off:
- A button press will power on as long as the BMC is
in the ready state.

If power is on:
- A button press less than 4s won't do anything.
- At 4s, issue a host power off and start a 10s timer.
- If the button is released within that 10s and not pressed
again, continue with the host power off.
- If the button is released within that 10s and also
pressed again in that 10s, do a hard power (chassis)
off.
- If the button is pressed throughout that 10s
issue a hard power off.

Instead of trying to integrate this behavior into the main button
handler code using even more #ifdefs in various spots, this commit
creates the concept of custom power button handlers, and then implements
one. This makes it less likely it could subtly break when changes are
made to the default code.

A 'power-button-handler' meson option is used to select the handler,
where the default uses the current behavior. A
PowerButtonHandlerFactory then creates the appropriate instance of the
handler selected by that option. If a handler is found, then the
default matches/callbacks won't be done and the handler can deal with
them as it sees fit.

Handlers are derived from a PowerButtonHandler abstract base class that
has 2 pure virtual functions:
- void pressed();
- void released(uint64_t pressTimeMS);

It will register for the power button pressed/released signals and then
call these overridden functions appropriately.

This new handler is implemented in a HostThenChassisPowerOff class.

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

show more ...


# 395c764c 18-Apr-2023 DelphineCCChiu <Delphine_CC_Chiu@wiwynn.com>

Remove power button long-press

So far, counting power button's pressing duration is supported.
There's no need to handle redundant case for button long-press.

Tested:
Press buttons and check corres

Remove power button long-press

So far, counting power button's pressing duration is supported.
There's no need to handle redundant case for button long-press.

Tested:
Press buttons and check corresponding behaviors.

Change-Id: I96d9160a10de6d4572148c55e2b7c2a9221d42e2
Signed-off-by: DelphineCCChiu <Delphine_CC_Chiu@wiwynn.com>

show more ...


# c0fee46e 23-Dec-2022 Potin Lai <potin.lai@quantatw.com>

button_handler: use CurrentHostState for powered on checking

Current poweredOn() function is based on chassis CurrentPowerState, so
it does not turn on the host when chassis is powered on and host s

button_handler: use CurrentHostState for powered on checking

Current poweredOn() function is based on chassis CurrentPowerState, so
it does not turn on the host when chassis is powered on and host state
is off.
Switch to use CurrentHostState property for system powered on checking.

Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Change-Id: Ife184a718944f6f318fad4494d077251c250b7c8

show more ...


# e2d0f426 19-Dec-2022 Potin Lai <potin.lai@quantatw.com>

button_handler: fix invalid power event error

Current power button handler handles longPowerReleased event, which
should be longPowerPressed.
revert back to longPowerPressed to avoid error of invali

button_handler: fix invalid power event error

Current power button handler handles longPowerReleased event, which
should be longPowerPressed.
revert back to longPowerPressed to avoid error of invalid power event.

Tested on Bletchley:

- Before
```
root@bletchley:~# journalctl -u phosphor-button-handler
Dec 19 21:52:53 bletchley button-handler[521]: Multi-host system detected : 6
Dec 19 21:52:53 bletchley button-handler[521]: 1 is invalid power event. skipping...
```

- After
```
root@bletchley:~# journalctl -u phosphor-button-handler
Dec 19 21:34:58 bletchley button-handler[418]: Multi-host system detected : 6
Dec 19 21:34:58 bletchley button-handler[418]: handlePowerEvent : handle long power button press
```

Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Change-Id: I77977f23f9e669cd4a8785608f1cb3ca4d148bed

show more ...


# e3b4e11f 26-Nov-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

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

show more ...


# 42507857 11-Aug-2022 Thang Q. Nguyen <thang@os.amperecomputing.com>

Fix getService fail on single host platform

Add exception handling in the getService() function to so that the
isMultiHost() function returns correct value for single and multi-host
platform.

Teste

Fix getService fail on single host platform

Add exception handling in the getService() function to so that the
isMultiHost() function returns correct value for single and multi-host
platform.

Tested: check on single host platform
1. Press power button and check if it works properly
2. Press reset button and check if it work properly

Signed-off-by: Thang Q. Nguyen <thang@os.amperecomputing.com>
Change-Id: I5c7019fb27b6ccb795ada9c63e591ce8561ff70c

show more ...


# a6d4e65d 13-Apr-2022 Naveen Moses <naveen.mosess@hcl.com>

Add OCP debug card host selector button interface

A new button interface class definition is added for handling OCP
debug card host selector button events.
In case of the button release event, The h

Add OCP debug card host selector button interface

A new button interface class definition is added for handling OCP
debug card host selector button events.
In case of the button release event, The host selector property is
increased up to the max host position.

Design : https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/45544

Signed-off-by: Naveen Moses <naveen.mosess@hcl.com>
Change-Id: Iec8fabb00d1daa10f587981a9c77df8a62e3c373

show more ...


# 9a529a69 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: I91502c85799b7d3be22b7d05659ff26bea08c32b

show more ...


# ab8dac51 15-Jul-2022 Naveen Moses <naveen.mosess@hcl.com>

Rename handler methods to match dbus signal type

The button handler process has multiple handlers which monitors
for "Released" dbus signal but has handlers named "pressed".
Such handlers has been r

Rename handler methods to match dbus signal type

The button handler process has multiple handlers which monitors
for "Released" dbus signal but has handlers named "pressed".
Such handlers has been renamed to match the signal type.

Signed-off-by: Naveen Moses <naveen.mosess@hcl.com>
Change-Id: Iff77569259df620dba2b04ed64ffc029fd9dee46

show more ...


# 9fb15970 20-Jun-2022 George Liu <liuxiwei@inspur.com>

logging: switch to lg2

After switching to C++20, it is recommended to use `phosphor::lg2`
to format log, and the correct `CODE_LINE` and `CODE_FUNC` values
can be used in log tracking.

Signed-off-b

logging: switch to lg2

After switching to C++20, it is recommended to use `phosphor::lg2`
to format log, and the correct `CODE_LINE` and `CODE_FUNC` values
can be used in log tracking.

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

show more ...


# d6a1bae7 20-Jun-2022 George Liu <liuxiwei@inspur.com>

meson: Add meson build

The intent behind this commit is build obmc-phosphor-buttons with
meson, and then remove files related to cmake.

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

meson: Add meson build

The intent behind this commit is build obmc-phosphor-buttons with
meson, and then remove files related to cmake.

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

show more ...


# 94afa4ba 20-Jun-2022 George Liu <liuxiwei@inspur.com>

Fix cppcheck warnings

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


# 5b98f4db 20-Jun-2022 George Liu <liuxiwei@inspur.com>

Update clang-format

Refer:https://github.com/openbmc/docs/blob/ac5d544553934f8083c61c5986a1420261bc8a4c/style/cpp/.clang-format

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

Update clang-format

Refer:https://github.com/openbmc/docs/blob/ac5d544553934f8083c61c5986a1420261bc8a4c/style/cpp/.clang-format

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

show more ...


# 3bd1cfcb 14-Feb-2022 Naveen Moses <naveen.mosess@hcl.com>

Add Host selector button interface

This change includes new button interface
for the host selector switch.

The button handler code is adapted to support
both single host and multiple host power co

Add Host selector button interface

This change includes new button interface
for the host selector switch.

The button handler code is adapted to support
both single host and multiple host power control
dbus events.

design : https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/45544

Signed-off-by: Naveen Moses <naveen.mosess@hcl.com>
Change-Id: Icbfb22baaee057fd255c3ab0cba129693b913a9d

show more ...


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

catch exceptions as const

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


# 703c7609 02-Sep-2021 Patrick Williams <patrick@stwcx.xyz>

exception: switch to public sdbus exception

SdBusError was intended to be a private error type inside sdbusplus.
Switch all catch locations to use the general sdbusplus::exception type.

exception: switch to public sdbus exception

SdBusError was intended to be a private error type inside sdbusplus.
Switch all catch locations to use the general sdbusplus::exception type.

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

show more ...


# 5ed4cc0f 13-May-2020 Patrick Williams <patrick@stwcx.xyz>

sdbusplus: replace message::variant with std::variant

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


# 51f5e8bd 13-May-2020 Patrick Williams <patrick@stwcx.xyz>

sdbusplus: remove deprecated variant_ns

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


# 69f93512 26-Nov-2018 Matt Spinler <spinler@us.ibm.com>

button-handler: Add ID button actions

Creates a signal handler for the 'Released' signal.

The handler will toggle the 'Asserted' property in the
LED group defined by the configu

button-handler: Add ID button actions

Creates a signal handler for the 'Released' signal.

The handler will toggle the 'Asserted' property in the
LED group defined by the configure file. The default
group is 'enclosure_identify'. The effect of this is
the LEDs in the group will toggle on or off on each
button press.

Tested: Used the 'simPress' method on the ID button object.

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

show more ...


# 06a5bddf 26-Nov-2018 Matt Spinler <spinler@us.ibm.com>

button-handler: Add reset button actions

Creates a signal handler for the 'Released' signal.

This will reboot the host if it is powered on. If the
system is off, it won't do an

button-handler: Add reset button actions

Creates a signal handler for the 'Released' signal.

This will reboot the host if it is powered on. If the
system is off, it won't do anything.

As with the other buttons, it only installs the watch if
the button object exists.

Tested: Used the 'simPress' method on the reset object
to trigger the signal.

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

show more ...


# 963c65f3 26-Nov-2018 Matt Spinler <spinler@us.ibm.com>

button-handler: Add power button actions

Create match handlers for the following power button signals:

1) 'Released'
* If the system is off, then power it on.
* If the syste

button-handler: Add power button actions

Create match handlers for the following power button signals:

1) 'Released'
* If the system is off, then power it on.
* If the system is on, then soft power it off.

2) 'PressedLong' (Really means long press released)
* If the system is on, do an immediate power off.
* If the system is off, do nothing.

It only installs the match objects for these if the power button
object exists on D-Bus. This is done so that systems that don't
implement a certain button won't still have watches on their
signals.

Tested: Pushed buttons and watched the magic happen.

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

show more ...


12