parsable nvidia-detect
John Bazik
jbazik at gmail.com
Thu Jun 10 05:44:46 BST 2021
Nvidia-detect is super helpful, but only for humans. I wrote a similar sh script that produces parsable output. I needed a script I can use to automate driver selection and installation. It depends only on the contents and names of the .ids files in /usr/share/nvidia, so it shouldn't need to be updated over time. I'm happy to contribute it if others would find it helpful. I GPL'd it. Sample output:
$ nvidia-driver -h
usage: nvidia-driver [PCIID]..
-a, --all list all devices and driver versions
-h, --help print this message
-n, --numver just show driver major version number
$ nvidia-driver
10DE1402 nvidia-driver
$ nvidia-driver -n
10DE1402 418
$ nvidia-driver -a
10DE1402 nvidia-driver nvidia-legacy-390xx-driver
$ nvidia-driver -n -a
10DE1402 418 390
$ nvidia-driver -a 10DE1D81 10DE1245
10DE1D81 nvidia-driver nvidia-legacy-390xx-amd64-driver:amd64
10DE1245 nvidia-legacy-390xx-driver nvidia-legacy-340xx-driver nvidia-legacy-304xx-driver
$ nvidia-driver 10DE124x
10DE124x none
It doesn't know about debian releases, but it's easy to check if a particular driver is available. Here it is:
https://gist.github.com/jbazik/d5dc0d0be25d1769027abbc3f049cbb2
John
More information about the pkg-nvidia-devel
mailing list