Closed hingino closed 1 year ago
GPU does not currently return driver version for Windows. Adding these 3 lines reliably returns driver version
package main import ( "fmt" "github.com/jaypipes/ghw" ) type gpuInfo struct { Vendor string Name string OfflineDriver string } func GetGpuData() []gpuInfo { gpus := []gpuInfo{} cards, err := ghw.GPU() if err != nil { fmt.Printf("Error getting GPU info: %v", err) } for _, card := range cards.GraphicsCards { gpu := gpuInfo{ Name: card.DeviceInfo.Product.Name, Vendor: card.DeviceInfo.Vendor.Name, OfflineDriver: card.DeviceInfo.Driver, } gpus = append(gpus, gpu) } return gpus } func main() { gpus := GetGpuData() for _, gpu := range gpus { println("GPU Vendor: ", gpu.Vendor) println("GPU Name: ", gpu.Name) println("Driver: ", gpu.OfflineDriver) } }
GPU Vendor: NVIDIA GPU Name: NVIDIA GeForce RTX 3060 Ti Driver:
GPU Vendor: NVIDIA GPU Name: NVIDIA GeForce RTX 3060 Ti Driver: 31.0.15.3118
Description
GPU does not currently return driver version for Windows. Adding these 3 lines reliably returns driver version
Test
Returns before update
Return after update