/openbmc/phosphor-buttons/inc/ |
H A D | host_then_chassis_poweroff.hpp | 1a309f77 Tue Apr 04 13:12:19 CDT 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 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>
|
H A D | power_button_profile_factory.hpp | 1a309f77 Tue Apr 04 13:12:19 CDT 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 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>
|
H A D | power_button_profile.hpp | 1a309f77 Tue Apr 04 13:12:19 CDT 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 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>
|
H A D | button_handler.hpp | 1a309f77 Tue Apr 04 13:12:19 CDT 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 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>
|
/openbmc/phosphor-buttons/src/ |
H A D | host_then_chassis_poweroff.cpp | 1a309f77 Tue Apr 04 13:12:19 CDT 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 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>
|
H A D | button_handler.cpp | 1a309f77 Tue Apr 04 13:12:19 CDT 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 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>
|
/openbmc/phosphor-buttons/ |
H A D | meson.build | 1a309f77 Tue Apr 04 13:12:19 CDT 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 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>
|