#!/bin/bash # This script should contain the command(s) necessary to switch off the # nVidia card. # This is a template script. # # Please note that the acpi_call module is need for these operations: # http://linux-hybrid-graphics.blogspot.com/2010/07/using-acpicall-module-to-switch-onoff.html echo -n "Withdrawing driver..." rmmod nvidia sleep 0.3 lsmod | grep -q nvidia if [ $? -eq 0 ] ; then echo -e "\e[78C[\e[1;31mFAIL\e[m]" echo "Error: could not unload nvidia module, leaving card turned on" 1>&2 exit else echo -e "\e[78C[ \e[1;32mOK\e[m ]" fi modprobe acpi_call if ! lsmod | grep -q acpi_call; then echo "Error: acpi_call module not loaded" exit fi acpi_call () { echo "$*" > /proc/acpi/call result=$(cat /proc/acpi/call) case "$result" in Error*) echo "Disabling nVidia card failed ($result)." ;; *) echo "Disabling nVidia card succeeded." ;; esac } echo -n "Doing ACPI calls..." #INSERTPOWEROFF # echo _OFF $(acpi_call "\_SB.PCI0.PEG0.PEGP._OFF") log=$(acpi_call "\_SB.PCI0.PEG0.PEGP._PS3") if [ $? -eq 0 ] ; then echo -e "\e[80C[ \e[1;32mOK\e[m ]" else echo -e "\e[80C[\e[1;31mFAIL\e[m]" echo $log 1>&2 fi