On my laptop the PCI bus printed by lspci for the Nvidia GPU is 2d:00.0 3D controller: NVIDIA and so the regex was not picking it up as it was searching only for base-10 numbers for the first 2 digits. Adding letters from a to f and changing the conversion from string to int to use base-16 made it work.
On my laptop the PCI bus printed by
lspci
for the Nvidia GPU is2d:00.0 3D controller: NVIDIA
and so the regex was not picking it up as it was searching only for base-10 numbers for the first 2 digits. Adding letters from a to f and changing the conversion from string to int to use base-16 made it work.