Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
kde powerdevil doesen't run scripts
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
The_Document
Apprentice
Apprentice


Joined: 03 Feb 2018
Posts: 275

PostPosted: Sat May 26, 2018 8:57 am    Post subject: kde powerdevil doesen't run scripts Reply with quote

have 2 scripts power corded/on battery scripts witch are nothing more than invoking cpupower to change cpu governor. Power devil DOES execute the scripts because speaker-test is audible after I add it to script. I believe this is a permissions issue but unsure how to solve this.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sat May 26, 2018 9:13 am    Post subject: Reply with quote

The_Document ...

how about showing us the scripts ;)

I stopped using cpupower as mostly what it does I could replicate with the following (perhaps of some use). Also, for a laptop you might want to use 'ondemand', and so avoid having to switch on ac_adapter disconnect/connect.

Code:
#!/bin/sh
# /etc/local.d/cpufreq-<governer>.start

set -e

if [ -d /lib/rc/bin ] ; then
   PATH="$PATH:/lib/rc/bin"
   export PATH
else
   alias ebegin="echo"
   alias eerror="echo"
   alias eend="return"
fi

sys_path="/sys/devices/system/cpu"
freq_gvnrs="${sys_path}/cpu0/cpufreq/scaling_available_governors"
cores="$(getconf _NPROCESSORS_ONLN)"

if [ -n "$1" ] ; then
   governer="$1"
else
   filename="$(basename -- $0 .${0##*.})"
   governer="${filename#*-}"
fi

ebegin "Setting cpufreq scaling governer to $governer"

[ "$cores" -gt 0 ] || exit 1

# in case the required governer happens to be a built as a module.
modprobe -q cpufreq_"$governer" || exit $?

if [ -e "$freq_gvnrs" ] && (grep -q "$governer" "$freq_gvnrs") ; then
   i=0
   while [ "$i" -lt "$cores" ] ; do
      echo "$governer" > "${sys_path}/cpu${i}/cpufreq/scaling_governor"
      i=$((i + 1))
   done
   unset i
   # for information on tuneables see:
   # https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt
   case "$governer" in
      ondemand)
      echo 45 > "${sys_path}/cpufreq/ondemand/up_threshold"
      echo 10 > "${sys_path}/cpufreq/ondemand/sampling_down_factor"
      echo  1 > "${sys_path}/cpufreq/ondemand/ignore_nice_load"
      echo  1 > "${sys_path}/cpufreq/ondemand/io_is_busy"
      ;;
      conservative)
      echo 45 > "${sys_path}/cpufreq/conservative/up_threshold"
      echo 20 > "${sys_path}/cpufreq/conservative/down_threshold"
      echo 10 > "${sys_path}/cpufreq/conservative/sampling_down_factor"
      echo  1 > "${sys_path}/cpufreq/conservative/ignore_nice_load"
      echo 10 > "${sys_path}/cpufreq/conservative/freq_step"
      ;;
      performance)
      # performace should offer two tuneables (not set):
      true
      ;;
      powersave)
      # powersave should offer two tuneables (not set):
      true
      ;;
      userspace)
      # userspace tuneables (not set):
      true
      ;;
   esac
else
   eerror "cpufreq governer $governer is not available" && return 1
fi

eend $?
Back to top
View user's profile Send private message
The_Document
Apprentice
Apprentice


Joined: 03 Feb 2018
Posts: 275

PostPosted: Sat May 26, 2018 9:17 am    Post subject: Reply with quote

Its not really a script

for ac
Code:
#!/bin/bash
cpupower frequency-set -g performance


for battery
Code:
#!/bin/bash
cpupower frequency-set -g powersave


powersave is like ondemand but better for battery life as it doesn't drain it as much as ondemand.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sat May 26, 2018 9:34 am    Post subject: Reply with quote

The_Document ...

OK, I don't see any issue with those (other than using bash where dash/bosh/busybox would sufice, and be less resource hungry).

Code:
% cat test
#!/bin/busybox sh
echo hello
% chmod u+x test
% ./test
hello

Anyhow, if you're using acpid you could do the following, and so skip using powerdevil ...

/etc/acpid/default.sh:
case "$group" in
[...]
  ac_adapter)
    case "$value" in
      *0) cpupower -c all frequency-set -g powersave ;;
      *1) cpupower -c all frequency-set -g performance ;;
      *) log_unhandled $* ;;
    esac
    ;;

If not, then I don't know what to suggest, I'm unfamiliar with powerdevil.

best ... khay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum