Page 1 of 1
[SOLVED] pm-utils issue
Posted: 1. Feb 2012, 19:53
by pwatk
I currently have the following two commands in my rc.local to disable power management on my laptops hard drive and wireless card:
Code: Select all
# Prevent excessive hard disk load cycling
hdparm -B 254 /dev/sda
# Prevent wifi intermittently dropping connection
iwconfig wlan0 power off
Although this works it's a bit hacky and doesn't cater for when the laptop resumes from hibernation or suspend at which point the settings are reset.
Some years ago I used two scripts in
/etc/pm/power.d and
/etc/pm/sleep.d to do the same work on a Ubuntu installation and I remember it working well but I can't get this to work for Salix.
Does anyone here have any experience with configuring pm-utils to make this work correctly on boot and after a hibernation/suspend?
-pwatk
Re: pm-utils issue
Posted: 1. Feb 2012, 23:31
by Shador
I've been doing the one or other tweaking with pm-utils. Recently on arch, but it should be the same here.
Probably there's something wrong with the hook you were trying to put in place. You need to put the files in the power.d directory. For example scripts have a look at the default ones shipped with the package in /usr/lib$LIBDIRSUFFIX/pm/power.d. man pm-suspend (towards the botton) resp. other man pages for pm-utils could be useful too.
Re: pm-utils issue
Posted: 2. Feb 2012, 14:00
by pwatk
Well I've discovered that this from the README.Slackware doesn't work:
Code: Select all
...
As an example, if you wanted to change the hdparm setting for
your hard drive's power management setting: rather than copying the entire
contents of /usr/lib(64)/pm-utils/power.d/harddrive to /etc/pm/power.d/ and
editing the copy, you could place only these two lines:
DRIVE_POWER_MGMT_BAT=128 # edit value as desired
DRIVE_POWER_MGMT_AC=128 # edit value as desired
...
So I copied
/usr/lib64/pm-utils/power.d/{harddrive,wireless} to
/etc/pm/power.d in entirety and made the changes I need:
Code: Select all
--- /usr/lib64/pm-utils/power.d/harddrive 2011-01-22 04:30:47.000000000 +0000
+++ /etc/pm/power.d/harddrive 2012-02-02 13:19:37.126703089 +0000
@@ -6,12 +6,12 @@
DRIVE_SPINDOWN_VALUE_AC="${DRIVE_SPINDOWN_VALUE_AC:-0}"
DRIVE_WRITE_CACHE_AC="${DRIVE_WRITE_CACHE_AC:-1}"
DRIVE_POWER_MGMT_AC="${DRIVE_POWER_MGMT_AC:-254}"
-DRIVE_ACOUSTIC_MGMT_AC="${DRIVE_ACOUSTIC_MGMT_AC:-0}"
+DRIVE_ACOUSTIC_MGMT_AC="${DRIVE_ACOUSTIC_MGMT_AC:-254}"
# Default values on battery
-DRIVE_SPINDOWN_VALUE_BAT="${DRIVE_SPINDOWN_VALUE_BAT:-6}"
-DRIVE_WRITE_CACHE_BAT="${DRIVE_WRITE_CACHE_BAT:-0}"
-DRIVE_POWER_MGMT_BAT="${DRIVE_POWER_MGMT_BAT:-128}"
+DRIVE_SPINDOWN_VALUE_BAT="${DRIVE_SPINDOWN_VALUE_BAT:-0}"
+DRIVE_WRITE_CACHE_BAT="${DRIVE_WRITE_CACHE_BAT:-1}"
+DRIVE_POWER_MGMT_BAT="${DRIVE_POWER_MGMT_BAT:-254}"
DRIVE_ACOUSTIC_MGMT_BAT="${DRIVE_ACOUSTIC_MGMT_BAT:-254}"
# Default devices to operate on
Code: Select all
--- /usr/lib64/pm-utils/power.d/wireless 2011-01-22 04:30:47.000000000 +0000
+++ /etc/pm/power.d/wireless 2012-02-02 13:06:01.419485828 +0000
@@ -71,9 +71,9 @@
}
case $1 in
- true) wireless_powersave on ;;
+ true) wireless_powersave off ;;
false) wireless_powersave off ;;
*) exit $NA ;;
esac
-exit 0
\ No newline at end of file
+exit 0
I'm now one step further because these settings are applied when resuming from hibernation but nothing happens if I plug or unplug the AC adaptor (I tested this with different settings) and the settings are not applied at boot.
Needless to say I'm really confused now.
Re: pm-utils issue
Posted: 2. Feb 2012, 22:08
by Shador
pwatk wrote:Well I've discovered that this from the README.Slackware doesn't work:
Code: Select all
...
As an example, if you wanted to change the hdparm setting for
your hard drive's power management setting: rather than copying the entire
contents of /usr/lib(64)/pm-utils/power.d/harddrive to /etc/pm/power.d/ and
editing the copy, you could place only these two lines:
DRIVE_POWER_MGMT_BAT=128 # edit value as desired
DRIVE_POWER_MGMT_AC=128 # edit value as desired
...
The README is wrong in that regard. Have a look at man pm-suspend and man pm-powersave. The meaning of each of the directories is explained there and how to use the program. It's much shorter than the Slackware README too.

To give you a short overview:
/etc/pm/config.d: Any configuration values like DRIVE_POWER_MGMT_BAT, ...
/etc/pm/sleep.d, /usr/lib/pm-utils/sleep.d: Suspend and hibernate hooks
/etc/pm/power.d/, /usr/lib/pm-utils/power.d/: Scripts which are executed to enable/disable powersave
Those lines need to go into /etc/pm-utils/config.d/. Add a file named e.g. /etc/pm-utils/config.d/drivepwr with this content:
Code: Select all
DRIVE_POWER_MGMT_BAT=128 # edit value as desired
DRIVE_POWER_MGMT_AC=128 # edit value as desired
It should work then without hacking the default scripts.
pwatk wrote:I'm now one step further because these settings are applied when resuming from hibernation but nothing happens if I plug or unplug the AC adaptor (I tested this with different settings) and the settings are not applied at boot.
Well, that's a completely different thing.

You weren't intially asking for it either, were you.

Anyway, as of now pm-utils or more specifically pm-powersave which handles this functionality, doesn't notice the change of power state. You need to modify the acpi-handler.sh. Have a look here:
https://sites.google.com/site/cheer6/acpi%27shandler.sh
Re: pm-utils issue
Posted: 3. Feb 2012, 00:16
by pwatk
Thanks, you've been really helpful.
I decided to install and configure laptop-modes-tools this evening which has solved my problem and more.
I also disabled the display settings in laptop-modes-tools and hard disk settings in xfce4-power-manager to avoid any conflicts which I assume could occur.