mirror of
https://github.com/clearml/go-nvlib
synced 2025-01-31 02:47:02 +00:00
Ensure pci bus ID is lower case
The PCI Bus ID returned by NVML is upper case and results in the following error: error getting PCI device class for device: failed to construct PCI device: unable to read PCI device vendor id for 0000:0A:00.0: open /sys/bus/pci/devices/0000:0A:00.0/vendor: no such file or directory Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
9110850748
commit
fa5d0408ce
@ -224,7 +224,7 @@ func (d *device) getClass() (Class, error) {
|
||||
}
|
||||
bytes = append(bytes, byte(b))
|
||||
}
|
||||
id := string(bytes)
|
||||
id := strings.ToLower(string(bytes))
|
||||
|
||||
if id != "0000" {
|
||||
id = strings.TrimPrefix(id, "0000")
|
||||
@ -232,7 +232,7 @@ func (d *device) getClass() (Class, error) {
|
||||
|
||||
device, err := nvpci.New().GetGPUByPciBusID(id)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("failed to construct PCI device: %v", ret)
|
||||
return 0, fmt.Errorf("failed to construct PCI device: %v", err)
|
||||
}
|
||||
|
||||
return Class(device.Class), nil
|
||||
|
Loading…
Reference in New Issue
Block a user