GPU: Count from 1, Add $gpu_show to change which GPUs are displayed

This commit is contained in:
Dylan Araps 2016-12-22 13:19:25 +11:00
parent 37d3b9f9a4
commit ab4edd42cf

View file

@ -969,9 +969,14 @@ get_gpu() {
gpus=($(lspci -mm | awk -F '\\"|\\" \\"' '/"Display|"3D|"VGA/ {print $3 " " $4}')) gpus=($(lspci -mm | awk -F '\\"|\\" \\"' '/"Display|"3D|"VGA/ {print $3 " " $4}'))
# Number the GPUs if more than one exists. # Number the GPUs if more than one exists.
(( "${#gpus[@]}" > 1 )) && gpu_num=0 (( "${#gpus[@]}" > 1 )) && gpu_num=1
for gpu in "${gpus[@]}"; do for gpu in "${gpus[@]}"; do
# GPU shorthand tests.
[[ "$gpu_show" == "dedicated" && "$gpu" =~ (i|I)ntel ]] || \
[[ "$gpu_show" == "integrated" && ! "$gpu" =~ (i|I)ntel ]] && \
{ unset -v gpu; continue; }
case "$gpu" in case "$gpu" in
*"advanced"*) *"advanced"*)
gpu="${gpu/'[AMD/ATI]' }" gpu="${gpu/'[AMD/ATI]' }"