#!/bin/bash # This script should contain the command(s) necessary to switch on 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 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 "Enabling nVidia card failed ($result)." ;; *) echo "Enabling nVidia card succeeded." ;; esac } echo -n "Doing ACPI calls..." #INSERTPOWERON #echo _ON $(acpi_call "\_SB.PCI0.PEG0.PEGP._ON") log=$(acpi_call "\_SB.PCI0.PEG0.PEGP._DSM {0xF8,0xD8,0x86,0xA4,0xDA,0x0B,0x1B,0x47,0xA7,0x2B,0x60,0x42,0xA6,0xB5,0xBE,0xE0} 0x100 0x1A {0x1,0x0,0x0,0x3}" && acpi_call "\_SB.PCI0.PEG0.PEGP._PS0") if [ $? -eq 0 ] ; then echo -e "\e[80C[ \e[1;32mOK\e[m ]" echo -n "Inserting driver..." modprobe nvidia-current else echo -e "\e[80C[\e[1;31mFAIL\e[m]" echo $log 1>&2 echo -n "Insert driver nevertheless? (y/n) " read answer; [ "x${answer}" = "xy" ] && modprobe nvidia-current fi [ $? -eq 0 ] && echo -e "\e[80C[ \e[1;32mOK\e[m ]" # modprobe nvidia-current