diff --git a/sbin/snail.nv_pwr_off b/sbin/snail.nv_pwr_off index 4f06028..132291f 100755 --- a/sbin/snail.nv_pwr_off +++ b/sbin/snail.nv_pwr_off @@ -4,6 +4,20 @@ TRIES=8 lsmod | grep '^nouveau ' >/dev/null && modprobe -rf nouveau &>/dev/null +# Trying bbswitch method +if [ -f /proc/acpi/bbswitch ]; then + let tries=$TRIES + while [ 0 -lt $tries ]; do + modprobe -r nvidia \ + && echo 'OFF' > /proc/acpi/bbswitch \ + && exit 0 + + sleep 0.01 + let tries-- + echo "tries left: $tries" + done +fi + # Trying acpi_call method if [ -f /proc/acpi/call ]; then model=`dmidecode $@ -s system-product-name` diff --git a/sbin/snail.nv_pwr_on b/sbin/snail.nv_pwr_on index 133d570..a2a24a8 100755 --- a/sbin/snail.nv_pwr_on +++ b/sbin/snail.nv_pwr_on @@ -4,6 +4,21 @@ TRIES=8 lsmod | grep '^nouveau ' >/dev/null && modprobe -rf nouveau &>/dev/null +# Trying bbswitch method +if [ -f /proc/acpi/bbswitch ]; then + let tries=$TRIES + while [ 0 -lt $tries ]; do + echo 'ON' > /proc/acpi/bbswitch \ + && modprobe nvidia \ + && exit 0 + + sleep 0.01 + let tries-- + echo "tries left: $tries" + done + +fi + # Trying acpi_call method if [ -f /proc/acpi/call ]; then model=`dmidecode $@ -s system-product-name`