UUBulb 09c4ef1764
refactor(pty): switch to using interface (#34)
* refactor(pty): switch to using interface

for better flexibility (although may not be useful)

* chore: reduce error messages

* delete redundant messages
2024-07-07 10:18:59 +08:00

28 lines
465 B
Go

//go:build !darwin
// +build !darwin
package gpu
import (
"errors"
"github.com/jaypipes/ghw"
)
func GetGPUModel() ([]string, error) {
var gpuModel []string
gi, err := ghw.GPU(ghw.WithDisableWarnings())
if err != nil {
return nil, err
}
for _, card := range gi.GraphicsCards {
if card.DeviceInfo == nil {
return nil, errors.New("Cannot find device info")
}
gpuModel = append(gpuModel, card.DeviceInfo.Product.Name)
}
return gpuModel, nil
}