hal/tools Makefile.am, 1.18, 1.19 hal-system-power-hibernate, NONE, 1.1 hal-system-power-set-power-save, NONE, 1.1 hal-system-power-suspend, NONE, 1.1

David Zeuthen david at freedesktop.org
Tue Aug 16 11:08:44 PDT 2005


Update of /cvs/hal/hal/tools
In directory gabe:/tmp/cvs-serv9732/tools

Modified Files:
	Makefile.am 
Added Files:
	hal-system-power-hibernate hal-system-power-set-power-save 
	hal-system-power-suspend 
Log Message:
2005-08-16  David Zeuthen  <davidz at redhat.com>

        First stab at system power management... Need to put this in the
        hal spec too..

        * hal.conf.in: Add security policy for Device.SystemPowerManagement
        and Device.Volume.Crypto interfaces - only allow the console user to
        invoke methods on these interfaces

        * fdi/policy/10osvendor/10-power-mgmt-policy.fdi: Add methods
        Suspend(int secondsBeforeWakeup), Hibernate() and
        SetPowerSave(bool shouldSavePower) to the
        org.freedesktop.Hal.Device.SystemPowerManagement interface

        * tools/Makefile.am (sbin_SCRIPTS): Add hal-system-power-*

        * tools/hal-system-power-hibernate: New file

        * tools/hal-system-power-suspend: New file

        * tools/hal-system-power-set-power-save: New file



Index: Makefile.am
===================================================================
RCS file: /cvs/hal/hal/tools/Makefile.am,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- Makefile.am	28 Jul 2005 00:55:09 -0000	1.18
+++ Makefile.am	16 Aug 2005 18:08:42 -0000	1.19
@@ -43,7 +43,11 @@
 endif
 ## FSTAB_SYNC_ENABLED end
 
-sbin_SCRIPTS = hal-luks-setup hal-luks-remove
+sbin_SCRIPTS =                            \
+	hal-luks-setup hal-luks-remove    \
+	hal-system-power-suspend          \
+	hal-system-power-hibernate        \
+	hal-system-power-set-power-save
 
 EXTRA_DIST=$(man_MANS) $(MAN_IN_FILES) gen-libgphoto-hal-fdi
 

--- NEW FILE: hal-system-power-hibernate ---
#!/bin/sh

unknown_distro() {
    echo org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported >&2
    echo No hibernate script found >&2
    exit 1
}


if [ -f /etc/redhat-release ] || [ -f /etc/fedora-release ] ; then
    /usr/sbin/pm-hibernate
    RET=$?
else
    # TODO: support other distros
    unknown_distro
fi

exit $RET

--- NEW FILE: hal-system-power-set-power-save ---
#!/bin/sh

read value

# TODO: write code here
if [ $value = "true" ]; then
    echo TODO: enable power savings
elif [ $value = "false" ]; then
    echo TODO: disable power savings
fi

--- NEW FILE: hal-system-power-suspend ---
#!/bin/sh

alarm_not_supported() {
    echo org.freedesktop.Hal.Device.SystemPowerManagement.AlarmNotSupported >&2
    echo Waking the system up is not supported >&2
    exit 1
}

unknown_distro() {
    echo org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported >&2
    echo No suspend script found >&2
    exit 1
}

read seconds_to_sleep

if [ -f /etc/redhat-release ] || [ -f /etc/fedora-release ] ; then
    # TODO: fix pm-suspend to take a --wakeup-alarm argument
    if [ $seconds_to_sleep != "0" ] ; then
	alarm_not_supported
    fi
    /usr/sbin/pm-suspend
    RET=$?
    # TODO: fixup pm-suspend to define erroc code (see alarm above) and throw
    #       the appropriate exception
else
    # TODO: support other distros
    unknown_distro
fi

exit $RET




More information about the hal-commit mailing list