SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#101 2013-01-18 20:26:48

foozer
Member
Registered: 2013-01-14
Posts: 25

Re: Laptop power saving script for #! & Debian

sudo chmod +x /etc/pm/power.d/powersave

Offline

Help fund CrunchBang, donate to the project!

#102 2013-01-18 20:42:15

bandibp
New Member
From: Budapest, Hungary
Registered: 2013-01-18
Posts: 3

Re: Laptop power saving script for #! & Debian


Avid #! learner.

Offline

#103 2013-01-18 21:39:01

foozer
Member
Registered: 2013-01-14
Posts: 25

Re: Laptop power saving script for #! & Debian

Offline

#104 2013-01-18 21:50:52

bandibp
New Member
From: Budapest, Hungary
Registered: 2013-01-18
Posts: 3

Re: Laptop power saving script for #! & Debian

/usr/lib/pm-utils/power.d/anacron true:success.
/etc/pm/power.d/powersave true:/etc/pm/power.d/powersave: 66: cannot create /sys/devices/virtual/backlight/acpi_video0/brightness: Directory nonexistent
/etc/pm/power.d/powersave: 66: cannot create /sys/bus/spi/devices/*/power/control: Directory nonexistent
success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/etc/pm/power.d/powersave false:/etc/pm/power.d/powersave: 66: cannot create /sys/devices/virtual/backlight/acpi_video0/brightness: Directory nonexistent
/etc/pm/power.d/powersave: 66: cannot create /sys/bus/spi/devices/*/power/control: Directory nonexistent
success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/etc/pm/power.d/powersave true:/etc/pm/power.d/powersave: 66: cannot create /sys/devices/virtual/backlight/acpi_video0/brightness: Directory nonexistent
/etc/pm/power.d/powersave: 66: cannot create /sys/bus/spi/devices/*/power/control: Directory nonexistent
success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/etc/pm/power.d/powersave false:/etc/pm/power.d/powersave: 66: cannot create /sys/devices/virtual/backlight/acpi_video0/brightness: Directory nonexistent
/etc/pm/power.d/powersave: 66: cannot create /sys/bus/spi/devices/*/power/control: Directory nonexistent
success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/etc/pm/power.d/powersave true:/etc/pm/power.d/powersave: 66: cannot create /sys/devices/virtual/backlight/acpi_video0/brightness: Directory nonexistent
/etc/pm/power.d/powersave: 66: cannot create /sys/bus/spi/devices/*/power/control: Directory nonexistent
success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.

Avid #! learner.

Offline

#105 2013-01-27 18:30:03

zubcho81
#! CrunchBanger
From: Sofia, Bulgaria
Registered: 2012-08-12
Posts: 209

Re: Laptop power saving script for #! & Debian

I have a question. Why when my script is triggered

#!/bin/sh
# A script to enable laptop power saving features for #! & Debian GNU+linux.
# http://crunchbanglinux.org/forums/topic/11954

# List of modules to unload, space seperated. Edit depending on your hardware and preferences.
#modlist="uvcvideo"
# Bus list for runtime pm. Probably shouldn't touch this.
buslist="pci spi i2c"

case "$1" in
    true)
    # Enable some power saving settings while on battery
       # Enable laptop mode
        echo 5 > /proc/sys/vm/laptop_mode
#--------------------------------------------------------------------------------------
       # Less VM disk activity. Suggested by powertop
        echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
#--------------------------------------------------------------------------------------
       # Intel power saving
        #echo Y > /sys/module/snd_hda_intel/parameters/power_save_controller
        #echo 1 > /sys/module/snd_hda_intel/parameters/power_save
#--------------------------------------------------------------------------------------
       # Set backlight brightness to 10%
        echo 1 > /sys/class/backlight/radeon_bl/brightness
#--------------------------------------------------------------------------------------
       # USB powersaving
        for i in /sys/bus/usb/devices/*/power/autosuspend; do
            echo 1 > $i
        done
#--------------------------------------------------------------------------------------
       # SATA power saving
        #for i in /sys/class/scsi_host/host*/link_power_management_policy; do
           #echo min_power > $i
           #done
#--------------------------------------------------------------------------------------
       # Disable hardware modules to save power
        for mod in $modlist; do
            grep $mod /proc/modules >/dev/null || continue
            modprobe -r $mod 2>/dev/null
        done
#--------------------------------------------------------------------------------------        
       # Enable runtime power management. Suggested by powertop.
        #for bus in $buslist; do
            #for i in /sys/bus/$bus/devices/*/power/control; do
              #  echo auto > $i
            #done

#--------------------------------------------------------------------------------------        
        #ipw2000 eth1 powersave
        iwpriv eth1 set_power 5
#--------------------------------------------------------------------------------------
		#CPU powersave mode
		cpufreq-set -g userspace 
		for i in /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor; do
			echo userspace > $i 
		  done
		cpufreq-set -u1000000
			
		#Ethernet down
		ifconfig eth0 down
		
		#HDD powersave mode
		hdparm -B 1 -S 12 /dev/sda
		
		#Kill ad-on storage
		hal-disable-polling --device /dev/cdrom
		
		ethtool -s eth0 wol d
    ;;
#--------------------------------------------------------------------------------------
    false)
       #Return settings to default on AC power
        echo 0 > /proc/sys/vm/laptop_mode
        echo 500 > /proc/sys/vm/dirty_writeback_centisecs
        #echo N > /sys/module/snd_hda_intel/parameters/power_save_controller
        #echo 0 > /sys/module/snd_hda_intel/parameters/power_save
        echo 10 > /sys/class/backlight/radeon_bl/brightness
        for i in /sys/bus/usb/devices/*/power/autosuspend; do
            echo 2 > $i
        done
        #for i in /sys/class/scsi_host/host*/link_power_management_policy
            #do echo max_performance > $i
        #done
        for mod in $modlist; do
            if ! lsmod | grep $mod; then
                modprobe $mod 2>/dev/null
            fi
        done
        #for bus in $buslist; do
            #for i in /sys/bus/$bus/devices/*/power/control; do
             #done
        iwpriv eth1 set_power 6
        cpufreq-set -g ondemand
        cpufreq-set -u1710000
        ifconfig eth0 up
		hdparm -B 255 -S 60 /dev/sda
        
    ;;
esac

exit 0
  

line 1  is working

    1. cpufreq-set -g userspace
   
but 2 and 3 are not...
   
    2.    for i in /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor; do
            echo userspace > $i
          done
    3.    cpufreq-set -u1000000

and the processor stays at 600mhz

 cpufreq-info 

cpufrequtils 007: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 10.0 us.
  hardware limits: 600 MHz - 1.70 GHz
  available frequency steps: 1.70 GHz, 1.60 GHz, 1.40 GHz, 1.20 GHz, 1000 MHz, 800 MHz, 600 MHz
  available cpufreq governors: userspace, powersave, ondemand, conservative, performance
  current policy: frequency should be within 600 MHz and 600 MHz.
                  The governor "userspace" may decide which speed to use
                  within this range.
  current CPU frequency is 600 MHz.

I want it to run between 600 and 1000 mhz, but it is working at 600.

I have to manually set in terminal
sudo cpufreq-set -u1000000

And it is working.

Last edited by zubcho81 (2013-01-27 18:36:56)


Dried frog pills
As their name suggests, these are pills made chiefly from frogs, specifically the extremely poisonous ones that live in the vivarium at Unseen University and handled by the first-year students, so that if they kill one of them, not too much education has been wasted.

I use them daily! tongue

Offline

#106 2013-01-27 19:09:06

xaos52
The Good Doctor
From: Planet of the @s
Registered: 2011-06-24
Posts: 4,602

Re: Laptop power saving script for #! & Debian

Run the script yourself with -x option:

sudo sh -x <path-to-your-shell-script>

Offline

#107 2013-01-27 19:22:05

zubcho81
#! CrunchBanger
From: Sofia, Bulgaria
Registered: 2012-08-12
Posts: 209

Re: Laptop power saving script for #! & Debian

sudo sh -x <path-to-your-shell-script>

Last edited by zubcho81 (2013-01-27 19:23:37)


Dried frog pills
As their name suggests, these are pills made chiefly from frogs, specifically the extremely poisonous ones that live in the vivarium at Unseen University and handled by the first-year students, so that if they kill one of them, not too much education has been wasted.

I use them daily! tongue

Offline

#108 2013-02-02 17:41:27

typewriterjason
#! Junkie
Registered: 2011-08-28
Posts: 257

Re: Laptop power saving script for #! & Debian

I installed Hardran3's script the other night, and I haven't seen any major increase to the battery life.

Unia, I don't have enough knowledge to immediately tell this, so can you tell me; is your script substantially different? Can I install your script as well, or would it not play well with Hardran3's script?


Fortune favors the bold.
#! WALDORF
Asus EEEPC 1001PXD | Lenovo ThinkPad t410

Offline

#109 2013-02-02 20:56:02

Unia
#! Octo-portal-pussy
From: The Netherlands
Registered: 2010-07-17
Posts: 4,634
Website

Re: Laptop power saving script for #! & Debian

We both use a similar approach, but you might get a situation in which my script overrides Hardran's, where Hardran's would again override mine etc.. so just to be safe I would install only one at a time.

You can install them both (not simultaneously big_smile) and then see which gives you better battery life and stick with that one.

Offline

#110 2013-02-04 22:02:55

typewriterjason
#! Junkie
Registered: 2011-08-28
Posts: 257

Re: Laptop power saving script for #! & Debian

Thanks for the response!

Hey, another question; your script has a powersave element for HDD, and I'm using a SSD... should I comment out that line or something?


Fortune favors the bold.
#! WALDORF
Asus EEEPC 1001PXD | Lenovo ThinkPad t410

Offline

#111 2013-02-04 23:32:53

Unia
#! Octo-portal-pussy
From: The Netherlands
Registered: 2010-07-17
Posts: 4,634
Website

Re: Laptop power saving script for #! & Debian

Offline

#112 2013-02-04 23:43:22

typewriterjason
#! Junkie
Registered: 2011-08-28
Posts: 257

Re: Laptop power saving script for #! & Debian

Oh, that's ok. I'll do my own research.

But while I'm bugging you. Do I put both the 'powersave' script and the 'powersave.sh' script in /usr/bin/ ?

Apologies for the pestering.


Fortune favors the bold.
#! WALDORF
Asus EEEPC 1001PXD | Lenovo ThinkPad t410

Offline

#113 2013-02-05 15:36:47

Unia
#! Octo-portal-pussy
From: The Netherlands
Registered: 2010-07-17
Posts: 4,634
Website

Re: Laptop power saving script for #! & Debian

git clone git://github.com/Unia/powersave.git

Last edited by Unia (2013-02-05 15:37:10)

Offline

#114 2013-02-05 16:46:18

el_koraco
#!/loony/bun
From: inside Ed
Registered: 2011-07-25
Posts: 4,749

Re: Laptop power saving script for #! & Debian

I don't even think these things are necessary any more. Most of this stuff has been integrated into newer versions of pm-utils. fewt has even sopped Jupiter development. The only thing I do have in my version of the script that isn't present upstream is going on the powersave CPU governor on battery. Check /usr/lib/pm-utils for more details.

Offline

#115 2013-02-05 17:02:51

typewriterjason
#! Junkie
Registered: 2011-08-28
Posts: 257

Re: Laptop power saving script for #! & Debian

I've been wondering about that. I'm running Waldorf, (not bleeding-edge versions, but still) and when I installed Hardan3's script, I didn't really notice a change. Maybe that's because of the pm-utils?

Hey @el_koraco, when you said 'my version of the script,' do you mean the 1st script posted by Hardan3, or Unia's script?


Fortune favors the bold.
#! WALDORF
Asus EEEPC 1001PXD | Lenovo ThinkPad t410

Offline

#116 2013-02-05 18:16:56

Unia
#! Octo-portal-pussy
From: The Netherlands
Registered: 2010-07-17
Posts: 4,634
Website

Re: Laptop power saving script for #! & Debian

Offline

#117 2013-02-05 19:10:04

el_koraco
#!/loony/bun
From: inside Ed
Registered: 2011-07-25
Posts: 4,749

Re: Laptop power saving script for #! & Debian

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: bleh

Debian Logo