Try all power methods with higher priority for acpi_call
This commit is contained in:
parent
7e67c7f4cf
commit
137559106b
|
@ -4,22 +4,6 @@ TRIES=8
|
||||||
|
|
||||||
lsmod | grep '^nouveau ' >/dev/null && modprobe -rf nouveau &>/dev/null
|
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
|
# Trying acpi_call method
|
||||||
if [ -f /proc/acpi/call ]; then
|
if [ -f /proc/acpi/call ]; then
|
||||||
model=`dmidecode $@ -s system-product-name`
|
model=`dmidecode $@ -s system-product-name`
|
||||||
|
@ -112,5 +96,19 @@ if [ -f /proc/acpi/call ]; then
|
||||||
done
|
done
|
||||||
fi
|
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"
|
echo "Cann't power off nVidia chip"
|
||||||
exit -1
|
exit -1
|
||||||
|
|
|
@ -4,22 +4,6 @@ TRIES=8
|
||||||
|
|
||||||
lsmod | grep '^nouveau ' >/dev/null && modprobe -rf nouveau &>/dev/null
|
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
|
# Trying acpi_call method
|
||||||
if [ -f /proc/acpi/call ]; then
|
if [ -f /proc/acpi/call ]; then
|
||||||
model=`dmidecode $@ -s system-product-name`
|
model=`dmidecode $@ -s system-product-name`
|
||||||
|
@ -112,5 +96,19 @@ if [ -f /proc/acpi/call ]; then
|
||||||
done
|
done
|
||||||
fi
|
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"
|
echo "Cann't power on nVidia chip"
|
||||||
exit -1
|
exit -1
|
||||||
|
|
Loading…
Reference in New Issue