SEARCH

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

You are not logged in.

#76 2011-11-03 10:43:50

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

Re: Laptop power saving script for #! & Debian

Offline

Be excellent to each other!

#77 2011-11-03 10:47:57

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

Re: Laptop power saving script for #! & Debian

@hadran
What do you think of adding cpufreq-utils to the mix? It might go something like this, though I've never scrpited in my life big_smile

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

...
case "$1" in
    true)
    # Enable some power saving settings while on battery
       ...
        cpufreq-set -g powersave
       ...
    false)
       ...
        cpufreq-set -g ondemand
    ;;

esac

exit 0

Last edited by el_koraco (2011-11-03 10:50:48)

Offline

#78 2011-11-29 18:58:14

Istvan
#! CrunchBanger
From: Budapest, Hungary
Registered: 2010-02-20
Posts: 148

Re: Laptop power saving script for #! & Debian

Enable/disable compositing under Xfce :

> true

env DISPLAY=:0 sudo -u youruser -H xfconf-query -c xfwm4 -p /general/use_compositing -t bool -s false

> false

env DISPLAY=:0 sudo -u youruser -H xfconf-query -c xfwm4 -p /general/use_compositing -t bool -s true

Insert theese lines in the according part of the powersave script, and spare some more milliwatts.

Last edited by Istvan (2011-11-29 19:01:10)


Ha ezt el tudod olvasni, biztosan nem vagy rövidlátó.

Offline

#79 2012-01-16 06:19:18

MarioMaster100
#! Junkie
Registered: 2011-04-02
Posts: 261

Re: Laptop power saving script for #! & Debian

Hmm I edited it and put the backlight on 10% but it still has the battery at about full brightness.

Offline

#80 2012-01-19 04:12:42

joypilhub
New Member
Registered: 2011-09-18
Posts: 5

Re: Laptop power saving script for #! & Debian

cat /proc/sys/vm/laptop_mode

Offline

#81 2012-02-19 14:09:26

Tunafish
#! Die Hard
From: the Netherlands
Registered: 2010-03-07
Posts: 1,204

Re: Laptop power saving script for #! & Debian

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

...
case "$1" in
    true)
    # Enable some power saving settings while on battery
       ...
        cpufreq-set -g powersave
       ...
    false)
       ...
        cpufreq-set -g ondemand
    ;;

esac

exit 0

Last edited by Tunafish (2012-02-19 14:09:48)

Offline

#82 2012-05-25 15:33:57

Resident Bot
#! Die Hard
From: The Netherlands
Registered: 2012-02-17
Posts: 638

Re: Laptop power saving script for #! & Debian

will I be able to make use of this script even though I always have my laptop plugged in and not on battery?
It''s just that it would still be handy to use as the computer would run cooler.


Troll = not a fanatic
slave of #!  and arch

Offline

#83 2012-06-09 21:56:46

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

Re: Laptop power saving script for #! & Debian

Offline

#84 2012-08-24 14:27:22

MarioMaster100
#! Junkie
Registered: 2011-04-02
Posts: 261

Re: Laptop power saving script for #! & Debian

Could this script be modified to auto-unload modules while running on AC power without the battery plugged in?

Offline

#85 2012-08-24 15:00:22

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

Re: Laptop power saving script for #! & Debian

Last edited by Unia (2012-08-24 15:00:50)

Offline

#86 2012-08-24 15:31:40

MarioMaster100
#! Junkie
Registered: 2011-04-02
Posts: 261

Re: Laptop power saving script for #! & Debian

Offline

#87 2012-08-24 15:37:39

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

Re: Laptop power saving script for #! & Debian

Offline

#88 2012-08-24 17:30:10

MarioMaster100
#! Junkie
Registered: 2011-04-02
Posts: 261

Re: Laptop power saving script for #! & Debian

Offline

#89 2012-08-24 18:46:37

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

Re: Laptop power saving script for #! & Debian

Send me a PM and we might figure it out wink Lets keep this topic clean

Offline

#90 2012-09-02 13:28:57

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

Re: Laptop power saving script for #! & Debian

I have made some changes to the way my script works. Before, it'd be copied to /etc/pm/power.d and be run through pm-utils' pm-powersave function.

Now that I switched to systemd, I can't use pm-powersave anymore so my script wouldn't get run. To make it work with systemd, I've made two udev rules that get placed in /etc/udev/rules.d and my script will now go to /usr/bin.

The udev rules detect changes in the power state (charging|discharging) and run /usr/bin/powersave {true|false} accordingly.

Note that the script itself hasn't changed, so you can still copy it and place it in /etc/pm/power.d and use it with pm-powersave.

Offline

#91 2012-09-15 15:35:13

dura
Bloated Gimp
From: interzone
Registered: 2012-09-15
Posts: 2,108

Re: Laptop power saving script for #! & Debian

Offline

#92 2012-09-15 20:13:53

dura
Bloated Gimp
From: interzone
Registered: 2012-09-15
Posts: 2,108

Re: Laptop power saving script for #! & Debian

There was, on inspection, while running on battery, a clicking sound while on battery. Every second (I checked a few times it wasn't my watch).

The dirty writeback, apparently.

I turned off this script as being executable.

Clicking disappears. Power consumption drops dramatically again - to 5w on idle!! Amazing. Better than Linux Mint 11, better than Windows that was on it initially. Astonishing. Happiness. Elation. New found crunchiness.

Daniel

Last edited by dura (2012-09-15 20:31:13)

Offline

#93 2012-11-28 20:06:04

prometheus
Member
Registered: 2012-09-14
Posts: 12

Re: Laptop power saving script for #! & Debian

Were you able to use scripts that hardran3 posted along with tlp? I know they are redundant, but I was trying to run something else in the powersave script, but it is not working. Does pm-power manager get disabled by tlp? Since I am not familiar with how these scripts are activated, I hope to get some schooling here. Any pointers would be helpful. The following is the script I am trying to run. It runs fine if I invoke it manually.

#!/bin/sh

tag=pmpersonal

case $1 in
    true)   # on battery power
              # do nothing
        logger -t $tag "on battery"
        # sudo -k tee /proc/acpi/bbswitch <<<OFF
        /home/john/.screenlayout/laptoponly.sh
    ;;
    false)  # on a/c power
        logger -t $tag "on A/C"
        # sudo tee /proc/acpi/bbswitch <<<ON
    sleep 2
        /home/john/.screenlayout/1920monitor_right.sh
    ;;
esac
exit 0

Last edited by prometheus (2012-11-28 20:06:36)


He's Got The Whole World in His Hands

Offline

#94 2012-11-28 22:56:21

dura
Bloated Gimp
From: interzone
Registered: 2012-09-15
Posts: 2,108

Re: Laptop power saving script for #! & Debian

I have both tlp and hardrans script running. I can remember about some clashing but don't think it applied to my machine, as laptop mode isn't running....or something. It's just running from power.d, in bin, as executable. You can fiddle with tlp config to not make them clash. Hardran's script is executed whenever battery is unplugged.

Offline

#95 2012-12-19 12:25:48

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

Re: Laptop power saving script for #! & Debian

Hi, so I'm very new here, but actively reading your posts. Running Crunchbang 10 on Dell D600 1.71 Ghz Pentium M, 1256 Ram, radeon 9000 32mb Vram, Hdd Hitachi 20Gb @ 4200rpm with 2.6.39.-4.dmz.1-liquorix-686 kernel.

So i've managed to undervolt the CPU to the max and have a stable system and running little tweaked by me script from the first page. I'm happy with all but something isn't right for me. When i'm running powertop it is telling me this...

2.48 W      0.0 pkts/s                Device         Network interface: eth1 (ipw2200)
1.51 W      0.0 pkts/s                Device         Network interface: eth0 (tg3)

And here is the question: How can I stop eth0 (lan port) from running without killing the wifi? I don't want to blacklist it, because some day I might use it. smile

Here is my version of the script from the first page:

#!/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

    ;;
#--------------------------------------------------------------------------------------
    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
        
    ;;
esac

exit 0

And pm-powersave.log

/usr/lib/pm-utils/power.d/anacron true:success.
/etc/pm/power.d/powersave true: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:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.

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

#96 2012-12-19 12:42:39

dura
Bloated Gimp
From: interzone
Registered: 2012-09-15
Posts: 2,108

Re: Laptop power saving script for #! & Debian

ifconfig eth0 down

You could make a script and put it in /bin so eth0 is turned off at boot. Make it executable:

#!/bin/sh
ifconfig eth0 down

Last edited by dura (2012-12-19 12:43:43)

Offline

#97 2012-12-19 12:53:31

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

Re: Laptop power saving script for #! & Debian

ifconfig eth0 down

Last edited by zubcho81 (2013-01-09 08:34:18)


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

#98 2013-01-09 08:35:07

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

Re: Laptop power saving script for #! & Debian

bump

Please delete this smile

Last edited by zubcho81 (2013-01-09 08:36:18)


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

#99 2013-01-10 13:08:07

p950tes
Member
From: Uppsala, Sweden
Registered: 2012-05-05
Posts: 16

Re: Laptop power saving script for #! & Debian

I'm on a ASUS U31SG and got a problem using hardran's script: When the powersave mode was true (ie. running on battery) then it couldn't power off on it's own. It simply sat at "Will now halt" all the way until the battery died (or me forcibly powering down by holding down the power button). It worked fine to reboot, was only shutting down that was the problem. Has anyone else had this issue?

Anyway, by experimenting with the script a bit I in the found that removing 'pci' from the buslist variable solved the problem.

EDIT: I managed to find that the pci device causing this was:

USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 05)

By leaving that one to "on" and setting the rest of the pci power control to auto I am able to power down the laptop properly.
Oh, and thanks for a great script!

Last edited by p950tes (2013-01-12 17:14:43)

Offline

Help fund CrunchBang, donate to the project!

#100 2013-01-18 20:02:43

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 false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/etc/pm/power.d/powersave true:not executable.
/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:not executable.
/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:not executable.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.

Avid #! learner.

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