Comment 9 for bug 74394

Fixing hdparm parameter value and laptop-mode issue on resume

Bug : when resuming from suspend laptop-mode.conf setting are not respected

Consequences : the same as in the previous case : laptop-mode.conf settings are not applied

Cause : nothing is done concerning laptop-mode during resume.

False solution ?? : I'm using pm-utils, and when I add SERVICES="laptop-mode" in "/etc/acpi/acpi-support", it doesnt't help, I don't understand why (laptop-mode should be restarted on resume).
But, It seem to work (SERVICES="laptop-mode") when using "/etc/apci/sleep.sh force" (so It may work using default suspend function of gnome?...)

-------------------

Real solutions :
With solution 1 and 2, you have to be carreful to the power.sh script, which has also to be modified.
With solution 3, nothing has to be done to power.sh (but see previous post...)

--------------------

Solution 1 : when using pm-utils, the following script can be added :
(proposed by Valentin : https://bugs.launchpad.net/ubuntu/+source/acpi-support/+bug/89269/comments/18)

2. cd /usr/lib/pm-utils/sleep.d
3. sudo gedit 99-power-state-fix.sh
4. paste this:

#!/bin/bash
/usr/bin/on_ac_power
if [ "$?" -eq 0 ]; then
 echo "BATTERY" > /var/lib/acpi-support/powerstate
 /etc/acpi/power.sh ac_adapter
else
 if [ "$?" -eq 1 ]; then
  echo "AC" > /var/lib/acpi-support/powerstate
  /etc/acpi/power.sh battery
 fi
fi

5. save & close
6. sudo chmod 755 99-power-state-fix.sh

-------------------

Solution 2 : using the default suspend of gnome (script /etc/apci/sleep.sh ?) :
Adding the same script in : /etc/acpi/resume.d/ (and maybe /etc/acpi/suspend.d/)

-------------------

Solution 3 : using the default suspend of gnome (script /etc/apci/sleep.sh ?) :
Adding a script called (for example) "99-hdd-spin-fix.sh" in the following directories:
/etc/acpi/start.d/
/etc/acpi/suspend.d/
/etc/acpi/resume.d/
which simply contains hdparm setting :
#!/bin/sh
hdparm -B 255 /dev/sda

BUT : with this solution no difference is done between AC and battery on resume (concerning hdparm setting)
-------------------

Solution 1 work fine for me combined with the power.sh script I proposed in the previous post.