home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / hal / scripts / linux / hal-system-power-hibernate-linux < prev    next >
Encoding:
Text File  |  2009-07-05  |  1.8 KB  |  45 lines

  1. #!/bin/sh
  2.  
  3. unsupported() {
  4.     echo org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported >&2
  5.     echo No hibernate script found >&2
  6.     exit 1
  7. }
  8.  
  9. # Make a suitable command line argument so that the tools can do the correct
  10. # quirks for video resume.
  11. # Passing the quirks to the tool allows the tool to not depend on HAL for data.
  12. QUIRKS=""
  13. [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_S3_BIOS" = "true" ] && QUIRKS="$QUIRKS --quirk-s3-bios"
  14. [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_S3_MODE" = "true" ] && QUIRKS="$QUIRKS --quirk-s3-mode"
  15. [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_DPMS_SUSPEND" = "true" ] && QUIRKS="$QUIRKS --quirk-dpms-suspend"
  16. [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_DPMS_ON" = "true" ] && QUIRKS="$QUIRKS --quirk-dpms-on"
  17. [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_VBESTATE_RESTORE" = "true" ] && QUIRKS="$QUIRKS --quirk-vbestate-restore"
  18. [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_VBEMODE_RESTORE" = "true" ] && QUIRKS="$QUIRKS --quirk-vbemode-restore"
  19. [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_VGA_MODE_3" = "true" ] && QUIRKS="$QUIRKS --quirk-vga-mode3"
  20. [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_VBE_POST" = "true" ] && QUIRKS="$QUIRKS --quirk-vbe-post"
  21. [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_RADEON_OFF" = "true" ] && QUIRKS="$QUIRKS --quirk-radeon-off"
  22. [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_RESET_BRIGHTNESS" = "true" ] && QUIRKS="$QUIRKS --quirk-reset-brightness"
  23. [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_NONE" = "true" ] && QUIRKS="$QUIRKS --quirk-none"
  24.  
  25. # We only support pm-utils
  26. if [ -x /usr/sbin/pm-hibernate ] ; then
  27.     /usr/sbin/pm-hibernate $QUIRKS
  28.     RET=$?
  29. else
  30.     unsupported
  31. fi
  32.  
  33. #Refresh devices as a resume can do funny things
  34. for type in button battery ac_adapter
  35. do
  36.     devices=`hal-find-by-capability --capability $type`
  37.     for device in $devices
  38.     do
  39.         dbus-send --system --print-reply --dest=org.freedesktop.Hal \
  40.               $device org.freedesktop.Hal.Device.Rescan
  41.     done
  42. done
  43.  
  44. exit $RET
  45.