|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /etc/pm/ |
Upload File : |
#!/bin/bash
. /etc/rc.d/init.d/functions
. /etc/sysconfig/pm
if [ -z "$HIBERNATE_RESUME_POST_VIDEO" ]; then
HIBERNATE_RESUME_POST_VIDEO="no"
fi
export HIBERNATE_RESUME_POST_VIDEO
get_video_type()
{
(
vendor=$(eval echo \
$(/sbin/lspci -mn | awk '{if ($2 ~ /^"0300"$/ ) print $3 }'))
[ -z "$vendor" ] && return 1
case "$vendor" in
1002)
echo ATI
return 0
;;
10de)
echo nVidia
return 0
;;
8086)
echo Intel
return 0
;;
*)
echo $vendor
return 0
;;
esac
)
}
get_lcd_status()
{
return 0
}
lcd_on()
{
return 0
}
lcd_off()
{
return 0
}
get_crt_status()
{
return 0
}
crt_on()
{
return 0
}
crt_off()
{
return 0
}
suspend_video()
{
return 0;
}
resume_video()
{
return 0;
}
rotate_video_state()
{
STATUS="$(get_crt_status) $(get_lcd_status)"
case "$STATUS" in
"off off")
crt_off
lcd_on
;;
"off on")
crt_on
lcd_on
;;
"on on")
crt_on
lcd_off
;;
"on off")
crt_off
lcd_off
;;
*)
;;
esac
}
take_suspend_lock()
{
VT=$(/usr/bin/fgconsole)
chvt 63
if [ -f ./suspended ]; then
pid=$(cat /.suspended)
if [ -d /proc/$pid ]; then
return 1
fi
fi
echo "$$" > /.suspended
return 0
}
remove_suspend_lock()
{
chvt $VT
openvt -- sh -c "usleep $1 ; rm -f /.suspended >/dev/null 2>&1 0<&1" >/dev/null 2>&1 0<&1 &
}
run_hooks()
{
[ -z "$1" ] && return 0
files="/etc/pm/hooks/*"
if [ "$2" = "reverse" ]; then
files=$(echo $files | awk '{ for (i=NF; i>=1; i--) print $i }')
fi
for file in $files ; do
[ -x $file ] && $file $1
done
}
get_power_status()
{
RETVAL=0
on_ac_power
case "$?" in
"0")
echo "ac"
;;
"1")
echo "battery"
;;
"255")
echo "error"
RETVAL=1
;;
esac
return $RETVAL
}
default_resume_kernel()
{
case $(uname -m) in
i?86|x86_64|athlon)
;;
*) # this is only valid for x86 and x86_64
return 1
esac
[ -x /sbin/grubby -a -x /sbin/grub ] || return 1
[ -e /boot/vmlinuz-$(uname -r) ] || return 1
out=$(/sbin/grubby --info /boot/vmlinuz-$(uname -r) |grep index)
[ -n "${out}" ] || return 1
current=${out#index=}
echo "savedefault --default=${current} --once" | /sbin/grub --batch --no-floppy --device-map=/boot/grub/device.map --no-floppy
return 0
}