home *** CD-ROM | disk | FTP | other *** search
/ tusportal.tus.k12.pa.us / tusportal.tus.k12.pa.us.tar / tusportal.tus.k12.pa.us / Wyse / latest-image.raw / 0.img / usr / lib / hal / scripts / linux / hal-system-power-suspend-hybrid-linux < prev    next >
Text File  |  2010-05-09  |  2KB  |  54 lines

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