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 :
- the laptop-mode setting are overwritten by 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 :
doesn't work because you always call, which sets wrong parameter values

As far as I understand, the solution proposed by Roy is the good one :
modifying : 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


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

else : laptop mode isn't installed : 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

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

See also (to be continued..)