~tjaalton/acpi-support/precise

« back to all changes in this revision

Viewing changes to ac.d/90-hdparm.sh

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek, Steve Langasek, Michael Terry
  • Date: 2009-06-26 15:41:38 UTC
  • Revision ID: james.westby@ubuntu.com-20090626154138-4fzkytv5xqxt9aes
Tags: 0.124
[ Steve Langasek ]
* Drop events/sony-eject, confirmed in bug reports to no longer work due
  to its use of acpi_fakekey.  This needs to be implemented in the kernel
  input layer, but in the meantime there's no reason to keep this here.
  LP: #76924.
* Drop events/panasonic-{hibernatebtn,sleepbtn}, also reported to not work
  now due to the acpi_fakekey implementation.

[ Michael Terry ]
* debian/copyright: Convert to DEP5 format
* ac.d, battery.d, power.sh, debian/init.d, debian/rules:
  - Don't install power hook directories, instead just call pm-powersave
* debian/preinst:
  - Remove ac.d and battery.d conffiles

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh
2
 
#
3
 
# This script adjusts hard drive APM settings using hdparm. The hardware
4
 
# defaults (usually hdparm -B 128) cause excessive head load/unload cycles
5
 
# on many modern hard drives. We therefore set hdparm -B 254 while on AC
6
 
# power. On battery we set hdparm -B 128, because the head parking is
7
 
# very useful for shock protection.
8
 
#
9
 
 
10
 
. /usr/share/acpi-support/power-funcs
11
 
 
12
 
DO_HDPARM=y
13
 
if [ -e /usr/sbin/laptop_mode ] ; then 
14
 
  LMT_CONTROL_HD_POWERMGMT=$(. /etc/laptop-mode/laptop-mode.conf && echo "$CONTROL_HD_POWERMGMT")
15
 
  if [ "$LMT_CONTROL_HD_POWERMGMT" != 0 ] \
16
 
     && [ -e /var/run/laptop-mode-tools/enabled ]
17
 
  then
18
 
    # Laptop mode controls hdparm -B settings, we don't.
19
 
    DO_HDPARM=n
20
 
  fi
21
 
fi
22
 
 
23
 
if [ "$DO_HDPARM" = y ] ; then
24
 
  # Get the power state into STATE
25
 
  getState;
26
 
  
27
 
  for dev in /dev/sd? /dev/hd? ; do
28
 
    if [ -b $dev ] ; then
29
 
      # Check for APM support; discard errors since not all drives
30
 
      # support HDIO_GET_IDENTITY (-i).    
31
 
      if hdparm -i $dev 2> /dev/null | grep -q 'AdvancedPM=yes' ; then
32
 
        if [ "$STATE" = "BATTERY" ] ; then
33
 
          hdparm -B 128 $dev
34
 
        else
35
 
          hdparm -B 254 $dev
36
 
        fi
37
 
      fi
38
 
    fi
39
 
  done
40
 
fi
41