You are not logged in.

#1 2020-11-28 16:14:39

microman333
Member
Registered: 2019-07-21
Posts: 8

need help to create a bash function to determine GPU vendor

I am currently working on an Arch Linux installation script, which will be releases as open source project (GPL3) on github.

The above function works on my notebook using an intel gpu. I would need some testing from other people. Including dual gpu setups.

function get_gpu_vendor {
  case $(lspci | awk -F ':' '/VGA/ || /3D/ || /Display/ {split($3, subfield, " "); print subfield[1]}') in
    Advanced)
      echo 'amd'
      ;;
    Intel)
      echo 'intel'
      ;;
    NVIDIA)
      echo 'nvidia'
      ;;
     *)
      echo 'other'
      ;;
  esac
}

Any help appreciated!

Last edited by microman333 (2020-11-28 16:15:36)

Offline

#2 2020-11-28 16:16:57

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,461

Re: need help to create a bash function to determine GPU vendor

Just as a general question, you realize that anyone that uses your script cannot get support from the Arch community, right? You'd be responsible for all questions not only about installation, but about any issues they have with the system going forward.

Offline

#3 2020-11-28 16:31:07

seth
Member
Registered: 2012-09-03
Posts: 49,951

Re: need help to create a bash function to determine GPU vendor

Next question: you do realize that there's a major difference between a 3D and a VGA device?
Notably that one will provide crtc(s) and the other won't?

Did you read the wiki pages on optimus/prime?
How do you intend to scriptfy the possible use-cases?
Did you consider varying multiscreen needs?

Offline

#4 2020-12-10 12:00:46

yodermk
Member
Registered: 2012-07-17
Posts: 86

Re: need help to create a bash function to determine GPU vendor

I have an nvidia (use binary blob) and it prints that.

Offline

Board footer

Powered by FluxBB