From 137559106b5e28dba6fabcc963e509c9c7d2680c Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Tue, 10 Apr 2012 10:44:12 +0400 Subject: [PATCH] Try all power methods with higher priority for acpi_call --- sbin/snail.nv_pwr_off | 30 ++++++++++++++---------------- sbin/snail.nv_pwr_on | 30 ++++++++++++++---------------- 2 files changed, 28 insertions(+), 32 deletions(-) diff --git a/sbin/snail.nv_pwr_off b/sbin/snail.nv_pwr_off index 2d4de50..4f06028 100755 --- a/sbin/snail.nv_pwr_off +++ b/sbin/snail.nv_pwr_off @@ -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 diff --git a/sbin/snail.nv_pwr_on b/sbin/snail.nv_pwr_on index 8612506..133d570 100755 --- a/sbin/snail.nv_pwr_on +++ b/sbin/snail.nv_pwr_on @@ -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