disabpe-secondary-gpu service fix
This commit is contained in:
1 parent
0c8739e0af
commit
c5aa7b1f86
1 file changed
+10
-7
@@ -1,4 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
if [[ ! -f /var/cache/disable-gpu ]] &>/dev/null; then
|
if [[ ! -f /var/cache/disable-gpu ]] &>/dev/null; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@@ -7,23 +9,24 @@ if grep "nomodeset" /proc/cmdline ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
remove_pci(){
|
remove_pci(){
|
||||||
if [[ -d "/sys/bus/pci/devices/0000:$1/driver" ]] ; then
|
if [[ -d "/sys/bus/pci/devices/$1/driver" ]] ; then
|
||||||
module=$(basename $(readlink /sys/bus/pci/devices/0000:$1/driver/module))
|
module=$(basename $(readlink /sys/bus/pci/devices/$1/driver/module))
|
||||||
echo "Disabled: $module ($1)"
|
echo "Disabled: $module ($1)"
|
||||||
rmmod -f $module
|
rmmod -f $module
|
||||||
fi
|
fi
|
||||||
echo 1 > /sys/bus/pci/devices/0000:$1/remove
|
echo 1 > /sys/bus/pci/devices/$1/remove
|
||||||
}
|
}
|
||||||
|
|
||||||
echo 1 > /sys/bus/pci/rescan
|
echo 1 > /sys/bus/pci/rescan
|
||||||
|
|
||||||
for dir in /sys/class/drm/card[0-9*] ; do
|
for dir in $(ls /sys/bus/pci/devices/); do
|
||||||
# 03 Display controller
|
# 03 Display controller
|
||||||
# 02 3D controller
|
# 02 3D controller
|
||||||
if grep "^0x0302" $dir/device/class ; then
|
if grep "^0x0302" /sys/bus/pci/devices/$dir/class ; then
|
||||||
pci="$(basename $(readlink $dir/device))"
|
pci="$dir"
|
||||||
echo "Found 3D controller: ${pci:5}"
|
echo "Found 3D controller: ${pci:5}"
|
||||||
remove_pci "${pci:5}"
|
remove_pci "$pci"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
udevadm control --reload
|
udevadm control --reload
|
||||||
Reference in new issue
Block a user