1*d2ec54f7Sphitran#!/bin/sh 2*d2ec54f7Sphitran# 3*d2ec54f7Sphitran# hal-system-system-power-suspend-sunos.sh 4*d2ec54f7Sphitran# 5*d2ec54f7Sphitran# Licensed under the Academic Free License version 2.1 6*d2ec54f7Sphitran# 7*d2ec54f7Sphitran 8*d2ec54f7Sphitranalarm_not_supported() { 9*d2ec54f7Sphitran echo org.freedesktop.Hal.Device.SystemPowerManagement.AlarmNotSupported >&2 10*d2ec54f7Sphitran echo Waking the system up is not supported >&2 11*d2ec54f7Sphitran exit 1 12*d2ec54f7Sphitran} 13*d2ec54f7Sphitran 14*d2ec54f7Sphitranunsupported() { 15*d2ec54f7Sphitran echo org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported >&2 16*d2ec54f7Sphitran echo No suspend method found >&2 17*d2ec54f7Sphitran exit 1 18*d2ec54f7Sphitran} 19*d2ec54f7Sphitran 20*d2ec54f7Sphitranread seconds_to_sleep 21*d2ec54f7Sphitranif [ $seconds_to_sleep != "0" ] ; then 22*d2ec54f7Sphitran alarm_not_supported 23*d2ec54f7Sphitranfi 24*d2ec54f7Sphitran 25*d2ec54f7Sphitranif [ -x "/usr/sbin/uadmin" ] ; then 26*d2ec54f7Sphitran /usr/sbin/uadmin 3 20 27*d2ec54f7Sphitran RET=$? 28*d2ec54f7Sphitranelse 29*d2ec54f7Sphitran unsupported 30*d2ec54f7Sphitranfi 31*d2ec54f7Sphitran 32*d2ec54f7Sphitran#Refresh devices as a resume can do funny things 33*d2ec54f7Sphitranfor type in button battery ac_adapter 34*d2ec54f7Sphitrando 35*d2ec54f7Sphitran devices=`hal-find-by-capability --capability $type` 36*d2ec54f7Sphitran for device in $devices 37*d2ec54f7Sphitran do 38*d2ec54f7Sphitran dbus-send --system --print-reply --dest=org.freedesktop.Hal \ 39*d2ec54f7Sphitran $device org.freedesktop.Hal.Device.Rescan 40*d2ec54f7Sphitran done 41*d2ec54f7Sphitrandone 42*d2ec54f7Sphitran 43*d2ec54f7Sphitranexit $RET 44