Hi list,
I'm using Debian Lenny with Laptop-mode tools that I've configured to manage my
laptop's hd, which is controlled by firmware that gives insane load cycle
values. Thus, I've enabled laptop-mode-tools and it currently applies a setting
of 254 (disabled) when running on AC and 128 (enabled and aggressive pm
settings) when running on battery. This works fine on boot, and when removing or
inserting the AC power. However, upon resume a setting of 128 is applied
regardless of the machine's powerstate.
I believe that laptop-mode is being restarted correctly since if I remove and
reinsert the AC cord the correct hdparm settings (254) are applied. My guess is
that something is also being re-initialized upon resume from suspend that is
over-riding laptop-mode-tools. In any event, I thought that the simplest fix for
this would be to add a script to /etc/pm/sleep.d/01-hdparm-power-check which
would do nothing if going to sleep, and if resuming would check whether the
computer was running on ac, and if so apply hdparm -B 254 /dev/sda
My problem lies in this second part, as I'm not sure how to correctly do a
check, the rest of it I can steal from other scripts included under
/usr/lib/pm-utils/sleep.d/
This is what I think 01-hdparm-power-check would look like:
=====================================
#
#!/bin/sh
# Check to see if we are running on AC power, and if so,
# override mystery program overriding laptop-mode.conf
. "${PM_FUNCTIONS}"
if cat /proc/acpi/ac_adapter/C1AB/state = off-line || exit $NA
case "$1" in
hibernate|suspend)
;;
thaw|resume)
hdparm -B 254 /dev/sda
;;
*) exit $NA
;;
esac
======================================
As you can see, I don't know much (anything) about bash scripting. Your advice,
assistance, criticism or concerns would be greatly appreciated.
Best,
AA
NOTE: I originally posted this to debian-laptop, but there does not seem to be
much traffic on that list. I have also tried posting this to Bart Samwell's
laptop-mode-tools waiting list, but there appears to be virtually no traffic there.
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]