Try all power methods with higher priority for acpi_call

This commit is contained in:
Kolan Sh 2012-04-10 10:44:12 +04:00
parent 7e67c7f4cf
commit 137559106b
2 changed files with 28 additions and 32 deletions

View File

@ -4,22 +4,6 @@ TRIES=8
lsmod | grep '^nouveau ' >/dev/null && modprobe -rf nouveau &>/dev/null
# Trying vgaswitcheroo method
if [ -f /sys/kernel/debug/vgaswitcheroo/switch ]; then
let tries=$TRIES
while [ 0 -lt $tries ]; do
modprobe -r nvidia \
&& echo 'OFF' > /sys/kernel/debug/vgaswitcheroo/switch \
&& exit 0
sleep 0.01
let tries--
echo "tries left: $tries"
done
echo "Cann't power off nVidia chip ;-("
exit -1
fi
# Trying acpi_call method
if [ -f /proc/acpi/call ]; then
model=`dmidecode $@ -s system-product-name`
@ -112,5 +96,19 @@ if [ -f /proc/acpi/call ]; then
done
fi
# Trying vgaswitcheroo method
if [ -f /sys/kernel/debug/vgaswitcheroo/switch ]; then
let tries=$TRIES
while [ 0 -lt $tries ]; do
modprobe -r nvidia \
&& echo 'OFF' > /sys/kernel/debug/vgaswitcheroo/switch \
&& exit 0
sleep 0.01
let tries--
echo "tries left: $tries"
done
fi
echo "Cann't power off nVidia chip"
exit -1

View File

@ -4,22 +4,6 @@ TRIES=8
lsmod | grep '^nouveau ' >/dev/null && modprobe -rf nouveau &>/dev/null
# Trying vgaswitcheroo method
if [ -f /sys/kernel/debug/vgaswitcheroo/switch ]; then
let tries=$TRIES
while [ 0 -lt $tries ]; do
echo 'ON' > /sys/kernel/debug/vgaswitcheroo/switch \
&& modprobe nvidia \
&& exit 0
sleep 0.01
let tries--
echo "tries left: $tries"
done
echo "Cann't power on nVidia chip ;-("
exit -1
fi
# Trying acpi_call method
if [ -f /proc/acpi/call ]; then
model=`dmidecode $@ -s system-product-name`
@ -112,5 +96,19 @@ if [ -f /proc/acpi/call ]; then
done
fi
# Trying vgaswitcheroo method
if [ -f /sys/kernel/debug/vgaswitcheroo/switch ]; then
let tries=$TRIES
while [ 0 -lt $tries ]; do
echo 'ON' > /sys/kernel/debug/vgaswitcheroo/switch \
&& modprobe nvidia \
&& exit 0
sleep 0.01
let tries--
echo "tries left: $tries"
done
fi
echo "Cann't power on nVidia chip"
exit -1