Power button power off behavior
Change the power button behavior to mirror the current behavior
on Power and x86 systems:
On short press: soft power off
On long press: hard power off
Resolves openbmc/openbmc#485
Change-Id: I436c364f6ed072474f942f80d98428df11b4c666
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/pychassisctl/chassis_control.py b/pychassisctl/chassis_control.py
index b3e16ff..7f14195 100755
--- a/pychassisctl/chassis_control.py
+++ b/pychassisctl/chassis_control.py
@@ -82,7 +82,7 @@
dbus_interface="org.openbmc.Button",
signal_name="Released",
path="/org/openbmc/buttons/power0")
- bus.add_signal_receiver(self.reset_button_signal_handler,
+ bus.add_signal_receiver(self.long_power_button_signal_handler,
dbus_interface="org.openbmc.Button",
signal_name="PressedLong",
path="/org/openbmc/buttons/power0")
@@ -211,15 +211,16 @@
self.powerOn()
def power_button_signal_handler(self):
- # toggle power
+ # toggle power, power-on / soft-power-off
state = self.getPowerState()
if state == POWER_OFF:
self.powerOn()
elif state == POWER_ON:
- self.powerOff();
+ self.softPowerOff();
- def reset_button_signal_handler(self):
- self.reboot();
+ def long_power_button_signal_handler(self):
+ print "Long-press button, hard power off"
+ self.powerOff();
def softreset_button_signal_handler(self):
self.softReboot();