FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Laptop

 
 
LinkBack Thread Tools
 
Old 07-11-2008, 12:32 PM
Arthur A
 
Default Applying correct hdparm values on resume

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


--
To UNSUBSCRIBE, email to debian-laptop-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 

Thread Tools




All times are GMT. The time now is 07:42 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org