Skip to content

Commit bfc31b6

Browse files
Update model fetching
1 parent 42a5ac8 commit bfc31b6

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

core/tabs/system-setup/arch/nvidia-drivers.sh

+12-3
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,21 @@ installDeps() {
1616
done
1717
}
1818

19-
checkHardware() {
19+
checkNvidiaHardware() {
2020
# Refer https://nouveau.freedesktop.org/CodeNames.html for model code names
21-
model=$(lspci -k | grep -A 2 -E "(VGA|3D)" | grep controller | cut -d ' ' -f 7 | cut -c 1-2 )
21+
model=$(lspci -k | grep -A 2 -E "(VGA|3D)" | grep NVIDIA | sed 's/.*Corporation //;s/ .*//' | cut -c 1-2)
2222
case "$model" in
2323
GM|GP|GV) return 1 ;;
2424
TU|GA|AD) return 0 ;;
2525
*) printf "%b\n" "${RED}Unsupported hardware." && exit 1 ;;
2626
esac
2727
}
2828

29+
checkIntelHardware() {
30+
model=$(grep "model name" /proc/cpuinfo | head -n 1 | cut -d ':' -f 2 | cut -c 2-3)
31+
[ "$model" -ge 11 ]
32+
}
33+
2934
promptUser() {
3035
printf "%b" "Do you want to $1 ? [y/N]:"
3136
read -r confirm
@@ -82,7 +87,7 @@ setupHardwareAcceleration() {
8287

8388
installDriver() {
8489
# Refer https://wiki.archlinux.org/title/NVIDIA for open-dkms or dkms driver selection
85-
if checkHardware && promptUser "install nvidia's open source drivers"; then
90+
if checkNvidiaHardware && promptUser "install nvidia's open source drivers"; then
8691
printf "%b\n" "${YELLOW}Installing nvidia open source driver...${RC}"
8792
installDeps
8893
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm nvidia-open-dkms
@@ -92,6 +97,10 @@ installDriver() {
9297
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm nvidia-dkms
9398
fi
9499

100+
if checkIntelHardware; then
101+
setKernelParam "ibt=off"
102+
fi
103+
95104
# Refer https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks#Preserve_video_memory_after_suspend
96105
setKernelParam "nvidia.NVreg_PreserveVideoMemoryAllocations=1"
97106
"$ESCALATION_TOOL" systemctl enable nvidia-suspend.service nvidia-hibernate.service nvidia-resume.service

0 commit comments

Comments
 (0)