After this change, if a subsystem name exists for a GPU, we display that name instead of the device name. This should fix the issue mentioned in #1490. For example, a card that would be shown as: GPU: AMD ATI Radeon RX 470/480/570/570X/580/580X/590 before will now be shown as: GPU: AMD ATI Radeon RX 480 4GB This fallback logic is implemented in the `awk` command. Additionally, the PCI address is now stripped from the awk output because it never is desirable to print it. It is, however, still kept internally in `awk` to distinguish multiple cards of the same model.
This commit is contained in:
parent
9b1108133c
commit
219714c86e
14
neofetch
14
neofetch
|
@ -2449,9 +2449,17 @@ get_gpu() {
|
||||||
case $os in
|
case $os in
|
||||||
"Linux")
|
"Linux")
|
||||||
# Read GPUs into array.
|
# Read GPUs into array.
|
||||||
gpu_cmd="$(lspci -mm | awk -F '\"|\" \"|\\(' \
|
gpu_cmd="$(lspci -mm |
|
||||||
'/"Display|"3D|"VGA/ {a[$0] = $1 " " $3 " " $4}
|
awk -F '\"|\" \"|\\(' \
|
||||||
END {for(i in a) {if(!seen[a[i]]++) print a[i]}}')"
|
'/"Display|"3D|"VGA/ {
|
||||||
|
a[$0] = $1 " " $3 " " ($7 ~ /^$|^Device [[:xdigit:]]+$/ ? $4 : $7)
|
||||||
|
}
|
||||||
|
END { for (i in a) {
|
||||||
|
if (!seen[a[i]]++) {
|
||||||
|
sub("^[^ ]+ ", "", a[i]);
|
||||||
|
print a[i]
|
||||||
|
}
|
||||||
|
}}')"
|
||||||
IFS=$'\n' read -d "" -ra gpus <<< "$gpu_cmd"
|
IFS=$'\n' read -d "" -ra gpus <<< "$gpu_cmd"
|
||||||
|
|
||||||
# Remove duplicate Intel Graphics outputs.
|
# Remove duplicate Intel Graphics outputs.
|
||||||
|
|
Reference in New Issue