LWN.net Logo

Laptops, power management, and Ubuntu

Laptops, power management, and Ubuntu

Posted Nov 12, 2007 11:11 UTC (Mon) by sitaram (subscriber, #5959)
Parent article: Laptops, power management, and Ubuntu

For all the mandriva users out there, here's what seems to work for me (this is a Dell
something with a Hitachi 60 GB hard disk).  Note that I don't see why some eqvt of this won't
work for others too...

(1) make the following changes in /etc/laptop-mode/laptop-mode.conf.

    # Idle timeout values. (hdparm -S)
    # Default is 2 hours on AC (NOLM_HD_IDLE_TIMEOUT_SECONDS=7200) and 20 seconds
    # for battery and for AC with laptop mode on.
    # Anything more than 10-15 minutes (900 seconds) ought to be OK, actually...
    LM_AC_HD_IDLE_TIMEOUT_SECONDS=5400
    LM_BATT_HD_IDLE_TIMEOUT_SECONDS=3600
    NOLM_HD_IDLE_TIMEOUT_SECONDS=7200

    # Should laptop mode tools control the hard drive power management settings?
    CONTROL_HD_POWERMGMT=1      # this has to be 1 else nothing happens, I believe

    # Power management for HD (hdparm -B values)
    BATT_HD_POWERMGMT=254       # 255 didn't work for me.
    LM_AC_HD_POWERMGMT=254
    NOLM_AC_HD_POWERMGMT=254

Notes on above:

I have found that controlling only "-B" is not enough.  As the original article said, in some
cases spindown also counts as a load/unload, so you need to fix "-S" also.

(2) in file /usr/share/pm-utils/sleep.d/92disk, added a line inside the function
"resume_disk":
        /sbin/hdparm -B 254 -S 241 /dev/sda

Notes on above:

(i) the code in the said file does not recognise SATA disks and I do not have the energy/time
(read: SMARTs, no pun intended!) to figure out how to make that happen, hence the hardcoding.
Please change the /dev/sda to whatever you have

(ii) if your hard disk is IDE, setting
        RESUME_DISK="-B 254 -S 241"
ought to be enough for you, but I have no way of testing that

(iii) why do I need to do this at all?  Glad you asked... ;-)

The reason is that the laptopmode hooks seem to kick in only when switching from battery to AC
or vice-versa.  When coming up from a suspend (whether to disk or to RAM), when there has been
NO change the AC/battery status, they DONT kick in, and you are left with the hard disk
default.  Which is what caused the problem in the first place!

This file (the /usr/share/pm-utils/sleep.d/92disk thing) *does* get called on a resume, so I
use that.

By the way this file is from the "pm-utils" package.


(Log in to post comments)

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds