[current/ktown] Powerdevil and pm-utils: not running scripts on resume
by denydias from LinuxQuestions.org on (#56BE2)
Hi there!
What I'll describe here is already identified and I have a workaround in place for the issue. I'm sharing this to confirm the issue so I can open a bug report to the powerdevil team. It's worth to note that this only relevant to the ones running Eric's ktown in -current.
In some time around May or June, probably after KDE 5_20.05, I've noted that when I resume my box from sleep, pm-utils script were not being executed anymore. It's easy to recognize that for me because I have /etc/pm/power.d/harddrive set to enable advanced power management on HDD, which causes the disc spin to cease after 30 seconds of inactivity.
Well, this week I had the time to investigate the issue further. Seems like powerdevil (KDE's power managent daemon) is ignoring the pm-utils scripts.
I solved that with a little hack in /etc/acpi/lid.sh:
Code:#!/bin/bash
# See: https://www.linuxquestions.org/questions/slackware-14/acpi-configuration-for-lid-680946/page2.html#post3333946
lidstate=$(cat /proc/acpi/button/lid/LID/state | awk '{print $2}')
if [ $lidstate = "closed" ]; then
logger "ACPI: lid closed, suspending system"
sync
else
logger "ACPI: lid opened, resuming system"
ac_state=$(cat /proc/acpi/ac_adapter/AC/state | awk '{$1="";print $0}' | awk '{$1=$1};1')
if [ $ac_state = "on-line" ]; then
pm-powersave false
else
pm-powersave true
fi
logger "ACPI: pm-powersave executed for AC $ac_state"
/etc/pm/sleep.d/49bluetooth-generic resume
logger "ACPI: system resumed"
fiThe above script is executed by /etc/acpi/acpi_handler.sh:
Code:#!/bin/sh
# Default acpi script that takes an entry for all actions
IFS=${IFS}/
set $@
case "$1" in
button)
case "$2" in
power) /sbin/init 0
;;
lid) /etc/acpi/lid.sh
;;
*) logger "ACPI action $2 is not defined"
;;
esac
;;
*)
logger "ACPI group $1 / action $2 is not defined"
;;
esacDoes anyone else running ktown have experienced something similar with power management settings and KDE lately?


What I'll describe here is already identified and I have a workaround in place for the issue. I'm sharing this to confirm the issue so I can open a bug report to the powerdevil team. It's worth to note that this only relevant to the ones running Eric's ktown in -current.
In some time around May or June, probably after KDE 5_20.05, I've noted that when I resume my box from sleep, pm-utils script were not being executed anymore. It's easy to recognize that for me because I have /etc/pm/power.d/harddrive set to enable advanced power management on HDD, which causes the disc spin to cease after 30 seconds of inactivity.
Well, this week I had the time to investigate the issue further. Seems like powerdevil (KDE's power managent daemon) is ignoring the pm-utils scripts.
I solved that with a little hack in /etc/acpi/lid.sh:
Code:#!/bin/bash
# See: https://www.linuxquestions.org/questions/slackware-14/acpi-configuration-for-lid-680946/page2.html#post3333946
lidstate=$(cat /proc/acpi/button/lid/LID/state | awk '{print $2}')
if [ $lidstate = "closed" ]; then
logger "ACPI: lid closed, suspending system"
sync
else
logger "ACPI: lid opened, resuming system"
ac_state=$(cat /proc/acpi/ac_adapter/AC/state | awk '{$1="";print $0}' | awk '{$1=$1};1')
if [ $ac_state = "on-line" ]; then
pm-powersave false
else
pm-powersave true
fi
logger "ACPI: pm-powersave executed for AC $ac_state"
/etc/pm/sleep.d/49bluetooth-generic resume
logger "ACPI: system resumed"
fiThe above script is executed by /etc/acpi/acpi_handler.sh:
Code:#!/bin/sh
# Default acpi script that takes an entry for all actions
IFS=${IFS}/
set $@
case "$1" in
button)
case "$2" in
power) /sbin/init 0
;;
lid) /etc/acpi/lid.sh
;;
*) logger "ACPI action $2 is not defined"
;;
esac
;;
*)
logger "ACPI group $1 / action $2 is not defined"
;;
esacDoes anyone else running ktown have experienced something similar with power management settings and KDE lately?