History log of /openbmc/phosphor-buttons/src/ (Results 1 – 25 of 51)
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
fbd3bd5d09-Oct-2025 Liora Guo <liora.guo.wiwynn@gmail.com>

phosphor-buttons: Fix HostSelector mode logic

Task Description:
This task fixes a issue where power button handlers fail to register
in multi-power button systems when a HostSelector D-Bus object ex

phosphor-buttons: Fix HostSelector mode logic

Task Description:
This task fixes a issue where power button handlers fail to register
in multi-power button systems when a HostSelector D-Bus object exists
for OCP debug card support. The problem occurs because the existing
logic incorrectly assumes that any HostSelector object presence
indicates host selector button mode, preventing proper power button
signal registration in multi-power button configurations.

Motivation:
The current power button handler has two modes:
- Host Selector Button Mode (e.g., Yosemite V2):
Single power button with host selector switch for target host
handling, where hostSelectButtonMode = true
- Multi Power Button Mode (e.g., Yosemite V4):
Each slot/sled has its own power button, where
hostSelectButtonMode = false
However, when HostSelector D-Bus object exists solely for OCP
debug card support (not for power button functionality), the system
incorrectly enters host selector button mode, causing multi-power
button systems to fail registering powerReleased signals.
This results in non-functional power buttons across the platform.

Design:
- Virtual Button Flag: Added virtualButton flag to distinguish
between HostSelector objects used for actual power button control
versus those used for OCP debug card support. The flag is read from
the virtual_button field in the HOST_SELECTOR GPIO configuration.
- Corrected Mode Logic: Modified hostSelectButtonMode calculation
to isHostSelectorExists && !virtualButton, ensuring that
HostSelector objects marked as virtual buttons don't trigger
host selector button mode.
- Unified Signal Registration: Replaced separate single/multi power
button registration logic with a unified approach that dynamically
discovers and registers powerReleased signal handlers for all available
power button interfaces using D-Bus ObjectMapper's GetSubTreePaths.

Test Log(Tested on Yosemite V4):
```
root@bmc:~# cat /etc/default/obmc/gpio/gpio_defs.json | grep -i -E "POWER_BUTTON|HOST_SELECTOR|virtual_button"
"name": "POWER_BUTTON1",
"name": "POWER_BUTTON2",
"name": "POWER_BUTTON3",
"name": "POWER_BUTTON4",
"name": "POWER_BUTTON5",
"name": "POWER_BUTTON6",
"name": "POWER_BUTTON7",
"name": "POWER_BUTTON8",
"name": "HOST_SELECTOR",
"virtual_button": true,

root@bmc:~# systemctl status phosphor-button-handler.service
● phosphor-button-handler.service - Phosphor Button Handler
Loaded: loaded (/usr/lib/systemd/system/phosphor-button-handler.service; enabled; preset: enabled)
Active: active (running) since Wed 2025-11-05 03:09:06 PST; 7s ago
Invocation: 81fd455a960e4c6cb201712d71219cb2
Main PID: 9319 (button-handler)
Tasks: 1 (limit: 1961)
Memory: 324K (peak: 1M)
CPU: 65ms
CGroup: /system.slice/phosphor-button-handler.service
└─9319 /usr/bin/button-handler

Nov 05 03:09:06 bmc button-handler[9319]: hostSelectButtonMode: False
Nov 05 03:09:06 bmc button-handler[9319]: Starting power button handler
Nov 05 03:09:06 bmc button-handler[9319]: Registering power button handler for: /xyz/openbmc_project/Chassis/Buttons/Power01
Nov 05 03:09:06 bmc button-handler[9319]: Registering power button handler for: /xyz/openbmc_project/Chassis/Buttons/Power02
Nov 05 03:09:06 bmc button-handler[9319]: Registering power button handler for: /xyz/openbmc_project/Chassis/Buttons/Power03
Nov 05 03:09:06 bmc button-handler[9319]: Registering power button handler for: /xyz/openbmc_project/Chassis/Buttons/Power04
Nov 05 03:09:06 bmc button-handler[9319]: Registering power button handler for: /xyz/openbmc_project/Chassis/Buttons/Power05
Nov 05 03:09:06 bmc button-handler[9319]: Registering power button handler for: /xyz/openbmc_project/Chassis/Buttons/Power06
Nov 05 03:09:06 bmc button-handler[9319]: Registering power button handler for: /xyz/openbmc_project/Chassis/Buttons/Power07
Nov 05 03:09:06 bmc button-handler[9319]: Registering power button handler for: /xyz/openbmc_project/Chassis/Buttons/Power08

```
Change-Id: Iaf5a6a4fc93522633ac3caa31d63f86a32eb88f5
Signed-off-by: Liora Guo <liora.guo.wiwynn@gmail.com>

show more ...

60dc341d04-Nov-2025 Patrick Williams <patrick@stwcx.xyz>

use sdbusplus unpack syntax

Rather than defining a variable and then reading it from a message,
sdbusplus also supports directly unpack-ing from the message. Use
this syntax instead as it is more e

use sdbusplus unpack syntax

Rather than defining a variable and then reading it from a message,
sdbusplus also supports directly unpack-ing from the message. Use
this syntax instead as it is more efficient and succinct.

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

show more ...

5f3c2e5b20-Jul-2025 LioraGuo-wiwynn <liora.guo.wiwynn@gmail.com>

hostSelector_switch: add support polling mode

Task Description:
Add support for polling mode to periodically sample the group GPIO
selector inputs and update the HostSelector interface’s Position
pr

hostSelector_switch: add support polling mode

Task Description:
Add support for polling mode to periodically sample the group GPIO
selector inputs and update the HostSelector interface’s Position
property on D-Bus.

Motivation:
-Some platforms expose the host-selector via a CPLD as GPIO inputs
without edge interrupts.
-Polling ensures all position changes are detected reliably.

Design:
- Enabled polling through the 'polling_mode' and 'polling_interval_ms'
options in JSON configuration.
- Introduced pollTimerHandler to periodically check GPIO states
and update the internal host selector position.

Tested:
journalctl -xeu xyz.openbmc_project.Chassis.Buttons.service -f
Jul 31 00:06:47 bmc buttons[629]: Start Phosphor buttons service...
Jul 31 00:06:47 bmc buttons[629]: Started polling mode: 2000ms
Jul 31 00:06:49 bmc buttons[629]: Host selector position updated to 0
Jul 31 00:06:53 bmc systemd[1]: Started Phosphor Buttons.

Jul 31 00:13:50 bmc buttons[629]: Host selector position updated to 1
Jul 31 00:13:52 bmc buttons[629]: Host selector position updated to 2
Jul 31 00:13:54 bmc buttons[629]: Host selector position updated to 3
Jul 31 00:14:00 bmc buttons[629]: Host selector position updated to 4
Jul 31 00:14:04 bmc buttons[629]: Host selector position updated to 5
Jul 31 00:14:10 bmc buttons[629]: Host selector position updated to 6
Jul 31 00:14:14 bmc buttons[629]: Host selector position updated to 7
Jul 31 00:14:16 bmc buttons[629]: Host selector position updated to 8
Jul 31 00:14:20 bmc buttons[629]: Host selector position updated to 0

Change-Id: I8b95d773191f1af03b747f9eeb33494da9878bc8
Signed-off-by: Liora Guo <liora.guo.wiwynn@gmail.com>

show more ...

8854325a22-Jul-2025 Liora Guo <liora.guo.wiwynn@gmail.com>

main: fix group_gpio_config parsing

Fix incorrect parsing of GPIO "pin"/"num" in group_gpio_config.

Motivation:
The code mistakenly accessed "pin"/"num" from the outer gpioConfig
object instead of

main: fix group_gpio_config parsing

Fix incorrect parsing of GPIO "pin"/"num" in group_gpio_config.

Motivation:
The code mistakenly accessed "pin"/"num" from the outer gpioConfig
object instead of from each config entry in group_gpio_config.
When "pin"/"num" only existed in the inner config, this led to
std::out_of_range exceptions at runtime.

Design:
Changed the parsing logic to read "pin"/"num" from each individual
config entry inside group_gpio_config instead of the parent object.

Change-Id: Ie479a336fae5e67c47c458e031a4cb2e9d8954cf
Signed-off-by: Liora Guo <liora.guo.wiwynn@gmail.com>

show more ...

efe5092e01-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: I9268183de7ea36e1830b7476d6a3782376c5d9ed
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: I9268183de7ea36e1830b7476d6a3782376c5d9ed
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...

31ce375e08-Nov-2024 Rush Chen <rush.chen.wiwynn@gmail.com>

Support multi power buttons with multi behaviors

For supporting more-than-one power buttons behaviors,
add new matches and instances by following json config.

This change is for multiple slots inte

Support multi power buttons with multi behaviors

For supporting more-than-one power buttons behaviors,
add new matches and instances by following json config.

This change is for multiple slots integrated on one chassis,
and each slot has button to control power status.

For example:
/xyz/openbmc_project/Chassis/Buttons/Power01 for button on slot1
/xyz/openbmc_project/Chassis/Buttons/Power02 for button on slot2

Moreover, support multi-level power control by json config,
chassis now can do action by corresponding pressing duration.

Tested:
Press buttons and check corresponding behaviors.

Change-Id: I7789f0367d5e846dd9e68f966ba0755fc916217a
Signed-off-by: Rush Chen <rush.chen.wiwynn@gmail.com>

show more ...

d36b6b1d16-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: Ic25904c3a6dc2d09cc28cabff14e4ba4c8dc8397
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...

010035ee17-Jun-2024 Manojkiran Eda <manojkiran.eda@gmail.com>

Fix spelling mistakes using codespell

This commit corrects various spelling mistakes throughout the
repository. The corrections were made automatically using `codespell`[1]
tool.

[1]: https://githu

Fix spelling mistakes using codespell

This commit corrects various spelling mistakes throughout the
repository. The corrections were made automatically using `codespell`[1]
tool.

[1]: https://github.com/codespell-project/codespell

Change-Id: I7ddcf61ed2d596171384fdb5f0fc1e2feb4240bf
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>

show more ...

971312ab12-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

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

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

cb418b0d16-Jan-2024 Jonico Eustaquio <jonico.eustaquio@fii-na.com>

Adding num key parsing

Currently there is only support for an alphanumeric references that is
decoded into a pin number. The "num" keyword supports using the pin
number directly (integer). The JSON

Adding num key parsing

Currently there is only support for an alphanumeric references that is
decoded into a pin number. The "num" keyword supports using the pin
number directly (integer). The JSON key field determines the parsing.

It matches the support for the "num" keyword for the gpio_defs.json
seen in skeleton/libobmc_intf. If added along with:

https://gerrit.openbmc.org/c/openbmc/skeleton/+/68883

then "num" could be used for systems that have numerically labeled GPIO
pins and have multiple GPIO banks.

Change-Id: Ibf3e432a36c60b650c7f245ee12e5af3a8359664
Signed-off-by: Jonico Eustaquio <jonico.eustaquio@fii-na.com>

show more ...

9c27656019-Jan-2024 Patrick Williams <patrick@stwcx.xyz>

State.Chassis: update service name

Both phosphor-state-manager and x86-power-control have code that exposes
both the Chassis and Chassis0 bus names as a backwards compatibility
when multi-chassis su

State.Chassis: update service name

Both phosphor-state-manager and x86-power-control have code that exposes
both the Chassis and Chassis0 bus names as a backwards compatibility
when multi-chassis support was added. Switch to the numbered bus name,
which is expected to be the non-deprecated one.

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

show more ...

0d6d74c817-Aug-2023 Patrick Williams <patrick@stwcx.xyz>

serial-uart-mux: use non-deprecated sdbusplus-client names

The generated sdbus++ bindings have SDBUSPP_REMOVE_DEPRECATED_NAMESPACE
as a guard around the type that was previously used. Use the
non-d

serial-uart-mux: use non-deprecated sdbusplus-client names

The generated sdbus++ bindings have SDBUSPP_REMOVE_DEPRECATED_NAMESPACE
as a guard around the type that was previously used. Use the
non-deprecated name to future-proof this code.

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

show more ...

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

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

9479b06c04-Apr-2023 Matt Spinler <spinler@us.ibm.com>

button-handler: use sdeventplus loop

Use the sdeventplus event loop so that an upcoming commit can make use
of sdeventplus timers.

Change-Id: I596ee36141f16ceb5e95078bad9fbe6a12c832a6
Signed-off-by

button-handler: use sdeventplus loop

Use the sdeventplus event loop so that an upcoming commit can make use
of sdeventplus timers.

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

show more ...

ccd7db0509-Feb-2023 Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>

Support host selector using cpld definitions

Description:
- Support host selector using cpld definitions

Design:
- Because the current structure only supports config defined by GPIO
(Yosemite V2)

Support host selector using cpld definitions

Description:
- Support host selector using cpld definitions

Design:
- Because the current structure only supports config defined by GPIO
(Yosemite V2), but there are also have the system (Yosemite V3.5)
gets the host-selector's selection from CPLD.

- So this commit is to extend the current configuration to use CPLD
definitions. Also, support adding event io from the register file
which was exported from the CLD driver.

- For example with config json below:
{
"cpld_definitions": [
{
"name": "HOST_SELECTOR",
"i2c_address": 15,
"i2c_bus": 12,
"register_name": "uart-selection-debug-card",
"max_position": 4
}
]
}

Dependency:
- CLD driver is required (link: https://lore.kernel.org/lkml/20230117094425.19004-1-Delphine_CC_Chiu@Wiwynn.com/)

Test Case:
- When ocp debug card uart button is pressed the position property on
dbus is correct.

Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
Change-Id: I6746afa6d905bd3c681e2921c643b3cd4cb9944c

show more ...

0d038f5810-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: Iad285e60cad29e025a02d0c0cabcb76fe593b5cf
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...

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

149452b012-Apr-2023 Patrick Williams <patrick@stwcx.xyz>

power-button: fix released signal to include duration

The latest dbus interface requires a duration in microseconds for
the PowerButton.Released signal. Add it in now so that the code
successfully

power-button: fix released signal to include duration

The latest dbus interface requires a duration in microseconds for
the PowerButton.Released signal. Add it in now so that the code
successfully compiles.

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

show more ...

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

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

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

d219fa3c19-Jul-2022 Naveen Moses <naveen.mosess@hcl.com>

Add serial uart mux interface class

1. This change adds the multi-host serial uart mux interface class.

In a multi-host system when the host position is changed,
then the serial uart mux is configu

Add serial uart mux interface class

1. This change adds the multi-host serial uart mux interface class.

In a multi-host system when the host position is changed,
then the serial uart mux is configured to enable the
respective host's serial console which is accessed via
OCP debug card.

2. Introduced two new methods in gpio.cpp
setGpioState - set state for gpio fd based on polarity
getGpiostate - get state for gpio fd based on polarity

3. Updated the readme file about details on the new gpio
configs

design : https://github.com/openbmc/docs/blob/master/designs/multihost-phosphor-buttons.md

Testing : This change is verified in yosemiteV2 platform.

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

show more ...

123