You are not logged in.
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
I found easier anyway to use acpid, and put a line in rc.local (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
Offline
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
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
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
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
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
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
I did...My maximum number is 10
Last edited by TheImmortalPhoenix (2012-06-09 23:14:25)
Offline
I did...Ma maximum number is 10
Then I don't know 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
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
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
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
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
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
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
[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
Simply remove those lines if a module cannot be unloaded it means that it's not loaded at all, so you don't need those lines...
Offline
Ok but what about the times?
Offline
@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
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
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
@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
@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
[[ $(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