--- tools/bsdsunix/hal-system-power-suspend-bsdsunix.orig 2016-12-05 16:21:28 UTC +++ tools/bsdsunix/hal-system-power-suspend-bsdsunix @@ -0,0 +1,35 @@ +#!/bin/sh + +alarm_not_supported() { + echo org.freedesktop.Hal.Device.SystemPowerManagement.AlarmNotSupported >&2 + echo Waking the system up is not supported >&2 + exit 1 +} + +unsupported() { + echo org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported >&2 + echo No suspend method found >&2 + exit 1 +} + +read seconds_to_sleep + +if [ -x /usr/sbin/zzz ] ; then + /usr/sbin/zzz + RET=$? +else + unsupported +fi + +#Refresh devices as a resume can do funny things +for type in button battery ac_adapter +do + devices=`hal-find-by-capability --capability $type` + for device in $devices + do + dbus-send --system --print-reply --dest=org.freedesktop.Hal \ + $device org.freedesktop.Hal.Device.Rescan + done +done + +exit $RET