Comment 5 for bug 74394

chourave (gaston72) wrote :

I agree with Roy description.

Everything worked fine under Gutsy with kernel 2-6-22-14, I have just upgraded my kernel : installing 2-6-24-16.
It fixes my resume problem, but now laptop-mode is broken.

1. In order to control everything using laptop-mode.conf, I used to enable laptop-mode both on AC and battery. Now it's impossible.
2. after resume, the hdparm settings are overwritten and the hard disk problem comes back (Load_Cycle_Count issue)

I'm becoming crazy with the behaviour of power.sh :
- the laptop-mode setting are overwritten by power.sh because of the definition of laptop_mode_enable or laptop_mode_disable functions.

- if you use SCRIPT in /etc/acpi/ac.d/ or /etc/acpi/battery.d/ :
The loop execute them, but their action will be cancelled by the call to laptop_mode_enable or laptop_mode_disable...

For the resume problem, the solution proposed here :
https://bugs.launchpad.net/ubuntu/+source/acpi-support/+bug/89269/comments/18
doesn't work because you always call power.sh, which sets wrong parameter values

As far as I understand, the solution proposed by Roy is the good one :
modifying power.sh : i.e. replacing the "laptop_mode_enable" or "laptop_mode_disable" functions by simple calls to laptop-mode auto (/usr/sbin/laptop_mode auto)

It could be implemented as follow :
- First : testing if laptop-mode is installed, and then applying parameter

getState;
checkStateChanged;

if laptop-mode is installed :
    laptop-mode auto
    if ac
        loop on the script .../ac.d
    elseif battery
        loop on the script .../battery.d
    end

else : laptop mode isn't installed : power.sh imposes the settings
    if ac
        ac default hdparm values
        loop on the script .../ac.d
    elseif battery
        battery default hdparm values
        loop on the script .../battery.d
    end
end..

Could it be right ? Does somebody knows how to do it safely and properly ?

See also (to be continued..)
https://bugs.launchpad.net/ubuntu/+source/acpi-support/+bug/59695/comments/273
https://bugs.launchpad.net/ubuntu/+source/acpi-support/+bug/229693/comments/1
https://bugs.launchpad.net/ubuntu/+source/laptop-mode-tools/+bug/80331/comments/1
https://bugs.launchpad.net/ubuntu/+source/laptop-mode-tools/+bug/172282/comments/1
....