Commit 84c0803f authored by Dylan Araps's avatar Dylan Araps

Merge #421: Fix multi gpu detection on Linux

parent 954b0ee2
...@@ -968,8 +968,17 @@ getgpu() { ...@@ -968,8 +968,17 @@ getgpu() {
if [ -f "/tmp/neofetch/gpu" ]; then if [ -f "/tmp/neofetch/gpu" ]; then
source "/tmp/neofetch/gpu" source "/tmp/neofetch/gpu"
else else
bdf_number="$(PATH="/sbin:$PATH" lspci -k | grep -A2 'VGA' | grep -B2 'Kernel driver in use' | awk '/^\w/ {print $1}')"
if [ -z "$bdf_number" ]; then
# Fallback if no kernel driver is in use
gpu="$(PATH="/sbin:$PATH" lspci -mm | awk -F '\\"|\\" \\"' '/3D|VGA/ {print $3 " " $4}')" gpu="$(PATH="/sbin:$PATH" lspci -mm | awk -F '\\"|\\" \\"' '/3D|VGA/ {print $3 " " $4}')"
else
# Find the currently used GPU by its BDF
gpu="$(PATH="/sbin:$PATH" lspci -mm | awk -v bdf_number="$bdf_number" -F '\\"|\\" \\"' '$0 ~ bdf_number {print $3 " " $4}')"
fi
case "$gpu" in case "$gpu" in
intel*) gpu="Intel Integrated Graphics" ;; intel*) gpu="Intel Integrated Graphics" ;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment