~ubuntu-branches/ubuntu/saucy/sysvinit/saucy-proposed

« back to all changes in this revision

Viewing changes to debian/src/initscripts/etc/init.d/ondemand

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2012-12-07 04:48:13 UTC
  • Revision ID: package-import@ubuntu.com-20121207044813-wvibj1ex2rl1hkxx
Tags: 2.88dsf-13.10ubuntu14
* Twiddle /etc/init.d/ondemand to prefer the "interactive" governor
  over the ondemand one, which improves responsiveness on devices
  that have a kernel that support this feature (such as the nexus7).
* Also, exit more gracefully if we have no governors available to us.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
. /lib/init/vars.sh
15
15
. /lib/lsb/init-functions
16
16
 
 
17
AVAILABLE="/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors"
 
18
 
17
19
case "$1" in
18
20
    start)
19
21
        start-stop-daemon --start --background --exec /etc/init.d/ondemand -- background
21
23
    background)
22
24
        sleep 60 # probably enough time for desktop login
23
25
 
 
26
        [ -f $AVAILABLE ] || exit 0
 
27
        read governors < $AVAILABLE
 
28
        case $governors in
 
29
                *interactive*)
 
30
                        GOVERNOR="interactive"
 
31
                        break
 
32
                        ;;
 
33
                *ondemand*)
 
34
                        GOVERNOR="ondemand"
 
35
                        break
 
36
                        ;;
 
37
                *)
 
38
                        exit 0
 
39
                        ;;
 
40
        esac
 
41
                        
24
42
        for CPUFREQ in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
25
43
        do
26
44
                [ -f $CPUFREQ ] || continue
27
 
                echo -n ondemand > $CPUFREQ
 
45
                echo -n $GOVERNOR > $CPUFREQ
28
46
        done
29
47
        ;;
30
48
    restart|reload|force-reload)