By default, the power button shuts down the PC. I set
I tried the devd trick of configuring a script to run when the power button is pressed, but this doesn't work. My config is:
Nothing is written to /tmp/power.log when pressing the button. I'm not sure if setting the default action
I also tried setting this to S3, then in /etc/rc.suspend I put in the command and then
hw.acpi.power_button_state: NONE
to avoid this, but would now like to use the power button to put the PC into a low power state (shut off all USB power, turn off screen) but leave the CPU running (so not suspend, but rather for overnight backups, etc.). I would like to turn off all the USB's so that it turns off for example keyboard backlight, speakers, etc. so that it's not a nuisance at night. Since the keyboard will be turned off, I need to use the power button to wake it back up and re-enable the USB.I tried the devd trick of configuring a script to run when the power button is pressed, but this doesn't work. My config is:
notify 100 {
match "system" "ACPI";
match "subsystem" "Button";
match "rule" "0";
action "echo Power pressed >> /tmp/power.log";
};
Nothing is written to /tmp/power.log when pressing the button. I'm not sure if setting the default action
hw.acpi.power_button_state=NONE
is the reason. I ran devd -d
to see the debug output and nothing is displayed when pressing power button. I also tried setting this to S3, then in /etc/rc.suspend I put in the command and then
exit 1
, which worked, but doesn't prevent the PC from suspending when pressing the power button. Any ideas on how I can run a script when power is pressed without it powering off or going into suspend?