--- acpi-support-0.137.orig/debian/acpi-support-base.postinst
+++ acpi-support-0.137/debian/acpi-support-base.postinst
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+        configure)		
+                invoke-rc.d acpid restart >/dev/null || true
+                ;;
+        *)
+                ;;
+esac
+
+#DEBHELPER#
--- acpi-support-0.137.orig/debian/acpi-fakekey.manpages
+++ acpi-support-0.137/debian/acpi-fakekey.manpages
@@ -0,0 +1 @@
+debian/acpi_fakekey.1
--- acpi-support-0.137.orig/debian/watch
+++ acpi-support-0.137/debian/watch
@@ -0,0 +1,2 @@
+version=2
+http://archive.ubuntu.com/ubuntu/pool/main/a/acpi-support/acpi-support_(.*).tar.gz
--- acpi-support-0.137.orig/debian/changelog
+++ acpi-support-0.137/debian/changelog
@@ -1,1325 +1,894 @@
-acpi-support (0.137) maverick; urgency=low
+acpi-support (0.137-5) unstable; urgency=low
 
-  * power.sh, lib/policy-funcs: don't call pm-powersave if upower is running,
-    as upower already does this for us unconditionally and we don't want to
-    run these scripts twice.  Eventually power.sh should be dropped entirely,
-    but Kubuntu hasn't yet transitioned to use upower.  LP: #582471.
-  * lib/power-funcs: drop dependency on finger, we can do this just as well
-    using who from coreutils.
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Tue, 22 Jun 2010 19:16:30 -0700
-
-acpi-support (0.136) lucid; urgency=low
-
-  * debian/rules: don't pass -n to dh_installinit, we do want changes to
-    maintainer scripts - we just don't want the init script called, so use
-    --no-start instead.
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Fri, 23 Apr 2010 04:47:56 -0700
-
-acpi-support (0.135) lucid; urgency=low
-
-  * debian/rules: don't call the init script in the postinst, the script
-    exists only to ensure the power policy is applied on boot so we should
-    keep our hands off on upgrade.  LP: #567182
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Fri, 23 Apr 2010 04:31:14 -0700
-
-acpi-support (0.134) lucid; urgency=low
-
-  * drop asus-eee-volume-* event handlers, which are also now superseded by
-    a kernel input device.  LP: #560551.
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Tue, 13 Apr 2010 17:18:57 -0700
-
-acpi-support (0.133) lucid; urgency=low
-
-  * Repair asus-touchpad.sh by using grep. (LP: #506442)
-
- -- Torsten Spindler (Canonical) <torsten@canonical.com>  Thu, 04 Mar 2010 12:00:21 +0100
-
-acpi-support (0.132) lucid; urgency=low
-
-  * lib/state-funcs, start.d/60-asus-wireless-led.sh, asus-wireless.sh:
-    eliminate setLEDAsusWireless altogether; this needs to be handled
-    directly by the kernel when the kill switch is toggled, not in a racy
-    and inconsistently-applied manner by acpi-support; and in at least some
-    cases we know this already *does* happen because of reports that
-    /sys/devices/platform/asus-laptop/wlan, used for toggling "the LED" with
-    the current kernel module, is actually an interface for toggling *the
-    antenna* that happens to also toggle the LED.  Likewise, we should not
-    be responsible for bringing up the antenna at boot, so get rid of the
-    file in the start.d directory.  LP: #293943, #204378, #334368.
-  * Now that the last script is gone from start.d, kill off the directory
-    and the init script handling too.
-  * Remove the asus-wireless-2 event handler, which is completely redundant
-    with the pre-existing asus-wireless-{off,on} handlers.  LP: #207871.
-
-  [ Erik Andrén ]
-  * Add support for ATKD 00000037 to events/asus-touchpad.
-    This makes the disable touchpad buttons (!) on the EeePc 1005HA work as
-    intended.  LP: #502720.
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Mon, 04 Jan 2010 15:52:56 -0800
-
-acpi-support (0.131) lucid; urgency=low
-
-  * events/lenovo-undock, undock.sh: new scripts to handle the Fn+F9 "undock"
-    button on ThinkPads, which unfortunately nothing else handles.  Thanks
-    to Jeffrey Baker for the first implementation.  LP: #18864.
-  * /etc/default/acpi-support: laptop-mode-tools is no longer installed by
-    default, so don't override its setting from here.  LP: #244838, #490186.
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Mon, 14 Dec 2009 11:04:22 -0800
-
-acpi-support (0.130) lucid; urgency=low
-
-  * Readd support for ATKD 0000006b to events/asus-touchpad.  LP: #314376.
-  * Drop dependency on laptop-mode-tools: this is not enabled by default, and
-    dropping it lets us remove much of the laptop-mode-tools delta wrt Debian.
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Wed, 18 Nov 2009 17:22:26 -0600
-
-acpi-support (0.129) karmic; urgency=low
-
-  * Fix ibm-wireless to use the 'rfkill' tool for toggling bluetooth,
-    recommending wireless-tools which currently provides this; and fix
-    the isAnyWirelessPoweredOn function for the latest change in the rfkill
-    /sys interface, looking under phy80211/ instead of under device/
-    (LP: #397698).  The toggleAllWirelessStates() function is still broken,
-    because the rfkill state on the iwl3945 (at least) is still being done
-    in the kernel, so we work around this for now by leaving the function
-    inactive.
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Tue, 13 Oct 2009 01:45:01 -0700
-
-acpi-support (0.128) karmic; urgency=low
-
-  [ Steve Langasek ]
-  * Get laptop-mode-tools out of Suggests.  Finally-really-fixes LP: #74683.
-  * Fix the touchpad handler to use xinput instead of (unreliable)
-    synclient, and add a corresponding Recommends; and call getXconsole so
-    we can actually talk to the X server.  LP: #447211.
-  * new events/asus-f8sv-touchpad: handle another touchpad ACPI event on
-    another ASUS model.  LP: #218598.
-  * lib/power-funcs: adjust getXconsole to work when the tty number is not
-    present on the X commandline.
-
-  [ Felix Geyer ]
-  * lib/policy-funcs: Recognize KDE4 PowerDevil as a power manager.
-    LP: #387750.
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Mon, 12 Oct 2009 16:49:00 -0700
-
-acpi-support (0.127) karmic; urgency=low
-
-  [ Lionel Le Folgoc ]
-  * lib/policy-funcs: Recognize xfce4-power-manager as a power manager.
-    LP: #425155
-
-  [ Steve Langasek ]
-  * Drop /etc/acpi/start.d/90-hdparm.sh: this is redundant because we're
-    already calling pm-powersave on start (either via /etc/acpi/power.sh,
-    or by one of the desktop power managers as enumerated in
-    lib/policy-funcs) so there's no reason we should be reapplying the
-    policy here.  LP: #443992, #438355, #318980.
-  * Add guidance-power-manager to the list of known desktop power managers.
-    LP: #154910
-
-  [ Michael Terry ]
-  * lib/policy-funcs: Recognize dalston as a power manager.  LP: #432578
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Mon, 05 Oct 2009 20:11:12 -0700
-
-acpi-support (0.126) karmic; urgency=low
-
-  * Drop /etc/acpi/start.d/10-save-dmidecode.sh, which is irrelevant given
-    the existence of /sys/class/dmi/id/.
-  * Drop events/panasonic-brightness-{down,up}, events/panasonic-mute,
-    events/panasonic-volume-{down,up}, and panabright.sh, confirmed to be
-    implemented now by the panasonic-laptop kernel driver.
-  * Drop events/asus-{a6u-touchpad,internet,lock,wireless} and
-    events/asus-media-{next,play-pause,prev,stop}, confirmed to be
-    implemented by the asus-laptop kernel driver.
-  * Drop events/thinkpad-thinkpad and thinkpad-thinkpad.sh, which is also
-    implemented in the thinkpad_acpi driver and should have been dropped a
-    while ago.
-  * Drop /etc/acpi/{ac,battery}.d, which were still being installed.
-  * Drop panapower.sh, which seems to have never been used.
-  * Clean up /etc/acpi/toshbright.sh, which was meant to be removed back in
-    jaunty
-  * Clean up /etc/acpi/hibernatebtn.sh, no longer used.
-  * Clean up /etc/acpi/wireless.sh, unused since before hardy.
-  * debian/preinst: fix the rm_conffile script to correctly handle conffiles
-    whose filename is a substring of another conffile in the same package
-  * Drop events/video_brightness{down,up}, video_brightness{up,down}.sh: at
-    least some platforms that use these ACPI sequences are seeing them
-    correctly translated to input events, so those users will see duplicate
-    events unless we drop them.  LP: #178860.
-  * Add missing dh_shlibdeps call to debian/rules.
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Wed, 26 Aug 2009 08:59:55 -0700
-
-acpi-support (0.125) karmic; urgency=low
-
-  * debian/rules, debian/control: drop "arch:Depends" substvar in favor of
-    using arch-dependent package relationships directly, and clean up
-    various deps that were supposed to be demoted to Recommends long ago.
-    LP: #74683.
-  * Drop dependency on vbetool entirely, no longer needed now that we've
-    handed suspend/resume quirks off to pm-utils.
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Mon, 13 Jul 2009 11:44:27 -0700
-
-acpi-support (0.124) karmic; urgency=low
-
-  [ 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:
+  * Removed leftover packaging files coming from the Ubuntu debian/
+    directory. (Closes: #591815)
+  * Improve suspned time by backgrounding X commands. (Closes: #593303)
+    - thanks to David Fries <david@fries.net>
+
+ -- Michael Meskes <meskes@debian.org>  Tue, 17 Aug 2010 09:48:09 +0200
+
+acpi-support (0.137-4) unstable; urgency=low
+
+  * Added option to suspend laptop on lid close. (Closes: #589625) -
+    thanks to Luca Niccoli <lultimouomo@gmail.com>
+  * Bumped Standards-Version to 3.9.1, no changes needed.
+
+ -- Michael Meskes <meskes@debian.org>  Mon, 16 Aug 2010 15:33:16 +0200
+
+acpi-support (0.137-3) unstable; urgency=low
+
+  * Re-added lost brace to policy-funcs. (Closes: #587599)
+  * Give udev time to create devices before starting acpi-fakekeyd.
+    (Closes: #584203)
+
+ -- Michael Meskes <meskes@debian.org>  Fri, 02 Jul 2010 17:59:04 +0200
+
+acpi-support (0.137-2) unstable; urgency=low
+
+  * Bumped versioned build-dependency on debhelper.
+  * Bumped Standards-Version to 3.9.0, no changes needed.
+  * Deleted stray 'i' in power-funcs.
+  * Converted Conflicts to Breaks.
+
+ -- Michael Meskes <meskes@debian.org>  Tue, 29 Jun 2010 13:50:31 +0200
+
+acpi-support (0.137-1) unstable; urgency=low
+
+  * Imported new Upstream version 0.137
+  * Removed old event handlers in /etc/acpi/events that are no longer
+    distributed by this package. 
+  * Fixed wireless toggling by rewriting the functions to use rfkill.
+    (Closes: #581312) - thanks to Luca Niccoli <lultimouomo@gmail.com>
+  * Made sure that ASUS key events are not handled on EeePCs because
+    they are correctly handled by the kernel input layer on these
+    systems. (Closes: #586924)
+
+ -- Michael Meskes <meskes@debian.org>  Thu, 24 Jun 2010 14:08:54 +0200
+
+acpi-support (0.136-4) unstable; urgency=low
+
+  * Make sure acpi_fakekeyd sends a EV_SYN package after the key press
+    event. (Closes: #577603)
+  * Do not try to provide a login environment when calling su which is
+    neither needed nor correctly implemented in this script. (Closes:
+    #585736)
+
+ -- Michael Meskes <meskes@debian.org>  Tue, 15 Jun 2010 18:48:21 +0200
+
+acpi-support (0.136-3) unstable; urgency=low
+
+  * Do not complain if daemon is already running.
+  * Do not recommend hal because it doesn't seem to be needed anymore.
+    (Closes: #580019)
+
+ -- Michael Meskes <meskes@debian.org>  Tue, 04 May 2010 14:02:16 +0200
+
+acpi-support (0.136-2) unstable; urgency=low
+
+  * Added postinst script to make sure acpi_fakekeyd is stopped before
+    starting it (Closes: #579798)
+
+ -- Michael Meskes <meskes@debian.org>  Sat, 01 May 2010 19:24:42 +0200
+
+acpi-support (0.136-1) unstable; urgency=low
+
+  * New Upstream version 0.136: drop asus-eee-volume-* event handlers, which
+    are also now superseded by a kernel input device. (Closes: #578889)
+  * Moved acpi_fakekey to its own package. (Closes: #487697)
+  * Added source/format file.
+  * Do not run power management scripts before syslog starts. (Closes: #578637)
+
+ -- Michael Meskes <meskes@debian.org>  Sun, 25 Apr 2010 17:03:56 +0200
+
+acpi-support (0.133-2) unstable; urgency=low
+
+  * Use logger for error message in power button script to make sure the admin
+    can see it in the logs.
+  * Get system information from kernel interface instead of using
+    dmidecode. (Closes: #572931)
+
+ -- Michael Meskes <meskes@debian.org>  Fri, 19 Mar 2010 17:41:06 +0100
+
+acpi-support (0.133-1) unstable; urgency=low
+
+  * New upstream version.
+  * Made asus-wireless.sh cope with different strings identifying the
+    vendor. (Closes: #571703)
+  * Added patch to handle special ASUS touchpad leds. (Closes: #571692)
+
+ -- Michael Meskes <meskes@debian.org>  Fri, 05 Mar 2010 15:14:21 +0100
+
+acpi-support (0.132-2) unstable; urgency=low
+
+  * Clarify rfkill usage for Thinkpad wireless toggling.
+  * Moved dmidecode back to Recommends. It's used on more systems than
+    originally anticipated.
+  * Do not suggest nvclock because it apparently is not used anymore.
+  * Suggest xinput that is needed for Asus touchpad toggling.
+  * Downgraded toshset to a suggestion.
+  * Make sure asus-wireless.sh is only executed if we are really on an
+    Asus laptop. Other brands generate the same key event but must not
+    execute the script. (Closes: #568244, #569756) - thanks to Stefano
+    <pietranera@gmail.com>
+  * Bumped Standards-Version to 3.8.4, no changes needed.
+
+ -- Michael Meskes <meskes@debian.org>  Tue, 16 Feb 2010 13:14:57 +0100
+
+acpi-support (0.132-1) unstable; urgency=low
+
+  * New upstream version:
+    - eliminate setLEDAsusWireless altogether; this needs to be handled
+      directly by the kernel when the kill switch is toggled, not in a racy
+      and inconsistently-applied manner by acpi-support; and in at least some
+      cases we know this already *does* happen because of reports that
+      /sys/devices/platform/asus-laptop/wlan, used for toggling "the LED" with
+      the current kernel module, is actually an interface for toggling *the
+      antenna* that happens to also toggle the LED.  Likewise, we should not
+      be responsible for bringing up the antenna at boot, so get rid of the
+      file in the start.d directory.  LP: #293943, #204378, #334368.
+    - Remove the asus-wireless-2 event handler, which is completely redundant
+      with the pre-existing asus-wireless-{off,on} handlers.  LP: #207871.
+    - Add support for ATKD 00000037 to events/asus-touchpad.
+      This makes the disable touchpad buttons (!) on the EeePc 1005HA work as
+      intended.  LP: #502720.
+  * Allow gnome-screensaver as alternative to xscreensaver. (Closes:
+    #564442)
+  * Do not remove conffiles that were later brought back and are
+    installed again. (Closes: #564455)
+
+ -- Michael Meskes <meskes@debian.org>  Sat, 09 Jan 2010 19:19:51 +0100
+
+acpi-support (0.131-6) unstable; urgency=low
+
+  * Cleaned up lsb-base logging usage in init script. (Closes: #563919) -
+    thanks to Jonathan McDowell <noodles@earth.li>
+  * Downgraded dmidecode to Suggests because it is only needed on
+    Thinkpads.
+  * Suggest rfkill and exit ibm-wireless.sh if rfkill is not installed.
+    (Closes: #564169)
+  * Remove test for powersaved. The package got removed from Debian.
+    (Closes: #553643)
+
+ -- Michael Meskes <meskes@debian.org>  Sat, 09 Jan 2010 15:50:08 +0100
+
+acpi-support (0.131-5) unstable; urgency=low
+
+  * Made cycling through wireless and bluetooth states configurable to
+    some degree. (Closes: #527276)
+  * Downgraded nvclock to suggestion because it is only needed for a few
+    systems. (Closes: #562883)
+  * Made method for switching display on and off configurable. (Closes:
+    #555110)
+
+ -- Michael Meskes <meskes@debian.org>  Mon, 28 Dec 2009 23:08:35 +0100
+
+acpi-support (0.131-4) unstable; urgency=low
+
+  * Really install asus-wireless-wlan event file.
+  * Re-added thinkpad-mute event handling.
+
+ -- Michael Meskes <meskes@debian.org>  Sun, 27 Dec 2009 11:39:56 +0100
+
+acpi-support (0.131-3) unstable; urgency=low
+
+  * It seems that on some Asus systems at least this script breaks
+    wireless completely. Therefore we remove it for now. If we find a
+    way to do it right on all systems we can re-enable it. (Closes:
+    #482349)
+  * Made wireless control button work on Asus A3A and other similar
+    systems. In the process updated state-funcs to not use deprecated
+    /sys/class/net/*/wireless directory anymore. (Closes: #561953) -
+    thanks to Jakub Adam <jakub.adam@ktknet.cz>
+
+ -- Michael Meskes <meskes@debian.org>  Fri, 25 Dec 2009 14:23:17 +0100
+
+acpi-support (0.131-2) unstable; urgency=low
+
+  * Switch off screen even if no user is logged in. (Closes: #503986)
+  * Remove dependency on hdparm, finger, powermgmt-base because neither
+    is used anymore.
+  * Recommend xscreensaver that is used to blank and lock the screen.
+
+ -- Michael Meskes <meskes@debian.org>  Thu, 17 Dec 2009 14:53:17 +0100
+
+acpi-support (0.131-1) unstable; urgency=low
+
+  * Pinky prints "?:0" as tty so we ought to check for that too.
+    (Closes: #560804)
+  * Do not try to modprobe uinput if it is already available. It might
+    already be (Closes: #556897)
+  * New upstream version:
+    - events/lenovo-undock, undock.sh: new scripts to handle the Fn+F9 "undock"
+      button on ThinkPads, which unfortunately nothing else handles. Thanks to
+      Jeffrey Baker for the first implementation. LP: #18864. (Closes: #388160)
+  * Re-added thinkpad volume key events. (Closes: #558009)
+  * Patched asus-wireless start script to not disable wireless. (Closes:
+    #482349)
+
+ -- Michael Meskes <meskes@debian.org>  Wed, 16 Dec 2009 11:20:51 +0100
+
+acpi-support (0.130-2) unstable; urgency=low
+
+  * Made grep accept non-ascii characters. (Closes: #559911) - thanks to
+    Євгеній Мещеряков <eugen@debian.org>
+  * Made screenblank use the right user to call xset. (Closes: #558216)
+  * Made pidof use full paths where needed to prevent denial of service
+    attacks by local users.(Closes: #553643)
+
+ -- Michael Meskes <meskes@debian.org>  Fri, 11 Dec 2009 17:33:29 +0100
+
+acpi-support (0.130-1) unstable; urgency=low
+
+  * Fixed some typos.
+  * New upstream version.
+  * Remove suggests on laptop-mode-tools as they are no longer called
+    from any script except those under examples.
+  * Made su use /bin/sh even if the user uses some non-posix shell.
+    (Closes: #557442)
+  * Removed bashism in power-funcs and made all script use /bin/sh.
+
+ -- Michael Meskes <meskes@debian.org>  Sun, 22 Nov 2009 12:32:08 +0100
+
+acpi-support (0.129-2) unstable; urgency=low
+
+  * Better document the need of the uinput module. (Closes: #556897)
+  * Remove 10-thinkpad-standby-led.sh that was forgotten earlier.
+    (Closes: #556896)
+  * Remove events/videobtn for good. (Closes: #556261)
+  * Make sure 90-hdparm.sh is deleted no matter if it is a file or a
+    symlink. (Closes: #556895)
+
+ -- Michael Meskes <meskes@debian.org>  Wed, 18 Nov 2009 16:19:08 +0100
+
+acpi-support (0.129-1) unstable; urgency=low
+
+  * New upstream version:
+    - Fix ibm-wireless to use the 'rfkill' tool for toggling bluetooth,
+      recommending wireless-tools which currently provides this; and fix
+      the isAnyWirelessPoweredOn function for the latest change in the rfkill
+      /sys interface, looking under phy80211/ instead of under device/
+      (LP: #397698).  The toggleAllWirelessStates() function is still broken,
+      because the rfkill state on the iwl3945 (at least) is still being done
+      in the kernel, so we work around this for now by leaving the function
+      inactive.
+      Closes: #548252, #554112, #491442
+    - Fix the touchpad handler to use xinput instead of (unreliable)
+      synclient, and add a corresponding Recommends; and call getXconsole so
+      we can actually talk to the X server.  LP: #447211.
+    - new events/asus-f8sv-touchpad: handle another touchpad ACPI event on
+      another ASUS model.  LP: #218598.
+    - lib/power-funcs: adjust getXconsole to work when the tty number is not
+      present on the X commandline.
+    - lib/policy-funcs: Recognize KDE4 PowerDevil as a power manager.
+      LP: #387750.
+    - lib/policy-funcs: Recognize xfce4-power-manager as a power manager.
+      LP: #425155
+    - Drop /etc/acpi/start.d/90-hdparm.sh: this is redundant because we're
+      already calling pm-powersave on start (either via /etc/acpi/power.sh,
+      or by one of the desktop power managers as enumerated in
+      lib/policy-funcs) so there's no reason we should be reapplying the
+      policy here.  LP: #443992, #438355, #318980.
+      Closes: #509597, #529604, #533754
+    - Add guidance-power-manager to the list of known desktop power managers.
+      LP: #154910
+    - lib/policy-funcs: Recognize dalston as a power manager.  LP: #432578
+    - Drop /etc/acpi/start.d/10-save-dmidecode.sh, which is irrelevant given
+      the existence of /sys/class/dmi/id/.
+    - Drop events/panasonic-brightness-{down,up}, events/panasonic-mute,
+      events/panasonic-volume-{down,up}, and panabright.sh, confirmed to be
+      implemented now by the panasonic-laptop kernel driver. Closes: #555603
+    - Drop events/asus-{a6u-touchpad,internet,lock,wireless} and
+      events/asus-media-{next,play-pause,prev,stop}, confirmed to be
+      implemented by the asus-laptop kernel driver.
+    - Drop events/thinkpad-thinkpad and thinkpad-thinkpad.sh, which is also
+      implemented in the thinkpad_acpi driver and should have been dropped a
+      while ago.
+    - Drop panapower.sh, which seems to have never been used.
+    - Clean up /etc/acpi/toshbright.sh, which was meant to be removed back in
+      jaunty
+    - Drop events/video_brightness{down,up}, video_brightness{up,down}.sh: at
+      least some platforms that use these ACPI sequences are seeing them
+      correctly translated to input events, so those users will see duplicate
+      events unless we drop them.  LP: #178860.
+      Closes: #556261
+    - 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.
     - Don't install power hook directories, instead just call pm-powersave
-  * debian/preinst:
-    - Remove ac.d and battery.d conffiles
+  * Added old powersave stuff to examples.
+  * Bumped Standards-Version to 3.8.3, no changes needed.
+  * Re-diffed patches
+  * Re-added hibernatebtn.sh that was removed upstream.
+  * Re-added Sony brightness files. Closes: #531074
+  * Re-added Sony eject event.
+  * Remove stuff no longer needed.
+  * Accept display :0 and :0.0 when looking for the right AUTHORITY file.
+    Closes: #550546
+  * Added patch to make acpi_fakekey correctly send all key events, even for
+    keys not available on the keyboard by sending keys through uinput.
+    Closes: #373660 - Thanks to: Thomas Jaeger <ThJaeger@gmail.com>
+  * Patched toggleAllWirelessStates for the latest change in the rfkill
+    /sys interface as well.
+
+ -- Michael Meskes <meskes@debian.org>  Mon, 16 Nov 2009 15:39:27 +0100
+
+acpi-support (0.123-1) unstable; urgency=low
+
+  * New upstream version:
+    events/asus-volume-{up,down,mute}: drop, these are handled in the kernel
+    input layer now
+  * Removed some bashisms, closes: #530037
+
+ -- Michael Meskes <meskes@debian.org>  Thu, 28 May 2009 15:46:50 +0200
+
+acpi-support (0.122-2) unstable; urgency=low
+
+  * Delete files even if we upgrade from an older version, closes: #527836
+
+ -- Michael Meskes <meskes@debian.org>  Sat, 09 May 2009 21:51:41 +0200
+
+acpi-support (0.122-1) unstable; urgency=low
+
+  * New upstream version:
+    * sleep.sh, hibernate.sh:
+      - Don't use custom suspend/hibernate solution. Instead, call pm-utils,
+        closes: #506549
+    * prepare.sh, resume.sh, resume.d, suspend.d:
+      - Delete; no longer used
+  * Removed obsolete config files if they are unchanged.
+  * Removed vbesave as it is not used anymore, closes: #497904
+  * Also removed suspend config files.
+  * Still offer the deleted old suspend/resume stuff as examples.
+  * Simplified default file accordingly.
+  * Made screenblank honor LOCK_SCREEN setting, closes: #510209
+
+ -- Michael Meskes <meskes@debian.org>  Tue, 05 May 2009 10:00:09 +0200
+
+acpi-support (0.121-1) unstable; urgency=low
+
+  * New upstream version:
+    * Correct suspend.d/55-down-interfaces.sh to point to
+      /var/run/network/ifstate rather than /etc/network/run/ifstate.
+    * Drop events/asus-mail: On newer Asus, like the eeePc, this is an
+      ACPI event generated by pulling out the power chord, not pressing
+      a mail key. The latter should be handled by hal-info now; if you
+      have an Acer laptop with a mail key, please report a bug against
+      hal-info, closes: #516662
+    * Drop acpi_fakekey translations for keys that are correctly handled
+      in the kernel input layer:
+      - events/ibm-sleepbtn
+      - events/ibm-lockbtn, thinkpad-lockorbattery.sh
+      - events/ibm-hibernatebtn
+      - events/lenovo-lockbtn
+      - events/ibm-videobtn, closes: #456778, #515794
+      - events/thinkpad-mute, always-mute.sh
+      - events/thinkpad-volume-down
+      - events/thinkpad-volume-up
+      - events/thinkpad-thinklight, thinkpad-thinklight.sh
+      - events/tosh-brightness-up
+      - events/tosh-brightness-down, toshbright.sh
+      - events/tosh-mute
+      - events/tosh-sleep
+      - events/sony-hibernate
+      - events/sony-brightness-up, events/sony-brightness-down, sonybright.sh
+      - events/thinkpad-brightness-down, events/thinkpad-brightness-up,
+        thinkpad-brightness-up.sh, thinkpad-brightness-down.sh
+    * Also drop events/thinkpad-zoom, thinkpad-zoom.sh because this key
+      isn't working correctly with or without this script and should be
+      fixed up in hal.
+  * Simplified packaging.
+  * Do not install 90-hdparm.sh four times, closes: #509588
+  * Thinkpad_acpi.modprobe was removed upstream because it is said to be not
+    needed anymore, closes: #518570
+  * Restore old scripts that were incorrectly merged, closes: #524986
+  * Made getXuser() use pinky instead of w, closes: #502141, #510619, #515784
+  * Added patch to adjust panabright.sh for new panasonic_laptop driver that
+    uses /sys instead of /proc, closes: #524838, #524841
+  * Deconfigure wireless devices before powering them down, closes: #496570
+  * Fixed incorrect variable usage in madwifi handling, closes: #501607
+  * Clarified documentation about acpi-support method, closes: #484934, #497377
+  * Recognize 901 as an EeePC as well, closes: #504012
+  * Added a sync call to suspendorhibernate, closes: #503320
+  * Also check for KDE4 powerdevil in CheckPolicy, closes: #520669
+  * Added real package console-tools to dependency on virtual package
+    console-utilities.
+  * Made all scripts use invoke-rc.d where possible.
+
+ -- Michael Meskes <meskes@debian.org>  Wed, 22 Apr 2009 12:53:08 +0200
+
+acpi-support (0.114-1) unstable; urgency=low
+
+  * Took over package for pkg-acpi. Closes: #522683
+  * Bumped Standards-Version to 3.8.1.
+  * Adapted fall back strategy for acpid powerbutton handling. If the old file
+    is still around we will use it. Closes: #522306
+  * Make sure xfce4 power manager is recognized too. Closes: #524074, #524075
+  * Check for 1000H as well in EeePC check. Closes: #515707
+  * New upstream version: Closes: #448673
+    * The rfkill interface has changed again in the 2.6.27 release(!), so
+      play catch-up once more.
+    * lib/state-funcs: add support for checking the new /sys/class/rfkill
+      interface for toggling wireless antennas.  LP: #267875
+    * acpi-support.docs:  Add installation of README
+    * control:  Add laptop-mode-tools to Suggests
+    * Add installation for ac.d/ and battery.d/ directories.
+      (LP: #274599)
+    * wireless.sh: Fix obviously wrong typo in function call name -
+      toggleWirelessStates is a non-existant function
+      (LP: #108897, deb #430895)
+    * Fix asus brightness hotkeys so lowest/highest brightness recognized
+      (LP: #76593)
+    * lib/IBM.config:  Change VBE state and POST_VIDEO for 1834's
+      (LP: #40621, #211285)
+    * Incorporate a portion of the changes from Debian, as detailed below.
+      Debian has been accumulating valuable fixes and structural changes for
+      some years, but it will take some time to digest all of them.
+    * Let laptop-mode-tools run properly (closes LP: #250938)
+      - power.sh: remove laptop-mode invocations, should be handled by pm-utils
+      - acpi-support: remove SPINDOWN_TIME, should be controlled by laptop-mode
+
+ -- Michael Meskes <meskes@debian.org>  Wed, 15 Apr 2009 15:11:37 +0200
+
+acpi-support (0.109-11) unstable; urgency=high
+
+  * Fix postinst to not remove thinkpad_acpi.modprobe. Closes: #514278
+  * Fix tests in postinst that are supposed to match on upgrade only to
+    not match on initial install (when $2 is empty).
+
+ -- Raphael Hertzog <hertzog@debian.org>  Fri, 06 Feb 2009 09:09:28 +0100
+
+acpi-support (0.109-10) unstable; urgency=low
+
+  * Fix default settings for Thinkpad R50e 1834. Closes: #507927
+
+ -- Raphael Hertzog <hertzog@debian.org>  Fri, 12 Dec 2008 16:33:12 +0100
+
+acpi-support (0.109-9) unstable; urgency=low
+
+  * Fix fix on broken getXuser so that it only takes the first
+    line of output from w -hs that matches  (Closes: #497999)
+
+ -- Bart Samwel <bart@samwel.tk>  Mon, 08 Sep 2008 20:42:41 +0200
+
+acpi-support (0.109-8) unstable; urgency=low
+
+  * Fix broken getXuser (Closes: #497999)
+
+ -- Bart Samwel <bart@samwel.tk>  Sun, 07 Sep 2008 10:19:26 +0200
+
+acpi-support (0.109-7) unstable; urgency=low
+
+  * Reported in #497220: CheckPolicy() now calls getXconsole instead of
+    getXuser, as it should.
+  * getXuser() now uses "w" to determine the X user. The old code used
+    finger, but this was highly unreliable. (Closes: #497220)
+  * Added missing 'policy-funcs' include to hibernatebtn.sh (Closes: 
+    #497125)
+  * scripts in /etc/acpi no longer test files from acpi-support-base
+    to see if they should run (Closes: #497801)
+  * Always consider a dbus-send call for a suspend method failed if 
+    dbus-send returns an error code (Closes: #496911)
+
+ -- Bart Samwel <bart@samwel.tk>  Thu, 04 Sep 2008 20:00:27 +0200
+
+acpi-support (0.109-6) unstable; urgency=high
+
+  * /etc/acpi/events/sleepbtn: /etc/acpi/events/sleepbtn runs wrong
+    script (Closes: #489465)
+  * /etc/acpi/battery.d is ignored on newer kernels (Closes: #491396)
+  * Incorrect D-BUS HAL call in dbus-hal suspend method (Closes:
+    #488937)
+
+ -- Bart Samwel <bart@samwel.tk>  Tue, 19 Aug 2008 21:39:41 +0200
+
+acpi-support (0.109-5) unstable; urgency=low
+
+  * Make suspendorhibernate script executable.
+
+ -- Bart Samwel <bart@samwel.tk>  Sun, 22 Jun 2008 23:11:52 +0200
+
+acpi-support (0.109-4) unstable; urgency=low
+
+  * Bashisms of the form '. script args' (Closes: #485435)
+  * Use legacy suspend mode by default for existing setups (but not for 
+    new ones) . (Closes: #485564)
+  * Do not send fake keys to user interface for /etc/acpi/sleep.sh and
+    /etc/acpi/hibernate.sh calls, only for button presses.
+    (Closes: #484901)
+
+ -- Bart Samwel <bart@samwel.tk>  Sun, 22 Jun 2008 23:01:32 +0200
+
+acpi-support (0.109-3) unstable; urgency=low
+
+  * /usr/share/acpi-support/screeblank returns 0 before blanking the
+    screen (Closes: #483015)
+
+ -- Bart Samwel <bart@samwel.tk>  Sun, 22 Jun 2008 22:43:13 +0200
+
+acpi-support (0.109-2) unstable; urgency=low
+
+  * Reinstate thinkpad_acpi.modprobe to fix "Many Thinkpad X60 keys stop
+    working" (Closes: #481253)
+  * Fix incorrect usage of getXconsole instead of getXuser in lid.sh
+    (Closes: #481534)
+  * toshset, nvclock moved to Recommends instead of Depends (Closes: #410918,
+    #434566, #438665, #445900 #457387)
+  * Deprecate built-in suspend/hibernate handling in favor of dbus
+    calls.
+  * Support suspend/hibernate handling by dbus calls to a power
+    management daemon or HAL, calling the pm-utils package, calling the
+    hibernate package, or using the legacy built-in suspend/hibernate support.
+    By default, send keys to the known power management daemons, or if they
+    are not running, fall back to use dbus to a power management daemon,
+    dbus directly to HAL, and direct calls to pm-utils.
+  * Add Recommends for hal, pm-utils, dbus.
+  * Ignore errors in 90-hdparm.sh while detecting if APM is supported,
+    since not all drives support the HDIO_GET_IDENTITY operation.
+    (Closes: #481685)
+  * lid.sh doesn't give lid.sh.pre a chance to abort the close (Closes:
+    #482708)
+  * Replace dependency on console-tools by console-utilities, which is a
+    virtual package that allows kbd | console-tools. (Closes: #481173)
+  * Installation Fails if /proc/acpi/event Not Present (Closes: #481312)
+  * Set DM-Upload-Allowed field to yes.
+
+ -- Bart Samwel <bart@samwel.tk>  Sun, 25 May 2008 18:17:46 +0200
+
+acpi-support (0.109-1) unstable; urgency=low
+
+  * New upstream release 0.109 (Ubuntu Hardy) [no relevant changes].
+  * New upstream release 0.108 (Ubuntu Hardy) [no relevant changes].
+  * New upstream release 0.107 (Ubuntu Hardy):
+    * "lib/FUJITSU SIEMENS.config": Fix typo, which caused failures on Fujitsu
+      notebooks (LP: #203452)
+  * New upstream release 0.106 (Ubuntu Hardy):
+    * Add events/asus-video to support asus switch video hotkey; patch from
+      Nicolò Chieffo (LP: #138228)
+    * Fix the value range in sonybright.sh (0-7 instead of 1-8); patch from
+      unggnu (LP: #136380)
+    * "lib/FUJITSU SIEMENS.config":
+      - Enable suspend for Fujitsu-Siemens C1110 (LP: #52970)
+      - Enable STR for Fujitsu-Siemens Lifebook S7020, S7110
+    * events/asus-*: Fix event key names for ASUS (HOTK); patch from
+      Jeroen van der Vegt (LP: #25784)
+    * Fix names in comments for events/panasonic-{mute,volume-down,volume-up}    
+    * Drop thinkpad_acpi.modprobe: the workarounds therein are not needed for
+      thinkpad_acpi in Hardy anymore; investigations by Jerone Young
+      (LP: #194679) [ Note from Bart Samwel: Therefore probably not needed in
+      current Debian kernels either. ]
+  * New upstream version 0.105 (from Ubuntu Hardy):
+    * Fix screenblank for KDE by using a dcop call
+  * Add HOTK key names in events/asus-* for more keys than provided by the
+    upstream.
+  * Remove extra non-owned files on purge. Closes: #455012
+  * Call old acpid power button handler /etc/acpi/powerbtn.sh if present.
+    Closes: #461311
+  * Support "operstate" power state file for madwifi drivers. Closes: #453706.
+  * Support operstate, rf_kill and power/state to determine if wireless is
+    powered on. Closes: #463719.
+  * Support asus-laptop module as well as asus-acpi module for setting the
+    wireless LED. Closes: #453856.
+  * As a fallback, detect X instances that were not started on a vt.
+    Closes: #462954.
+  * Add missing checks that acpi-support is installed to some of the config
+    scripts. Closes: #469556.
+  * Remove Default-Stop entries from vbesave init script, since the script
+    doesn't do anything when it's stopped. Closes: #461441.
+  * Check that a drive supports APM before using hdparm -B on it.
+    Closes: #458787.
+  * Divert sleep button to sleep.sh if power management daemons are not
+    running, for thinkpad, panasonic, sony and toshiba laptops.
+    Closes: #467374, 373660.
+  * Stop laptop mode early in the suspend/hibernate process, and start it late
+    at resume time. This fixes suspend/resume problems on at least one machine.
+    Closes: #458437.
+  * Config option USE_HIBERNATE_PACKAGE=true will now instruct acpi-support to
+    delegate sleeping and hibernation to the "hibernate" package.
+    Closes: #426934, #405563.
+  * Check if we can actually open event device in acpi_fakekey. Closes: #410478.
+  * Support Asus R1F tablet screen rotation. Kudos to Antonio Trueba.
+    Closes: #450531.
+  * Remove /etc/acpi/resume.d/49-915-resolution-set.sh. It will be moved to
+    the 915resolution package. Closes: #447742, #467347.
+  * Don't misinterpret Asus Eee PC hotkeys as brightness keys. Closes: #459328.
+  * Support Asus Eee PC volume up/down and mute keys. Closes: #459326.
+  * Get rid of extra quotes in asus-wireless.sh.
+  * Fix handling of ${shlibs:Depends} in control file (it wasn't generated in
+    the rules file).
+  * Move radeontool to Recommends. (This is possible because radeontool is in
+    task "laptop" now.)
+  * Once again got rid of some bash dependencies. Closes: #453861.
+  * Be able to detect X user when X has been started using startx. Thanks to
+    Csaba Halasz for the patch. Closes: #471510.
+  * Call wpa_action stop for wpasupplicant-controlled interfaces before suspend.
+    Closes: #473184.
+  * Correctly bring up logical interfaces on resume. Closes: #475002.
+  * Instead of restarting Network Manager on suspend, call its sleep and wakeup
+    events. Closes: #477917.
+  * Add console-tools to depends of acpi-support-base, since we use fgconsole in
+    power-funcs.
+  * Fix dcop call in CheckPolicy to pass the X user. Closes: #480033.
+  * Let acpi-support depend on exact version of acpi-support-base.
 
- -- Steve Langasek <steve.langasek@ubuntu.com>  Fri, 26 Jun 2009 15:41:38 -0700
+ -- Bart Samwel <bart@samwel.tk>  Mon, 12 May 2008 17:10:00 +0200
 
-acpi-support (0.123) karmic; urgency=low
-
-  * events/asus-volume-{up,down,mute}: drop, these are handled in the kernel
-    input layer now.  LP: #286339.
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Sun, 17 May 2009 19:10:16 -0700
-
-acpi-support (0.122) karmic; urgency=low
-
-  * sleep.sh, hibernate.sh:
-    - Don't use custom suspend/hibernate solution.  Instead, call pm-utils.
-      LP: #366119
-  * prepare.sh, resume.sh, resume.d, suspend.d:
-    - Delete; no longer used
-  * debian/dirs, debian/rules:
-    - Don't install resume.d and suspend.d directories
-  * debian/control:
-    - Depend on pm-utils
-  * debian/preinst:
-    - Remove any existing resume.d and suspend.d files.
-
- -- Michael Terry <michael.terry@canonical.com>  Mon, 27 Apr 2009 10:08:23 -0400
-
-acpi-support (0.121) jaunty; urgency=low
-
-  * Remove /etc/modprobe.d/ibm_acpi.modprobe in case it's still present;
-    this conffile was shipped in dapper and never cleaned up properly.
-    LP: #340873.
-  * Drop smartdimmer from Recommends; this was only needed for the sony
-    brightness scripts, which are removed in favor of hal.
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Wed, 25 Mar 2009 09:53:30 -0700
-
-acpi-support (0.120) jaunty; urgency=low
-
-  [ Alexander Solodukhin ]
-  * Correct suspend.d/55-down-interfaces.sh to point to
-    /var/run/network/ifstate rather than /etc/network/run/ifstate.
-    LP: #295544.
-
-  [ Martin Pitt ]
-  * Drop lib/*.config: I committed all sleep quirks to hal-info now
-    (upstream, and in Jaunty). The ACPI_SLEEP whitelisting, as well as
-    acpi-support's suspend/resume handling itself is not used by
-    default any more, and almost all laptops support suspend/resume
-    nowadays, so keeping a whitelist is the wrong approach.
-    LP: #37303, #44781.
-  * lib/device-funcs: Drop reading of .config files.
-  * Drop vbesave, resume.d/17-video-restore.sh, suspend.d/
-    80-video-pci-state.sh, suspend.d/80-video-vesa-state.sh:
-    pm-utils and hal-info handle VBE/PCI status quirks.
-
-  [ Scott James Remnant ]
-  * suspend.d/88-time.sh, resume.d/50-time.sh: Remove since the kernel
-    keeps the system clock in sync with the hardware clock over a
-    suspend/resume cycle.  LP: #312486, #218120, #158358, #157936.
-  * debian/preinst: Remove on upgrade.
-  * Remove the toshiba_acpi.modprobe file; this sets a kernel option that's
-    been the default for ages. 
-
- -- Scott James Remnant <scott@ubuntu.com>  Tue, 03 Mar 2009 17:29:01 +0000
-
-acpi-support (0.119) jaunty; urgency=low
-
-  * debian/preinst: Fix off-by-one error in version comparison from
-    0.118 fix.
-
- -- Martin Pitt <martin.pitt@ubuntu.com>  Tue, 03 Feb 2009 17:15:47 +0100
-
-acpi-support (0.118) jaunty; urgency=low
-
-  * Drop events/asus-mail: On newer Asus, like the eeePc, this is an
-    ACPI event generated by pulling out the power chord, not pressing
-    a mail key. The latter should be handled by hal-info now; if you
-    have an Acer laptop with a mail key, please report a bug against
-    hal-info. (LP: #268422)
-
- -- Martin Pitt <martin.pitt@ubuntu.com>  Tue, 03 Feb 2009 16:45:08 +0100
-
-acpi-support (0.117) jaunty; urgency=low
-
-  * Drop acpi_fakekey translations for keys that are correctly handled
-    in the kernel input layer:
-    - events/ibm-sleepbtn (LP: #306310)
-    - events/ibm-lockbtn, thinkpad-lockorbattery.sh
-    - events/ibm-hibernatebtn
-    - events/lenovo-lockbtn
-    - events/ibm-videobtn
-    - events/thinkpad-mute, always-mute.sh
-    - events/thinkpad-volume-down
-    - events/thinkpad-volume-up (LP: #51537)
-    - events/thinkpad-thinklight, thinkpad-thinklight.sh
-    - events/tosh-brightness-up
-    - events/tosh-brightness-down, toshbright.sh
-    - events/tosh-mute
-    - events/tosh-sleep
-    - events/sony-hibernate
-    - events/sony-brightness-up, events/sony-brightness-down, sonybright.sh
-    - events/thinkpad-brightness-down, events/thinkpad-brightness-up,
-      thinkpad-brightness-up.sh, thinkpad-brightness-down.sh
-  * Also drop events/thinkpad-zoom, thinkpad-zoom.sh because this key
-    isn't working correctly with or without this script and should be
-    fixed up in hal.
-  * debian/control: document Vcs-Bzr for the package.
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Mon, 02 Feb 2009 14:28:38 +0100
-
-acpi-support (0.116) jaunty; urgency=low
-
-  [ Jakob Unterwurzacher ]
-  * Defensive quoting in 90-hdparm.sh, so that the script doesn't throw
-    a syntax error when the battery state is undetermined.
-
-  [ Steve Langasek ]
-  * lib/power-funcs: refactor getState() to return 'AC' by default,
-    since this is implicitly the case if we don't have a battery.
-    LP: #59695.
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Fri, 30 Jan 2009 02:07:48 -0800
-
-acpi-support (0.115) jaunty; urgency=low
-
-  * {ac,battery,resume,start}.d/90-hdparm.sh: don't just check whether
-    laptop-mode is configured to control the drives, also check whether 
-    laptop-mode itself is *enabled*.  Finally closes LP: #59695.
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Mon, 05 Jan 2009 10:50:10 +0000
-
-acpi-support (0.114) intrepid; urgency=low
-
-  * The rfkill interface has changed again in the 2.6.27 release(!), so
-    play catch-up once more.
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Wed, 15 Oct 2008 03:08:58 +0000
-
-acpi-support (0.113) intrepid; urgency=low
-
-  * lib/state-funcs: add support for checking the new /sys/class/rfkill
-    interface for toggling wireless antennas.  LP: #267875
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Sat, 11 Oct 2008 19:18:10 +0000
-
-acpi-support (0.112) intrepid; urgency=low
-
-  * acpi-support.docs:  Add installation of README
-  * control:  Add laptop-mode-tools to Suggests
-  * Add installation for ac.d/ and battery.d/ directories.
-    (LP: #274599)
-  * wireless.sh: Fix obviously wrong typo in function call name -
-    toggleWirelessStates is a non-existant function
-    (LP: #108897, deb #430895)
-  * Fix asus brightness hotkeys so lowest/highest brightness recognized
-    (LP: #76593)
-
- -- Bryce Harrington <bryce@ubuntu.com>  Thu, 25 Sep 2008 17:50:26 -0700
-
-acpi-support (0.111) intrepid; urgency=low
-
-  * lib/IBM.config:  Change VBE state and POST_VIDEO for 1834's
-    (LP: #40621, #211285)
-  * Incorporate a portion of the changes from Debian, as detailed below.
-    Debian has been accumulating valuable fixes and structural changes for
-    some years, but it will take some time to digest all of them.
+acpi-support (0.103-5) unstable; urgency=low
 
   [ Bart Samwel ]
-  * ac.d/90-hdparm.sh, battery.d/90-hdparm.sh, resume.d/90-hdparm.sh,
-    start.d/90-hdparm.sh: Set hdparm power management to 254 for all hard
-    drives.  Ignore errors while detecting of APM is supported.  Set
-    hdparm -B 128 while on battery in 90-hdparm.sh. Head parking is useful
+  * Don't do exit in 90-hdparm.sh, it exits the whole resume/startup process.
+    Closes: #453478.
+  * Read laptop-mode.conf better in 90-hdparm.sh. Closes: #452489.
+  * Set hdparm -B 128 while on battery in 90-hdparm.sh. Head parking is useful
     on the road for shock protection. Still set hdparm -B 254 while on AC.
-    (Closes: #448673, #452489, #453478, #458787, #481685)
-  * Switch from #!/bin/bash to #!/bin/sh in a number of scripts, and
-    cleanup bashisms throughout.  Continues a change started with 0.93.
-    (Closes: #407510, #485435, #453861)
-  * Add checks for existance of key-constants and state-funcs throughout
-    scripts to prevent erroneous failures when using eeepc-acpi-scripts.
-    Use "test ... || ..." style over "[ ... ] || ..." just for consistency.
-    (Closes: #469556)
-  * Check if we can actually open event device in acpi_fakekey.c.
-    (Closes: #410478)
-  * Correctly detect keyboard event device in acpi_fakekey.c.  Apparently
-    the power key is in the range checked by acpi_fakekey. It's now
-    changed it so that it assumes that any input device which has a key in
-    the QWERTYUIOP range is "the" keyboard.
-    (Closes: #433771)
-  * Remove useless use of grep in asus-touchpad.sh.
-  * Add HOTK key names in events/asus-* for additional keys.
-  * Support Asus Eee PC volume up/down and mute keys in events/asus-eee-volume-*.
-    (Closes: #459326)
-  * Add rotatescreen.sh, asus-rotate script to support Asus R1F tablet
-    screen rotation.
-    (Closes: #450531)
+  * Listen on a wider range of battery and ac events (required on some
+    laptops).
 
   [ Raphael Hertzog ]
-  * Add a new SKIP_INTERFACES variables in /etc/default/acpi-support and use
-    it to define network interfaces that are not tied to hardware to avoid
-    shutting them down during suspend, such as lo, qemu, and dummy.
-  * Improved package description in control file, thanks to Cl?ment Stenac.
-    (Closes: #383691)
-
-  [ Loic Minier ]
-  * Install new manpage for acpi_fakekey, thanks Nico Golde.
-    (Closes: #383365)
-  * Fix "APCI" instead of "ACPI" typo in IBM.config; thanks Joshua Kwan;
-    (Closes: #389511)
-
- -- Bryce Harrington <bryce@ubuntu.com>  Wed, 24 Sep 2008 08:43:42 -0700
-
-acpi-support (0.110) intrepid; urgency=low
-
-  * Let laptop-mode-tools run properly (closes LP: #250938)
-    - power.sh: remove laptop-mode invocations, should be handled by pm-utils
-    - acpi-support: remove SPINDOWN_TIME, should be controlled by laptop-mode
-
- -- Alexey Borzenkov <snaury@gmail.com>  Tue, 22 Jul 2008 23:59:07 +0400
-
-acpi-support (0.109) hardy; urgency=low
-
-   [ Daniel Hahler ]
-   * power.sh:
-     Fix glob pattern for laptop_mode_{enable,disable}. It did not match any
-     devices. Thanks Andrea Ratto. (LP: #89269)
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Mon, 14 Apr 2008 06:47:19 +0000
-
-acpi-support (0.108) hardy; urgency=low
-
-  [ Daniel Hahler ]
-  * /etc/modprobe.d/toshiba_acpi.modprobe, debian/rules, README.toshiba:
-    Fix regression for toshiba, which should not have been removed
-    (LP: #199888)
-  * events/lenovo-eject, debian/preinst:
-    Drop events/lenovo-eject again: it's a dock eject button and not a CD
-    eject button (LP: #194609)
-
-  [ Steve Langasek ]
-  * lib/state-funcs: update isAnyWirelessPoweredOn() to recognize
-    devices exporting only the new rf_kill status interface.
-    LP: #180598.
-
- -- Steve Langasek <steve.langasek@ubuntu.com>  Fri, 21 Mar 2008 16:51:13 -0700
-
-acpi-support (0.107) hardy; urgency=low
-
-  * "lib/FUJITSU SIEMENS.config": Fix typo, which caused failures on Fujitsu
-    notebooks (LP: #203452)
-  * debian/preinst: remove obsolete conffiles on upgrade
-    (/etc/modprobe.d/{thinkpad,toshiba}_acpi.modprobe)
-
- -- Daniel Hahler <ubuntu@thequod.de>  Tue, 18 Mar 2008 23:56:09 +0100
-
-acpi-support (0.106) hardy; urgency=low
-
-  * Cherrypicked bugfix patches from Launchpad (LP: #193842)
-  * lib/state-funcs: make wireless led work with asus-laptop (the new module);
-    patch from Nicolò Chieffo (LP: #189889)
-  * Add events/asus-video to support asus switch video hotkey; patch from
-    Nicolò Chieffo (LP: #138228)
-  * events/asus-wireless-2, asus-wireless-2.sh:
-    Support Fn+F2 on Asus A8Js; patch from Matteo Collina (LP: #105929)
-  * Fix the value range in sonybright.sh (0-7 instead of 1-8); patch from unggnu
-    (LP: #136380)
-  * "lib/FUJITSU SIEMENS.config":
-    - Enable suspend for Fujitsu-Siemens C1110 (LP: #52970)
-    - Enable STR for Fujitsu-Siemens Lifebook S7020, S7110
-  * resume.d/50-time.sh, suspend.d/88-time.sh:
-    Fix handling of hardware clock before/after suspend; patch from Rodrigo
-    Novo (LP: #36815)
-  * events/asus-*: Fix event key names for ASUS (HOTK); patch from
-    Jeroen van der Vegt (LP: #25784)
-  * Fix names in comments for events/panasonic-{mute,volume-down,volume-up}
-  * debian/rules, README.toshiba: Drop toshiba_acpi.modprobe, which only
-    contained an invalid/obsolete option "hotkeys_over_acpi" (LP: #180678)
-  * debian/control: Standards-Version 3.7.3
-  * Drop thinkpad_acpi.modprobe: the workarounds therein are not needed for
-    thinkpad_acpi in Hardy anymore; investigations by Jerone Young (LP: #194679)
-  * Add events/lenovo-eject to handle the Thinkpad eject button (Fn+F9); patch
-    from Jerone Young (LP: #194609)
-
- -- Daniel Hahler <ubuntu@thequod.de>  Thu, 06 Mar 2008 02:15:54 +0100
-
-acpi-support (0.105) hardy; urgency=low
-
-  * Fix screenblank for KDE by using a dcop call
-    (LP: #25057)
-
- -- dAniel hAhler <ubuntu@thequod.de>  Thu, 13 Dec 2007 23:32:11 +0100
-
-acpi-support (0.104) hardy; urgency=low
-
-  * Depend on x11-xserver-utils instead of xset.
-
- -- Timo Aaltonen <tepsipakki@ubuntu.com>  Sat, 10 Nov 2007 12:25:03 +0200
-
-acpi-support (0.103) gutsy; urgency=low
-
-  * Replace call to 'thinkpad-keys-update' with "thinkpad-keys --update"
-  * Remove wireless-related comment gruff from 'thinkpad-cmos' event.
-
- -- Paul Sladen <sladen@ubuntu.com>  Tue, 18 Sep 2007 20:09:02 +0300
-
-acpi-support (0.102) gutsy; urgency=low
-
-  * Poke thinkpad-keys on CMOS notification 
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Sat, 15 Sep 2007 22:13:42 +0100
-
-acpi-support (0.101) gutsy; urgency=low
-
-  * Switch Thinkpad to using ACPI events for magic keys so that
-    'thinkpad-keys' can go away and save us all from the new Lenovopad
-    slow NVRAM.
-  - See 'hotkey-setup' for remapping and initial module loading + setup.
-  * Extend mask used in 'thinkpad_acpi.modprobe'.
-  * Replace 'bin/bash' with 'bin/sh' in a couple of files.
-
- -- Paul Sladen <sladen@ubuntu.com>  Thu, 13 Sep 2007 19:15:14 +0300
-
-acpi-support (0.100) gutsy; urgency=low
-
-  * send events on ACPI brightness presses
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Sun, 09 Sep 2007 18:02:20 +0100
-
-acpi-support (0.99) gutsy; urgency=low
+  * Updated Standards-Version to 3.7.3 (no change).
+  * Wrap some changelog lines to please lintian.
+  * Fix dh_gencontrol invocation to pass "-pacpi-support" before "--".
 
-  * prepare.sh: Fix missing space in executability test (thanks, Sitsofe
-    Wheeler and TJ; LP: #136453).
+ -- Raphael Hertzog <hertzog@debian.org>  Thu, 13 Dec 2007 20:27:24 +0100
 
- -- Colin Watson <cjwatson@ubuntu.com>  Sat, 01 Sep 2007 17:32:01 +0100
+acpi-support (0.103-4) unstable; urgency=low
 
-acpi-support (0.98) gutsy; urgency=low
+  * acpi-support-base now Replaces acpi-support (<= 0.103-2).
+    Closes: #451748.
+  * Fix checks for existing handlers in powerbutton handler. Closes: #451803
+  * Restart laptop-mode after resume, so all of the hardware settings are
+    reapplied.
 
-  * Add support for the video toggle hotkey
+ -- Bart Samwel <bart@samwel.tk>  Sun, 18 Nov 2007 10:36:29 +0200
 
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Fri, 31 Aug 2007 05:02:08 +0100
+acpi-support (0.103-3) unstable; urgency=low
 
-acpi-support (0.97) gutsy; urgency=low
+  * Rebuild as Debian native package because we diverged too much from Ubuntu.
+    This ensures that the source tarball corresponds really to what's in SVN
+    and won't reintroduce deleted files. Closes: #451568, #451569
 
-  * Improve X display finding
-  * Switch Thinkpad wireless hotkey control back to firmware for now
-  * Improve Toshiba wireless handling
-  * Check fragment scripts are executable
-  * Improve Panasonic support
-  * Improve state saving/restoring over suspend/resume
-  * Add Asus brightness key support
-  * Alter some dependencies to recommends
-  * Fix init script to check state on boot
-  * Depend on the appropriate shlibdeps
-  * Add a postrm to tidy up the init scripts
-  * We no longer need to stop mysql
-  * Tidy up scripts so a few errors aren't produced
-  * Update sony brightness script to handle sony-laptop 
+ -- Raphael Hertzog <hertzog@debian.org>  Sat, 17 Nov 2007 20:18:29 +0100
 
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Fri, 31 Aug 2007 04:19:36 +0100
+acpi-support (0.103-2) unstable; urgency=low
 
-acpi-support (0.96ubuntu1) gutsy; urgency=low
-
-  * Build packages for lpia as well.
-
- -- Adam Conrad <adconrad@ubuntu.com>  Wed, 15 Aug 2007 23:48:51 +1000
-
-acpi-support (0.96) gutsy; urgency=low
-
-  * ibm-acpi has been renamed to thinkpad-acpi. Rename options file accordingly.
-    LP: #119052. Thanks to Benjamin Pineau <ben.pineau@gmail.com> for the patch.
-
- -- Reinhard Tartler <siretart@tauware.de>  Sun, 15 Jul 2007 18:55:10 +0200
-
-acpi-support (0.95) feisty; urgency=low
-
-  * Clean up issues with toggling multiple wireless cards.
-    - Move variable initiation into loop inside 'wireless.sh'
-    - Move contents of 'wireless.sh' into lib/state-funcs:toggleAllWirelessState()
-    - Update '{ibm,tosh,asus}-wireless.sh' to use state-funcs
-    (Closes: LP #96107)
-    (Thanks to Nicolò Chieffo for assistance and testing)
-  * Remove spurious 'echo HERE' from lib/state-funcs.  D'oh.
-  
- -- Paul Sladen <paul@katu>  Mon, 26 Mar 2007 01:06:58 +0100
+  [ Bart Samwel ]
+  * getXconsole returns wrong DISPLAY="0\n0" (Closes: #437940)
+  * powerbtn handler missing (Closes: #433877)
+  * Asus wireless card on/off button fix (Closes: #410952)
+  * Restore screen brightness on certain Asus laptops (Closes: #448134)
+  * Split off power button support into acpi-support-base.
+  * Set hdparm power management to 254 for all hard drives. (Closes: #448673)
+  * Don't check executable flags on /etc/acpi/suspend.d and /etc/acpi/resume.d
+    scripts. (Closes: #447571)
+  * Attempt to fix brightness keys for Sony fr215 laptop (Closes: #446056)
+  * Support KDE screensaver for screen blanking (Closes: #446516)
+  * Listen for Fn+F5 and Fn+F6 again on thinkpads (Closes: #446647)
+  * Fix incorrect reference to module sbs in resume.d/72-acpi-pain.sh
+    (Closes: #447085)
 
-acpi-support (0.94) feisty; urgency=low
+  [ Raphael Hertzog ]
+  * Add descriptions to LSB headers in init scripts (fix lintian warnings).
 
-  * Save and restore values that the kernel does not preserve across
-    suspend/resume and hibernate/resume:
-    - /sys/class/net/eth*/device/rf_kill
-    (Closes: LP #37010)
-    - /proc/acpi/ibm/bluetooth
-    (Closes: LP #37175)
-    - /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
-    (Closes: LP #68191)
-  * White list Lenovo ThinkPad Z60m as working suspend.
-    (Closes: LP #57144)
-  
- -- Paul Sladen <sladen@ubuntu.com>  Thu, 22 Mar 2007 03:57:36 +0000
+ -- Raphael Hertzog <hertzog@debian.org>  Thu, 15 Nov 2007 11:45:41 +0100
 
-acpi-support (0.93) feisty; urgency=low
+acpi-support (0.103-1) unstable; urgency=low
 
-  * Change 'wireless.sh' to use 'device/rf_kill' for wireless devices (if
-    available) in preference to 'device/power/state' which was been
-    removed by the upstream kernel developers.
-    (Closes: LP #42820)
-  * Teach 'lib/state-funcs:isAnyWirelessPoweredOn()' to also check
-    'device/rf_kill' if it's available.
-    (Closes: LP #42820)
-  * Change 'ibm-wireless.sh' to rotate wireless and bluetooth states
-    through the sequence: both, bluetooth only, wireless only, neither.
-    (Closes: LP #24680)
-  * Correct inverted logic in 'isAnyWirelessPoweredOn()'.
-    (Closes: LP #66083)
-  * Change script shebangs to use '/bin/sh' instead of '/bin/bash'.
+  * New upstream version 0.96 (from Ubuntu Gutsy):
+    * ibm-acpi has been renamed to thinkpad-acpi. Rename options file
+      accordingly. (Closes: #434845)
+  * New upstream version 0.96-ubuntu1 (from Ubuntu Gutsy):
+    * Build packages for lpia as well.
+  * New upstream version 0.97 (from Ubuntu Gutsy):
+    * Improve X display finding
+    * Switch Thinkpad wireless hotkey control back to firmware for now
+    * Improve Toshiba wireless handling
+    * Check fragment scripts are executable
+    * Improve Panasonic support
+    * Improve state saving/restoring over suspend/resume
+    * Add Asus brightness key support
+    * Alter some dependencies to recommends
+    * Fix init script to check state on boot
+    * Depend on the appropriate shlibdeps
+    * Add a postrm to tidy up the init scripts
+    * We no longer need to stop mysql
+    * Tidy up scripts so a few errors aren't produced
+    * Update sony brightness script to handle sony-laptop  
+  * New upstream version 0.98 (from Ubuntu Gutsy):
+     * Add support for the video toggle hotkey
+  * New upstream version 0.99 (from Ubuntu Gutsy):
+    * prepare.sh: Fix missing space in executability test.
+  * New upstream version 0.100 (from Ubuntu Gutsy):
+    * send events on ACPI brightness presses
+  * New upstream version 0.101 (from Ubuntu Gutsy):
+    * Switch Thinkpad to using ACPI events for magic keys so that
+      'thinkpad-keys' can go away and save us all from the new Lenovopad
+      slow NVRAM.
+    - See 'hotkey-setup' for remapping and initial module loading + setup.
+    * Extend mask used in 'thinkpad_acpi.modprobe'.
+  * New upstream version 0.102 (from Ubuntu Gutsy):
+    * Poke thinkpad-keys on CMOS notification 
+  * New upstream version 0.103 (from Ubuntu Gutsy):
+    * Replace call to 'thinkpad-keys-update' with "thinkpad-keys --update"
+    * Remove wireless-related comment gruff from 'thinkpad-cmos' event.  
+  * Use nvclock instead of smartdimmer for setting LCD brightness on Sony
+    laptops. (Closes: #430491)
+  * Call the correct function in wireless.sh to toglle wireless states.
+    (Closes: #430895)
+  * Correctly detect keyboard event device in acpi_fakekey. (Closes: #433771)
+  * Add LSB dependency info to acpi-support and vbesave init scripts.
+    (Closes: #432020)
+  * Fix a problem in power-funcs (getXconsole function), which didn't work when
+    COLUMNS was set. (Closes: #437141)
+  * Press LEFT SHIFT (using acpi_fakekey) after unblanking the screen when the
+    lid is opened. (Closes: #374069)
+  * Fix path to backlight control file for sony laptops, from upstream version
+    0.97. (Closes: #424004)
+  * Honor DEB_BUILD_OPTIONS=nostrip. (Closes: #436370)
+  * Document thinkpad_acpi options in thinkpad_acpi.modprobe. (Closes: #438430)
+  * Send SIGHUP to ksysguardd on resume so that it reopens its files in
+    /proc/acpi. (Closes: #421017)
+  * Correct directory existence check in power.sh. (Closes: #430494)
+  * Perform error checking for vbetool. (Closes: #445213)
+  * Reduced dependency on xbase-clients to x11-xserver-utils. (Closes: #438665)
   
- -- Paul Sladen <sladen@ubuntu.com>  Wed, 21 Mar 2007 04:55:27 +0000
-
-acpi-support (0.92) feisty; urgency=low
-
-  * Add 'events/sony-eject' for Sony Vaio TX3.
-    (Closes: LP #55388)
-
- -- Paul Sladen <sladen@ubuntu.com>  Sun, 18 Mar 2007 23:09:38 +0000
-
-acpi-support (0.91build1) feisty; urgency=low
-
-  * Rebuild for changes in the amd64 toolchain.
-
- -- Matthias Klose <doko@ubuntu.com>  Mon,  5 Mar 2007 01:12:40 +0000
-
-acpi-support (0.91) feisty; urgency=low
-
-  * Identical to 0.90, revert the sync from Debian
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Wed,  8 Nov 2006 17:33:04 +0000
-
-acpi-support (0.90) edgy; urgency=low
-
-  * Explicitly switch the screen back to text mode if it was that way 
-    before resume
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Sun, 15 Oct 2006 18:09:03 +0100
-
-acpi-support (0.89) edgy; urgency=low
-
-  * Add support for high-res uswsusp
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Fri, 15 Sep 2006 21:43:54 +0100
-
-acpi-support (0.88) edgy; urgency=low
-
-  * Change defaults
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Fri, 15 Sep 2006 17:48:05 +0100
-
-acpi-support (0.87) edgy; urgency=low
-
-  * Add support for using uswsusp
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Thu, 24 Aug 2006 01:03:30 +0100
-
-acpi-support (0.86) edgy; urgency=low
-
-  * Remove stop links from rc0 and rc6
-
- -- Scott James Remnant <scott@ubuntu.com>  Thu, 20 Jul 2006 23:03:51 +0100
-
-acpi-support (0.85) dapper-updates; urgency=low
-
-  * Don't unload nsc-ircc on suspend
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Mon, 19 Jun 2006 10:38:09 +0100
-
-acpi-support (0.84) dapper; urgency=low
-
-  * Whitelist another laptop (Ubuntu #44781)
-    - Hewlett-Packard Pavilion ZV6000
-  * Add whitelist for bizarre old laptop (Closes: Ubuntu #38174)
-
- -- Daniel Silverstone <daniel.silverstone@ubuntu.com>  Tue, 23 May 2006 14:02:34 +0100
-
-acpi-support (0.83) dapper; urgency=low
-
-  * Whitelist laptops (Ubuntu #44781) (Closes: Ubuntu #44909)
-  * Fix use of 'pidof' so that it won't bork if multiple processes exist
-    with the same name and to not spawn extra subshells.  Also do a
-    more specific 'dcop' call and _only_ if 'dcopserver' is actually running.
-  * Increase the 'acpilock' back up from 5 -> 10 seconds that got dropped,
-    may help with (Ubuntu #43519).
-  * Save the 'dmidecode' bios-version as we can identify ThinkPads with blank
-    product-names.
-  * Add entry for ThinkPad R40 with BIOS version "1PET62WW" (Tony Whitmore)
-
- -- Paul Sladen <ubuntu@paul.sladen.org>  Mon, 22 May 2006 19:06:40 +0100
-
-acpi-support (0.82) dapper; urgency=low
-
-  * Add more whitelisted laptops
-  * Add battery.d and ac.d (Closes: Ubuntu #44996)
-  * Use pccardctl rather than cardctl (Closes: Ubuntu #44164)
-  * Only call xscreensaver if it's running
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Tue, 16 May 2006 13:06:24 +0100
-
-acpi-support (0.81) dapper; urgency=low
-
-  * Whitelist Dell Inspiron XPS Gen2
-  (Closes: Ubuntu #44732)
-
- -- Paul Sladen <ubuntu@paul.sladen.org>  Mon, 15 May 2006 00:42:08 +0100
-
-acpi-support (0.80) dapper; urgency=low
-
-  * Add support for the toshiba battery button and add a generic
-    batterybtn.sh action script
-
- -- Daniel Silverstone <daniel.silverstone@ubuntu.com>  Wed, 10 May 2006 12:09:25 +0100
-
-acpi-support (0.79) dapper; urgency=low
-
-  * Reorder some checks in order to avoid deadlocks in KDE
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Sun,  7 May 2006 14:51:20 +0100
-
-acpi-support (0.78) dapper; urgency=low
-
-  * Fix Sony brightness handling so minimum brightness doesn't "stick"
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Sat,  6 May 2006 00:57:38 +0100
-
-acpi-support (0.77) dapper; urgency=low
-
-  * Call smartdimmer even if the Sony acpi brightness value is mad
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Fri,  5 May 2006 23:59:16 +0100
-
-acpi-support (0.76) dapper; urgency=low
-
-  * Only save VBE state on laptops - desktops should have a runnable 
-    BIOS
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Wed,  3 May 2006 21:32:13 +0100
-
-acpi-support (0.75) dapper; urgency=low
-
-  * Default to saving VBE state on boot
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Sun, 30 Apr 2006 19:24:51 +0100
-
-acpi-support (0.74) dapper; urgency=low
-
-  * Whitelist Asus A5E [Malone: #37303]
-    Closes: launchpad #37303
-
- -- Paul Sladen <ubuntu@paul.sladen.org>  Sun, 30 Apr 2006 02:22:39 +0200
-
-acpi-support (0.73) dapper; urgency=low
-
-  * Fix mis-named interface-down script 
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Mon, 24 Apr 2006 21:05:43 +0100
-
-acpi-support (0.72) dapper; urgency=low
-
-  * Re-disable laptop-mode by default, to work around LP#12483
-    - Has the pleasant side effect of making the comment match the code
-
- -- Matt Zimmerman <mdz@ubuntu.com>  Sat, 22 Apr 2006 05:34:12 -0700
-
-acpi-support (0.71) dapper; urgency=low
-
-  * Split resume.sh and prepare.sh up to make it easier to add appropriate hooks
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Fri, 21 Apr 2006 16:13:19 +0100
-
-acpi-support (0.70) dapper; urgency=low
-
-  * Drop call to ifrename which is not only not installed by default, but
-    conflicts with udev so can't be installed. 
-
- -- Scott James Remnant <scott@ubuntu.com>  Tue, 18 Apr 2006 09:22:00 +0100
-
-acpi-support (0.69) dapper; urgency=low
-
-  * Add whitelist for Sony VGN-S260
-    Closes: launchpad #32186
-  * Apply patch to unload netconsole if it's present.
-    Closes: launchpad #33885
-
- -- Daniel Silverstone <daniel.silverstone@ubuntu.com>  Thu, 13 Apr 2006 10:52:29 +0100
-
-acpi-support (0.68) dapper; urgency=low
-
-  * Bring up only those interfaces we downed, and do it all at once now
-    that ifup doesn't block on the state file each time. 
-
- -- Scott James Remnant <scott@ubuntu.com>  Thu,  6 Apr 2006 06:32:41 +0100
-
-acpi-support (0.67) dapper; urgency=low
-
-  * ...and fix lib/state-funcs:isAnyWirelessPoweredOn() so that it
-    doesn't have eth1 hard-coded as a wireless device.  Oops.
-
- -- Paul Sladen <ubuntu@paul.sladen.org>  Wed, 29 Mar 2006 13:56:09 +0100
-
-acpi-support (0.66) dapper; urgency=low
-
-  * Cache result of 'dmidecode -s *' so that they can be access without
-    privileges when checking 'pmi capabilities'.  [Malone: #36573]
-
- -- Paul Sladen <ubuntu@paul.sladen.org>  Tue, 28 Mar 2006 20:19:48 +0100
-
-acpi-support (0.65) dapper; urgency=low
-
-  * Whitelist Compaq Evo N600c has working SLEEP [Malone: #36838]
-  * Whitelist Sony VGN-FJ1S has working SLEEP [Malone: #29890]
-  * Add support for '/etc/acpi/start.d/*.sh' to be run on startup
-  * Synchronise the Asus Wireless LED on start and resume [Malone: #22795]
-  * Execute {suspend,resume}.d/*.sh at different times depending on
-    whether they match [01]*.sh, [2-7]*.sh, [89]*.sh
-  * Flash the ThinkPad Moon LED while hibernating/suspending.
-
- -- Paul Sladen <ubuntu@paul.sladen.org>  Tue, 28 Mar 2006 17:20:48 +0100
-
-acpi-support (0.64) dapper; urgency=low
-
-  * Add support for Asus A6U Touchpad toggle [Malone #31063].
-
- -- Paul Sladen <ubuntu@paul.sladen.org>  Sat, 25 Mar 2006 22:38:36 +0000
-
-acpi-support (0.63) dapper; urgency=low
-
-  * Set KEY_BATTERY=236 on the basis that this is going to be assigned upstream.
-
- -- Paul Sladen <ubuntu@paul.sladen.org>  Sat, 25 Mar 2006 19:37:16 +0000
-
-acpi-support (0.62) dapper; urgency=low
-
-  * And the rest 
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Thu, 23 Mar 2006 21:49:11 +0000
-
-acpi-support (0.61) dapper; urgency=low
-
-  * Use modprobe -r rather than rmmod [Malone #36172] 
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Thu, 23 Mar 2006 16:36:49 +0000
-
-acpi-support (0.60) dapper; urgency=low
-
-  * Trim trailing spaces from the end of dmidecode strings before looking
-    for the appropriate '.config' file.  [Malone #34536]
-  * Add correct handling for new Lenovo ThinkPads that have changed the
-    action of Fn-F3 from KEY_LOCK => KEY_BATTERY.  [Malone #35395]
-  * Add Lenovo ThinkPad handling of Fn-F8 to toggle the Touchpad
-    on newer models or do-nothing on normal ThinkPads [Malone #35395]
-  * Append 'aliased-keys' onto 'key-constants' for unassigned keycodes.
-   - Nota Bene: KEY_BATTERY will need updating when assigned upstream.
-  * Fix handling of hexadecimal numbers when generating 'key-constants'.
-
- -- Paul Sladen <ubuntu@paul.sladen.org>  Tue, 21 Mar 2006 15:05:02 +0000
-
-acpi-support (0.59) dapper; urgency=low
-
-  * Disable USB module unloading - the kernel seems to manage it better 
-    now
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Sat, 18 Feb 2006 14:25:11 +0000
-
-acpi-support (0.58) dapper; urgency=low
-
-  * Pull in missing policy-funcs in sleep.sh
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Thu, 16 Feb 2006 13:33:51 +0000
-
-acpi-support (0.57) dapper; urgency=low
-
-  * Re-enable laptop-mode
+ -- Bart Samwel <bart@samwel.tk>  Sun, 07 Oct 2007 11:15:00 +0200
 
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Thu, 16 Feb 2006 00:37:52 +0000
+acpi-support (0.95-2) unstable; urgency=low
 
-acpi-support (0.56) dapper; urgency=low
-
-  * Re-enable hard drive power saving
-  * Disable laptop-mode before starting hibernate
-  * Fix PCI state saving for PCI devices
-  * Remove recommends on xscreensaver
-  * Fix policy checking - don't run certain scripts if a desktop policy
-    manager is running
-  * Unload ndiswrapper after taking down its interface
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Thu, 16 Feb 2006 00:29:29 +0000
-
-acpi-support (0.55) dapper; urgency=low
-
-  * Change asus-lock and tosh-lock to invoke lockbtn.sh which in turn will
-    create a KEY_COFFEE event.
-    This needs a kernel fix before it will be of much use in the general case.
-  * Add tosh-www to run webbtn.sh
-  * Add tosh-mail to run mailbtn.sh
-  * Add tosh-ibutton to run mediabtn.sh
-
- -- Daniel Silverstone <daniel.silverstone@ubuntu.com>  Wed, 15 Feb 2006 17:35:19 +0000
-
-acpi-support (0.54) dapper; urgency=low
-
-  * Fix acpi_fakekey
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Mon, 13 Feb 2006 18:40:46 +0000
-
-acpi-support (0.53) dapper; urgency=low
-
-  * Transition model-specific sleep and hibernate buttons to use
-    keycodes rather than executing scripts directly
-  * Don't directly execute the sleep script if g-p-m or klaptopdaemon
-    are running - they should define policy
-  * Change to using symbolic constants rather than numbers (patch from
-    Paul Sladen <ubuntu@paul.sladen.org>
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Mon,  6 Feb 2006 14:55:50 +0000
-
-acpi-support (0.52) dapper; urgency=low
-
-  * Stop using uinput - fake keyboard input directly
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Fri, 27 Jan 2006 04:29:18 +0000
-
-acpi-support (0.51) dapper; urgency=low
-
-  * Switch on brightness support in ibm-acpi
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Tue, 24 Jan 2006 03:25:23 +0000
-
-acpi-support (0.50) dapper; urgency=low
-
-  * Load uinput module on boot (Ubuntu #21566)
-  * Fix power.sh conditionals (Ubuntu #21567)
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Tue, 27 Dec 2005 14:55:55 +0000
-
-acpi-support (0.49) dapper; urgency=low
-
-  * Use uinput rather than hacky X stuff to fake keypresses
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Sat, 24 Dec 2005 20:33:38 +0000
-
-acpi-support (0.48) dapper; urgency=low
-
-  * Only depend on vbetool on i386 and amd64
-  * Fix reference to SCREEN_LOCK - should have been LOCK_SCREEN
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Sat, 24 Dec 2005 18:56:01 +0000
-
-acpi-support (0.47) dapper; urgency=low
-
-  * Freeze the framebuffer around sleep/resume
-  * Check SCREEN_LOCK on lid close (Ubuntu #20007)
-  * Work with newer dmidecodes (Ubuntu #19879)
-  * Use laptop-mode-tools rather than laptop-mode (Ubuntu #19572)
-  * Remove extra radeontool call (Ubuntu #18208)
-  * Add radeontool and smartdimmer to depends
-  * Add support for saving/restoring video PCI state (Ubuntu #17972)
-  * Fix the permissions on /var/lib/acpi-support/powerstate (Ubuntu #17606)
-  * Reenable spindown timings on SATA drives (Ubuntu #17230)
-  * Poke alsa to improve sound recovery
-  * Kill dhclient while suspending - otherwise it blocks ifdown
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Tue, 29 Nov 2005 18:25:31 +0000
-
-acpi-support (0.46) breezy; urgency=low
-
-  * Add some extra machines to the whitelists
-  * Depend on powermgmt-base
-  * Disable restarting irda services by default
-  * Disable laptop-mode by default
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Wed, 12 Oct 2005 12:50:11 +0100
-
-acpi-support (0.45) breezy; urgency=low
-
-  * Remove sneaky new dependencies on radeontool and smartdimmer.  We're too
-    close to release to start poking the hardware in interesting new ways by
-    default
-
- -- Matt Zimmerman <mdz@ubuntu.com>  Tue,  4 Oct 2005 17:35:54 -0700
-
-acpi-support (0.44) breezy; urgency=low
-
-  * Fix whitelisting
-  * Fix resume when suspended for longer than the xscreensaver timeout
-  * Disable attempts to use hdparm on SATA drives - we don't have the 
-    kernel support.
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Tue,  4 Oct 2005 16:44:01 +0100
-
-acpi-support (0.43) breezy; urgency=low
-
-  * Fix Radeon backlight tweak support
-  * Fix lid closing screen locking
-  * Fix check for ac adapters
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Tue,  4 Oct 2005 05:07:58 +0100
-
-acpi-support (0.42) breezy; urgency=low
-
-  * Fix missing fi statement in init script
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Mon,  3 Oct 2005 02:03:21 +0100
-
-acpi-support (0.41) breezy; urgency=low
-
-  * Make sure that xscreensaver-command -lock is always called
-  * Use smartdimmer on Sonys if it's available. Nnngh.
-  * Add support for resetting IDE drives more enthusiastically
-  * Add support for using radeontool on some awkward machines
-  * Unload/reload fan and thermal modules on resume to increase the
-    chances of them working
-  * Unload/reload ibm-acpi if it's loaded (#14791)
-  * Fix lid.sh (#16802)
-  * Unify init script/power.sh, and make sure power.sh is called on
-    resume (#14833)
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Mon,  3 Oct 2005 00:48:57 +0100
-
-acpi-support (0.40) breezy; urgency=low
-
-  * Add a large set of whitelisted laptops
-  * Export DISPLAY before trying to call apps (closes: #16555)
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Sat,  1 Oct 2005 18:01:54 +0100
-
-acpi-support (0.39) breezy; urgency=low
-
-  * Fix up a couple of bugs in the display handling code
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Fri, 30 Sep 2005 04:25:58 +0100
-
-acpi-support (0.38) breezy; urgency=low
-
-  * Add support for leaving some modules loaded
-  * Run X commands on all displays, not just :0
-  * Run hotkey commands on the foremost console
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Fri, 30 Sep 2005 03:40:32 +0100
-
-acpi-support (0.37) breezy; urgency=low
-
-  * Add support for custom suspend and resume scripts
-  * Add Toshiba brightness restoration over suspend/resume
-    (Both provided by Daniel Silverstone)
-  * Run 855resolution on resume if it's configured (closes: #16271)
-  * Revert to using xscreensaver
-  * Stop services before unloading modules (closes: #16008)
-  * Fix syntax error in asus-wireless.sh
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Tue, 27 Sep 2005 01:48:39 +0100
-
-acpi-support (0.36) breezy; urgency=low
-
-  * Change Panasonic brightness on button down, not button release
-  * Fix quoting in vbesave init script
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Fri, 23 Sep 2005 11:58:37 +0100
-
-acpi-support (0.35) breezy; urgency=low
-
-  * Fix for occasionally picking the wrong user
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Wed, 21 Sep 2005 00:07:08 +0100
-
-acpi-support (0.34) breezy; urgency=low
-
-  The "I do not wish to discuss it" release
-
-  * Add workaround for prodding fans back into life on resume
-  * Add sick evil code for doing sick evil things to sick evil 
-    screensavers
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Tue, 20 Sep 2005 03:15:46 +0100
-
-acpi-support (0.33) breezy; urgency=low
-
-  * Remove hdparm -B calls in the init scripts
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Thu, 15 Sep 2005 21:16:54 +0100
-
-acpi-support (0.32) breezy; urgency=low
-
-  * Add correct quoting to check for running PowerManager
-  * Remove PowerManager checking from lid script
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Thu, 15 Sep 2005 15:55:12 +0100
-
-acpi-support (0.31) breezy; urgency=low
-
-  * Don't mess with hdparm -B; it triggers a bug elsewhere which causes
-    the system to hang on some laptops
-
- -- Matt Zimmerman <mdz@ubuntu.com>  Wed, 14 Sep 2005 15:28:21 -0700
-
-acpi-support (0.30) breezy; urgency=low
-
-  * Remove hardcoded /dev/hda from the init script
-  * Unload irda modules on suspend - they don't tend to survive
-  * Make sure that we power the screen back on on lid open
-  * Don't unload/reload input modules - it seems to break things
-  * Background xscreensaver locking
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Fri,  2 Sep 2005 17:47:17 +0100
-
-acpi-support (0.29) breezy; urgency=low
-
-  * Deal more nicely with running IRDA, otherwise the kernel tends to 
-    oops
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Thu,  1 Sep 2005 18:09:14 +0100
-
-acpi-support (0.28) breezy; urgency=low
-
-  * If power-manager is running, let it determine policy rather than 
-    running scripts blindly. Ignore this for machine-specific hotkeys.
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Tue, 30 Aug 2005 18:13:40 +0100
-
-acpi-support (0.27) breezy; urgency=low
-
-  * Use "..." rather than ":" in init script messages, for consistency with
-    other scripts
-
- -- Matt Zimmerman <mdz@ubuntu.com>  Mon, 29 Aug 2005 15:51:25 -0700
-
-acpi-support (0.26) breezy; urgency=low
-
-  * Fix power.sh so that it actually works (Ubuntu #14241)
-  * Add support for Sony brightness control (Ubuntu #14188)
-  * Include scripts for Asus volume control (Ubuntu #14164)
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Sun, 28 Aug 2005 17:33:14 +0100
-
-acpi-support (0.25) breezy; urgency=low
-
-  * Depend on xset (Ubuntu #13997) 
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Thu, 25 Aug 2005 10:12:35 +0100
-
-acpi-support (0.24) breezy; urgency=low
-
-  * Add another missing build-depend DANIEL WHY DO YOU HATE ME SO
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Thu, 25 Aug 2005 01:34:14 +0100
-
-acpi-support (0.23) breezy; urgency=low
-
-  * Add missing build-depends
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Thu, 25 Aug 2005 01:20:28 +0100
-
-acpi-support (0.22) breezy; urgency=low
-
-  [ Thom May ]
-  * Import into bzr.
-  * Notify NetworkManager on suspend and resume, and Recommend:
-    network-manager
-
-  [ Matthew Garrett ]
-  * Add support for sending key events to userspace
-  * Add scripts for various media events
-  * Let the BIOS handle video hotkey events on Thinkpads
-  * Add ACPI events for Toshiba media buttons
-  * Don't change VTs on lid close
-  * Remove gratuitous sleep statements
-  * Improve the ability to guess the user and home directory
-  * Add more support for Panasonic and Asus machines
-  * Improve Asus and Thinkpad wireless control scripts
-  * Support SATA disks
-  * Eject PCMCIA cards at a more appropriate time, and handle
-    ndiswrapper
-  * Support Toshiba bluetooth switching
-
- -- Matthew Garrett <mjg59@srcf.ucam.org>  Mon, 22 Aug 2005 21:55:51 +0100
-
-acpi-support (0.21) hoary; urgency=low
-
-  * Ensure we only return one match from grep.
-  * Run /etc/acpi/local/lid.sh.post if it exists.
-  * sleep for one second, then nuke the acpi lock
-
- -- Thom May <thom@ubuntu.com>  Fri,  1 Apr 2005 11:37:06 +0100
-
-acpi-support (0.20) hoary; urgency=low
-
-  * Ifrename on resume so our interfaces are called the same. (Ubuntu: #7480)
-  * call xscreensaver-command -deactivate so we get a dialog rather than a
-    blank screen when we resume. (Ubuntu: #7717)
-  * Don't clobber LIDSTATE when we mean POWERSTATE (Ubuntu: #8258)
-  * Background the acpid lock removal
-
- -- Thom May <thom@ubuntu.com>  Thu, 17 Mar 2005 17:39:22 +0000
-
-acpi-support (0.19.1) hoary; urgency=low
-
-  * Ensure that we only attempt to save vbe state if ACPI_SLEEP is enabled
-
- -- Thom May <thom@ubuntu.com>  Mon,  7 Mar 2005 12:49:28 +0000
-
-acpi-support (0.19) hoary; urgency=low
-
-  * Add ia64 to the list of supported architectures
-
- -- Thom May <thom@ubuntu.com>  Wed,  2 Mar 2005 23:19:57 +0000
-
-acpi-support (0.18) hoary; urgency=low
-
-  * Fix vbesave init script (Ubuntu: #6907)
-
- -- Thom May <thom@ubuntu.com>  Fri, 25 Feb 2005 11:03:48 +0000
-
-acpi-support (0.17) hoary; urgency=low
-
-  * Use acpid locking functionality finally (Hi, Martijn!)
-  * vbestate:
-    - Test for existence of vbetool
-    - LSBifiy
-    - Convert to a true init script
-    - quieten
-  * Check whether package has been removed but not purged in init script
-
- -- Thom May <thom@ubuntu.com>  Wed, 23 Feb 2005 15:07:51 +0000
-
-acpi-support (0.16) hoary; urgency=low
-
-  * Fix dumb typos
-
- -- Thom May <thom@debian.org>  Mon, 24 Jan 2005 17:30:48 +0000
-
-acpi-support (0.15) hoary; urgency=low
-
-  * Install ibm_acpi.modprobe and tosh_acpi.modprobe by default
-
- -- Thom May <thom@planetarytramp.net>  Sat, 22 Jan 2005 16:18:09 +0000
-
-acpi-support (0.14) hoary; urgency=low
-
-  * Run vbesave at the top of rc2, rather than in rcS, so we can still boot to
-    single user
-
- -- Thom May <thom@planetarytramp.net>  Mon, 17 Jan 2005 17:26:37 +0000
-
-acpi-support (0.13) hoary; urgency=low
-
-  * Update toshiba scripts to handle both possible BIOS values
-  * Fix == bashisms. (Ubuntu #5566)
-  * Fix up ASUS event scripts. (Ubuntu #5510)
-
- -- Thom May <thom@planetarytramp.net>  Fri, 14 Jan 2005 12:31:29 +0000
-
-acpi-support (0.12) hoary; urgency=low
-
-  * Depend on vbetool on i386 only
-
- -- Thom May <thom@planetarytramp.net>  Fri, 14 Jan 2005 10:48:37 +0000
-
-acpi-support (0.11) hoary; urgency=low
-
-  * Add Toshiba, Asus and Panasonic event scripts
-  * Add Toshiba modprobe config and README
-  * All Tosh stuff courtesy of Daniel Silverstone
-
- -- Thom May <thom@planetarytramp.net>  Thu, 13 Jan 2005 16:08:48 +0000
-
-acpi-support (0.10) hoary; urgency=low
-
-  * Matthew Garrett:
-        - /etc/defaults/acpi-support: new
-        - hotplug events for IBM laptops
-        - lots more
-
- -- Thom May <thom@planetarytramp.net>  Thu, 13 Jan 2005 12:27:47 +0000
-
-acpi-support (0.9) warty; urgency=low
-
-  * Add stop target to the init script, disable hdparm advanced power
-    management therein. (Warty #1914)
-
- -- Thom May <thom@canonical.com>  Tue,  5 Oct 2004 21:18:52 +0100
-
-acpi-support (0.8) warty; urgency=low
-
-  * Explicitly add /usr/bin/X11 to path. (Warty #1549)
-
- -- Thom May <thom@canonical.com>  Fri, 24 Sep 2004 12:08:20 +0100
-
-acpi-support (0.7) warty; urgency=low
-
-  * Added versioned depend on lsb-base
-
- -- Nathaniel McCallum <npmccallum@canonical.com>  Fri,  3 Sep 2004 14:45:32 -0400
-
-acpi-support (0.6) warty; urgency=low
+  * Remove spurious file acpi-support_0.90-2.diff.gz added in the repository
+    during last merge (it's still in the orig.tar.gz though).
+  * Add a new SKIP_INTERFACES variables in /etc/default/acpi-support and use
+    it to define network interfaces that are not tied to hardware to avoid
+    shutting them down during suspend.
+  * Properly remove files that have been removed in the SVN in the clean
+    target. This is required because the files are still present in the
+    .orig.tar.gz file (otherwise autobuilder builds will have the unwanted
+    files).
+  * Add XS-Vcs-* fields in debian/control.
 
-  * Load after acpid. (Warty #992)
+ -- Raphael Hertzog <hertzog@debian.org>  Fri, 15 Jun 2007 21:34:42 +0200
 
- -- Thom May <thom@planetarytramp.net>  Fri,  3 Sep 2004 18:39:52 +0100
+acpi-support (0.95-1) unstable; urgency=low
 
-acpi-support (0.5) warty; urgency=low
+  [ Bart Samwel ]
+  * New upstream versions (from Ubuntu Feisty and Gutsy).
+    * 0.95: Clean up issues with toggling multiple wireless cards.
+      - Move variable initiation into loop inside 'wireless.sh'
+      - Move contents of 'wireless.sh' into 
+        lib/state-funcs:toggleAllWirelessState()
+      - Update '{ibm,tosh,asus}-wireless.sh' to use state-funcs
+    * 0.95: Remove spurious 'echo HERE' from lib/state-funcs.  D'oh.
+    * 0.94: Save and restore values that the kernel does not preserve across
+      suspend/resume and hibernate/resume:
+      - /sys/class/net/eth*/device/rf_kill
+      - /proc/acpi/ibm/bluetooth
+      - /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
+    * 0.94: White list Lenovo ThinkPad Z60m as working suspend.
+    * 0.93: Change 'wireless.sh' to use 'device/rf_kill' for wireless
+      devices (if available) in preference to 'device/power/state' which
+      has been removed by the upstream kernel developers.
+    * 0.93: Teach 'lib/state-funcs:isAnyWirelessPoweredOn( )' to also check
+      'device/rf_kill' if it's available.
+    * 0.93: Change 'ibm-wireless.sh' to rotate wireless and bluetooth states
+    * 0.93: Correct inverted logic in 'isAnyWirelessPoweredOn()'.
+    * 0.93: Change script shebangs to use '/bin/sh' instead of '/bin/bash'.
+    * 0.92: Add 'events/sony-eject' for Sony Vaio TX3.
+  * Stop pretending to control laptop-mode-tools, which
+    only works (and badly too) in the upstream Ubuntu version. The lmt
+    package provides its own acpi bindings. Add reference in config file
+    to laptop-mode-tools as a replacement for the current non-working
+    configuration option. (Closes: #425800)
+  * Change Recommends of laptop-mode-tools to Suggests. This should prevent
+    automatic enabling of laptop mode for unsuspecting users, it should not
+    be installed by default.
+  * Check that acpi-support is still installed in script configuration files.
+    (Closes: #424752)
+  * Change order of PCI video state restoration so that it is always the last
+    to be saved and the first to be restored. (Closes: #396897)
+  * Only use ifup/ifdown for interfaces listed by /etc/network/run/ifstate.
+    For other interfaces that are up, use "ifconfig down" to force them down,
+    and restart network-manager and ifplugd after resume to bring them back up.
+    (Closes: #373659)
+  * Do not ifup/down "lo" and "dummy..." interfaces over suspend.
+    (Closes: #427128)
+  * Removed bash dependencies. (Note that this may break custom scripts in
+    /etc/acpi that contain bashisms, as the scripts are sourced, not just
+    executed.) (Closes: #407510)
+  * Instead of only restoring the hardware clock on resume, stop and start the
+    hwclock.sh service over suspend. (Closes: #389537)
+  * Move radeontool call out of loop in lid.sh. (Mentioned in bug 391498, but
+    does not solve the bug.)
+  * Potential fix for "sometimes lid.sh doesn't work" bug. (Part of bug 391498,
+    but not enough to close it.)
+  * Bump up Debhelper compatibility level to 5.
+  * Remove useless use of grep in asus-touchpad.sh.
 
-  * debian/init.d: pretty initscript
+  [ Raphael Hertzog ]
+  * Mark Bart as Maintainer.
+  * Put myself in Uploaders instead.
+  * Sponsor upload for Bart. Change version to 0.95-1.
+  * Manually remove (or move out of the way) old scripts in postint. Concerns:
+    - /etc/acpi/suspend.d/80-video-pci-state.sh
+    - /etc/acpi/resume.d/49-855-resolution-set.sh
+    - /etc/acpi/resume.d/13-855-resolution-set.sh
+    - /etc/modprobe.d/toshiba_acpi.modprobe
+  * Documents policy for handling obsolete configuration files in
+    README.Debian.
+
+ -- Raphael Hertzog <hertzog@debian.org>  Thu, 14 Jun 2007 21:52:16 +0200
+
+acpi-support (0.90-4) unstable; urgency=low
+
+  * Change logic of isAnyWirelessPoweredOn() to only succeed if one wireless
+    device with support for reporting a "state" in sysfs is turned on;
+    closes: #410402.
+  * Add myself as uploader.
+  * Install new manpage for acpi_fakekey, thanks Nico Golde; closes: #383365.
+  * Call dh_strip to drop the ELF comment section of acpi_fakekey.
+  * Depend on radeontool on all arches.
+
+ -- Loic Minier <lool@dooz.org>  Sun, 11 Feb 2007 19:48:22 +0100
+
+acpi-support (0.90-3) unstable; urgency=low
+
+  * Disable VESA BIOS Extensions (VBE) state saving / restoring for X60s
+    Thinkpads (models 1702*, 1704*); closes: 407188.
+
+ -- Loic Minier <lool@dooz.org>  Fri, 19 Jan 2007 22:57:56 +0100
+
+acpi-support (0.90-2) unstable; urgency=low
+
+  * Invoke /usr/sbin/s2disk instead of /sbin/s2disk; thanks Jan Luebbe.
+  * Don't pass any arguments to s2disk as it doesn't support these in newer
+    uswsusp versions.
+  * Fix "APCI" instead of "ACPI" typo in IBM.config; thanks Joshua Kwan;
+    closes: #389511.
 
- -- Nathaniel McCallum <npmccallum@canonical.com>  Thu,  2 Sep 2004 13:16:21 -0400
+ -- Loic Minier <lool@dooz.org>  Sun, 22 Oct 2006 19:15:00 +0200
 
-acpi-support (0.4) warty; urgency=low
+acpi-support (0.90-1) unstable; urgency=low
 
-  * use a subdirectory of /var/lib (Closes Warty #842)
-  * don't hardcode names so that suckful HP boxes might work. (Closes Warty
-    #841)
+  * New upstream versions (from Ubuntu Edgy).
+    * 0.90: Explicitly switch the screen back to text mode if it was that way
+            before resume.
+    * 0.89: Add support for high-res uswsusp
+    * 0.88: Change defaults
+    * 0.87: Add support for using uswsusp
+  * Conflict with uswsusp <= 0.2 as well.
 
- -- Thom May <thom@planetarytramp.net>  Tue, 31 Aug 2004 15:27:13 +0100
+ -- Loic Minier <lool@dooz.org>  Sat, 21 Oct 2006 12:59:06 +0200
 
-acpi-support (0.3) warty; urgency=low
+acpi-support (0.86-1) unstable; urgency=low
 
-  * Apparently, acpid needs a good kick when we change the events.
+  * New upstream version (from Ubuntu Edgy).
+    * 0.86: Remove stop links from rc0 and rc6
+    * 0.85: Don't unload nsc-ircc on suspend
+  * Add ${shlibs:Depends} and call to dh_shlibdeps. Closes: #383449
+  * 855resolution is no more in Debian, replaced by 915resolution. 
+    Closes: #381210
+  * Improved description, thanks to Clément Stenac. Closes: #383691
+  * Removed README.toshiba which doesn't apply to Debian (or which doesn't
+    apply any more, the toshiba_acpi option indicated doesn't exist in
+    2.6.17.7). Closes: #383326
 
- -- Thom May <thom@planetarytramp.net>  Thu, 19 Aug 2004 18:38:55 +0100
+ -- Raphael Hertzog <hertzog@debian.org>  Sun, 20 Aug 2006 10:43:59 +0200
 
-acpi-support (0.2) warty; urgency=low
+acpi-support (0.84-1) unstable; urgency=low
 
-  * use a safer state file to maintain state across lid open/close 
+  * New upstream version.
+  * Put laptop-mode-tools in Recommends instead of Depends to not force the
+    user to use it: it can be painful to have to wait for the disk to spin up
+    and the gain is not always worth it with recent (very small) hard-disks.
+  * Add upstream changelog.
 
- -- Thom May <thom@planetarytramp.net>  Thu, 19 Aug 2004 17:43:38 +0100
+ -- Raphael Hertzog <hertzog@debian.org>  Fri, 16 Jun 2006 17:51:06 +0200
 
-acpi-support (0.1) warty; urgency=low
+acpi-support (0.80-1) unstable; urgency=low
 
-  * First upload.
-  * delimit a basic collection of safe acpi events
+  * Initial release.
+  * Add a watch file.
+  * Little fixes for lintian compliancy.
 
- -- Thom May <thom@planetarytramp.net>  Thu, 19 Aug 2004 15:33:01 +0100
+ -- Raphael Hertzog <hertzog@debian.org>  Mon, 15 May 2006 00:02:44 +0000
--- acpi-support-0.137.orig/debian/acpi-support.docs
+++ acpi-support-0.137/debian/acpi-support.docs
@@ -1 +1,5 @@
 README
+README.toshiba
+debian/addons/docs/README.asus
+debian/addons/docs/README.thinkpad
+debian/examples
--- acpi-support-0.137.orig/debian/acpi-support.postrm
+++ acpi-support-0.137/debian/acpi-support.postrm
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -e
+
+#DEBHELPER#
+
+if [ "$1" = "purge" ] ; then
+	rm -f /etc/acpi/resume.d/13-855-resolution-set.sh.obsolete
+	rm -f /etc/acpi/resume.d/49-855-resolution-set.sh.obsolete
+	rm -f /etc/modprobe.d/ibm_acpi.modprobe
+fi
+
--- acpi-support-0.137.orig/debian/README.Debian
+++ acpi-support-0.137/debian/README.Debian
@@ -0,0 +1,78 @@
+Handling of obsolete configuration files/scripts
+------------------------------------------------
+
+Since dpkg doesn't not remove conffiles that are no more provided by the
+current version of the package, we have to disable them manually so that they
+don't create troubles.
+
+Older versions of this package renamed all these files by adding a ".obsolete"
+extension. Newer version only rename those files that were changed. Unchanged
+files are simply deleted. If you find out such files in
+/etc/acpi/{events,suspend.d,resume.d}, you can safely remove them. 
+
+This renaming is required because otherwise they would be actively used
+while they are no more supposed to be there.
+
+You can use the following command to find the files that have been renamed:
+$ dpkg -s acpi-support | grep obsolete$
+
+(If you have none, it's not a bug, it's just that you installed acpi-support
+after the last removal, or that you purged it to reinstall it properly from
+scratch).
+
+The acpi_fakekeyd daemon.
+-------------------------
+
+With the kernel only allowing key events for which a real key exists on the
+keyboard the old approach of acpi_fakekey to just send the needed event through
+an existing keyboard device does not always work. As a workaround acpi_fakekey
+now sends the generated key press event through the user level input driver and
+thus needs CONFIG_INPUT_UINPUT defined in the kernel and, if build as a module,
+the uinput module to be loaded.
+
+The "acpi-support" method for suspending.
+-----------------------------------------
+
+Older version of acpi-support had their own scripts to control suspend and
+resume. This has been deprecated for quite some time and finally has been
+removed in 0.122-1. The scripts are stil available under
+/usr/share/doc/acpi-support/examples and can easily be copied back to their
+orignal location under /etc/acpi. Once the scripts have been installed they can
+be configured by editing /etc/default/acpi-support.
+
+To have a custom script executed on suspend, it is recommended to use pm-utils
+instead (/usr/lib/pm-utils/sleep.d/). Note that acpi-support is bypassed by
+'acpitool -s'; to enable the suspend actions defined through acpi-support, one
+must put a laptop to sleep with '/etc/acpi/sleep.sh'.
+
+If
+   (a) you are upgrading from an earlier version of "acpi-support"
+   and
+   (b) you do not have any custom scripts in /etc/acpi/*.d/
+   and
+   (c) you have custom set some variables in /etc/default/acpi-support
+       to "true"
+then
+you should be able to use the "pm-utils" method for suspending by using command
+line parameters for pm-suspend according to the following table:
+
+ variable                    pm-utils parameter
+
+ SAVE_VBE_STATE              --quirk-vbestate-restore
+ POST_VIDEO                  --quirk-vbe-post
+ SAVE_VIDEO_PCI_STATE        --quirk-save-pci
+ USE_DPMS                    --quirk-dpms-suspend
+ RADEON_LIGHT                --quirk-radeon-off
+
+You can set these parameters automatically by adding a file in
+/etc/pm/config.d/ containing a  line like
+	ADD_PARAMETERS="--quirk-vbestate-restore --quirk-vbe-post"
+
+In addition, if you had a line in /etc/default/acpi-support like
+	MODULES="module1 module2"
+Then you should add the line
+	SUSPEND_MODULES="module1 module2"
+to a file in /etc/pm/config.d/
+
+Should you experience problems when switching to pm-utils please report them.
+
--- acpi-support-0.137.orig/debian/control
+++ acpi-support-0.137/debian/control
@@ -1,21 +1,20 @@
 Source: acpi-support
 Section: admin
 Priority: optional
-Maintainer: Ubuntu Core developers <ubuntu-devel-discuss@lists.ubuntu.com>
-XSBC-Original-Maintainer: Bart Samwel <bart@samwel.tk>
-Uploaders: Loic Minier <lool@dooz.org>, Raphael Hertzog <hertzog@debian.org>
-DM-Upload-Allowed: yes
-Build-Depends: debhelper (>= 4.1.16)
-Vcs-Bzr: https://code.launchpad.net/~ubuntu-core-dev/acpi-support/trunk/
-XS-Orig-Vcs-Svn: svn://svn.debian.org/collab-maint/deb-maint/acpi-support/trunk
-XS-Orig-Vcs-Browser: http://svn.debian.org/wsvn/collab-maint/deb-maint/acpi-support/trunk/
-Standards-Version: 3.7.3
+Maintainer: Debian Acpi Team <pkg-acpi-devel@lists.alioth.debian.org>
+Uploaders: Michael Meskes <meskes@debian.org>
+Build-Depends: debhelper (>= 7), quilt (>= 0.40)
+Vcs-Git: git://git.debian.org/git/pkg-acpi/acpi-support.git
+Vcs-Browser: http://git.debian.org/?p=pkg-acpi/acpi-support.git
+Standards-Version: 3.9.1
 
 Package: acpi-support
-Architecture: i386 amd64 ia64 lpia
-Depends: x11-xserver-utils, acpid (>= 1.0.4-1ubuntu4), hdparm, lsb-base (>= 1.3-9ubuntu3), powermgmt-base, laptop-detect, dmidecode (>= 2.7-1), ${shlibs:Depends}, pm-utils
-Recommends: toshset [i386 amd64], radeontool, xinput, wireless-tools
-Conflicts: uswsusp (<= 0.2)
+Architecture: all
+Depends: acpi-support-base (>= 0.109-1), x11-xserver-utils, acpid (>= 1.0.4), lsb-base (>= 1.3-9), pm-utils, acpi-fakekey, 
+         ${arch:Depends}, ${misc:Depends}
+Recommends: dbus, vbetool, xscreensaver|gnome-screensaver, radeontool
+Suggests: rfkill, xinput, ${arch:Suggests}
+Breaks: uswsusp (<= 0.2)
 Description: scripts for handling many ACPI events
  This package contains scripts to react to various ACPI events. It only
  includes scripts for events that can be supported with some level of
@@ -29,3 +28,25 @@
     hardware that needs it.
   * On some laptops, set screen brightness.
 
+Package: acpi-support-base
+Architecture: all
+Depends: acpid (>= 1.0.4), console-tools | console-utilities, ${misc:Depends}
+Suggests: acpi-support
+Replaces: acpi-support (<< 0.109-1)
+Description: scripts for handling base ACPI events such as the power button
+ This package contains scripts to react to various base ACPI events
+ such as the power button. For more extensive ACPI support, including support
+ for suspend-to-RAM and for various laptop features, install the package
+ "acpi-support".
+
+Package: acpi-fakekey
+Architecture: i386 amd64 ia64
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Replaces: acpi-support (<< 0.136-1)
+Breaks: acpi-support (<< 0.136-1)
+Description: tool to generate fake key events
+ This package contains a small tool that can be used to generate key events as
+ if the corresponding key was pressed. It is used by scripts processing ACPI
+ events to translate these events to key presses but can also be used
+ separately.
+
--- acpi-support-0.137.orig/debian/acpi-support.postinst
+++ acpi-support-0.137/debian/acpi-support.postinst
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+        configure)
+                invoke-rc.d acpid restart >/dev/null || true
+                ;;
+        *)
+                ;;
+esac
+
+# Remove shutdown and reboot links; this init script does not need them.
+if [ -n "$2" ] && dpkg --compare-versions "$2" lt "0.86"; then
+	rm -f /etc/rc0.d/K20acpi-support /etc/rc6.d/K20acpi-support
+fi
+
+# vbesave got removed
+if [ -n "$2" ] && dpkg --compare-versions "$2" lt "0.122-1"; then
+	update-rc.d vbesave remove >/dev/null || exit $?
+fi
+
+#DEBHELPER#
--- acpi-support-0.137.orig/debian/acpi-fakekey.install
+++ acpi-support-0.137/debian/acpi-fakekey.install
@@ -0,0 +1,2 @@
+acpi_fakekey					/usr/bin
+acpi_fakekeyd					/usr/sbin
--- acpi-support-0.137.orig/debian/acpi-support.init
+++ acpi-support-0.137/debian/acpi-support.init
@@ -0,0 +1,53 @@
+#!/bin/sh
+# INIT script to check whether we're on batteries, and so start with laptop 
+# mode etc enabled.
+
+### BEGIN INIT INFO
+# Provides:          acpi-support
+# Required-Start:    $local_fs $remote_fs $syslog
+# Required-Stop:     $local_fs $remote_fs $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      1
+# Short-Description: Start some power management scripts
+### END INIT INFO
+
+test -f /usr/share/acpi-support/power-funcs || exit 0
+
+# BUGS: unless we start *really* late, we have no way of throttling 
+# xscreensaver, since it won't be there to command.
+. /usr/share/acpi-support/power-funcs
+
+test -f /lib/lsb/init-functions || exit 1
+. /lib/lsb/init-functions
+
+test -d /var/lib/acpi-support || exit 0
+
+case "$1" in
+  start)
+    log_action_begin_msg "Checking battery state"
+    if [ x"`echo /proc/acpi/ac_adapter/*`" != x"/proc/acpi/ac_adapter/*" ]; then 
+	/etc/acpi/power.sh
+    fi
+    # Source everything in /etc/acpi/start.d/
+    for SCRIPT in /etc/acpi/start.d/*.sh; do
+	if [ -f "$SCRIPT" ] ; then
+  	  . $SCRIPT
+  	fi
+    done
+    log_action_end_msg 0
+    ;;
+  stop)
+    log_action_begin_msg "Disabling power management"
+    if [ x"`echo /proc/acpi/ac_adapter/*`" != x"/proc/acpi/ac_adapter/*" ]; then
+	/etc/acpi/power.sh false
+    fi
+    log_action_end_msg 0
+    ;;
+  restart|force-reload)
+    # Doesn't make sense for this package
+    ;;
+  *)
+  ;;
+esac
+        
+
--- acpi-support-0.137.orig/debian/acpi-support.preinst
+++ acpi-support-0.137/debian/acpi-support.preinst
@@ -0,0 +1,204 @@
+#!/bin/sh
+
+set -e
+
+#DEBHELPER#
+
+# Remove a no-longer used conffile
+rm_conffile() {
+    PKGNAME="$1"
+    CONFFILE="$2"
+    if [ -e "$CONFFILE" ]; then
+        md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
+        old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`"
+        if [ "$md5sum" != "$old_md5sum" ]; then
+            echo "Obsolete conffile $CONFFILE has been modified by you."
+            echo "Saving as $CONFFILE.obsolete ..."
+            mv -f "$CONFFILE" "$CONFFILE".obsolete
+        else
+	    echo "Removing obsolete conffile $CONFFILE ..."
+	    rm -f "$CONFFILE"
+        fi
+    fi
+}
+
+case "$1" in
+  install|upgrade)
+    if dpkg --compare-versions "$2" lt 0.95-1; then
+	rm_conffile acpi-support /etc/acpi/suspend.d/80-video-pci-state.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/49-855-resolution-set.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/13-855-resolution-set.sh
+	rm_conffile acpi-support /etc/modprobe.d/toshiba_acpi.modprobe
+    fi
+
+    if dpkg --compare-versions "$2" lt 0.114-2; then
+	rm_conffile acpi-support /etc/acpi/resume.d/13-915-resolution-set.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/49-915-resolution-set.sh
+	rm_conffile acpi-support /etc/modprobe.d/ibm_acpi.modprobe
+	rm_conffile acpi-support /etc/modprobe.d/thinkpad_acpi.modprobe
+    fi
+
+    if dpkg --compare-versions "$2" lt 0.122-2; then
+	# old files that were actually removed in 0.121-1
+	rm_conffile acpi-support /etc/acpi/thinkpad-lockorbattery.sh
+	rm_conffile acpi-support /etc/acpi/thinkpad-thinklight.sh
+	rm_conffile acpi-support /etc/acpi/toshbright.sh
+	rm_conffile acpi-support /etc/acpi/thinkpad-brightness-up.sh
+	rm_conffile acpi-support /etc/acpi/thinkpad-brightness-down.sh
+	rm_conffile acpi-support /etc/acpi/thinkpad-zoom.sh
+
+	rm_conffile acpi-support /etc/acpi/events/asus-mail
+	rm_conffile acpi-support /etc/acpi/events/ibm-sleepbtn
+	rm_conffile acpi-support /etc/acpi/events/ibm-lockbtn
+	rm_conffile acpi-support /etc/acpi/events/ibm-hibernatebtn
+	rm_conffile acpi-support /etc/acpi/events/lenovo-lockbtn
+	rm_conffile acpi-support /etc/acpi/events/ibm-videobtn
+	rm_conffile acpi-support /etc/acpi/events/thinkpad-thinklight
+	rm_conffile acpi-support /etc/acpi/events/tosh-brightness-up
+	rm_conffile acpi-support /etc/acpi/events/tosh-brightness-down
+	rm_conffile acpi-support /etc/acpi/events/tosh-mute
+	rm_conffile acpi-support /etc/acpi/events/tosh-sleep
+	rm_conffile acpi-support /etc/acpi/events/sony-hibernate
+	rm_conffile acpi-support /etc/acpi/events/thinkpad-brightness-up
+	rm_conffile acpi-support /etc/acpi/events/thinkpad-brightness-down
+	rm_conffile acpi-support /etc/acpi/events/thinkpad-zoom
+
+	# in 0.122-1 we removed the whole suspend/resume stuff
+	rm_conffile acpi-support /etc/acpi/resume.d/11-video-pci-restore.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/13-855-resolution-set.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/15-video-post.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/17-video-restore.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/35-modules-load.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/40-infra-red.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/49-855-resolution-set.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/50-framebuffer-enable.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/50-time.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/50-tosh-restore-brightness.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/55-screen.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/58-proc-sysfs-restore-state.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/60-asus-wireless-led.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/62-ifup.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/65-console.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/67-sound.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/69-services.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/72-acpi-pain.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/89-asus-restore-brightness.sh
+
+	[ -L /etc/acpi/resume.d/90-hdparm.sh ] && rm -f /etc/acpi/resume.d/90-hdparm.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/90-hdparm.sh
+
+	rm_conffile acpi-support /etc/acpi/resume.d/90-thinkpad-unstandby-led.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/90-xscreensaver.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/95-laptop-mode.sh
+	rm_conffile acpi-support /etc/acpi/resume.d/98-acpi-unlock.sh
+
+	rm_conffile acpi-support /etc/acpi/suspend.d/01-laptop-mode.sh
+	rm_conffile acpi-support /etc/acpi/suspend.d/05-acpi-lock.sh
+	rm_conffile acpi-support /etc/acpi/suspend.d/10-thinkpad-standby-led.sh
+	rm_conffile acpi-support /etc/acpi/suspend.d/30-proc-sysfs-save-state.sh
+	rm_conffile acpi-support /etc/acpi/suspend.d/50-irda-stop.sh
+	rm_conffile acpi-support /etc/acpi/suspend.d/50-time.sh
+	rm_conffile acpi-support /etc/acpi/suspend.d/50-tosh-save-brightness.sh
+	rm_conffile acpi-support /etc/acpi/suspend.d/55-down-interfaces.sh
+	rm_conffile acpi-support /etc/acpi/suspend.d/60-generate-modules-list.sh
+	rm_conffile acpi-support /etc/acpi/suspend.d/65-services-stop.sh
+	rm_conffile acpi-support /etc/acpi/suspend.d/70-modules-unload.sh
+	rm_conffile acpi-support /etc/acpi/suspend.d/75-console-switch.sh
+	rm_conffile acpi-support /etc/acpi/suspend.d/80-video-vesa-state.sh
+	rm_conffile acpi-support /etc/acpi/suspend.d/81-video-pci-state.sh
+	rm_conffile acpi-support /etc/acpi/suspend.d/85-alsa-state.sh
+	rm_conffile acpi-support /etc/acpi/suspend.d/88-time.sh
+	rm_conffile acpi-support /etc/acpi/suspend.d/90-framebuffer-stop.sh
+
+	rm_conffile acpi-support /etc/acpi/prepare.sh
+	rm_conffile acpi-support /etc/acpi/resume.sh
+
+	rm_conffile acpi-support /etc/init.d/vbesave
+
+	# Also remove the symlinks
+	[ -L /etc/acpi/resume.d/10-thinkpad-standby-led.sh ] && rm -f /etc/acpi/resume.d/10-thinkpad-standby-led.sh
+
+	# These used to be a symlink, but are a real files now.
+	[ -L /etc/acpi/start.d/60-asus-wireless-led.sh ] && rm -f /etc/acpi/start.d/60-asus-wireless-led.sh
+	[ -L /etc/acpi/start.d/90-hdparm.sh ] && rm -f /etc/acpi/start.d/90-hdparm.sh 
+    fi
+
+    if dpkg --compare-versions "$2" lt 0.123-1; then
+	rm_conffile acpi-support /etc/acpi/events/asus-volume-down
+	rm_conffile acpi-support /etc/acpi/events/asus-volume-mute
+	rm_conffile acpi-support /etc/acpi/events/asus-volume-up
+    fi
+
+    if dpkg --compare-versions "$2" lt 0.129-1; then
+	rm_conffile acpi-support /etc/acpi/panabright.sh
+	rm_conffile acpi-support /etc/acpi/panapower.sh
+	rm_conffile acpi-support /etc/acpi/thinkpad-thinkpad.sh
+	rm_conffile acpi-support /etc/acpi/video_brightnessdown.sh
+	rm_conffile acpi-support /etc/acpi/video_brightnessup.sh
+	rm_conffile acpi-support /etc/acpi/wireless.sh
+	rm_conffile acpi-support /etc/acpi/events/video_brightnessdown
+	rm_conffile acpi-support /etc/acpi/events/video_brightnessup
+	rm_conffile acpi-support /etc/acpi/events/asus-a6u-touchpad
+	rm_conffile acpi-support /etc/acpi/events/asus-internet
+	rm_conffile acpi-support /etc/acpi/events/asus-lock
+	rm_conffile acpi-support /etc/acpi/events/asus-wireless
+	rm_conffile acpi-support /etc/acpi/events/asus-media-next
+	rm_conffile acpi-support /etc/acpi/events/asus-media-play-pause
+	rm_conffile acpi-support /etc/acpi/events/asus-media-prev
+	rm_conffile acpi-support /etc/acpi/events/asus-media-stop
+	rm_conffile acpi-support /etc/acpi/events/panasonic-brightness-down
+	rm_conffile acpi-support /etc/acpi/events/panasonic-brightness-up
+	rm_conffile acpi-support /etc/acpi/events/panasonic-mute
+	rm_conffile acpi-support /etc/acpi/events/panasonic-volume-down
+	rm_conffile acpi-support /etc/acpi/events/panasonic-volume-up
+	rm_conffile acpi-support /etc/acpi/events/thinkpad-thinkpad
+	rm_conffile acpi-support /etc/acpi/events/video_brightnessdown
+	rm_conffile acpi-support /etc/acpi/events/video_brightnessup
+
+	[ -L /etc/acpi/ac.d/90-hdparm.sh ] && rm -f /etc/acpi/ac.d/90-hdparm.sh
+	rm_conffile acpi-support /etc/acpi/ac.d/90-hdparm.sh
+	[ -L /etc/acpi/battery.d/90-hdparm.sh ] && rm -f /etc/acpi/battery.d/90-hdparm.sh
+	rm_conffile acpi-support /etc/acpi/battery.d/90-hdparm.sh
+	[ -L /etc/acpi/start.d/90-hdparm.sh ] && rm -f /etc/acpi/start.d/90-hdparm.sh
+	rm_conffile acpi-support /etc/acpi/start.d/90-hdparm.sh
+
+	[ -d /etc/acpi/ac.d ] && rmdir --ignore-fail-on-non-empty /etc/acpi/ac.d 
+	[ -d /etc/acpi/battery.d ] && rmdir --ignore-fail-on-non-empty /etc/acpi/battery.d
+    fi
+
+    if dpkg --compare-versions "$2" lt 0.129-2; then
+	rm_conffile acpi-support /etc/acpi/events/videobtn
+
+	# This was actually forgotton long ago, so we remove it now.
+	rm_conffile acpi-support /etc/acpi/resume.d/10-thinkpad-standby-led.sh
+
+	[ -d /etc/acpi/resume.d ] && rmdir --ignore-fail-on-non-empty /etc/acpi/resume.d 
+	[ -d /etc/acpi/suspend.d ] && rmdir --ignore-fail-on-non-empty /etc/acpi/suspend.d
+    fi
+
+    if dpkg --compare-versions "$2" lt 0.131-1; then
+	# Just another one that was forgotten.
+	rm_conffile acpi-support /etc/acpi/start.d/10-save-dmidecode.sh
+    fi
+
+    if dpkg --compare-versions "$2" lt 0.131-3; then
+	rm_conffile acpi-support /etc/acpi/start.d/60-asus-wireless-led.sh
+    fi
+
+    if dpkg --compare-versions "$2" lt 0.132-1; then
+	rm_conffile acpi-support /etc/acpi/asus-wireless-2.sh
+	rm_conffile acpi-support /etc/acpi/events/asus-wireless-2
+    fi
+
+    if dpkg --compare-versions "$2" lt 0.137-1; then
+	rm_conffile acpi-support /etc/acpi/events/asus-eee-volume-down
+	rm_conffile acpi-support /etc/acpi/events/asus-eee-volume-mute
+	rm_conffile acpi-support /etc/acpi/events/asus-eee-volume-up
+	rm_conffile acpi-support /etc/acpi/events/panasonic-hibernatebtn
+	rm_conffile acpi-support /etc/acpi/events/panasonic-sleepbtn
+	rm_conffile acpi-support /etc/acpi/if-asus-eee.sh
+    fi
+  ;;
+esac
+
+exit 0
--- acpi-support-0.137.orig/debian/copyright
+++ acpi-support-0.137/debian/copyright
@@ -1,11 +1,24 @@
-Format: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=54
-Name: acpi-support
-Contact: Ubuntu Core Developers <ubuntu-devel-discuss@lists.ubuntu.com>
-Source: https://code.launchpad.net/~ubuntu-core-dev/acpi-support/trunk/
-
-Files: *
-Copyright: 2004-2009, Canonical Ltd.
-           2005-2007, Matthew Garrett <mjg59@srcf.ucam.org>
-License: GPL-2+
- On Debian systems the full text of the GNU General Public License
- can be found in the '/usr/share/common-licenses/GPL-2' file.
+This package written and debianised for Ubuntu by Thom May
+<thom@canonical.com> based on work by Matthew Garrett
+<mjg59@srcf.ucam.org>. It was downloaded from
+http://archive.ubuntu.com/ubuntu/pool/main/a/acpi-support/
+
+Copyright (C) 2004 Canonical Ltd.
+ Authors: Matthew Garrett, Thom May
+
+acpi-support is licensed under the GNU general public license, version 2
+
+acpi-support is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; either version 2, or (at your option) any later version.
+
+acpi-support is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+acpi-support; see the file COPYING.  If not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+On Debian systems, a copy of the GNU General Public License is available in
+/usr/share/common-licenses/GPL as part of the base-files package.
--- acpi-support-0.137.orig/debian/acpi-support-base.install
+++ acpi-support-0.137/debian/acpi-support-base.install
@@ -0,0 +1,4 @@
+debian/addons/scripts/powerbtn-acpi-support.sh	/etc/acpi
+debian/addons/events/powerbtn-acpi-support	/etc/acpi/events
+
+lib/po*						/usr/share/acpi-support
--- acpi-support-0.137.orig/debian/acpi-fakekey.dirs
+++ acpi-support-0.137/debian/acpi-fakekey.dirs
@@ -0,0 +1,3 @@
+/usr/bin
+/usr/sbin
+
--- acpi-support-0.137.orig/debian/acpi-fakekey.postinst
+++ acpi-support-0.137/debian/acpi-fakekey.postinst
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = configure ]; then
+	if [ -z "$2" ]; then
+		# if this package has been installed before, the init script
+		# already stopped acpi_fakekeyd, but if we're upgrading from an
+		# acpi-support package containing acpi_fakekeyd we have to
+		# manually stop the daemon to be able to start it in the
+		# debhelper section below
+
+		start-stop-daemon --oknodo --stop --quiet --exec /usr/sbin/acpi_fakekeyd
+	fi
+fi
+
+#DEBHELPER#
+
+exit 0
--- acpi-support-0.137.orig/debian/acpi-support-base.dirs
+++ acpi-support-0.137/debian/acpi-support-base.dirs
@@ -0,0 +1,4 @@
+etc/acpi
+etc/acpi/events
+usr/share/acpi-support
+usr/share/doc/acpi-support-base
--- acpi-support-0.137.orig/debian/README.source
+++ acpi-support-0.137/debian/README.source
@@ -0,0 +1,58 @@
+This package uses quilt to manage all modifications to the upstream
+source.  Changes are stored in the source package as diffs in
+debian/patches and applied during the build.
+
+To configure quilt to use debian/patches instead of patches, you want
+either to export QUILT_PATCHES=debian/patches in your environment
+or use this snippet in your ~/.quiltrc:
+
+    for where in ./ ../ ../../ ../../../ ../../../../ ../../../../../; do
+        if [ -e ${where}debian/rules -a -d ${where}debian/patches ]; then
+                export QUILT_PATCHES=debian/patches
+                break
+        fi
+    done
+
+To get the fully patched source after unpacking the source package, cd to
+the root level of the source package and run:
+
+    quilt push -a
+
+The last patch listed in debian/patches/series will become the current
+patch.
+
+To add a new set of changes, first run quilt push -a, and then run:
+
+    quilt new <patch>
+
+where <patch> is a descriptive name for the patch, used as the filename in
+debian/patches.  Then, for every file that will be modified by this patch,
+run:
+
+    quilt add <file>
+
+before editing those files.  You must tell quilt with quilt add what files
+will be part of the patch before making changes or quilt will not work
+properly.  After editing the files, run:
+
+    quilt refresh
+
+to save the results as a patch.
+
+Alternately, if you already have an external patch and you just want to
+add it to the build system, run quilt push -a and then:
+
+    quilt import -P <patch> /path/to/patch
+    quilt push -a
+
+(add -p 0 to quilt import if needed). <patch> as above is the filename to
+use in debian/patches.  The last quilt push -a will apply the patch to
+make sure it works properly.
+
+To remove an existing patch from the list of patches that will be applied,
+run:
+
+    quilt delete <patch>
+
+You may need to run quilt pop -a to unapply patches first before running
+this command.
--- acpi-support-0.137.orig/debian/acpi-support.dirs
+++ acpi-support-0.137/debian/acpi-support.dirs
@@ -0,0 +1,7 @@
+etc/acpi
+etc/acpi/events
+etc/default
+etc/init.d
+usr/share/acpi-support
+usr/share/doc/acpi-support
+var/lib/acpi-support
--- acpi-support-0.137.orig/debian/acpi_fakekey.1
+++ acpi-support-0.137/debian/acpi_fakekey.1
@@ -1,5 +1,5 @@
 .Dd 2007-01-22
-.Dt acpi_fakekeya 1
+.Dt acpi_fakekey 1
 .Os "Debian GNU/Linux"
 .Sh NAME
 .Nm acpi_fakekey
--- acpi-support-0.137.orig/debian/rules
+++ acpi-support-0.137/debian/rules
@@ -1,46 +1,57 @@
 #!/usr/bin/make -f
 
-clean:
-	make clean
+include /usr/share/quilt/quilt.make
+
+DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
+ifeq ($(DEB_HOST_ARCH),i386)
+arch-depends := -V'arch:Suggests=toshset'
+endif
+
+clean: unpatch
 	dh_testdir
+	dh_testroot
+	make clean
+	-rm -f acpi_fakekeyd
 	dh_clean
 
-build:
+build: patch build-stamp
+build-stamp:
 	make
 
-install:
+dhclean: 
+	dh_testdir
+	dh_testroot
+	dh_prep
+
+install: dhclean
 	dh_testdir
 	dh_testroot
-	dh_clean -k
 	dh_installdirs
-	for file in lib/*; do\
-		install -m 644 "$$file" debian/acpi-support/usr/share/acpi-support/;\
-	done
-	for file in events/*; do\
-		install -m 644 $$file debian/acpi-support/etc/acpi/events/;\
-	done
-	for file in *.sh; do\
-		install -m 755 $$file debian/acpi-support/etc/acpi/;\
-	done
-	install -m 644 acpi-support debian/acpi-support/etc/default/;
-	install -m 755 acpi_fakekey debian/acpi-support/usr/bin/acpi_fakekey
-	install -m 644 key-constants debian/acpi-support/usr/share/acpi-support/
+	# work around buggy orig tarball, to be removed for the next upstream version
+	-rm -f debian/acpi-support.manpages debian/dirs debian/docs debian/init.d debian/postinst debian/preinst
 
 binary-indep:
 
-binary-arch: install
+binary-arch: dhclean install
 	dh_testdir
 	dh_testroot
 	dh_installdocs
-	dh_installchangelogs
+	dh_installchangelogs 
 	dh_installman
-	dh_installinit --no-start -- start 99 2 3 4 5 . stop 20 1 .
+	dh_installinit -pacpi-support --no-start -- start 99 2 3 4 5 . stop 20 1 . 
+	dh_installinit -pacpi-fakekey -- start 99 2 3 4 5 .  
+	dh_install
+	find debian/acpi-support/etc/acpi -name "*.sh" -exec chmod a+x {} \;
+	chmod a-x debian/acpi-support/usr/share/acpi-support/state-funcs
+	find debian/acpi-support-base/etc/acpi -name "*.sh" -exec chmod a+x {} \;
+	dh_strip
+	dh_link
 	dh_compress
 	dh_fixperms
 	dh_installdeb
-	dh_shlibdeps
-	dh_gencontrol
+	dh_shlibdeps 
+	dh_gencontrol -- $(arch-depends)
 	dh_md5sums
 	dh_builddeb
-
+	
 binary: binary-arch binary-indep
--- acpi-support-0.137.orig/debian/acpi-support.install
+++ acpi-support-0.137/debian/acpi-support.install
@@ -0,0 +1,87 @@
+asus-brn-down.sh				/etc/acpi
+asus-brn-up.sh					/etc/acpi
+asus-touchpad.sh				/etc/acpi
+asus-wireless.sh				/etc/acpi
+batterybtn.sh					/etc/acpi
+ejectbtn.sh					/etc/acpi
+hibernate.sh					/etc/acpi
+ibm-wireless.sh					/etc/acpi
+lid.sh						/etc/acpi
+lockbtn.sh					/etc/acpi
+mailbtn.sh					/etc/acpi
+mediabtn.sh					/etc/acpi
+mutebtn.sh					/etc/acpi
+nextbtn.sh					/etc/acpi
+playbtn.sh					/etc/acpi
+power.sh					/etc/acpi
+prevbtn.sh					/etc/acpi
+rotatescreen.sh					/etc/acpi
+screenblank.sh					/etc/acpi
+sleep.sh					/etc/acpi
+sleepbtn.sh					/etc/acpi
+stopbtn.sh					/etc/acpi
+thinkpad-stretchortouchpad.sh			/etc/acpi
+tosh-wireless.sh				/etc/acpi
+undock.sh					/etc/acpi
+videobtn.sh					/etc/acpi
+voldownbtn.sh					/etc/acpi
+volupbtn.sh					/etc/acpi
+webbtn.sh					/etc/acpi
+
+debian/addons/scripts/always-mute.sh		/etc/acpi
+debian/addons/scripts/hibernatebtn.sh		/etc/acpi
+debian/addons/scripts/if-asus-not-eee.sh	/etc/acpi
+debian/addons/scripts/sonybright.sh		/etc/acpi
+
+events/ac					/etc/acpi/events
+events/asus-brightness-down			/etc/acpi/events
+events/asus-brightness-up			/etc/acpi/events
+events/asus-f8sv-touchpad			/etc/acpi/events
+events/asus-media-eject				/etc/acpi/events
+events/asus-rotate				/etc/acpi/events
+events/asus-touchpad				/etc/acpi/events
+events/asus-video				/etc/acpi/events
+events/asus-wireless-off			/etc/acpi/events
+events/asus-wireless-on				/etc/acpi/events
+events/battery					/etc/acpi/events
+events/ibm-wireless				/etc/acpi/events
+events/lenovo-touchpad				/etc/acpi/events
+events/lenovo-undock				/etc/acpi/events
+events/lidbtn					/etc/acpi/events
+events/panasonic-lockbtn			/etc/acpi/events
+events/sleepbtn					/etc/acpi/events
+events/sony-mute				/etc/acpi/events
+events/sony-sleep				/etc/acpi/events
+events/sony-volume-down				/etc/acpi/events
+events/sony-volume-up				/etc/acpi/events
+events/thinkpad-cmos				/etc/acpi/events
+events/tosh-battery				/etc/acpi/events
+events/tosh-hibernate				/etc/acpi/events
+events/tosh-ibutton				/etc/acpi/events
+events/tosh-lock				/etc/acpi/events
+events/tosh-mail				/etc/acpi/events
+events/tosh-media				/etc/acpi/events
+events/tosh-next				/etc/acpi/events
+events/tosh-play				/etc/acpi/events
+events/tosh-prev				/etc/acpi/events
+events/tosh-stop				/etc/acpi/events
+events/tosh-wireless				/etc/acpi/events
+events/tosh-www					/etc/acpi/events
+
+debian/addons/events/asus-wireless-wlan  	/etc/acpi/events
+debian/addons/events/sony-brightness-down	/etc/acpi/events
+debian/addons/events/sony-brightness-up		/etc/acpi/events
+debian/addons/events/sony-eject			/etc/acpi/events
+debian/addons/events/thinkpad-mute		/etc/acpi/events
+debian/addons/events/thinkpad-volume-down	/etc/acpi/events
+debian/addons/events/thinkpad-volume-up		/etc/acpi/events
+
+key-constants					/usr/share/acpi-support
+lib/device-funcs				/usr/share/acpi-support
+lib/screenblank					/usr/share/acpi-support
+lib/state-funcs					/usr/share/acpi-support
+
+debian/addons/default/acpi-support		/etc/default
+
+debian/lintian/acpi-support			/usr/share/lintian/overrides
+
--- acpi-support-0.137.orig/debian/acpi-fakekey.init
+++ acpi-support-0.137/debian/acpi-fakekey.init
@@ -0,0 +1,73 @@
+#!/bin/sh
+# INIT script to check whether we're on batteries, and so start with laptop 
+# mode etc enabled.
+
+### BEGIN INIT INFO
+# Provides:          acpi-fakekey
+# Required-Start:    $local_fs $remote_fs
+# Required-Stop:     $local_fs $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      
+# Short-Description: Start acpi_fakekey daemon
+### END INIT INFO
+
+test -f /lib/lsb/init-functions || exit 1
+. /lib/lsb/init-functions
+
+case "$1" in
+  start)
+    log_action_begin_msg "Starting acpi_fakekey daemon"
+    if [ ! -d /sys/devices/virtual/misc/uinput ]; then
+	 if ! modprobe -q uinput; then
+		if ! find /lib/modules/`uname -r` -name "uinput\.*" 2>/dev/null|grep -q uinput; then
+			log_action_end_msg 1 "No suitable uinput module for running kernel found"
+		else
+			log_action_end_msg 1 "Modprobe uinput failed. Please use 'dmesg' to find out why"
+		fi
+	fi
+	# give udev time to create the devices
+	sleep 1
+    fi
+
+    if [ -d /sys/devices/virtual/misc/uinput ]; then
+	if start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/acpi_fakekeyd
+	then
+		log_action_end_msg 0
+	else
+		log_action_end_msg 1 "Could not start /usr/sbin/acpi_fakekeyd"
+	fi
+    else
+	log_action_end_msg 0
+    fi
+    ;;
+  stop)
+    log_action_begin_msg "Stopping acpi_fakekey daemon"
+    if start-stop-daemon --stop --quiet --exec /usr/sbin/acpi_fakekeyd
+    then
+    	if [ -d /sys/devices/virtual/misc/uinput ]; then
+		sleep 1 # give acpi_fakekeyd a chance to disappear
+		if ! rmmod uinput 2>/dev/null; then
+                        log_action_end_msg 1 "Cannot unload module uinput"
+		else
+			log_action_end_msg 0
+                fi
+	fi
+    else
+	log_action_end_msg 1 "Could not stop /usr/sbin/acpi_fakekeyd"
+    fi
+    ;;
+  restart|force-reload)
+    log_action_begin_msg "Restarting acpi_fakekey daemon"
+    start-stop-daemon --stop --quiet --exec /usr/sbin/acpi_fakekeyd
+    if start-stop-daemon --start --quiet --exec /usr/sbin/acpi_fakekeyd
+    then
+	log_action_end_msg 0
+    else
+	log_action_end_msg 1 "Could not restart /usr/sbin/acpi_fakekeyd"
+    fi
+    ;;
+  *)
+  ;;
+esac
+        
+
--- acpi-support-0.137.orig/debian/lintian/acpi-support
+++ acpi-support-0.137/debian/lintian/acpi-support
@@ -0,0 +1 @@
+acpi-support: init.d-script-possible-missing-stop /etc/init.d/acpi-support 0 6
--- acpi-support-0.137.orig/debian/source/format
+++ acpi-support-0.137/debian/source/format
@@ -0,0 +1 @@
+1.0
--- acpi-support-0.137.orig/debian/examples/init.d/vbesave
+++ acpi-support-0.137/debian/examples/init.d/vbesave
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+### BEGIN INIT INFO
+# Provides:          vbesave
+# Required-Start:    $local_fs $remote_fs
+# Required-Stop:     $local_fs $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      
+# Short-Description: Save VESA state at boot time
+# Description:       VESA state is saved at boot time so that it can be
+#                    restored later to a sane state for example after a suspend.
+### END INIT INFO
+
+test -f /usr/share/acpi-support/power-funcs || exit 0
+
+test -x /usr/sbin/vbetool || exit 0
+set -e
+
+. /lib/lsb/init-functions
+
+test -f /etc/default/rcS && . /etc/default/rcS
+test -f /etc/default/acpi-support && . /etc/default/acpi-support
+test -f /usr/share/acpi-support/device-funcs && . /usr/share/acpi-support/device-funcs
+
+case "$1" in
+ start)
+	if laptop-detect > /dev/null; then
+		LAPTOP=true;
+	fi
+
+	if [ x$LAPTOP != xtrue ]; then
+		exit 0;
+	fi
+
+        DeviceConfig
+	log_begin_msg "Saving VESA state..."
+	if [ "$SAVE_VBE_STATE" = "true" ]; then
+	    if [ "$VERBOSE" = no ]; then 
+		if ! vbetool vbestate save > $VBESTATE 2>/dev/null; then
+		    log_end_msg $?
+		    exit 1
+		fi
+	    else
+		if ! vbetool vbestate save > $VBESTATE ; then
+		    log_end_msg $?
+		    exit 1
+		fi
+	    fi
+	    log_end_msg 0
+        fi
+        ;;
+ stop|restart|force-reload)
+	# Doesn't make sense (and shut up lintian)
+	;;
+ *)
+        exit 0
+        ;;
+esac
--- acpi-support-0.137.orig/debian/examples/config/Samsung Electronics.config	
+++ acpi-support-0.137/debian/examples/config/Samsung Electronics.config	
@@ -0,0 +1,5 @@
+case "$model" in
+		"NX05S"*)	
+		ACPI_SLEEP=true
+	;;
+esac 
--- acpi-support-0.137.orig/debian/examples/config/Dell Computer Corporation.config	
+++ acpi-support-0.137/debian/examples/config/Dell Computer Corporation.config	
@@ -0,0 +1 @@
+. "/usr/share/acpi-support/Dell Inc..config"
\ No newline at end of file
--- acpi-support-0.137.orig/debian/examples/config/FUJITSU.config
+++ acpi-support-0.137/debian/examples/config/FUJITSU.config
@@ -0,0 +1 @@
+. "/usr/share/acpi-support/FUJITSU SIEMENS.config"
\ No newline at end of file
--- acpi-support-0.137.orig/debian/examples/config/Dell Inc..config	
+++ acpi-support-0.137/debian/examples/config/Dell Inc..config	
@@ -0,0 +1,60 @@
+case "$model" in
+	"Inspiron 700m"*)
+		ACPI_SLEEP=true;
+	;;
+	"Inspiron 1200"*)
+		ACPI_SLEEP=true;
+	;;
+	"Inspiron 6000"*)
+		ACPI_SLEEP=true;
+	;;
+        "Inspiron 8100"*)
+                ACPI_SLEEP=true;
+        ;;
+        "Inspiron 8200"*)
+                ACPI_SLEEP=true;
+        ;;
+        "Inspiron 8600"*)
+                ACPI_SLEEP=true;
+		POST_VIDEO=false;
+        ;;
+	"Inspiron 9300"*)
+		ACPI_SLEEP=true;
+	;;
+	"Inspiron XPS Gen2"*)
+		ACPI_SLEEP=true;
+	;;
+	"Latitude 110L"*)
+		ACPI_SLEEP=true;
+	;;
+	"Latitude D410"*)
+		ACPI_SLEEP=true;
+	;;
+	"Latitude D505"*)
+		ACPI_SLEEP=true;
+	;;
+	"Latitude D510"*)
+		ACPI_SLEEP=true;
+	;;
+	"Latitude D600"*)
+		ACPI_SLEEP=true;
+	;;
+	"Latitude D610"*)
+		ACPI_SLEEP=true;
+	;;
+	"Latitude D800"*)
+		ACPI_SLEEP=true;
+	;;
+	"Latitude D810"*)
+		ACPI_SLEEP=true;
+	;;
+	"Latitude X1"*)
+		ACPI_SLEEP=true;
+	;;
+	"Latitude X300"*)
+		ACPI_SLEEP=true;
+	;;
+	"Precision M20"*)
+		ACPI_SLEEP=true;
+	;;
+esac 
--- acpi-support-0.137.orig/debian/examples/config/IBM.config
+++ acpi-support-0.137/debian/examples/config/IBM.config
@@ -0,0 +1,93 @@
+case "$model" in
+	# R40 
+	2681*|2682*|2683*|2892*|2893*|2896*|2898*|2899*)
+		ACPI_SLEEP=true;
+	;;
+	# More R40
+	2722*|2723*|2724*|2897*)
+		ACPI_SLEEP=true;
+	;;
+	# R50/p 
+	1829*|1830*|1831*|1832*|1833*|1836*|1840*|1841*)
+		ACPI_SLEEP=true;
+	;;
+	# R50e 1834 - see LP: #40621, #211285
+	1834*)
+		ACPI_SLEEP=true;
+		SAVE_VIDEO_PCI_STATE=true;
+		SAVE_VBE_STATE=true;
+		POST_VIDEO=true;
+        ;;
+	1842*|2670*)
+		ACPI_SLEEP=true;
+		SAVE_VIDEO_PCI_STATE=true;
+		SAVE_VBE_STATE=false;
+		POST_VIDEO=false;
+        ;;
+	# R52 
+	1846*|1847*|1848*|1849*|1850*|1858*|1870*)
+		ACPI_SLEEP=true;
+	;;
+	# T21
+	2647*|2648*)
+		ACPI_SLEEP=true;
+	;;
+	# T23 - seems to have a different format
+	475S*)
+		ACPI_SLEEP=true;
+	;;
+	# T40/T41/T42/p
+	2373*|2374*|2375*|2376*|2378*|2379*)
+		ACPI_SLEEP=true;
+	;;
+	# T43 
+	1871*|1872*|1873*|1874*|1875*|1876*)	
+		ACPI_SLEEP=true;
+	;;
+	#T43/p
+	2668*|2669*|2678*|2679*|2686*|2687*)
+		ACPI_SLEEP=true;
+	;;
+	# X30
+	2672*)
+		ACPI_SLEEP=true;
+		SAVE_VBE_STATE=false;
+		# Don't switch backlights off without extra help
+		RADEON_LIGHT=true;
+	;;
+	# more X30
+	2673*|2884*|2885*|2890*|2891*)
+		ACPI_SLEEP=true;
+		# Don't switch backlights off without extra help
+		RADEON_LIGHT=true;
+	;;
+	# X40
+	2369*|2370*|2371*|2372*|2382*|2386*)
+		ACPI_SLEEP=true;
+	;;
+	# X41
+	1864*|1865*|2525*|2526*|2527*|2528*)
+		ACPI_SLEEP=true;
+	;;
+	# X41 Tablet 
+	1866*|1867*|1869*)
+		ACPI_SLEEP=true;
+	;;
+	# X60s
+	1702*|1704*)
+		SAVE_VBE_STATE=false;
+	;;
+	# Z60m (Intel graphics) 'ThinkPad Z60m'
+	2529*)	
+		ACPI_SLEEP=true;
+	;;
+	# ThinkPad R40 with a product name of "_______" (yes, 7 blank spaces)
+	"")
+	case "$bios_version" in
+		# BIOS version for "ThinkPad R40 model 2722, 2723, 2724, 2897"
+		1PET53WW*)
+			ACPI_SLEEP=true
+		;;
+	esac
+	;;
+esac 
--- acpi-support-0.137.orig/debian/examples/config/Acer.config
+++ acpi-support-0.137/debian/examples/config/Acer.config
@@ -0,0 +1,11 @@
+case "$model" in
+	"Aspire 2000"*)
+		ACPI_SLEEP=true
+	;;
+	"TravelMate 290"*)
+		ACPI_SLEEP=true
+	;;
+	"TravelMate 660"*)
+		ACPI_SLEEP=true
+	;;
+esac 
--- acpi-support-0.137.orig/debian/examples/config/ASUSTeK Computer Inc..config	
+++ acpi-support-0.137/debian/examples/config/ASUSTeK Computer Inc..config	
@@ -0,0 +1,20 @@
+case "$model" in
+	"A5E"*)
+		ACPI_SLEEP=true
+	;;
+	"A6U"*)
+		ACPI_SLEEP=true
+	;;
+	"L7000G series Notebook PC"*) 
+		ACPI_SLEEP=true
+	;;
+	"L5Gx"*)
+		ACPI_SLEEP=true
+	;;
+	"M6Ne"*) 
+		ACPI_SLEEP=true
+	;;
+	"W5A"*) 
+		ACPI_SLEEP=true
+	;;
+esac 
--- acpi-support-0.137.orig/debian/examples/config/NEC Computers International.config	
+++ acpi-support-0.137/debian/examples/config/NEC Computers International.config	
@@ -0,0 +1,5 @@
+case "$version" in
+	"PB10M00402"*)
+		ACPI_SLEEP=true
+	;;
+esac 
--- acpi-support-0.137.orig/debian/examples/config/Hewlett-Packard.config
+++ acpi-support-0.137/debian/examples/config/Hewlett-Packard.config
@@ -0,0 +1,57 @@
+case "$model" in
+	"HP Compaq nc4200"*)
+		ACPI_SLEEP=true
+	;;
+	"HP Compaq nc6000"*)
+		ACPI_SLEEP=true
+	;;
+	"HP Compaq nx6110"*)
+		ACPI_SLEEP=true
+	;;
+	"HP Compaq nc6120"*)
+		ACPI_SLEEP=true
+	;;
+	"HP Compaq nx6125"*)
+		ACPI_SLEEP=true
+		POST_VIDEO=false
+	;;
+	"HP Compaq nc6220"*)
+		ACPI_SLEEP=true
+	;;
+	"HP Compaq nc6230"*)
+		ACPI_SLEEP=true
+	;;
+	"HP Compaq nx8220"*)
+		ACPI_SLEEP=true
+	;;
+	"HP Compaq nc8230"*)
+		ACPI_SLEEP=true
+	;;
+	"HP Compaq nx9040"*)
+		ACPI_SLEEP=true
+	;;
+	"HP Pavilion dv1000"*)
+		ACPI_SLEEP=true
+	;;
+	"HP Pavilion zt3000"*)
+		ACPI_SLEEP=true
+	;;
+	"HP Tablet PC Tx1100"*)
+		ACPI_SLEEP=true
+	;;
+	"HP Tablet PC TR1105"*)
+		ACPI_SLEEP=true
+	;;
+	"Pavilion dv4000"*)
+		ACPI_SLEEP=true
+	;;
+	"Pavilion zd7000"*)
+		ACPI_SLEEP=true
+	;;
+        "Pavilion zv6000"*)
+		ACPI_SLEEP=true
+	;;
+	"Presario 2200"*)
+		ACPI_SLEEP=true
+	;;
+esac 
--- acpi-support-0.137.orig/debian/examples/config/Compaq.config
+++ acpi-support-0.137/debian/examples/config/Compaq.config
@@ -0,0 +1,8 @@
+case "$model" in
+	"Armada    E500"*)
+		ACPI_SLEEP=true
+	;;
+        "Evo N600c"*)
+                ACPI_SLEEP=true
+        ;;
+esac 
--- acpi-support-0.137.orig/debian/examples/config/Sony Corporation.config	
+++ acpi-support-0.137/debian/examples/config/Sony Corporation.config	
@@ -0,0 +1,11 @@
+case "$model" in
+	"PCG-U101"*)
+		ACPI_SLEEP=true
+	;;
+        "VGN-FJ1S_W"*)
+                ACPI_SLEEP=true
+        ;;
+	"VGN-S260"*)
+		ACPI_SLEEP=true
+	;;
+esac 
--- acpi-support-0.137.orig/debian/examples/config/ECS.config
+++ acpi-support-0.137/debian/examples/config/ECS.config
@@ -0,0 +1,5 @@
+case "$model" in
+	"G556 Centrino"*)
+		ACPI_SLEEP=true
+	;;
+esac 
--- acpi-support-0.137.orig/debian/examples/config/Acer, inc..config	
+++ acpi-support-0.137/debian/examples/config/Acer, inc..config	
@@ -0,0 +1,14 @@
+case "$model" in
+	"Aspire 3000"*)
+		ACPI_SLEEP=true
+	;;
+	"Ferrari 4000"*)
+		ACPI_SLEEP=true
+	;;
+	"TravelMate 3260"*)
+		SAVE_VIDEO_PCI_STATE=true
+	;;
+	"TravelMate 8100"*)
+		ACPI_SLEEP=true
+	;;
+esac 
--- acpi-support-0.137.orig/debian/examples/config/TOSHIBA.config
+++ acpi-support-0.137/debian/examples/config/TOSHIBA.config
@@ -0,0 +1,35 @@
+case "$model" in
+	"libretto U100"*)
+		ACPI_SLEEP=true
+	;;
+	"P4000"*)
+		ACPI_SLEEP=true
+	;;
+	"PORTEGE A100"*)
+		ACPI_SLEEP=true
+	;;
+	"PORTEGE A200"*)
+		ACPI_SLEEP=true
+	;;
+	"PORTEGE M200"*)
+		ACPI_SLEEP=true
+	;;
+	"PORTEGE R200"*)
+		ACPI_SLEEP=true
+	;;
+	"Satellite 1900"*)
+		ACPI_SLEEP=true
+	;;
+	"Satellite M70"*)
+		ACPI_SLEEP=true
+	;;
+	"TECRA A2"*)
+		ACPI_SLEEP=true
+	;;
+	"TECRA A5"*)
+		ACPI_SLEEP=true
+	;;
+	"TECRA M2"*)
+		ACPI_SLEEP=true
+	;;
+esac 
--- acpi-support-0.137.orig/debian/examples/config/56548.config
+++ acpi-support-0.137/debian/examples/config/56548.config
@@ -0,0 +1,6 @@
+case "$model" in
+# The 'Uknown' below is *NOT* a typo
+	"Uknown"*)
+		ACPI_SLEEP=true
+	;;
+esac
--- acpi-support-0.137.orig/debian/examples/config/FUJITSU SIEMENS.config	
+++ acpi-support-0.137/debian/examples/config/FUJITSU SIEMENS.config	
@@ -0,0 +1,32 @@
+case "$model" in
+	"Amilo A7640"*)
+		ACPI_SLEEP=true
+	;;
+	"AMILO M"*)
+		ACPI_SLEEP=true
+	;;
+	"LIFEBOOK E4010"*)
+                ACPI_SLEEP=true
+		POST_VIDEO=false
+	;;		
+	"LifeBook S Series"*)
+		ACPI_SLEEP=true
+	;;
+	"LIFEBOOK S7020"*)
+ 		SAVE_VIDEO_PCI_STATE=true
+ 		ACPI_SLEEP=true
+ 	;;
+	"LIFEBOOK S7110"*|"LifeBook S7110"*)
+ 		SAVE_VIDEO_PCI_STATE=true
+ 		ACPI_SLEEP=true
+ 	;;
+	"LIFEBOOK S6120"*)
+		ACPI_SLEEP=true
+	;;
+	"LIFEBOOK C1110"*)
+		ACPI_SLEEP=true
+	;;
+	"LIFEBOOK P7010"*)
+		ACPI_SLEEP=true
+	;;
+esac 
--- acpi-support-0.137.orig/debian/examples/config/SHARP Corporation.config	
+++ acpi-support-0.137/debian/examples/config/SHARP Corporation.config	
@@ -0,0 +1,5 @@
+case "$model" in
+	"PC-MM20 Series"*)
+		ACPI_SLEEP=true
+	;;
+esac 
--- acpi-support-0.137.orig/debian/examples/default/acpi-support
+++ acpi-support-0.137/debian/examples/default/acpi-support
@@ -0,0 +1,154 @@
+#
+# Configuration file for the acpi-support package
+#
+#
+# The acpi-support package is intended as "glue" to make special functions of
+# laptops work. Specifically, it translates special function keys for some
+# laptop models into actions or generic function key presses.
+#
+
+
+#
+# Suspend/hibernate method
+# ------------------------
+#
+# When gnome-power-manager or klaptopdaemon are running, acpi-support will
+# translate the suspend and hibernate keys of laptops into special "suspend"
+# and "hibernate" keys that these daemons handle.
+#
+# Only in situations where there is no gnome-power-manager or klaptopdaemon
+# running, acpi-support needs to perform suspend/hibernate in some other way.
+# There are several options for this. The options are:
+#
+# dbus-pm:
+#    Perform suspend and hibernate actions via a DBUS request to the power
+#    management daemon. This works for power management daemons that we don't
+#    know of. (For gnome-power-manager and klaptopdaemon this will do nothing,
+#    since those will be detected when they are running, and triggered using
+#    a virtual keypress.)
+#
+# dbus-hal:
+#    Perform suspend and hibernate actions via a DBUS request directly to HAL,
+#    bypassing any running power management daemons.
+#
+# pm-utils:
+#    Use pm-suspend and pm-hibernate to suspend and hibernate. (The dbus method
+#    normally results in this as well, but calls through dbus. Use this option
+#    only if you don't have dbus installed.) This runs actions in the directory
+#    /usr/lib/pm-utils/sleep.d/.
+#
+# hibernate:
+#    Use the hibernate package to suspend and hibernate.
+#
+# acpi-support:
+#    Use the legacy built-in suspend/hibernate support. (DEPRECATED)
+#    This runs actions in the directory '/etc/acpi/suspend.d/' and
+#    '/etc/acpi/resume.d/'.
+# 
+# none:
+#    Do not attempt to suspend/hibernate. Set SUSPEND_METHODS="none" to
+#    disable suspend/hibernate handling in acpi-support.
+#
+# If you specify dbus or pm-utils, the result will normally be the same as when
+# you suspend from your desktop environment. If you specify "hibernate" or
+# "acpi-support", be aware that this probably does not match what your desktop
+# environment would do (unless you have managed to configure something so that
+# the DBUS power management interfaces call the hibernate package).
+# 
+# NOTE: none of the suspend/hibernate actions are invoked when a
+# laptop is put to sleep with 'acpitool -s'. If you do not use Gnome
+# or KDE and want the following suspend methods to be used, you
+# should run '/etc/acpi/sleep.sh' instead of using 'acpitool'.
+#
+# Please specify a space separated list of options. The recommended value is
+# "dbus pm-utils"
+#
+SUSPEND_METHODS="dbus-pm dbus-hal pm-utils"
+
+
+
+#
+# LEGACY BUILT IN SUSPEND SUPPORT (DEPRECATED)
+# --------------------------------------------
+#
+# These options only work for the "acpi-support" suspend method. This is NOT
+# recommended, but is retained for backward compatibility reasons.
+#
+
+# Comment the next line to disable ACPI suspend to RAM
+ACPI_SLEEP=true
+
+# Comment the next line to disable suspend to disk
+ACPI_HIBERNATE=true
+
+# Change the following to "standby" to use ACPI S1 sleep, rather than S3.
+# This will save less power, but may work on more machines
+ACPI_SLEEP_MODE=mem
+
+# Add modules to this list to have them removed before suspend and reloaded
+# on resume. An example would be MODULES="em8300 yenta_socket"
+#
+# Note that network cards and USB controllers will automatically be unloaded 
+# unless they're listed in MODULES_WHITELIST
+MODULES=""
+
+# Add modules to this list to leave them in the kernel over suspend/resume
+MODULES_WHITELIST=""
+
+# Should we save and restore state using the VESA BIOS Extensions?
+SAVE_VBE_STATE=true
+
+# The file that we use to save the vbestate
+VBESTATE=/var/lib/acpi-support/vbestate
+
+# Should we attempt to warm-boot the video hardware on resume?
+POST_VIDEO=true
+
+# Save and restore video state?
+# SAVE_VIDEO_PCI_STATE=true
+
+# Should we switch the screen off with DPMS on suspend?
+USE_DPMS=true
+
+# Use Radeontool to switch the screen off? Seems to be needed on some machines
+# RADEON_LIGHT=true
+
+# Uncomment the next line to switch away from X and back again after resume.
+# This is needed for some hardware, but should be unnecessary on most.
+# DOUBLE_CONSOLE_SWITCH=true
+
+# Set the following to "platform" if you want to use ACPI to shut down
+# your machine on hibernation
+HIBERNATE_MODE=shutdown
+
+# Comment this out to disable screen locking on resume
+LOCK_SCREEN=true
+
+# Uncomment this line to have DMA disabled before suspend and reenabled
+# afterwards
+# DISABLE_DMA=true
+
+# Uncomment this line to attempt to reset the drive on resume. This seems
+# to be needed for some Sonys
+# RESET_DRIVE=true
+
+# Add services to this list to stop them before suspend and restart them in 
+# the resume process.
+STOP_SERVICES=""
+
+# Restart Infra Red services on resume - off by default as it crashes some
+# machines
+RESTART_IRDA=false
+
+# Add to this list network interfaces that you don't want to be stopped
+# during suspend (in fact any network interface whose name starts with
+# a prefix given in this list is skipped)
+SKIP_INTERFACES="dummy qemu"
+
+# Note: to enable "laptop mode" (to spin down your hard drive for longer
+# periods of time), install the laptop-mode-tools package and configure
+# it in /etc/laptop-mode/laptop-mode.conf. 
+#
+# (Note to upgraders: earlier versions of the acpi-support package contained 
+# an option to enable/disable laptop mode. This option has never actually
+# worked, and for that reason it has been removed.)
--- acpi-support-0.137.orig/debian/examples/acpi/hibernate.sh
+++ acpi-support-0.137/debian/examples/acpi/hibernate.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+test -f /usr/share/acpi-support/state-funcs || exit 0
+
+/usr/share/acpi-support/suspendorhibernate hibernate
--- acpi-support-0.137.orig/debian/examples/acpi/power.sh
+++ acpi-support-0.137/debian/examples/acpi/power.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+test -f /usr/share/acpi-support/key-constants || exit 0
+
+. /etc/default/acpi-support
+. /usr/share/acpi-support/power-funcs
+
+if [ x$1 = xstop ] ; then
+  # When  stop, we go to the AC state regardless of the actual power state.
+  RUN_SCRIPT_DIR=/etc/acpi/ac.d
+
+  # However, if we have a stored power state, and that power state is already
+  # AC, then we don't need to do anything, and we exit immediately.
+  if [ -f "$POWERSTATE" ]; then
+    OLDSTATE=$(cat $POWERSTATE) 
+    if [ "$OLDSTATE" = "AC" ] ; then  
+      exit 0
+    fi
+  fi
+else
+  # Get the power state (AC/BATTERY) into STATE
+  getState;
+
+  # Compare the power state with a stored state and exit if the state is the
+  # same. If not, then store the power state for comparison the next time
+  # around.
+  checkStateChanged;
+
+  if [ "$STATE" = "BATTERY" ] ; then
+    RUN_SCRIPT_DIR=/etc/acpi/battery.d
+  else
+    RUN_SCRIPT_DIR=/etc/acpi/ac.d
+  fi
+fi
+
+for SCRIPT in $RUN_SCRIPT_DIR/*.sh; do
+    if [ -f $SCRIPT ] ; then
+	. $SCRIPT
+    fi
+done
+
--- acpi-support-0.137.orig/debian/examples/acpi/sleep.sh
+++ acpi-support-0.137/debian/examples/acpi/sleep.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# This script HANDLES the sleep button (does not TRANSLATE it). It is part
+# of the *suspend* side of acpi-support, not the special keys translation
+# side. If this script is called, it is assumed to be the result of a suspend
+# key press that can also be heard by other parts of the system. The only time
+# that it actually does something is when it is determined that no other parts
+# of the system are listening (this is what the CheckPolicy call does).
+
+test -f /usr/share/acpi-support/key-constants || exit 0
+
+. /usr/share/acpi-support/policy-funcs
+
+if [ `CheckPolicy` != 0 ]; then
+  # No power management daemons are running. Divert to our own implementation.
+  /usr/share/acpi-support/suspendorhibernate suspend
+fi
+
+
--- acpi-support-0.137.orig/debian/examples/acpi/resume.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+test -f /usr/share/acpi-support/key-constants || exit 0
+
+# Source from /etc/acpi/resume.d/
+for SCRIPT in /etc/acpi/resume.d/*.sh; do
+    if [ -x $SCRIPT ] ; then
+        . $SCRIPT
+    fi
+done
--- acpi-support-0.137.orig/debian/examples/acpi/prepare.sh
+++ acpi-support-0.137/debian/examples/acpi/prepare.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+test -f /usr/share/acpi-support/key-constants || exit 0
+
+for SCRIPT in /etc/acpi/suspend.d/*.sh; do
+    if [ -x $SCRIPT ] ; then
+	. $SCRIPT
+    fi
+done
--- acpi-support-0.137.orig/debian/examples/acpi/suspendorhibernate
+++ acpi-support-0.137/debian/examples/acpi/suspendorhibernate
@@ -0,0 +1,211 @@
+#!/bin/sh
+#
+# How we handle suspend/hibernate is a bit complicated:
+#
+# If gnome-power-manager or klaptopdaemon are running, we send a fake key
+# and that's it. The daemons may have policies that turn off suspend in
+# response to suspend keys etc., so we don't want to do anything ourselves.
+#
+# If not, we follow the SUSPEND_METHODS setting.
+#
+#
+# This script takes parameter "suspend" or "hibernate".
+#
+. /etc/default/acpi-support
+. /usr/share/acpi-support/power-funcs
+. /usr/share/acpi-support/device-funcs
+. /usr/share/acpi-support/policy-funcs
+. /usr/share/acpi-support/key-constants
+
+DeviceConfig;
+
+# The difference between suspend and hibernate
+if [ "$1" = "suspend" ] ; then
+	KEY=$KEY_SLEEP
+	HIBERNATE_CMD=/usr/sbin/hibernate-ram
+	PM_UTILS_CMD=/usr/sbin/pm-suspend
+	DBUS_METHOD=Suspend
+	DBUS_PARAMS="int32:0"
+elif [ "$1" = "hibernate" ] ; then
+	KEY=$KEY_SUSPEND
+	HIBERNATE_CMD=/usr/sbin/hibernate-disk
+	PM_UTILS_CMD=/usr/sbin/pm-hibernate
+	DBUS_METHOD=Hibernate
+	DBUS_PARAMS=
+else
+	echo "'Usage: '$0' (suspend|hibernate)'"
+fi
+
+
+#
+# Backward compatibility
+#
+
+# Backward compatibility for setting USE_HIBERNATE_PACKAGE
+if [ "$SUSPEND_METHODS" = "" ] &&
+   [ "$USE_HIBERNATE_PACKAGE" = "true" ] &&
+   [ -x "$HIBERNATE_CMD" ] ; then
+	SUSPEND_METHODS="hibernate"
+fi
+
+# Backward compatibility for setups before SUSPEND_METHODS existed.
+if [ "$SUSPEND_METHODS" = "" ] ; then
+	# Legacy configuration -- use the built-in legacy suspend support. We
+	# can NEVER change this explicitly, because it will break people's
+	# working suspend setups, especially ones that depend on custom scripts
+	# in /etc/acpi/suspend.d and /etc/acpi/resume.d.
+	SUSPEND_METHODS="acpi-support"
+fi
+
+#
+# Just in case ...
+#
+sync
+
+#
+# Try the SUSPEND_METHODS in order.
+#
+
+for METHOD in $SUSPEND_METHODS; do
+	case $METHOD in
+	none)
+		exit
+		;;
+		
+	dbus-pm)
+		if [ -x /usr/bin/dbus-send ] ; then
+			# Call the power management daemon (which, if it is
+			# running, we probably don't know about, since we send
+			# keys if we detect one running that we know of).
+			if /usr/bin/dbus-send --session \
+			  --dest=org.freedesktop.PowerManagement \
+			  --type=method_call \
+			  --print-reply \
+			  --reply-timeout=2000 \
+			  /org/freedesktop/PowerManagement \
+			  org.freedesktop.PowerManagement.$DBUS_METHOD ;
+			  then			  
+			  	# The other side exists, we have access to it,
+			  	# and it received the message. It may have
+			  	# failed (I tested this: if pm-suspend returns
+			  	# exit code 1, then the return code of dbus-send
+			  	# is still 0 and you get no errors), but that
+			  	# doesn't matter: the first method in the list
+			  	# that we can access is the one that has to do
+			  	# it.
+			  	exit
+			fi
+			# We got a DBUS error, which means that the other side
+			# does not exist or we don't have access to it. We
+			# continue by trying the next option.
+		fi
+		;;
+		
+	dbus-hal)
+		if [ -x /usr/bin/dbus-send ] ; then
+			# Call HAL directly.
+			if /usr/bin/dbus-send --system \
+			  --dest=org.freedesktop.Hal \
+			  --type=method_call \
+			  --print-reply \
+			  --reply-timeout=2000 \
+			  /org/freedesktop/Hal/devices/computer \
+			  org.freedesktop.Hal.Device.SystemPowerManagement.$DBUS_METHOD $DBUS_PARAMS ;
+			  then			  
+			  	# The other side exists, we have access to it,
+			  	# and it received the message. It may have
+			  	# failed (I tested this: if pm-suspend returns
+			  	# exit code 1, then the return code of dbus-send
+			  	# is still 0 and you get no errors), but that
+			  	# doesn't matter: the first method in the list
+			  	# that we can access is the one that has to do
+			  	# it.
+			  	exit
+			fi
+			# We got a DBUS error, which means that the other side
+			# does not exist or we don't have access to it. We
+			# continue by trying the next option.
+		fi
+		;;
+		
+	pm-utils)
+		if [ -x $PM_UTILS_CMD ] ; then
+			$PM_UTILS_CMD
+			exit
+		fi
+		;;
+		
+	hibernate)
+		if [ -x $HIBERNATE_CMD ] ; then
+			$HIBERNATE_CMD
+			exit		
+		fi
+		;;
+		
+	acpi-support)
+		if [ "$1" = "hibernate" ] ; then
+			if [ x$ACPI_HIBERNATE != xtrue ]; then
+			  exit;
+			fi
+					
+			# Unset video posting - it's not needed for suspend to disk
+			unset POST_VIDEO
+			unset USE_DPMS
+
+			. /etc/acpi/prepare.sh
+
+			echo -n $HIBERNATE_MODE >/sys/power/disk
+
+			if [ -x /usr/sbin/s2disk ]; then
+			    /usr/sbin/s2disk
+			else
+			    echo -n "disk" >/sys/power/state
+			fi
+
+			. /etc/acpi/resume.sh
+		else	# $1 = suspend			
+			if [ x$ACPI_SLEEP != xtrue ]; then
+			  exit;
+			fi
+
+			if [ x$LOCK_SCREEN = xtrue ]; then
+			    if pidof xscreensaver > /dev/null; then 
+				for x in /tmp/.X11-unix/*; do
+				    displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
+				    getXuser;
+				    if [ x"$XAUTHORITY" != x"" ]; then	    
+					export DISPLAY=":$displaynum"
+					. /usr/share/acpi-support/screenblank
+				    fi
+				done
+			    fi
+			fi
+
+			# Generic preparation code
+			. /etc/acpi/prepare.sh
+
+			if [ x$DISABLE_DMA = xtrue ] && [ -b /dev/hda ]; then
+			  hdparm -d 0 /dev/hda
+			fi
+
+			echo -n $ACPI_SLEEP_MODE >/sys/power/state
+
+			if [ x$RESET_DRIVE = xtrue ] && [ -b /dev/hda ]; then
+			    hdparm -w /dev/hda
+			    hdparm -C /dev/hda
+			    hdparm -C /dev/hda
+			    hdparm -C /dev/hda
+			    hdparm -d 1 /dev/hda
+			fi
+
+			if [ x$DISABLE_DMA = xtrue ] && [ -b /dev/hda ]; then
+			  hdparm -d 1 /dev/hda
+			fi
+
+			# Generic wakeup code
+			. /etc/acpi/resume.sh	
+		fi	
+		exit
+		;;
+	esac
+done
--- acpi-support-0.137.orig/debian/examples/acpi/start.d/90-hdparm.sh
+++ acpi-support-0.137/debian/examples/acpi/start.d/90-hdparm.sh
@@ -0,0 +1,41 @@
+#! /bin/sh
+#
+# This script adjusts hard drive APM settings using hdparm. The hardware
+# defaults (usually hdparm -B 128) cause excessive head load/unload cycles
+# on many modern hard drives. We therefore set hdparm -B 254 while on AC
+# power. On battery we set hdparm -B 128, because the head parking is
+# very useful for shock protection.
+#
+
+. /usr/share/acpi-support/power-funcs
+
+DO_HDPARM=y
+if [ -e /usr/sbin/laptop_mode ] ; then 
+  LMT_CONTROL_HD_POWERMGMT=$(. /etc/laptop-mode/laptop-mode.conf && echo "$CONTROL_HD_POWERMGMT")
+  if [ "$LMT_CONTROL_HD_POWERMGMT" != 0 ] \
+     && [ -e /var/run/laptop-mode-tools/enabled ]
+  then
+    # Laptop mode controls hdparm -B settings, we don't.
+    DO_HDPARM=n
+  fi
+fi
+
+if [ "$DO_HDPARM" = y ] ; then
+  # Get the power state into STATE
+  getState;
+  
+  for dev in /dev/sd? /dev/hd? ; do
+    if [ -b $dev ] ; then
+      # Check for APM support; discard errors since not all drives
+      # support HDIO_GET_IDENTITY (-i).    
+      if hdparm -i $dev 2> /dev/null | grep -q 'AdvancedPM=yes' ; then
+	if [ "$STATE" = "BATTERY" ] ; then
+	  hdparm -B 128 $dev
+	else
+	  hdparm -B 254 $dev
+	fi
+      fi
+    fi
+  done
+fi
+
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/15-video-post.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/15-video-post.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+# Post the video card
+if [ x$POST_VIDEO = xtrue ]; then
+  vbetool post
+fi
+
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/98-acpi-unlock.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/98-acpi-unlock.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+#Let acpid process events again
+(sleep 10 && rm /var/lock/acpisleep)&
+
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/40-infra-red.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/40-infra-red.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Restart IR if necessary
+if [ -f /var/run/irdadev ] && [ x$RESTART_IRDA = xtrue ]; then
+    rm /var/run/irdadev;
+    /etc/init.d/irda-setup start;
+    /etc/init.d/irda-utils start;
+fi;
+
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/50-framebuffer-enable.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/50-framebuffer-enable.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# And turn the framebuffer back on
+for x in /sys/class/graphics/*; do
+    if [ -f $x/state ]; then
+        echo -n 0 >$x/state;
+    fi
+done
+
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/89-asus-restore-brightness.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/89-asus-restore-brightness.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Fix for dark password prompt after a resume on some ASUS laptops
+# from https://bugs.launchpad.net/system76/+bug/114675/
+
+if [ -r /proc/acpi/asus/brn ] ; then
+	brtNum=`cat /proc/acpi/asus/brn`
+	echo $brtNum > /proc/acpi/asus/brn
+fi
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/62-ifup.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/62-ifup.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Bring up the interfaces. This should probably be left up to some policy
+# manager, but at the moment we just bring back all the ifupdown-managed
+# interfaces that were up at suspend time.
+for x in $IFUP_INTERFACES; do
+    if must_control_interface $x ; then
+        ifup $x &
+    fi
+done
+
+# Wake up NetworkManager
+dbus-send --system --dest=org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.NetworkManager.wake
+
+# Kick ifplugd to check its interfaces. (Not sure if this is necessary, but it
+# can't hurt either.)
+invoke-rc.d --quiet ifplugd restart
+
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/13-855-resolution-set.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/13-855-resolution-set.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+if [ -x /usr/sbin/855resolution ]; then
+    . /etc/default/855resolution
+    if [ "$MODE" != "" ] && [ "$XRESO" != "" ] && [ "$YRESO" != "" ]; then
+	/etc/init.d/855resolution start;
+    fi
+fi
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/95-laptop-mode.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/95-laptop-mode.sh
@@ -0,0 +1,5 @@
+#! /bin/sh
+
+if [ -e /etc/init.d/laptop-mode ] ; then
+	invoke-rc.d laptop-mode restart
+fi
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/90-thinkpad-unstandby-led.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/90-thinkpad-unstandby-led.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+. /usr/share/acpi-support/state-funcs
+setLEDThinkpadSuspending 0
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/90-hdparm.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/90-hdparm.sh
@@ -0,0 +1,41 @@
+#! /bin/sh
+#
+# This script adjusts hard drive APM settings using hdparm. The hardware
+# defaults (usually hdparm -B 128) cause excessive head load/unload cycles
+# on many modern hard drives. We therefore set hdparm -B 254 while on AC
+# power. On battery we set hdparm -B 128, because the head parking is
+# very useful for shock protection.
+#
+
+. /usr/share/acpi-support/power-funcs
+
+DO_HDPARM=y
+if [ -e /usr/sbin/laptop_mode ] ; then 
+  LMT_CONTROL_HD_POWERMGMT=$(. /etc/laptop-mode/laptop-mode.conf && echo "$CONTROL_HD_POWERMGMT")
+  if [ "$LMT_CONTROL_HD_POWERMGMT" != 0 ] \
+     && [ -e /var/run/laptop-mode-tools/enabled ]
+  then
+    # Laptop mode controls hdparm -B settings, we don't.
+    DO_HDPARM=n
+  fi
+fi
+
+if [ "$DO_HDPARM" = y ] ; then
+  # Get the power state into STATE
+  getState;
+  
+  for dev in /dev/sd? /dev/hd? ; do
+    if [ -b $dev ] ; then
+      # Check for APM support; discard errors since not all drives
+      # support HDIO_GET_IDENTITY (-i).    
+      if hdparm -i $dev 2> /dev/null | grep -q 'AdvancedPM=yes' ; then
+	if [ "$STATE" = "BATTERY" ] ; then
+	  hdparm -B 128 $dev
+	else
+	  hdparm -B 254 $dev
+	fi
+      fi
+    fi
+  done
+fi
+
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/60-asus-wireless-led.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/60-asus-wireless-led.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+. /usr/share/acpi-support/state-funcs
+if isAnyWirelessPoweredOn ; then
+    setLEDAsusWireless 1
+else
+    setLEDAsusWireless 0
+fi
+
+  
\ No newline at end of file
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/90-xscreensaver.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/90-xscreensaver.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# now, we should poke xscreensaver so you get a dialog
+if pidof xscreensaver > /dev/null; then 
+    for x in /tmp/.X11-unix/*; do
+	displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
+	getXuser;
+	if [ x"$XAUTHORITY" != x"" ]; then
+	    export DISPLAY=":$displaynum"
+	    su $user -c "(xscreensaver-command -deactivate)"
+	fi
+    done
+fi
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/65-console.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/65-console.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Some hardware needs another X/console switch in order to bring stuff back
+chvt $CONSOLE;
+if [ x$DOUBLE_CONSOLE_SWITCH = xtrue ]; then
+  chvt 12;
+  chvt $CONSOLE;
+fi
+
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/17-video-restore.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/17-video-restore.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Attempt to restore some video card state
+if [ x$SAVE_VBE_STATE = xtrue ]; then
+  vbetool vbestate restore <$VBESTATE
+  if [ $VBEMODE != "3" ]; then
+    vbetool vbemode set $VBEMODE;
+  else
+    vbetool vgamode set 3;
+  fi
+fi
+
+
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/67-sound.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/67-sound.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# Get sound back
+if [ -x /etc/init.d/alsa-utils ]; then
+        if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
+                invoke-rc.d alsa-utils start
+        else
+		/etc/init.d/alsa-utils start
+        fi
+fi
+
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/72-acpi-pain.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/72-acpi-pain.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# Some hardware gets unhappy about button events unless we do this
+modprobe -r button
+modprobe button
+
+# Kick the fans
+modprobe -r fan
+modprobe -r thermal
+modprobe fan
+modprobe thermal
+
+if [ "`grep thinkpad_acpi /proc/modules`" ]; then
+    # No, I don't know why
+    modprobe -r thinkpad_acpi
+    modprobe thinkpad_acpi
+fi
+
+# NNGH FAN HATE
+for x in /proc/acpi/fan/*; do
+    if [ -f "$x/state" ] && [ "`grep on $x/state`" ]; then
+        echo -n 3 > $x/state;
+        echo -n 0 > $x/state;
+    fi
+done
+
+# Make sure that the drive power state is set correctly again
+modprobe -r sbs
+modprobe -r ac
+modprobe ac
+modprobe -r battery
+modprobe battery
+modprobe sbs
+/etc/acpi/power.sh
+
+# Force monitoring processes to reopen their /proc/acpi files after modules
+# have been replaced.
+killall -s HUP ksysguardd
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/11-video-pci-restore.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/11-video-pci-restore.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# Restore video PCI state
+if [ x$SAVE_VIDEO_PCI_STATE = xtrue ]; then
+  for x in /sys/bus/pci/devices/*; do
+    if [ -f /var/run/vga-pci-`basename $x` ]; then
+        cat /var/run/vga-pci-`basename $x` >$x/config;
+    fi
+  done
+fi
+
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/50-tosh-restore-brightness.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/50-tosh-restore-brightness.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+if [ "x$TOSH_BRIGHTNESS" != "x" ]; then
+  # To reset the brightness...
+  echo 'brightness : '$TOSH_MAXBRIGHT > $TOSH_LCD
+  echo 'brightness : 0' > $TOSH_LCD
+  # And then restore it...
+  echo 'brightness : '$TOSH_BRIGHTNESS > $TOSH_LCD
+  unset TOSH_BRIGHTNESS TOSH_MAXBRIGHT
+fi
+
+unset TOSH_LCD
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/55-screen.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/55-screen.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+# And make sure that the screen is on
+if [ x$USE_DPMS = xtrue ]; then
+  vbetool dpms on
+fi
+
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/69-services.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/69-services.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+# we need to restart our services after the network is back
+for x in $STOP_SERVICES; do
+        invoke-rc.d --quiet $x start
+done
+
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/10-thinkpad-standby-led.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/10-thinkpad-standby-led.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+. /usr/share/acpi-support/state-funcs
+setLEDThinkpadSuspending 1
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/58-proc-sysfs-restore-state.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/58-proc-sysfs-restore-state.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Paul Sladen 2007-03-22
+# Restore saved /sys and /proc states following resume.
+# See suspend.d/??-proc-sysfs-restore-state.sh for details.
+
+if [ -r /var/run/proc-sysfs-save-state ] ; then
+    while read WHERE foo WHAT ; do
+	if [ "x$foo" = "x=" -a -w "$WHERE" ] ; then
+	    echo -n "$WHAT" > "$WHERE"
+	fi
+    done < /var/run/proc-sysfs-save-state
+fi
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/35-modules-load.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/35-modules-load.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# Increase the firmware loading timeout while we're doing this
+# Otherwise, swap thrash tends to lead to failure to start
+if [ -f /sys/class/firmware/timeout ]; then
+    timeout=`cat /sys/class/firmware/timeout`
+    echo 100 >/sys/class/firmware/timeout
+fi
+
+# Load any drivers that we removed
+for x in $MODULES; do
+    modprobe $x;
+done
+
+# And reset the firmware timeout
+if [ -f /sys/class/firmware/timeout ]; then
+    echo $timeout >/sys/class/firmware/timeout
+fi
+
+# And bring back PCMCIA code
+[ -x /sbin/pccardctl ] && pccardctl insert
--- acpi-support-0.137.orig/debian/examples/acpi/resume.d/49-855-resolution-set.sh
+++ acpi-support-0.137/debian/examples/acpi/resume.d/49-855-resolution-set.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+if [ -x /usr/sbin/855resolution ]; then
+    . /etc/default/855resolution
+    if [ "$MODE" != "" ] && [ "$XRESO" != "" ] && [ "$YRESO" != "" ]; then
+	/etc/init.d/855resolution start;
+    fi
+fi
--- acpi-support-0.137.orig/debian/examples/acpi/ac.d/90-hdparm.sh
+++ acpi-support-0.137/debian/examples/acpi/ac.d/90-hdparm.sh
@@ -0,0 +1,41 @@
+#! /bin/sh
+#
+# This script adjusts hard drive APM settings using hdparm. The hardware
+# defaults (usually hdparm -B 128) cause excessive head load/unload cycles
+# on many modern hard drives. We therefore set hdparm -B 254 while on AC
+# power. On battery we set hdparm -B 128, because the head parking is
+# very useful for shock protection.
+#
+
+. /usr/share/acpi-support/power-funcs
+
+DO_HDPARM=y
+if [ -e /usr/sbin/laptop_mode ] ; then 
+  LMT_CONTROL_HD_POWERMGMT=$(. /etc/laptop-mode/laptop-mode.conf && echo "$CONTROL_HD_POWERMGMT")
+  if [ "$LMT_CONTROL_HD_POWERMGMT" != 0 ] \
+     && [ -e /var/run/laptop-mode-tools/enabled ]
+  then
+    # Laptop mode controls hdparm -B settings, we don't.
+    DO_HDPARM=n
+  fi
+fi
+
+if [ "$DO_HDPARM" = y ] ; then
+  # Get the power state into STATE
+  getState;
+  
+  for dev in /dev/sd? /dev/hd? ; do
+    if [ -b $dev ] ; then
+      # Check for APM support; discard errors since not all drives
+      # support HDIO_GET_IDENTITY (-i).    
+      if hdparm -i $dev 2> /dev/null | grep -q 'AdvancedPM=yes' ; then
+	if [ "$STATE" = "BATTERY" ] ; then
+	  hdparm -B 128 $dev
+	else
+	  hdparm -B 254 $dev
+	fi
+      fi
+    fi
+  done
+fi
+
--- acpi-support-0.137.orig/debian/examples/acpi/suspend.d/50-tosh-save-brightness.sh
+++ acpi-support-0.137/debian/examples/acpi/suspend.d/50-tosh-save-brightness.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+TOSH_LCD=/proc/acpi/toshiba/lcd
+
+if [ -e $TOSH_LCD ]; then
+  TOSH_BRIGHTNESS=$(( `grep brightness: $TOSH_LCD | cut -d: -f2` + 0 ))
+  TOSH_MAXBRIGHT=$(( `grep brightness_levels: $TOSH_LCD | cut -d: -f2` - 1))
+  # Turn brightness to max to make bios password prompt easier to see
+  echo 'brightness : '$TOSH_MAXBRIGHT > $TOSH_LCD
+fi
+
--- acpi-support-0.137.orig/debian/examples/acpi/suspend.d/75-console-switch.sh
+++ acpi-support-0.137/debian/examples/acpi/suspend.d/75-console-switch.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# And remember which console we're on
+CONSOLE=`fgconsole`
+
+# Change away from X, otherwise it'll blow up when we POST the video interface
+chvt 12
+
--- acpi-support-0.137.orig/debian/examples/acpi/suspend.d/81-video-pci-state.sh
+++ acpi-support-0.137/debian/examples/acpi/suspend.d/81-video-pci-state.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# Save video PCI state?
+if [ x$SAVE_VIDEO_PCI_STATE = xtrue ]; then
+  for x in /sys/bus/pci/devices/*; do
+    if [ `cat $x/class` = "0x030000" ]; then
+        cat $x/config >/var/run/vga-pci-`basename $x`;
+    fi
+  done
+fi
+
--- acpi-support-0.137.orig/debian/examples/acpi/suspend.d/50-irda-stop.sh
+++ acpi-support-0.137/debian/examples/acpi/suspend.d/50-irda-stop.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# Stop IRDA if it's running
+if [ -f /var/run/irattach.pid ]; then
+    if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
+	invoke-rc.d irda-utils stop
+    else
+	/etc/init.d/irda-utils stop
+    fi
+    killall -9 irattach
+fi
+
--- acpi-support-0.137.orig/debian/examples/acpi/suspend.d/30-proc-sysfs-save-state.sh
+++ acpi-support-0.137/debian/examples/acpi/suspend.d/30-proc-sysfs-save-state.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+# Paul Sladen 2007-03-22
+# Save the state of various things that the kernel does not, or cannot
+# maintain over the course of a suspend/resume or suspend/hibernate
+# cycle.  Lines are written into '/var/run/proc-sysfs-save-state' in
+# the format:
+# /sys/foo/bar/moo = XYZ
+
+if [ -d /var/run -a -w /var/run ] ; then
+    ( 
+	for i in /sys/class/net/*/device/rf_kill /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor ; do
+	    if [ -r "$i" ] ; then
+		echo -n "$i = " ; cat "$i"
+	    fi
+	done
+
+	i=/proc/acpi/ibm/bluetooth
+	if [ -r $i ] ; then
+	    echo -n "$i = "
+	    grep -q disabled /proc/acpi/ibm/bluetooth && echo disable || echo enable
+	fi
+    ) > /var/run/proc-sysfs-save-state
+fi
+
--- acpi-support-0.137.orig/debian/examples/acpi/suspend.d/90-framebuffer-stop.sh
+++ acpi-support-0.137/debian/examples/acpi/suspend.d/90-framebuffer-stop.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# Make sure the backlight goes off
+if [ x$USE_DPMS = "xtrue" ]; then
+  vbetool dpms off
+fi
+
+# SHUT UP FRAMEBUFFER
+for x in /sys/class/graphics/*; do
+    if [ -f $x/state ]; then
+        echo -n 1 >$x/state;
+    fi
+done
+
--- acpi-support-0.137.orig/debian/examples/acpi/suspend.d/70-modules-unload.sh
+++ acpi-support-0.137/debian/examples/acpi/suspend.d/70-modules-unload.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# Some modules survive better if they're left loaded
+for x in $MODULES_WHITELIST; do
+        MODULES=`echo $MODULES | sed s/$x//g`;
+done
+
+# Now remove various modules that might misbehave while suspending
+for x in $MODULES; do
+    modprobe -r $x 2>/dev/null;
+done
+
--- acpi-support-0.137.orig/debian/examples/acpi/suspend.d/80-video-vesa-state.sh
+++ acpi-support-0.137/debian/examples/acpi/suspend.d/80-video-vesa-state.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+if [ x$SAVE_VBE_STATE = "xtrue" ]; then
+  # Check if we're in a VESA mode - if so, we need to do things more
+  # awkwardly. Otherwise, just use the state from boot.
+  VBEMODE=$(vbetool vbemode get || echo FAILED);
+  if ( echo "$VBEMODE" | grep -q FAILED ); then
+ 	echo "vbetool returned an error while requesting the vbe mode."
+  else
+    if [ "$VBEMODE" != "3" ]; then
+      vbetool vbemode set 3;
+      vbetool vbestate save >$VBESTATE;
+    fi
+  fi
+fi
+
--- acpi-support-0.137.orig/debian/examples/acpi/suspend.d/01-laptop-mode.sh
+++ acpi-support-0.137/debian/examples/acpi/suspend.d/01-laptop-mode.sh
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+# There have been reports of non-working suspend if laptop mode was enabled
+# during suspend. See for example Debian BTS #458437.
+if [ -e /etc/init.d/laptop-mode ] ; then
+	invoke-rc.d laptop-mode stop 
+fi
--- acpi-support-0.137.orig/debian/examples/acpi/suspend.d/10-thinkpad-standby-led.sh
+++ acpi-support-0.137/debian/examples/acpi/suspend.d/10-thinkpad-standby-led.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+. /usr/share/acpi-support/state-funcs
+setLEDThinkpadSuspending 1
--- acpi-support-0.137.orig/debian/examples/acpi/suspend.d/60-generate-modules-list.sh
+++ acpi-support-0.137/debian/examples/acpi/suspend.d/60-generate-modules-list.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+for x in /sys/module/*_ircc /sys/module/*_ircc2; do
+    x=`basename $x`
+    # nsc_ircc is safe over suspend/resume
+    if [ $x != "nsc_ircc" ]; then
+	modprobe -r $x 2>/dev/null;
+	# These don't get added to the reload list, since irda startup will
+ 	# do that
+    fi
+done
+
+if [ -d /sys/module/ndiswrapper ]; then
+        modprobe -r ndiswrapper
+        MODULES="$MODULES ndiswrapper"
+fi
+
+# This is not guaranteed to work - several drivers appear to use names that
+# are not the same as their module name
+for x in /sys/class/net/*; do
+    if [ -e $x/device/driver ]
+        then
+        MODULES="$MODULES $(basename $(readlink $x/device/driver) | tr [:upper:\] [:lower:])"
+    fi
+done
+
+if [ -d /sys/module/netconsole ]; then
+    rmmod netconsole
+    MODULES="$MODULES netconsole"
+fi
--- acpi-support-0.137.orig/debian/examples/acpi/suspend.d/65-services-stop.sh
+++ acpi-support-0.137/debian/examples/acpi/suspend.d/65-services-stop.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+# Shut down services known to misbehave
+for x in $STOP_SERVICES; do
+        invoke-rc.d --quiet $x stop
+done
+
--- acpi-support-0.137.orig/debian/examples/acpi/suspend.d/85-alsa-state.sh
+++ acpi-support-0.137/debian/examples/acpi/suspend.d/85-alsa-state.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# Save the ALSA state
+if [ -x /etc/init.d/alsa-utils ]; then
+        if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
+                invoke-rc.d alsa-utils stop
+        else
+		/etc/init.d/alsa-utils stop
+        fi
+fi
+
--- acpi-support-0.137.orig/debian/examples/acpi/suspend.d/05-acpi-lock.sh
+++ acpi-support-0.137/debian/examples/acpi/suspend.d/05-acpi-lock.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+#prevent acpid from processing any following events
+touch /var/lock/acpisleep
+
--- acpi-support-0.137.orig/debian/examples/acpi/suspend.d/55-down-interfaces.sh
+++ acpi-support-0.137/debian/examples/acpi/suspend.d/55-down-interfaces.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+pccardctl eject
+
+# Get rid of any currently running dhclients
+killall dhclient dhclient3 2>/dev/null
+
+# First do all network interfaces that were brought up by ifupdown. These are
+# the only interfaces that we bring up on resume (the other ones are probably
+# managed by other tools, such as NetworkManager, and will be brought up
+# automatically). Due to logical interfaces, the interfaces that we pass to
+# ifdown are DIFFERENT than those that we pass to ifup, see Debian BTS #475002.
+IFDOWN_INTERFACES="`cat /var/run/network/ifstate | sed 's/=.*//'`"
+IFUP_INTERFACES="`cat /var/run/network/ifstate`"
+
+must_control_interface()
+{
+  # Always skip lo
+  test "$1" = "lo" && return 1
+  for i in $SKIP_INTERFACES; do
+      # Skip if listed in $SKIP_INTERFACES
+      echo "$1" | grep -q "^$i" && return 1
+  done
+  return 0
+}
+
+
+# Shut down the interfaces (except lo, which can and should be kept up)
+for x in $IFDOWN_INTERFACES; do
+    if must_control_interface $x ; then
+ 	if [ -x /sbin/wpa_action ] && wpa_action $x check; then
+	 	# Ugly workaround for the fact that wpasupplicant does not hook
+	 	# into ifdown itself. See Debian BTS #473184, #390884.
+ 		wpa_action $x stop
+ 	else
+ 		ifdown $x
+ 	fi
+    fi
+done
+
+# Tell NetworkManager to shut down networking
+dbus-send --system --dest=org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.NetworkManager.sleep
+
+# Find the remaining running network interfaces...
+INTERFACES=`/sbin/ifconfig | awk '/^[^ ]+/ {print $1}'`
+
+# And shut them down (except lo, which can and should be kept up)
+for x in $INTERFACES; do
+    if must_control_interface $x ; then
+      ifconfig $x down
+    fi
+done
+
--- acpi-support-0.137.orig/debian/examples/acpi/battery.d/90-hdparm.sh
+++ acpi-support-0.137/debian/examples/acpi/battery.d/90-hdparm.sh
@@ -0,0 +1,41 @@
+#! /bin/sh
+#
+# This script adjusts hard drive APM settings using hdparm. The hardware
+# defaults (usually hdparm -B 128) cause excessive head load/unload cycles
+# on many modern hard drives. We therefore set hdparm -B 254 while on AC
+# power. On battery we set hdparm -B 128, because the head parking is
+# very useful for shock protection.
+#
+
+. /usr/share/acpi-support/power-funcs
+
+DO_HDPARM=y
+if [ -e /usr/sbin/laptop_mode ] ; then 
+  LMT_CONTROL_HD_POWERMGMT=$(. /etc/laptop-mode/laptop-mode.conf && echo "$CONTROL_HD_POWERMGMT")
+  if [ "$LMT_CONTROL_HD_POWERMGMT" != 0 ] \
+     && [ -e /var/run/laptop-mode-tools/enabled ]
+  then
+    # Laptop mode controls hdparm -B settings, we don't.
+    DO_HDPARM=n
+  fi
+fi
+
+if [ "$DO_HDPARM" = y ] ; then
+  # Get the power state into STATE
+  getState;
+  
+  for dev in /dev/sd? /dev/hd? ; do
+    if [ -b $dev ] ; then
+      # Check for APM support; discard errors since not all drives
+      # support HDIO_GET_IDENTITY (-i).    
+      if hdparm -i $dev 2> /dev/null | grep -q 'AdvancedPM=yes' ; then
+	if [ "$STATE" = "BATTERY" ] ; then
+	  hdparm -B 128 $dev
+	else
+	  hdparm -B 254 $dev
+	fi
+      fi
+    fi
+  done
+fi
+
--- acpi-support-0.137.orig/debian/patches/hibernate.sh.diff
+++ acpi-support-0.137/debian/patches/hibernate.sh.diff
@@ -0,0 +1,10 @@
+diff -ruN acpi-support.orig/hibernate.sh acpi-support/hibernate.sh
+--- acpi-support.orig/hibernate.sh	2009-11-22 12:25:44.000000000 +0100
++++ acpi-support/hibernate.sh	2009-11-22 12:26:19.000000000 +0100
+@@ -1,5 +1,4 @@
+-#!/bin/bash
+-# TODO:  Above should be /bin/sh
++#!/bin/sh
+ 
+ test -f /usr/share/acpi-support/state-funcs || exit 0
+ 
--- acpi-support-0.137.orig/debian/patches/background.diff
+++ acpi-support-0.137/debian/patches/background.diff
@@ -0,0 +1,29 @@
+--- acpi-support/lib/screenblank
++++ acpi-support/lib/screenblank
+@@ -1,7 +1,7 @@
+ if [ `pidof xscreensaver` ]; then
+-	su $user -s /bin/sh -c "(xscreensaver-command -throttle)"
++	su $user -s /bin/sh -c "(xscreensaver-command -throttle&)"
+ 		if [ x$LOCK_SCREEN = xtrue ]; then	
+-		su $user -s /bin/sh -c "(xscreensaver-command -lock)"
++		su $user -s /bin/sh -c "(xscreensaver-command -lock&)"
+ 	fi
+ elif [ `pidof dcopserver` ]; then
+ 	if [ x$LOCK_SCREEN = xtrue ]; then
+@@ -16,13 +16,13 @@ fi
+ 
+ case "$DISPLAY_DPMS" in
+   xset)
+-su $user -s /bin/sh -c "xset dpms force off"
++su $user -s /bin/sh -c "xset dpms force off&"
+ 	;;
+   xrandr)
+-	su $user -s /bin/sh -c "xrandr --output LVDS --off"
++	su $user -s /bin/sh -c "xrandr --output LVDS --off&"
+ 	;;
+   vbetool)
+-	/usr/sbin/vbetool dpms off
++	/usr/sbin/vbetool dpms off &
+ 	;;
+ esac
+ 
--- acpi-support-0.137.orig/debian/patches/screenblank.diff
+++ acpi-support-0.137/debian/patches/screenblank.diff
@@ -0,0 +1,18 @@
+--- acpi-support-0.122.orig/lib/screenblank
++++ acpi-support-0.122/lib/screenblank
+@@ -4,7 +4,14 @@
+ 		su $user -c "(xscreensaver-command -lock)"
+ 	fi
+ elif [ `pidof dcopserver` ]; then
+-	dcop kdesktop KScreensaverIface lock
++	if [ x$LOCK_SCREEN = xtrue ]; then
++		avail_sessions=`dcop --all-users --list-sessions | grep '.DCOP.*__0'`
++    		# send the lock command to all sessions
++    		for session in $avail_sessions; do
++		    	# /dev/null because dcop warns if it can't connect to X (this is normal!)
++		    	dcop --session "$session" --all-users kdesktop KScreensaverIface lock > /dev/null 2>&1
++    		done
++	fi
+ fi
+ 
+ xset dpms force off
--- acpi-support-0.137.orig/debian/patches/lid-sleep.diff
+++ acpi-support-0.137/debian/patches/lid-sleep.diff
@@ -0,0 +1,15 @@
+Index: acpi-support-0.137/lid.sh
+===================================================================
+--- acpi-support-0.137.orig/lid.sh	2010-08-05 19:55:35.031725187 +0200
++++ acpi-support-0.137/lid.sh	2010-08-05 19:56:01.980727213 +0200
+@@ -13,6 +13,10 @@
+ grep -q closed /proc/acpi/button/lid/*/state
+ if [ $? = 0 ]
+ then
++    if [ x$LID_SLEEP = xtrue ]; then
++        [ -x /etc/acpi/sleep.sh ] && /etc/acpi/sleep.sh
++        exit
++    fi
+     for x in /tmp/.X11-unix/*; do
+ 	displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
+ 	getXuser;
--- acpi-support-0.137.orig/debian/patches/asus-touchpad.sh-led.diff
+++ acpi-support-0.137/debian/patches/asus-touchpad.sh-led.diff
@@ -0,0 +1,15 @@
+--- acpi-support-0.133.orig/asus-touchpad.sh
++++ acpi-support-0.133/asus-touchpad.sh
+@@ -25,6 +25,12 @@
+ 
+ if [ $TPSTATUS = 0 ]; then
+    xinput set-int-prop $XINPUTNUM "Synaptics Off" 8 1
++   if [ -e /sys/class/leds/asus::touchpad/brightness ]; then
++	echo 0 > /sys/class/leds/asus::touchpad/brightness
++   fi
+ else
+    xinput set-int-prop $XINPUTNUM "Synaptics Off" 8 0
++   if [ -e /sys/class/leds/asus::touchpad/brightness ]; then
++	echo 1 > /sys/class/leds/asus::touchpad/brightness
++   fi
+ fi
--- acpi-support-0.137.orig/debian/patches/battery.diff
+++ acpi-support-0.137/debian/patches/battery.diff
@@ -0,0 +1,9 @@
+--- acpi-support-0.114.orig/events/battery
++++ acpi-support-0.114/events/battery
+@@ -1,5 +1,5 @@
+ # /etc/acpi/events/battery
+ # Called when AC power goes away and we switch to battery
+ 
+-event=battery
++event=battery.*
+ action=/etc/acpi/power.sh
--- acpi-support-0.137.orig/debian/patches/policy-funcs.diff
+++ acpi-support-0.137/debian/patches/policy-funcs.diff
@@ -0,0 +1,31 @@
+--- acpi-support-0.137.orig/lib/policy-funcs	2010-06-24 09:16:57.000000000 +0200
++++ acpi-support-0.137.orig/lib/policy-funcs	2010-06-24 09:18:04.000000000 +0200
+@@ -1,3 +1,5 @@
++. /usr/share/acpi-support/power-funcs
++
+ CheckUPowerPolicy() {
+ 	if pidof upowerd > /dev/null; then
+ 		return 0;
+@@ -5,12 +7,21 @@
+ 		return 1;
+ 	fi
+ }
++
++# The (not very aptly named) function CheckPolicy checks if the current X
++# console user is running a power management daemon that handles suspend/resume
++# requests. This is used in various places to determine if we need to handle
++# something ourselves or if we need to pass the info on to a power management
++# daemon (e.g. through a fake key press).
++
+ CheckPolicy() {
+ 	local PMS
++
++	getXconsole
+ 	PMS="gnome-power-manager kpowersave xfce4-power-manager"
+ 	PMS="$PMS guidance-power-manager.py dalston-power-applet"
+ 	if pidof -x $PMS > /dev/null ||
+-	   (pidof dcopserver > /dev/null && test -x /usr/bin/dcop && /usr/bin/dcop kded kded loadedModules | grep -q klaptopdaemon) ||
++	   (test "$XUSER" != "" && pidof dcopserver > /dev/null && test -x /usr/bin/dcop && /usr/bin/dcop --user $XUSER kded kded loadedModules | grep -q klaptopdaemon) ||
+ 	   PowerDevilRunning ; then
+ 		echo 0;
+ 	else
--- acpi-support-0.137.orig/debian/patches/ibm.diff
+++ acpi-support-0.137/debian/patches/ibm.diff
@@ -0,0 +1,35 @@
+--- acpi-support/ibm-wireless.sh.orig	2009-12-28 19:00:36.000000000 +0100
++++ acpi-support/ibm-wireless.sh	2009-12-28 19:35:02.000000000 +0100
+@@ -1,10 +1,17 @@
+ #!/bin/sh
+ 
+ test -f /usr/share/acpi-support/state-funcs || exit 0
++if (! test -x /usr/sbin/rfkill)
++then
++logger "Error: Please install package rfkill to enable toggling of wireless devices."
++exit 0
++fi
++
+ 
+ # Find and toggle wireless of bluetooth devices on ThinkPads
+ 
+ . /usr/share/acpi-support/state-funcs
++. /etc/default/acpi-support
+ 
+ rfkill list | sed -n -e'/tpacpi_bluetooth_sw/,/^[0-9]/p' | grep -q 'Soft blocked: yes'
+ bluetooth_state=$?
+@@ -16,8 +23,14 @@
+ if ! isAnyWirelessPoweredOn; then
+     # Wireless was turned off
+     if [ "$bluetooth_state" = 0 ]; then
++      if [ x$WIRELESS_BLUETOOTH_SYNC != xtrue ]; then
+         rfkill unblock bluetooth
++      fi
+     else
+         rfkill block bluetooth
+     fi
++else
++    if [ x$WIRELESS_BLUETOOTH_SYNC = xtrue -a "$bluetooth_state" = 0 ]; then
++	rfkill unblock bluetooth
++    fi
+ fi
--- acpi-support-0.137.orig/debian/patches/state-funcs.diff
+++ acpi-support-0.137/debian/patches/state-funcs.diff
@@ -0,0 +1,145 @@
+--- acpi-support-0.137.orig/lib/state-funcs
++++ acpi-support-0.137/lib/state-funcs
+@@ -1,91 +1,66 @@
+-#!/bin/sh
+ # Paul Sladen, 2006-03-28, 2007-03-26
++# Luca Niccoli <lultimouomo@gmail.com>, 2010-06-23
+ # Library functions to check/change status of wireless
+ 
++WLAN_RFKILLS=`for RFKILL in /sys/class/rfkill/rfkill*; do if [ $(cat $RFKILL/type) = wlan ]; then echo $RFKILL/state; fi; done`
++
++haveDevRfkill()
++{
++  [ -c /dev/rfkill ] && [ -x /usr/sbin/rfkill ]
++}
++
+ # Return 0 if there is, allowing you to write   if isAnyWirelessPoweredOn; then ...
+ isAnyWirelessPoweredOn()
+ {
+-    for DEVICE in /sys/class/net/* ; do
+-	if [ -d $DEVICE/wireless ]; then
+-	    for RFKILL in $DEVICE/phy80211/rfkill*/state $DEVICE/device/rfkill/rfkill*/state
+-	    do
+-		if [ -r "$RFKILL" ] && [ "$(cat "$RFKILL")" -eq 1 ]
+-		then
+-		    return 0
+-		fi
+-	    done
+-	    # if any of the wireless devices are turned on then return success
+-	    if [ -r $DEVICE/device/power/state ] && [ "`cat $DEVICE/device/power/state`" -eq 0 ]
+-	    then
+-		return 0
+-	    fi
+-	    if [ -r $DEVICE/device/rf_kill ] && [ "`cat $DEVICE/device/rf_kill`" -eq 0 ]
+-	    then
+-		return 0
+-	    fi
+-	fi
+-    done
+-
+-    # otherwise return failure
++    if haveDevRfkill; then
++        rfkill list wlan | grep -q "Soft blocked: no"
++        return $?
++    else
++        for RFKILL in $WLAN_RFKILLS ; do
++            if [ -r "$RFKILL" ] && [ "$(cat "$RFKILL")" -eq 1 ]; then
++                return 0
++            fi
++        done
++    fi
++    # otherwise return failure  
+     return 1
+ }
+ 
+ # Takes no parameters, toggles all wireless devices.
+-# TODO: Should possible toggle all wireless devices to the state of the first one.
+-# Attempts to use 'rf_kill' first, and then tries 'power/state', though that
+-# will fail on >=2.6.18 kernels since upstream removed the functionality...
+ toggleAllWirelessStates()
+ {
+-    for DEVICE in /sys/class/net/* ; do
+-	if [ -d $DEVICE/wireless ] ; then
+-	    # $DEVICE is a wireless device.
+-
+-	    FOUND=
+-	    # Yes, that's right... the new interface reverses the truth values.
+-	    ON=1
+-	    OFF=0
+-	    for CONTROL in $DEVICE/device/rfkill/rfkill*/state; do
+-		if [ -w "$CONTROL" ]; then
+-		    FOUND=1
+-
+-		    if [ "$(cat "$CONTROL")" = "$ON" ] ; then
+-			# It's powered on. Switch it off.
+-			echo -n "$OFF" > "$CONTROL"
+-		    else
+-			# It's powered off. Switch it on.
+-			echo -n "$ON" > "$CONTROL"
+-		    fi
+-		fi
+-	    done
+-	    # it might be safe to assume that a device only supports one
+-	    # interface at a time; but just in case, we short-circuit
+-	    # here to avoid toggling the power twice
+-	    if [ -n "$FOUND" ]; then
+-		continue
+-	    fi
+-
+-	    ON=0
+-	    OFF=1  # 1 for rf_kill, 2 for power/state
+-	    for CONTROL in $DEVICE/device/rf_kill $DEVICE/device/power/state ; do
+-		if [ -w $CONTROL ] ; then
+-		    # We have a way of controlling the device, lets try
+-		    if [ "`cat $CONTROL`" = 0 ] ; then
+-			# It's powered on. Switch it off.
+-			if echo -n $OFF > $CONTROL ; then 
+-			    break
+-			else
+-			    OFF=2 # for power/state, second time around
+-			fi
+-		    else
+-			# It's powered off. Switch it on.
+-			if echo -n $ON > $CONTROL ; then
+-			    break
+-			fi
+-		    fi
+-		fi
+-	    done
+-	fi
+-    done
++    # If rfkill is handled by the kernel, don't touch it
++    if ! grep -q '^H.*\brfkill\b' /proc/bus/input/devices; then
++        if isAnyWirelessPoweredOn; then
++            # ifconfig down wireless interfaces, helps with some buggy driver            
++            for WIFACE in `iwconfig 2>/dev/null |grep -o '^[[:alnum:]]*'`; do
++                ifconfig $WIFACE down || :
++            done
++            if haveDevRfkill; then
++                rfkill block wlan
++            else
++                for RFKILL in $WLAN_RFKILLS; do
++                    [ -w $RFKILL ] && echo 0 > $RFKILL
++                done
++            fi
++        else
++            if haveDevRfkill; then
++                rfkill unblock wlan
++            else
++                for RFKILL in $WLAN_RFKILLS; do
++                    [ -w $RFKILL ] && echo 1 > $RFKILL
++                done
++            fi
++        fi
++    fi
++    # Is wireless on now? Set the interfaces up and poke wicd
++    sleep 5
++    if isAnyWirelessPoweredOn; then
++        for WIFACE in `iwconfig 2>/dev/null |grep -o '^[[:alnum:]]*'`; do
++            ifconfig $WIFACE up || :
++        done
++        [ -x /usr/share/wicd/daemon/autoconnect.py ] &&  /usr/share/wicd/daemon/autoconnect.py 
++    fi
+ }
+ 
+ # Pass '1' to blink suspending LED and '0' to stop LED
--- acpi-support-0.137.orig/debian/patches/xset.diff
+++ acpi-support-0.137/debian/patches/xset.diff
@@ -0,0 +1,11 @@
+--- acpi-support/lib/screenblank	2009-12-11 16:05:32.000000000 +0100
++++ acpi-support/lib/screenblank	2009-12-11 16:05:53.000000000 +0100
+@@ -14,7 +14,7 @@
+ 	fi
+ fi
+ 
+-xset dpms force off
++su $user -s /bin/sh -c "xset dpms force off"
+ if [ x$RADEON_LIGHT = xtrue ]; then
+     [ -x /usr/sbin/radeontool ] && radeontool light off
+ fi
--- acpi-support-0.137.orig/debian/patches/series
+++ acpi-support-0.137/debian/patches/series
@@ -0,0 +1,27 @@
+ac.diff
+acpi_fakekey.diff
+asus-brn-up.sh.diff
+asus-touchpad.sh.diff
+asus-touchpad.sh-led.diff
+asus-wireless.sh.diff
+battery.diff
+hibernate.sh.diff
+lid.sh.diff
+policy-funcs.diff
+policy-funcs-grep.diff
+power-funcs.diff
+screenblank.diff
+sleep.sh.diff
+sleepbtn.sh.diff
+state-funcs.diff
+su_shell.diff
+xset.diff
+full-path.diff
+blank_no_user.diff
+ibm.diff
+dpms.diff
+dmi.diff
+asus-brightness-down.diff
+asus-brightness-up.diff
+lid-sleep.diff
+background.diff
--- acpi-support-0.137.orig/debian/patches/sleep.sh.diff
+++ acpi-support-0.137/debian/patches/sleep.sh.diff
@@ -0,0 +1,10 @@
+diff -ruN acpi-support.orig/sleep.sh acpi-support/sleep.sh
+--- acpi-support.orig/sleep.sh	2009-11-22 12:27:18.000000000 +0100
++++ acpi-support/sleep.sh	2009-11-22 12:27:41.000000000 +0100
+@@ -1,5 +1,4 @@
+-#!/bin/bash
+-# TODO:  Change above to /bin/sh
++#!/bin/sh
+ 
+ # This script HANDLES the sleep button (does not TRANSLATE it). It is part
+ # of the *suspend* side of acpi-support, not the special keys translation
--- acpi-support-0.137.orig/debian/patches/dmi.diff
+++ acpi-support-0.137/debian/patches/dmi.diff
@@ -0,0 +1,32 @@
+--- acpi-support-0.133.orig/lib/device-funcs	2010-03-19 17:25:40.000000000 +0100
++++ acpi-support-0.133/lib/device-funcs	2010-03-19 17:36:09.000000000 +0100
+@@ -1,10 +1,7 @@
+ 
+ DeviceConfig() {
+-
+-    # Use a cached copy of the DMI data if it is available as we may
+-    # not be running with privileges necessary to access /dev/mem
+-    manufacturer=`cat /var/lib/acpi-support/system-manufacturer||dmidecode --string system-manufacturer|sed -e 's/ *$//'`
+-    model=`cat /var/lib/acpi-support/system-product-name||dmidecode --string system-product-name|sed -e 's/ *$//'`
+-    version=`cat /var/lib/acpi-support/system-version||dmidecode --string system-version|sed -e 's/ *$//'`
+-    bios_version=`cat /var/lib/acpi-support/bios-version||dmidecode --string bios-version|sed -e 's/ *$//'`
++    manufacturer=`cat /sys/class/dmi/id/sys_vendor|sed -e 's/ *$//'`
++    model=`cat /sys/class/dmi/id/product_name|sed -e 's/ *$//'`
++    version=`cat /sys/class/dmi/id/product_version|sed -e 's/ *$//'`
++    bios_version=`cat /sys/class/dmi/id/bios_version|sed -e 's/ *$//'`
+ }
+--- acpi-support-0.133.orig/thinkpad-stretchortouchpad.sh	2010-03-19 17:26:13.000000000 +0100
++++ acpi-support-0.133/thinkpad-stretchortouchpad.sh	2010-03-19 17:27:46.000000000 +0100
+@@ -17,10 +17,10 @@
+ 
+ toggle_touchpad=0
+ 
+-system_manufactuer=`dmidecode -s system-manufacturer`
++system_manufactuer=`cat /sys/class/dmi/id/sys_vendor`
+ case "$system_manufactuer" in
+     IBM*)
+-    system_version=`dmidecode -s system-version`
++    system_version=`cat /sys/class/dmi/id/product_version`
+     case "$system_version" in
+ 	ThinkPad\ [TXZ]60*)
+ 	toggle_touchpad=1
--- acpi-support-0.137.orig/debian/patches/asus-brightness-down.diff
+++ acpi-support-0.137/debian/patches/asus-brightness-down.diff
@@ -0,0 +1,6 @@
+--- acpi-support-0.137/events/asus-brightness-down	2010-06-23 04:27:29.000000000 +0200
++++ acpi-support-0.137/events/asus-brightness-down	2010-06-24 14:00:00.000000000 +0200
+@@ -1,2 +1,2 @@
+ event=hotkey (ATKD|HOTK) 0000002[0123456789abcdef]
+-action=/etc/acpi/asus-brn-down.sh
++action=/etc/acpi/if-asus-not-eee.sh asus-brn-down.sh
--- acpi-support-0.137.orig/debian/patches/policy-funcs-grep.diff
+++ acpi-support-0.137/debian/patches/policy-funcs-grep.diff
@@ -0,0 +1,11 @@
+--- acpi-support/lib/policy-funcs	2009-12-07 20:18:55.643070790 +0100
++++ acpi-support/lib/policy-funcs	2009-12-07 20:19:15.489729366 +0100
+@@ -26,7 +26,7 @@
+ 	
+ 	for p in $(pidof kded4); do
+ 		test -r /proc/$p/environ || continue
+-		local DBUS_SESS=$(cat /proc/$p/environ | grep -z "DBUS_SESSION_BUS_ADDRESS=")
++		local DBUS_SESS=$(cat /proc/$p/environ | grep -a -z "DBUS_SESSION_BUS_ADDRESS=")
+ 		test "$DBUS_SESS" != "" || continue
+ 		(su - $(ps -o user= $p) -s /bin/sh -c "$DBUS_SESS dbus-send --print-reply --dest=org.kde.kded /kded org.kde.kded.loadedModules" | grep -q powerdevil) && return 0
+ 	done
--- acpi-support-0.137.orig/debian/patches/power-funcs.diff
+++ acpi-support-0.137/debian/patches/power-funcs.diff
@@ -0,0 +1,95 @@
+--- acpi-support-0.137.orig/lib/power-funcs
++++ acpi-support-0.137/lib/power-funcs
+@@ -5,11 +5,17 @@
+ PATH="$PATH:/usr/bin/X11"
+ POWERSTATE="/var/lib/acpi-support/powerstate"
+ 
++# getXuser gets the X user belonging to the display in $displaynum.
++# If you want the foreground X user, use getXconsole!
++
+ getXuser() {
+-	user=$(who | awk "/:$displaynum)/ { print \$1; exit }")
++	user=`pinky -fw | awk '{ if ($2 == "?:'$displaynum'" || $(NF) == ":'$displaynum'" || $2 == "?:'$displaynum'.0" || $(NF) == ":'$displaynum'.0"  ) { print $1; exit; } }'`
+ 
+ 	if [ x"$user" = x"" ]; then
+-		user=$(who | awk "/:$displaynum/ { print \$1; exit }")
++		startx=`pgrep -n startx`
++		if [ x"$startx" != x"" ]; then
++			user=`ps -o user --no-headers $startx`
++		fi
+ 	fi
+ 	if [ x"$user" != x"" ]; then
+         	userhome=`getent passwd $user | cut -d: -f6`
+@@ -17,8 +23,10 @@
+ 	else
+ 		export XAUTHORITY=""
+ 	fi
++	export XUSER=$user
+ }
+ 
++# getXconsole gets the foreground (console) X user
+ getXconsole() {
+ 	console=`fgconsole`;
+ 	displaynum=`ps t tty$console | sed -n -re 's,.*/X .*:([0-9]+).*,\1,p'`
+@@ -27,11 +35,41 @@
+ 		getXuser
+ 	fi
+ }
++
++ac_adapters() {
++    for x in /sys/class/power_supply/*; do
++       if [ -d "$x" ] ; then
++            read type < $x/type
++            test "$type" = "Mains" && echo $x
++        fi
++    done
++}
+ 
+ getState() {
+-        /usr/bin/on_ac_power
+-        if [ "$?" -eq 1 ]; then
+-                STATE="BATTERY"
++	# Run through all power supply information. If we have only one that is online,
++        # then we are on AC power. If we find no power supplies at all, then we assume
++        # that we are on a desktop machine without power supply information and we are
++        # actually on AC.
++        ONLINE_POWER_SUPPLY_PRESENT=0
++	POWER_SUPPLY_PRESENT=0
++
++        for x in $(ac_adapters); do
++            POWER_SUPPLY_PRESENT=1
++            if grep -q 1 $x/online ; then
++                ONLINE_POWER_SUPPLY_PRESENT=1
++            fi
++        done
++
++        for x in /proc/acpi/ac_adapter/*; do
++            if [ -d "$x" ] ; then
++                POWER_SUPPLY_PRESENT=1
++                if grep -q on-line $x/state ; then
++                    ONLINE_POWER_SUPPLY_PRESENT=1
++                fi
++            fi
++        done
++        if [ $POWER_SUPPLY_PRESENT = 1 ] && [ $ONLINE_POWER_SUPPLY_PRESENT = 0 ] ; then
++		STATE="BATTERY";
+         else
+                 STATE="AC"
+         fi
+@@ -41,7 +79,7 @@
+ checkStateChanged() {
+ # do we have our state stashed?
+         if [ -f "$POWERSTATE" ]; then
+-                OLDSTATE=$(<$POWERSTATE) 
++                OLDSTATE=$(cat $POWERSTATE) 
+                 if [ "$STATE" = "$OLDSTATE" ]; then
+                        exit 0
+                 else
+@@ -54,7 +92,6 @@
+         fi
+ }
+ 
+-LAPTOP_MODE='/usr/sbin/laptop_mode'
+ HDPARM='/sbin/hdparm -q'
+ 
+ LIDSTATE='/var/lib/acpi-support/lidstate'
--- acpi-support-0.137.orig/debian/patches/asus-brn-up.sh.diff
+++ acpi-support-0.137/debian/patches/asus-brn-up.sh.diff
@@ -0,0 +1,11 @@
+--- acpi-support-0.114.orig/asus-brn-up.sh
++++ acpi-support-0.114/asus-brn-up.sh
+@@ -1,7 +1,7 @@
+ #!/bin/sh
+ test -f /usr/share/acpi-support/key-constants || exit 0
+-
+ . /usr/share/acpi-support/key-constants
++. /usr/share/acpi-support/device-funcs
+ 
+ DeviceConfig
+ 
--- acpi-support-0.137.orig/debian/patches/sleepbtn.sh.diff
+++ acpi-support-0.137/debian/patches/sleepbtn.sh.diff
@@ -0,0 +1,33 @@
+--- acpi-support-0.114.orig/sleepbtn.sh
++++ acpi-support-0.114/sleepbtn.sh
+@@ -8,5 +8,28 @@
+ 
+ test -f /usr/share/acpi-support/key-constants || exit 0
+ 
+-. /usr/share/acpi-support/key-constants
+-acpi_fakekey $KEY_SLEEP
++. /usr/share/acpi-support/policy-funcs
++
++if [ `CheckPolicy` = 0 ]; then
++  # If gnome-power-manager or klaptopdaemon are running, generate the X "sleep"
++  # key. The daemons will handle that keypress according to their settings.
++
++  # (Since this script is called only when a key is pressed that is *not* seen
++  # as a suspend key by the rest of the system, we still need to do this
++  # translation here.)
++  
++  . /usr/share/acpi-support/key-constants
++  acpi_fakekey $KEY_SLEEP 
++else
++  # No power management daemons are running. Divert to our own implementation.
++
++  # Note that sleep.sh assumes that the pressed key is also seen by the rest
++  # of the system. However, it will choose the right path (our own
++  # implementation) if CheckPolicy != 0, which is exactly what we want. And this
++  # way we have a single user-configurable point for how we do suspend. (Not
++  # that that's nice, but until we have pluggable suspend methods this is the
++  # way to go.)
++  
++  /etc/acpi/sleep.sh
++fi
++
--- acpi-support-0.137.orig/debian/patches/full-path.diff
+++ acpi-support-0.137/debian/patches/full-path.diff
@@ -0,0 +1,13 @@
+--- acpi-support/lib/policy-funcs	2009-12-11 16:47:50.000000000 +0100
++++ acpi-support/lib/policy-funcs	2009-12-11 17:24:02.000000000 +0100
+@@ -10,8 +10,8 @@
+ 	local PMS
+ 
+ 	getXconsole
+-	PMS="gnome-power-manager kpowersave xfce4-power-manager"
+-	PMS="$PMS guidance-power-manager.py dalston-power-applet"
++	PMS="/usr/bin/gnome-power-manager /usr/bin/kpowersave /usr/bin/xfce4-power-manager"
++	PMS="$PMS /usr/bin/guidance-power-manager /usr/lib/dalston/dalston-power-applet"
+ 	if pidof -x $PMS > /dev/null ||
+ 	   (test "$XUSER" != "" && pidof dcopserver > /dev/null && test -x /usr/bin/dcop && /usr/bin/dcop --user $XUSER kded kded loadedModules | grep -q klaptopdaemon) ||
+ 	   PowerDevilRunning ; then
--- acpi-support-0.137.orig/debian/patches/asus-wireless.sh.diff
+++ acpi-support-0.137/debian/patches/asus-wireless.sh.diff
@@ -0,0 +1,22 @@
+--- acpi-support-0.133.orig/asus-wireless.sh
++++ acpi-support-0.133/asus-wireless.sh
+@@ -5,4 +5,18 @@
+ 
+ . /usr/share/acpi-support/state-funcs
+ 
+-toggleAllWirelessStates
++VENDOR=`cat /sys/class/dmi/id/sys_vendor | tr [:upper:] [:lower:] | cut -c1-4`
++test $VENDOR = "asus" || exit 0
++
++if [ "$1" = "" ] ; then
++	toggleAllWirelessStates;
++elif ( isAnyWirelessPoweredOn ) ; then
++	if [ "$1" = "off" ] ; then
++		toggleAllWirelessStates;
++	fi
++else
++	if [ "$1" = "on" ] ; then
++		toggleAllWirelessStates;
++	fi
++fi
++
--- acpi-support-0.137.orig/debian/patches/blank_no_user.diff
+++ acpi-support-0.137/debian/patches/blank_no_user.diff
@@ -0,0 +1,20 @@
+--- acpi-support-0.131.orig/lid.sh
++++ acpi-support-0.131/lid.sh
+@@ -19,6 +19,8 @@
+ 	if [ x"$XAUTHORITY" != x"" ]; then
+ 	    export DISPLAY=":$displaynum"	    
+ 	    . /usr/share/acpi-support/screenblank
++	else
++	    [ -x /usr/sbin/vbetool ] && /usr/sbin/vbetool dpms off
+ 	fi
+     done
+ else
+@@ -41,6 +43,8 @@
+ 		su $user -s /bin/sh -c "xscreensaver-command -deactivate"
+ 	    fi
+ 	    su $user -s /bin/sh -c "xset dpms force on"
++	else
++	    [ -x /usr/sbin/vbetool ] && /usr/sbin/vbetool dpms on
+ 	fi
+     done
+ fi
--- acpi-support-0.137.orig/debian/patches/acpi_fakekey.diff
+++ acpi-support-0.137/debian/patches/acpi_fakekey.diff
@@ -0,0 +1,216 @@
+diff -Nru acpi-support-0.115/acpi_fakekey.c /tmp/Umsn0ebzYy/acpi-support-0.115+thjaeger1/acpi_fakekey.c
+--- acpi-support-0.115/acpi_fakekey.c	2008-09-26 00:14:34.000000000 +0100
++++ acpi-support-0.115+thjaeger1/acpi_fakekey.c	2009-01-19 09:09:31.000000000 +0000
+@@ -1,68 +1,29 @@
+ #include <unistd.h>
+ #include <fcntl.h>
+-#include <string.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+-#include <linux/input.h>
+ 
+-#define TestBit(bit, array) (array[(bit) / 8] & (1 << ((bit) % 8)))
+-
+-int find_keyboard() {
+-	int i, j;
+-        int fd;
+-        char filename[32];
+-        char key_bitmask[(KEY_MAX + 7) / 8];
+-
+-        for (i=0; i<32; i++) {
+-                snprintf(filename,sizeof(filename), "/dev/input/event%d", i);
+-
+-                fd = open(filename, O_RDWR);
+-		if (fd < 0) {
+-			perror("open");
+-			exit(EXIT_FAILURE);
+-		}                
+-		
+-                ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(key_bitmask)), key_bitmask);
+-
+-		/* We assume that anything that has an alphabetic key in the
+-		   QWERTYUIOP range in it is the main keyboard. */
+-		for (j = KEY_Q; j <= KEY_P; j++) {
+-			if (TestBit(j, key_bitmask))
+-				return fd;
+-		}
+-
+-                close (fd);
+-        }
+-        return 0;
+-}
++#define FIFO "/dev/shm/acpi_fakekey"
+ 
+ int main(int argc, char** argv) {
+ 	int fd;
+-	int key;
+-	struct input_event event;
++	unsigned char key;
+ 
+-	if (argc == 2) {
+-		key = atoi(argv[1]);
+-	} else {
+-		return 1;
++	if (argc != 2) {
++		printf("Usage: %s <key>\n", argv[0]);
++		return EXIT_FAILURE;
+ 	}
++	key = atoi(argv[1]);
+ 
+-	fd = find_keyboard();
+-
+-	if (!fd) {
+-		return 2;
++	if ((fd = open(FIFO, O_WRONLY)) == -1) {
++		perror("fifo");
++		return EXIT_FAILURE;
++	}
++	if (write(fd, &key, 1) == -1) {
++		perror("write");
++		return EXIT_FAILURE;
+ 	}
+ 
+-	event.type = EV_KEY;
+-	event.code = key;
+-	event.value = 1;
+-	write(fd, &event, sizeof event);
+-
+-	event.type = EV_KEY;
+-	event.code = key;
+-	event.value = 0;
+-	write(fd, &event, sizeof event);
+-	
+-	return 0;
++	close(fd);
++	return EXIT_SUCCESS;
+ }
+-
+diff -Nru /tmp/clWVJzRiJd/acpi-support-0.115/Makefile /tmp/Umsn0ebzYy/acpi-support-0.115+thjaeger1/Makefile
+--- acpi-support-0.115/Makefile	2008-09-26 00:14:34.000000000 +0100
++++ acpi-support-0.115+thjaeger1/Makefile	2009-01-19 09:09:31.000000000 +0000
+@@ -1,8 +1,10 @@
+-all: acpi_fakekey
++all: acpi_fakekey acpi_fakekeyd
+ 
+ acpi_fakekey: acpi_fakekey.c
+-	gcc -g -Wall -o acpi_fakekey acpi_fakekey.c
+-	strip acpi_fakekey
++	gcc -g -Os -Wall -o $@ $<
++
++acpi_fakekeyd: acpi_fakekeyd.c
++	gcc -g -Os -Wall -o $@ $<
+ 
+ # Keep this manually generated so that it doesn't build-dep on
+ # 'linux-headers' and stays predictable.
+@@ -15,4 +19,4 @@
+ 	test -f aliased-keys && cat aliased-keys >> $@
+ 
+ clean:
+-	rm -f acpi_fakekey
++	$(RM) acpi_fakekey acpi_fakekeyd
+--- acpi-support/acpi_fakekeyd.c	2010-06-15 12:35:38.846063228 +0200
++++ acpi-support/acpi_fakekeyd.c	2010-06-15 18:22:03.000000000 +0200
+@@ -0,0 +1,103 @@
++#include <unistd.h>
++#include <fcntl.h>
++#include <string.h>
++#include <stdlib.h>
++#include <stdio.h>
++#include <linux/uinput.h>
++#include <sys/stat.h>
++
++#define FIFO "/dev/shm/acpi_fakekey"
++
++void fail(const char *str) {
++	perror(str);
++	exit(EXIT_FAILURE);
++}
++
++void daemonize() {
++	int pid;
++	if ((pid = fork()) == -1)
++		fail("fork");
++
++	if (pid)
++		exit(EXIT_SUCCESS);
++
++	if (setsid() == -1)
++		fail("setsid");
++
++	if (chdir("/") == -1)
++		fail("chdir");
++
++	if (!freopen("/dev/null", "r", stdin))
++		fail("freopen");
++	if (!freopen("/dev/null", "w", stdout))
++		fail("freopen");
++	if (!freopen("/dev/null", "w", stderr))
++		fail("freopen");
++}
++
++int main(int argc, char** argv) {
++	int fd;
++	int fifo;
++	int i;
++	struct uinput_user_dev dev;
++	fd_set sfd;
++
++	if ((fd = open("/dev/input/uinput", O_WRONLY | O_NDELAY)) == -1)
++		fail("open device");
++
++	memset(&dev, 0, sizeof(dev));
++	strncpy(dev.name, "ACPI Virtual Keyboard Device", UINPUT_MAX_NAME_SIZE);
++	dev.id.version = 4;
++	dev.id.bustype = BUS_USB;
++
++	ioctl(fd, UI_SET_EVBIT, EV_KEY);
++	for (i = 0; i < 256; i++)
++		ioctl(fd, UI_SET_KEYBIT, i);
++	if (write(fd, &dev, sizeof(dev)) == -1)
++		fail("write");
++
++	if (ioctl(fd, UI_DEV_CREATE) == -1)
++		fail("create device");
++
++	remove(FIFO);
++	if (mkfifo(FIFO, 0200) == -1)
++		fail("mkfifo");
++	
++	if ((fifo = open(FIFO, O_RDWR | O_NONBLOCK)) == -1)
++		fail("open fifo");
++
++	daemonize();
++
++	FD_ZERO(&sfd);
++	FD_SET(fifo, &sfd);
++	while (select(fifo+1, &sfd, 0, 0, 0) != -1) {
++		int n;
++		unsigned char key; 
++		struct input_event event;
++		if ((n = read(fifo, &key, 1)) == -1)
++			break;
++		if (!n)
++			continue;
++
++		event.type = EV_KEY;
++		event.code = key;
++		event.value = 1;
++		if (write(fd, &event, sizeof event) == -1)
++			break;
++		event.value = 0;
++		if (write(fd, &event, sizeof event) == -1)
++			break;
++		/* Need to write sync event */
++		memset(&event, 0, sizeof(event));
++		event.type = EV_SYN;
++		event.code = SYN_REPORT;
++		event.value = 0;
++		if (write(fd, &event, sizeof event) == -1)
++			break;
++	}
++
++	ioctl(fd, UI_DEV_DESTROY);
++	close(fd);
++	remove(FIFO);
++	return EXIT_FAILURE;
++}
--- acpi-support-0.137.orig/debian/patches/lid.sh.diff
+++ acpi-support-0.137/debian/patches/lid.sh.diff
@@ -0,0 +1,9 @@
+--- acpi-support-0.114.orig/lid.sh
++++ acpi-support-0.114/lid.sh
+@@ -1,5 +1,4 @@
+-#!/bin/bash
+-# TODO:  Change the above to /bin/sh
++#!/bin/sh
+ 
+ test -f /usr/share/acpi-support/state-funcs || exit 0
+ 
--- acpi-support-0.137.orig/debian/patches/asus-touchpad.sh.diff
+++ acpi-support-0.137/debian/patches/asus-touchpad.sh.diff
@@ -0,0 +1,23 @@
+--- acpi-support-0.114.orig/asus-touchpad.sh
++++ acpi-support-0.114/asus-touchpad.sh
+@@ -3,12 +3,20 @@
+ 
+ . /usr/share/acpi-support/power-funcs
+ 
++if (! test -x /usr/bin/xinput)
++then
++logger "Error: Please install package xinput to enable toggling of touchpad devices."
++exit 0
++fi
++
+ # if this is the right behavior, then this should be moved out of acpi-support
+ # to hal (or whatever is replacing hal for such events)
+ getXconsole
+ 
+ XINPUTNUM=`xinput list | grep 'SynPS/2 Synaptics TouchPad' | sed -n -e's/.*id=\([0-9]\+\).*/\1/p'`
+ 
++[ -f /usr/share/acpi-support/state-funcs ] || exit 0
++
+ # get the current state of the touchpad
+ TPSTATUS=`xinput list-props $XINPUTNUM | awk '/Synaptics Off/ { print $NF }'`
+ 
--- acpi-support-0.137.orig/debian/patches/asus-brightness-up.diff
+++ acpi-support-0.137/debian/patches/asus-brightness-up.diff
@@ -0,0 +1,6 @@
+--- acpi-support-0.137/events/asus-brightness-up	2010-06-23 04:27:29.000000000 +0200
++++ acpi-support-0.137/events/asus-brightness-up	2010-06-24 13:59:48.000000000 +0200
+@@ -1,2 +1,2 @@
+ event=hotkey (ATKD|HOTK) 0000001[0123456789abcdef]
+-action=/etc/acpi/asus-brn-up.sh
++action=/etc/acpi/if-asus-not-eee.sh asus-brn-up.sh
--- acpi-support-0.137.orig/debian/patches/ac.diff
+++ acpi-support-0.137/debian/patches/ac.diff
@@ -0,0 +1,9 @@
+--- acpi-support-0.114.orig/events/ac
++++ acpi-support-0.114/events/ac
+@@ -2,5 +2,5 @@
+ # Called when the user connects ac power to us
+ # 
+ 
+-event=ac_adapter
++event=ac_adapter.*
+ action=/etc/acpi/power.sh
--- acpi-support-0.137.orig/debian/patches/su_shell.diff
+++ acpi-support-0.137/debian/patches/su_shell.diff
@@ -0,0 +1,48 @@
+diff -ruN acpi-support.orig/lib/policy-funcs acpi-support/lib/policy-funcs
+--- acpi-support.orig/lib/policy-funcs	2009-11-22 12:16:55.000000000 +0100
++++ acpi-support/lib/policy-funcs	2009-11-22 12:17:11.000000000 +0100
+@@ -28,7 +28,7 @@
+ 		test -r /proc/$p/environ || continue
+ 		local DBUS_SESS=$(cat /proc/$p/environ | grep -z "DBUS_SESSION_BUS_ADDRESS=")
+ 		test "$DBUS_SESS" != "" || continue
+-		(su - $(ps -o user= $p) -c "$DBUS_SESS dbus-send --print-reply --dest=org.kde.kded /kded org.kde.kded.loadedModules" | grep -q powerdevil) && return 0
++		(su $(ps -o user= $p) -s /bin/sh -c "$DBUS_SESS dbus-send --print-reply --dest=org.kde.kded /kded org.kde.kded.loadedModules" | grep -q powerdevil) && return 0
+ 	done
+ 	
+ 	return 1
+diff -ruN acpi-support.orig/lib/screenblank acpi-support/lib/screenblank
+--- acpi-support.orig/lib/screenblank	2009-11-22 12:17:22.000000000 +0100
++++ acpi-support/lib/screenblank	2009-11-22 12:17:40.000000000 +0100
+@@ -1,7 +1,7 @@
+ if [ `pidof xscreensaver` ]; then
+-	su $user -c "(xscreensaver-command -throttle)"
++	su $user -s /bin/sh -c "(xscreensaver-command -throttle)"
+ 		if [ x$LOCK_SCREEN = xtrue ]; then	
+-		su $user -c "(xscreensaver-command -lock)"
++		su $user -s /bin/sh -c "(xscreensaver-command -lock)"
+ 	fi
+ elif [ `pidof dcopserver` ]; then
+ 	if [ x$LOCK_SCREEN = xtrue ]; then
+diff -ruN acpi-support.orig/lid.sh acpi-support/lid.sh
+--- acpi-support.orig/lid.sh	2009-11-22 12:15:59.000000000 +0100
++++ acpi-support/lid.sh	2009-11-22 12:16:05.000000000 +0100
+@@ -31,16 +31,16 @@
+ 	    if [ $? = 1 ]
+ 		then
+ 		if pidof xscreensaver > /dev/null; then 
+-		    su $user -c "xscreensaver-command -unthrottle"
++		    su $user -s /bin/sh -c "xscreensaver-command -unthrottle"
+ 		fi
+ 	    fi
+ 	    if [ x$RADEON_LIGHT = xtrue ]; then
+ 		[ -x /usr/sbin/radeontool ] && radeontool light on
+ 	    fi
+ 	    if [ `pidof xscreensaver` ]; then
+-		su $user -c "xscreensaver-command -deactivate"
++		su $user -s /bin/sh -c "xscreensaver-command -deactivate"
+ 	    fi
+-	    su $user -c "xset dpms force on"
++	    su $user -s /bin/sh -c "xset dpms force on"
+ 	fi
+     done
+ fi
--- acpi-support-0.137.orig/debian/patches/dpms.diff
+++ acpi-support-0.137/debian/patches/dpms.diff
@@ -0,0 +1,51 @@
+--- acpi-support/lid.sh	2009-12-28 22:54:05.000000000 +0100
++++ acpi-support/lid.sh	2009-12-28 22:58:11.000000000 +0100
+@@ -42,7 +42,17 @@
+ 	    if [ `pidof xscreensaver` ]; then
+ 		su $user -s /bin/sh -c "xscreensaver-command -deactivate"
+ 	    fi
++	    case "$DISPLAY_DPMS" in
++		xset)
+ 	    su $user -s /bin/sh -c "xset dpms force on"
++			;;
++		xrandr)
++			su $user -s /bin/sh -c "xrandr --output LVDS --auto"
++			;;
++		vbetool)
++			/usr/sbin/vbetool dpms on
++			;;
++	    esac
+ 	else
+ 	    [ -x /usr/sbin/vbetool ] && /usr/sbin/vbetool dpms on
+ 	fi
+--- acpi-support/lib/screenblank	2009-12-28 22:54:08.000000000 +0100
++++ acpi-support/lib/screenblank	2009-12-28 22:59:06.000000000 +0100
+@@ -14,7 +14,18 @@
+ 	fi
+ fi
+ 
++case "$DISPLAY_DPMS" in
++  xset)
+ su $user -s /bin/sh -c "xset dpms force off"
++	;;
++  xrandr)
++	su $user -s /bin/sh -c "xrandr --output LVDS --off"
++	;;
++  vbetool)
++	/usr/sbin/vbetool dpms off
++	;;
++esac
++
+ if [ x$RADEON_LIGHT = xtrue ]; then
+     [ -x /usr/sbin/radeontool ] && radeontool light off
+ fi
+--- acpi-support/screenblank.sh	2009-12-28 23:04:58.000000000 +0100
++++ acpi-support/screenblank.sh	2009-12-28 23:05:59.000000000 +0100
+@@ -4,6 +4,7 @@
+ 
+ . /etc/default/acpi-support
+ . /usr/share/acpi-support/power-funcs
++. /etc/default/acpi-support
+ 
+ for x in /tmp/.X11-unix/*; do
+     displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
--- acpi-support-0.137.orig/debian/addons/events/sony-eject
+++ acpi-support-0.137/debian/addons/events/sony-eject
@@ -0,0 +1,4 @@
+# Eject button on Sony Vaio TX3
+
+event=sony/hotkey SPIC 00000001 0000001b
+action=/etc/acpi/ejectbtn.sh
--- acpi-support-0.137.orig/debian/addons/events/asus-wireless-wlan
+++ acpi-support-0.137/debian/addons/events/asus-wireless-wlan
@@ -0,0 +1,2 @@
+event=button/wlan WLAN 00000080
+action=/etc/acpi/asus-wireless.sh
--- acpi-support-0.137.orig/debian/addons/events/thinkpad-mute
+++ acpi-support-0.137/debian/addons/events/thinkpad-mute
@@ -0,0 +1,3 @@
+# Volume Always Mute
+event=ibm/hotkey HKEY 00000080 00001017
+action=/etc/acpi/always-mute.sh
--- acpi-support-0.137.orig/debian/addons/events/sony-brightness-down
+++ acpi-support-0.137/debian/addons/events/sony-brightness-down
@@ -0,0 +1,4 @@
+# /etc/acpi/events/sony-brightness-down
+
+event=sony/hotkey SPIC 00000001 00000010
+action=/etc/acpi/sonybright.sh down
--- acpi-support-0.137.orig/debian/addons/events/thinkpad-volume-down
+++ acpi-support-0.137/debian/addons/events/thinkpad-volume-down
@@ -0,0 +1,3 @@
+# Volume Down
+event=ibm/hotkey HKEY 00000080 00001016
+action=/etc/acpi/voldownbtn.sh 
--- acpi-support-0.137.orig/debian/addons/events/thinkpad-volume-up
+++ acpi-support-0.137/debian/addons/events/thinkpad-volume-up
@@ -0,0 +1,3 @@
+# Volume Up
+event=ibm/hotkey HKEY 00000080 00001015
+action=/etc/acpi/volupbtn.sh
--- acpi-support-0.137.orig/debian/addons/events/sony-brightness-up
+++ acpi-support-0.137/debian/addons/events/sony-brightness-up
@@ -0,0 +1,4 @@
+# /etc/acpi/events/sony-brightness-up
+
+event=sony/hotkey SPIC 00000001 00000011
+action=/etc/acpi/sonybright.sh up
--- acpi-support-0.137.orig/debian/addons/events/powerbtn-acpi-support
+++ acpi-support-0.137/debian/addons/events/powerbtn-acpi-support
@@ -0,0 +1,2 @@
+event=button[ /]power
+action=/etc/acpi/powerbtn-acpi-support.sh
--- acpi-support-0.137.orig/debian/addons/default/acpi-support
+++ acpi-support-0.137/debian/addons/default/acpi-support
@@ -0,0 +1,50 @@
+#
+# Configuration file for the acpi-support package
+#
+#
+# The acpi-support package is intended as "glue" to make special functions of
+# laptops work. Specifically, it translates special function keys for some
+# laptop models into actions or generic function key presses.
+#
+
+
+#
+# Suspend/hibernate method
+# ------------------------
+#
+# When gnome or kde power management daemons are running, acpi-support will
+# translate the suspend and hibernate keys of laptops into special "suspend"
+# and "hibernate" keys that these daemons handle.
+#
+# Only in situations where there is no power management daemon
+# running, acpi-support needs to perform suspend/hibernate in some other way.
+# Beginning with version 0.122-1 acpi-support solely uses pm-utils then.
+
+# Comment the next line to disable ACPI suspend to RAM
+ACPI_SLEEP=true
+
+# Comment the next line to disable suspend to disk
+ACPI_HIBERNATE=true
+
+# Use Radeontool to switch the screen off? Seems to be needed on some machines
+# RADEON_LIGHT=true
+
+# Comment this out to disable screen locking on resume
+LOCK_SCREEN=true
+
+# Uncomment this to enable ACPI sleep when the lid screen is closed.
+#LID_SLEEP=true
+
+# On some systems pressing the wireless button only results in an event that we
+# handle, but not in some hardware enforced action. On these systems we are
+# free to choose whether or not we cycle through "Both on, Both off, Wireless
+# only, Bluetooth only" as we used to do, or if we just do "Both on, Both off"
+# as the hardware kill switch does on most systems.
+#
+# For compatibility reasons with older version the larger cycle is the default.
+# Enable this to to have both in switched on and off simultaniously. 
+#WIRELESS_BLUETOOTH_SYNC=true
+
+# Choose the method used to switch off/on the display. Available options are
+# "xset", "xrandr" and "vbetool".
+DISPLAY_DPMS=xset
--- acpi-support-0.137.orig/debian/addons/scripts/always-mute.sh
+++ acpi-support-0.137/debian/addons/scripts/always-mute.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# on ThinkPads, the volume keys always performs mute,
+# regardless of the previous state;  for the moment
+# we fake this by "always" unmuting and then remuting.
+# Kludge/behaviour copied over from 'thinkpad-keys'
+#  -Paul Sladen 2007-09-13
+[ -f /usr/share/acpi-support/key-constants ] || exit 0
+. /usr/share/acpi-support/key-constants
+#acpi_fakekey $KEY_VOLUMEUP
+acpi_fakekey $KEY_MUTE
--- acpi-support-0.137.orig/debian/addons/scripts/powerbtn-acpi-support.sh
+++ acpi-support-0.137/debian/addons/scripts/powerbtn-acpi-support.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+# This script initiates a shutdown when the power putton has been
+# pressed. Loosely based on the sample that ships with the acpid package.
+# If the acpid sample is present as a real config file (as it was in earlier
+# versions of acpid), we skip this script. (Purging and reinstalling acpid
+# resolves this situation, or simply deleting /etc/acpi/events/powerbtn.)
+
+if [ -f /etc/acpi/events/powerbtn -o -f /etc/acpi/events/powerbtn.dpkg-bak ] ; then 
+	logger Acpi-support not handling power button, acpid handler exists at /etc/acpi/events/powerbtn or /etc/acpi/events/powerbtn.dpkg-bak.
+	exit 0
+fi
+
+[ -e /usr/share/acpi-support/policy-funcs ] || exit 0
+
+. /usr/share/acpi-support/policy-funcs
+
+if [ `CheckPolicy` = 0 ] ; then
+	exit 0
+fi
+
+if [ -x /etc/acpi/powerbtn.sh ] ; then
+	# Compatibility with old config script from acpid package
+	/etc/acpi/powerbtn.sh
+elif [ -x /etc/acpi/powerbtn.sh.dpkg-bak ] ; then
+        # Compatibility with old config script from acpid package
+	# which is still around because it was changed by the admin
+        /etc/acpi/powerbtn.sh.dpkg-bak
+else
+	# Normal handling.
+	/sbin/shutdown -h -P now "Power button pressed"
+fi
+
--- acpi-support-0.137.orig/debian/addons/scripts/hibernatebtn.sh
+++ acpi-support-0.137/debian/addons/scripts/hibernatebtn.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+test -f /usr/share/acpi-support/state-funcs || exit 0
+
+. /usr/share/acpi-support/policy-funcs
+
+if [ `CheckPolicy` = 0 ]; then
+  # If gnome-power-manager or klaptopdaemon are running, generate the X "sleep"
+  # key. The daemons will handle that keypress according to their settings.
+  . /usr/share/acpi-support/key-constants
+  acpi_fakekey $KEY_SUSPEND
+else
+  # No power management daemons are running. Divert to our own implementation.
+  /etc/acpi/hibernate.sh
+fi
+
--- acpi-support-0.137.orig/debian/addons/scripts/if-asus-not-eee.sh
+++ acpi-support-0.137/debian/addons/scripts/if-asus-not-eee.sh
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+# The hotkeys for the Asus Eee PC conflict with brightness keys on other Asus
+# laptops. This script invokes another acpi script (passed as an argument), but
+# only if the system is not an Eee PC.
+
+test -d /sys/bus/platform/devices/eeepc && exit 0 
+
+/etc/acpi/$1
--- acpi-support-0.137.orig/debian/addons/scripts/sonybright.sh
+++ acpi-support-0.137/debian/addons/scripts/sonybright.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+# TODO: Change above to /bin/sh
+
+test -f /usr/share/acpi-support/key-constants || exit 0
+
+BRIGHTNESS=$(cat /sys/class/backlight/sony/brightness)
+
+if [ "$BRIGHTNESS" -gt 7 ]; then
+	BRIGHTNESS=0
+fi
+
+if [ "x$1" = "xdown" ]; then
+   if [ "x$BRIGHTNESS" != "x0" ]; then
+      BRIGHTNESS=$(( $BRIGHTNESS - 1 ))
+      echo $BRIGHTNESS > /sys/class/backlight/sony/brightness
+   else
+      [ -x /usr/bin/spicctrl ] && /usr/bin/spicctrl -b 0   
+   fi
+   # Recent nvidia Sonys have ACPI methods that do nothing. Thanks, Sony.
+   [ -x /usr/bin/smartdimmer ] && smartdimmer -d 2>/dev/null
+elif [ "x$1" = "xup" ]; then
+   if [ "x$BRIGHTNESS" != "x7" ]; then
+      BRIGHTNESS=$(( $BRIGHTNESS + 1 ))
+      echo $BRIGHTNESS > /sys/class/backlight/sony/brightness
+   fi
+   [ -x /usr/bin/smartdimmer ] && smartdimmer -i 2>/dev/null
+else
+   echo >&2 Unknown argument $1
+fi
--- acpi-support-0.137.orig/debian/addons/docs/README.asus
+++ acpi-support-0.137/debian/addons/docs/README.asus
@@ -0,0 +1,8 @@
+TouchPad
+^^^^^^^^
+
+The asus-touchpad.sh scripts uses xinput to toggle the touchpad device. That's
+why the xinput package is suggested by acpi-support. Please make sure xinput is
+installed if you experience any problems with touchpad toggling.
+
+Michael Meskes <meskes@debian.org>
--- acpi-support-0.137.orig/debian/addons/docs/README.thinkpad
+++ acpi-support-0.137/debian/addons/docs/README.thinkpad
@@ -0,0 +1,20 @@
+Volume keys
+^^^^^^^^^^^
+
+On most Thinkpads with a fairly recent kernel (tested from 2.6.30 upwards) the
+volume keys are correctly handled by the kernel input layer. However, there are
+some reports from systems on which they are not, but instead these keys still
+generate ibm/hotkey events. Translation of these hotkey events is done by
+acpi-support for the time being. If the keys are handled correctly by the
+kernel the translation is not triggered so no harm is done.
+
+If you experience any problem with the volume keys on a Thinkpad please tell us.
+
+Wireless
+^^^^^^^^
+
+The ibm-wireless.sh scripts uses rfkill to toggle wireless. That's why the
+rfkill package is suggested by acpi-support. Please make sure rfkill is
+installed if you experience any problems with wireless toggling.
+
+Michael Meskes <meskes@debian.org>
