KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21585/root/usr/lib/hal/scripts/linux/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21585/root/usr/lib/hal/scripts/linux/hal-system-power-suspend-linux
#!/bin/sh

POWERSAVED_SUSPEND2RAM="dbus-send --system --dest=com.novell.powersave \
                        --print-reply /com/novell/powersave \
                        com.novell.powersave.action.SuspendToRam"

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

# Make a suitable command line argument so that the tools can do the correct
# quirks for video resume.
# Passing the quirks to the tool allows the tool to not depend on HAL for data.
QUIRKS="--from-hal"
[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_S3_BIOS" = "true" ] && QUIRKS="$QUIRKS --quirk-s3-bios"
[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_S3_MODE" = "true" ] && QUIRKS="$QUIRKS --quirk-s3-mode"
[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_DPMS_SUSPEND" = "true" ] && QUIRKS="$QUIRKS --quirk-dpms-suspend"
[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_DPMS_ON" = "true" ] && QUIRKS="$QUIRKS --quirk-dpms-on"
[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_VBESTATE_RESTORE" = "true" ] && QUIRKS="$QUIRKS --quirk-vbestate-restore"
[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_VBEMODE_RESTORE" = "true" ] && QUIRKS="$QUIRKS --quirk-vbemode-restore"
[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_VGA_MODE_3" = "true" ] && QUIRKS="$QUIRKS --quirk-vga-mode3"
[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_VBE_POST" = "true" ] && QUIRKS="$QUIRKS --quirk-vbe-post"
[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_RADEON_OFF" = "true" ] && QUIRKS="$QUIRKS --quirk-radeon-off"
[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_NONE" = "true" ] && QUIRKS="$QUIRKS --quirk-none"

#PMU systems cannot use /sys/power/state yet, so use a helper to issue an ioctl
if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "pmu" ]; then
	hal-system-power-pmu sleep
	if [ $? -ne 0 ]; then
		echo "org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported" >&2
		exit 1
	fi
	exit 0
fi

#SuSE and ALTLinux only support powersave
if [ -f "/etc/altlinux-release" ] || [ -f "/etc/SuSE-release" ] ; then
	if [ -x /usr/bin/powersave ] ; then
	        $POWERSAVED_SUSPEND2RAM
		RET=$?
	else
		# TODO: add support
		unsupported
	fi

#Mandriva supports suspend-scripts 
elif [ -f "/etc/mandriva-release" ] ; then 
    # TODO: fix pmsuspend to take a --wakeup-alarm argument 
    if [ $seconds_to_sleep != "0" ] ; then 
	alarm_not_supported 
    fi 
    
    if [ -x "/usr/sbin/pmsuspend" ] ; then 
	/usr/sbin/pmsuspend memory
	RET=$? 
    else 
        # TODO: add support 
	unsupported 
    fi 

#RedHat/Fedora only support pm-utils
elif [ -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
	# TODO: fixup pm-suspend to define erroc code (see alarm above) and throw
	#	   the appropriate exception
	if [ -x "/usr/sbin/pm-suspend" ] ; then
		rm -f /var/lib/hal/system-power-suspend-output
		touch /var/lib/hal/system-power-suspend-output
		chmod 644 /var/lib/hal/system-power-suspend-output
		echo "==== Kernel version: ====" >> /var/lib/hal/system-power-suspend-output
		/bin/uname -a >> /var/lib/hal/system-power-suspend-output
		echo "==== Modules loaded before suspending: ====" >> /var/lib/hal/system-power-suspend-output
		/sbin/lsmod >> /var/lib/hal/system-power-suspend-output
		echo "==== Output of /usr/sbin/pm-suspend ====" >> /var/lib/hal/system-power-suspend-output
		/bin/bash -x /usr/sbin/pm-suspend $QUIRKS >> /var/lib/hal/system-power-suspend-output 2>&1
		RET=$?
		echo "==== DONE ====" >> /var/lib/hal/system-power-suspend-output
	else
		# TODO: add support
		unsupported
	fi

#FreeBSD uses zzz to suspend for both ACPI and APM
elif [ "x`uname -s`" = "xFreeBSD" ] ; then
	if [ -x /usr/sbin/zzz ] ; then
		/usr/sbin/zzz
		RET=$?
	else
		unsupported
	fi

#Other distros just need to have *any* tools installed
else
	if [ -x "/usr/bin/powersave" ] ; then
	    $POWERSAVED_SUSPEND2RAM
	    RET=$?
	elif [ -x "/usr/sbin/pmi" ] ; then
	    /usr/sbin/pmi action suspend force
	    RET=$?
	elif [ -w "/sys/power/state" ] ; then
	    # Use the raw kernel sysfs interface
	    echo "mem" > /sys/power/state
	    RET=$?
	else
	    # TODO: add other scripts support
	    unsupported
	    fi
	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 > /dev/null 2>&1
	done
done

exit $RET

Anon7 - 2021