mirror of
https://github.com/clearml/go-nvlib
synced 2025-02-24 13:04:27 +00:00
Generate warnings instead of errors for unknown device / class ids in the PCI database.
Signed-off-by: Christopher Desiniotis <cdesiniotis@nvidia.com>
This commit is contained in:
parent
2c8c6ab21c
commit
114da86794
@ -39,6 +39,10 @@ const (
|
|||||||
PCI3dControllerClass uint32 = 0x030200
|
PCI3dControllerClass uint32 = 0x030200
|
||||||
// PCINvSwitchClass represents the PCI class for NVSwitches
|
// PCINvSwitchClass represents the PCI class for NVSwitches
|
||||||
PCINvSwitchClass uint32 = 0x068000
|
PCINvSwitchClass uint32 = 0x068000
|
||||||
|
// UnknownDeviceString is the device name to set for devices not found in the PCI database
|
||||||
|
UnknownDeviceString = "UNKNOWN_DEVICE"
|
||||||
|
// UnknownClassString is the class name to set for devices not found in the PCI database
|
||||||
|
UnknownClassString = "UNKNOWN_CLASS"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Interface allows us to get a list of all NVIDIA PCI devices
|
// Interface allows us to get a list of all NVIDIA PCI devices
|
||||||
@ -304,11 +308,13 @@ func (p *nvpci) GetGPUByPciBusID(address string) (*NvidiaPCIDevice, error) {
|
|||||||
|
|
||||||
deviceName, err := pciDB.GetDeviceName(uint16(vendorID), uint16(deviceID))
|
deviceName, err := pciDB.GetDeviceName(uint16(vendorID), uint16(deviceID))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to get device name: %v", err)
|
fmt.Printf("WARNING: unable to get device name: %v\n", err)
|
||||||
|
deviceName = UnknownDeviceString
|
||||||
}
|
}
|
||||||
className, err := pciDB.GetClassName(uint32(classID))
|
className, err := pciDB.GetClassName(uint32(classID))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to get class name for device: %v", err)
|
fmt.Printf("WARNING: unable to get class name for device: %v\n", err)
|
||||||
|
className = UnknownClassString
|
||||||
}
|
}
|
||||||
|
|
||||||
nvdevice := &NvidiaPCIDevice{
|
nvdevice := &NvidiaPCIDevice{
|
||||||
|
Loading…
Reference in New Issue
Block a user