|
|
|
@ -1,19 +1,18 @@
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
function exit_script {
|
|
|
|
|
sleep 0.5
|
|
|
|
|
if nvidia-smi | grep "No running processes found"; then
|
|
|
|
|
sudo rmmod nvidia_modeset
|
|
|
|
|
sudo rmmod nvidia
|
|
|
|
|
sudo sh -c 'echo "\\_SB.PCI0.GPP0.PG00._OFF" > /proc/acpi/call'
|
|
|
|
|
fi
|
|
|
|
|
function exit_script() {
|
|
|
|
|
echo 1 | sudo tee /sys/bus/pci/devices/0000:01:00.0/remove
|
|
|
|
|
echo 1 | sudo tee /sys/bus/pci/devices/0000:01:00.1/remove
|
|
|
|
|
echo 1 | sudo tee /sys/bus/pci/devices/0000:01:00.2/remove
|
|
|
|
|
echo 1 | sudo tee /sys/bus/pci/devices/0000:01:00.3/remove
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trap exit_script SIGINT
|
|
|
|
|
trap exit_script SIGTERM
|
|
|
|
|
if lsmod | grep nvidia; then
|
|
|
|
|
if lspci | grep -i nvidia; then
|
|
|
|
|
vblank_mode=0 primusrun "$@"
|
|
|
|
|
else
|
|
|
|
|
sudo sh -c 'echo "\\_SB.PCI0.GPP0.PG00._ON" > /proc/acpi/call'
|
|
|
|
|
echo 1 | sudo tee /sys/bus/pci/rescan
|
|
|
|
|
sudo modprobe nvidia
|
|
|
|
|
sleep 1
|
|
|
|
|
vblank_mode=0 primusrun "$@"
|
|
|
|
|
fi
|
|
|
|
|