1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-04-23 20:57:10 +00:00

Merge pull request from marquiz/devel/sysfs-usb

source/usb: scan host sysfs
This commit is contained in:
Kubernetes Prow Robot 2022-10-24 11:52:23 -07:00 committed by GitHub
commit 1911abe9f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,6 +26,7 @@ import (
"k8s.io/klog/v2"
nfdv1alpha1 "sigs.k8s.io/node-feature-discovery/pkg/apis/nfd/v1alpha1"
"sigs.k8s.io/node-feature-discovery/pkg/utils/hostpath"
)
var devAttrs = []string{"class", "vendor", "device", "serial"}
@ -106,7 +107,7 @@ func detectUsb() ([]nfdv1alpha1.InstanceFeature, error) {
// Unlike PCI, the USB sysfs interface includes entries not just for
// devices. We work around this by globbing anything that includes a
// valid product ID.
const devPathGlob = "/sys/bus/usb/devices/*/idProduct"
devPathGlob := hostpath.SysfsDir.Path("bus/usb/devices/*/idProduct")
devPaths, err := filepath.Glob(devPathGlob)
if err != nil {
return nil, err