You are not logged in.

#151 2012-06-07 09:02:28

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: 3x+ battery life

I decided to go for the pm-utils way, but I rebuild upower without idevice support so it doesn't need additional dependencies. If you want to do the same, use this PKGBUILD:

pkgname=upower
pkgver=0.9.16
pkgrel=1
pkgdesc="Abstraction for enumerating power devices, listening to device events and querying history and statistics"
arch=('i686' 'x86_64')
url="http://upower.freedesktop.org"
license=('GPL')
depends=('udev' 'libusb' 'polkit' 'pm-utils' 'dbus-glib')
makedepends=('intltool' 'gobject-introspection' 'docbook-xsl')
options=('!libtool')
source=($url/releases/$pkgname-$pkgver.tar.xz)
sha256sums=('eb9a3d39a8cb62970fd612e333bc7a43437ab0e7890303578b0a7e3c67c8c212')

build() {
  cd "$pkgname-$pkgver"

  # put udev files in /usr/lib
  sed -i "/slashlibdir=/s#/lib#/usr/lib#" configure

  ./configure --prefix=/usr --sysconfdir=/etc \
      --localstatedir=/var \
      --libexecdir=/usr/lib/upower \
      --with-systemdsystemunitdir=/usr/lib/systemd/system \
      --disable-static \
      --without-idevice
  make
}

package() {
  cd "$pkgname-$pkgver"
  make DESTDIR="$pkgdir" install
}

If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#152 2012-06-07 10:39:17

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: 3x+ battery life

I found easier anyway to use acpid, and put a line in rc.local smile (or creating a systemd unit, as i did) .
Read here to understand my problem with pm-utils and upowerd -> https://bugs.archlinux.org/task/29974
Yeah it is very long smile

Offline

#153 2012-06-07 15:43:38

Zucca
Member
From: KUUSANKOSKI, Finland
Registered: 2009-02-26
Posts: 135

Re: 3x+ battery life

Unia wrote:

Hm, here's a disadvantage of using handler.sh: it will only switch power states when you (un)plug the power. When you boot with power unplugged, it will not automatically trigger powerdown.

That problem can be solved by adding few lines to rc.local for example.


K.i.s.s. <3

Offline

#154 2012-06-07 17:11:58

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: 3x+ battery life

Zucca wrote:
Unia wrote:

Hm, here's a disadvantage of using handler.sh: it will only switch power states when you (un)plug the power. When you boot with power unplugged, it will not automatically trigger powerdown.

That problem can be solved by adding few lines to rc.local for example.

Such as?


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#155 2012-06-07 17:20:40

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: 3x+ battery life

it depends: do you want to use acpid with pm-utils or acpid with powerdown and powerup script?
In the first case you only must put "pm-powersave" in rc.local.
In the second

if cat /sys/class/power_supply/AC0/online | grep 0 > /dev/null 2>&1
then
powerdown
else 
powerup
fi

Last edited by nierro (2012-06-07 17:20:49)

Offline

#156 2012-06-09 21:53:07

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: 3x+ battery life

For those of you looking for the pm-utils way of doing things, you can find my script here:
https://github.com/Unia/Powersave

Thought it might come in handy for some of you. All credit goes to Taylorchu for his initial work on this!


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#157 2012-06-09 22:47:02

TheImmortalPhoenix
Member
From: 127.0.0.1
Registered: 2011-08-13
Posts: 436

Re: 3x+ battery life

Your script looks great dear Unia, i'm using it, i think it's confortable...I've just a problem with setting brightness...when i'm in 'powersave' mode, it is correctly set to '0', but when i return to 'normal' mode, it's not set back to '9' but remains to '0'
I tried to edit file manually but i got this error:

"/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/backlight/acpi_video0/brightness" E667: Fsync failed

Can anyone help me to solve this issue?

EDIT: I don't know why but now the problem seems to be solved...

Last edited by TheImmortalPhoenix (2012-06-09 22:52:07)

Offline

#158 2012-06-09 22:55:02

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: 3x+ battery life

TheImmortalPhoenix wrote:

Your script looks great dear Unia, i'm using it, i think it's confortable...I've just a problem with setting brightness...when i'm in 'powersave' mode, it is correctly set to '0', but when i return to 'normal' mode, it's not set back to '9' but remains to '0'
I tried to edit file manually but i got this error:

"/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/backlight/acpi_video0/brightness" E667: Fsync failed

Can anyone help me to solve this issue?

EDIT: I don't know why but now the problem seems to be solved...

Just to be clear; did you notice the README I made? It says you have to edit the variable there, as it differs per manufacturer and even model.


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#159 2012-06-09 23:11:48

TheImmortalPhoenix
Member
From: 127.0.0.1
Registered: 2011-08-13
Posts: 436

Re: 3x+ battery life

I did...My maximum number is 10

Last edited by TheImmortalPhoenix (2012-06-09 23:14:25)

Offline

#160 2012-06-09 23:14:02

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: 3x+ battery life

TheImmortalPhoenix wrote:

I did...Ma maximum number is 10

Then I don't know big_smile Glad it works for you now, though!


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#161 2012-06-10 02:46:56

hesse
Member
Registered: 2011-12-08
Posts: 88

Re: 3x+ battery life

Cool project! I'm trying this script out together with /etc/acpi/handler.sh. By the way, what's the basic difference between

echo -n mem > /sys/power/state 

and

pm-suspend

?

Offline

#162 2012-06-10 11:15:14

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: 3x+ battery life

hesse wrote:

Cool project! I'm trying this script out together with /etc/acpi/handler.sh. By the way, what's the basic difference between

echo -n mem > /sys/power/state 

and

pm-suspend

?

According to the pm-utils Wiki, pm-utils (thus pm-suspend) is a more robust tool than just echoing the state into the kernel (?). In this case, more robust means that it works well with for example proprietary drivers such as Catalyst. For this reason, I am using pm-utils instead of echoing the state.

I have to say though, that I have never used the echoing way of doing it so it might just work perfect for you. Also, I'm not sure if there are any other differences.


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#163 2012-06-10 16:36:51

hesse
Member
Registered: 2011-12-08
Posts: 88

Re: 3x+ battery life

I have to say though, that I have never used the echoing way of doing it so it might just work perfect for you. Also, I'm not sure if there are any other differences.

I replaced my pm-suspend line with echo -n 'mem' > /sys/power/state in my handler.sh and it's working great. Also I made a small addition (some may call it bloat) to my /usr/lib/powerdown-utils to make it easier to see who is using its functions in the error messages:

# log as myself
test -n "$1" && me="$1" || me="powerdown-utils"

# turn on kernel options
opt() {
  echo $2 | tee $1 &>/dev/null
  [[ $? != 0 ]] && echo "[${me}] cannot enable option $1"
}
...
# powerdown - powersave script
source /usr/lib/powerdown-utils "powerdown" 
...
# powerdown - powerup
source /usr/lib/powerdown-utils "powerup" 
...

So the output from plugging in and unplugging AC adapter is now logged as:

[powerup] cannot enable option /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
[powerdown] cannot enable option /sys/devices/system/cpu/sched_smt_power_savings
[powerdown] cannot enable option /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
[powerdown] cannot enable option /sys/module/snd_ac97_codec/parameters/power_save
[powerdown] cannot enable option /sys/module/i915/parameters/i915_enable_rc6

Last edited by hesse (2012-06-10 16:37:46)

Offline

#164 2012-06-15 21:41:36

unikum
Member
From: Russia
Registered: 2010-09-04
Posts: 151
Website

Re: 3x+ battery life

Seems script should be updated:

# powerdown 
[powerdown] cannot enable option /sys/devices/system/cpu/sched_smt_power_savings
[powerdown] cannot enable option /sys/devices/system/cpu/sched_mc_power_savings
[powerdown] cannot enable option /sys/module/pcie_aspm/parameters/policy
[powerdown] cannot enable option /sys/class/scsi_host/host*/link_power_management_policy
[powerdown] cannot enable option /sys/module/snd_ac97_codec/parameters/power_save
[powerdown] cannot run iwconfig wlan0 power on
[powerdown] cannot enable option /sys/module/i915/parameters/i915_enable_rc6
[powerdown] cannot enable option /sys/module/i915/parameters/i915_enable_fbc
[powerdown] cannot unload module uvcvideo
[powerdown] cannot unload module videodev
[powerdown] cannot unload module btusb
[powerdown] cannot unload module bluetooth

Offline

#165 2012-06-15 21:43:39

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: 3x+ battery life

unikum wrote:

Seems script should be updated:

# powerdown 
[powerdown] cannot enable option /sys/devices/system/cpu/sched_smt_power_savings
[powerdown] cannot enable option /sys/devices/system/cpu/sched_mc_power_savings
[powerdown] cannot enable option /sys/module/pcie_aspm/parameters/policy
[powerdown] cannot enable option /sys/class/scsi_host/host*/link_power_management_policy
[powerdown] cannot enable option /sys/module/snd_ac97_codec/parameters/power_save
[powerdown] cannot run iwconfig wlan0 power on
[powerdown] cannot enable option /sys/module/i915/parameters/i915_enable_rc6
[powerdown] cannot enable option /sys/module/i915/parameters/i915_enable_fbc
[powerdown] cannot unload module uvcvideo
[powerdown] cannot unload module videodev
[powerdown] cannot unload module btusb
[powerdown] cannot unload module bluetooth

And it worked before?


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#166 2012-06-16 01:24:05

taylorchu
Member
Registered: 2010-08-09
Posts: 405

Re: 3x+ battery life

something to check:
1. root privileges
2. acpi-cpufreq is loaded
3. the module is used on your machine


"After you do enough distro research, you will choose Arch."

Offline

#167 2012-06-24 19:29:09

dartfira
Member
Registered: 2010-08-23
Posts: 104

Re: 3x+ battery life

[powerdown] cannot enable option /sys/module/snd_ac97_codec/parameters/power_save
[powerdown] cannot enable option /sys/module/i915/parameters/i915_enable_rc6
[powerdown] cannot unload module uvcvideo
[powerdown] cannot unload module videodev
[powerdown] cannot unload module btusb
[powerdown] cannot unload module bluetooth

Mine, but I has no bluetooth hardware.
Still get 2.23 hours as laptop-mode.

Offline

#168 2012-06-24 20:32:23

TheImmortalPhoenix
Member
From: 127.0.0.1
Registered: 2011-08-13
Posts: 436

Re: 3x+ battery life

Simply remove those lines wink if a module cannot be unloaded it means that it's not loaded at all, so you don't need those lines...

Offline

#169 2012-07-07 14:26:53

dartfira
Member
Registered: 2010-08-23
Posts: 104

Re: 3x+ battery life

Ok but what about the times?

Offline

#170 2012-07-07 22:48:18

taylorchu
Member
Registered: 2010-08-09
Posts: 405

Re: 3x+ battery life

@everyone
the latest version includes existence checks, so all error messges are relevant now.


"After you do enough distro research, you will choose Arch."

Offline

#171 2012-07-09 14:49:24

fredmorcos
Member
From: Austria
Registered: 2008-09-01
Posts: 9
Website

Re: 3x+ battery life

Would anyone be interested in contributing to sysconf?

https://bbs.archlinux.org/viewtopic.php?id=144507

Also, I am open to merging projects towards a single complete solution for this problem.

From what I found in this thread (a quick skim) that is missing in sysconf would be:

1. pm-utils integration scripts.
2. Screen brightness control.
3. Curses/dialog UI for creating/editing profiles.
4. Check the README for some TODO items.

Cheers,
Fred

Offline

#172 2012-07-09 15:01:28

patroclo7
Member
From: Bassano del Grappa, ITALY
Registered: 2006-01-11
Posts: 915

Re: 3x+ battery life

I am experimenting with a slightly personalized powerdown script and I enjoy it a lot. Thanks for this.

In the load function in /usr/lib/powerdown-utils there is the following line:

[[ $(lsmod | grep $1) == "" ]] || return

When I run powerup from an interactive shell I always get exit code 1. If I change that line to how it is in the unload function:

[[ $(lsmod | grep $1) == "" ]] && return 

then I get exit code 0 (success).
Please note that in both cases the modules that should be loaded are actually loaded, so I think that it succeeds.
Am I missing something?


Mortuus in anima, curam gero cutis

Offline

#173 2012-07-11 01:45:04

taylorchu
Member
Registered: 2010-08-09
Posts: 405

Re: 3x+ battery life

@fred
Sorry, I was not sure about your future plan. Could you talk about it?

@patroclo7
these lines just grep lsmod info and see whether it can grep something. If it can, it means the module is loaded, so unload.


"After you do enough distro research, you will choose Arch."

Offline

#174 2012-07-11 10:47:52

patroclo7
Member
From: Bassano del Grappa, ITALY
Registered: 2006-01-11
Posts: 915

Re: 3x+ battery life

@taylorchu: Yes, I understand. My only problem is that as a result of that specific line powerup always exits with an error code (it does not matter if the modules are already loaded or not), although it loads the modules as expected. Not sure if this has something to do with zsh being my default shell.

Last edited by patroclo7 (2012-07-11 10:53:58)


Mortuus in anima, curam gero cutis

Offline

#175 2012-07-12 00:44:39

taylorchu
Member
Registered: 2010-08-09
Posts: 405

Re: 3x+ battery life

[[ $(lsmod | grep $1) = "" ]]
can you confirm that this have different result if the module is loaded or not?


"After you do enough distro research, you will choose Arch."

Offline

Board footer

Powered by FluxBB