implement device linking

This commit is contained in:
2025-02-11 07:11:05 +00:00
parent 571093379f
commit 58ce74552b
4 changed files with 70 additions and 29 deletions

View File

@@ -35,21 +35,6 @@ func GetConfig(configPath string) Config {
return config
}
// finds the first substring r in s such that s = ... a r b ...
func FindSubstringBetween(s string, a string, b string) (string, error) {
x := strings.Split(s, a)
if len(x) <= 2 {
return "", fmt.Errorf("%s not found in %s", a, s)
}
y := strings.Split(x[1], b)
if len(y) <= 2 {
return "", fmt.Errorf("%s not found in %s", b, s)
}
return y[0], nil
}
// returns if a device pcie bus id is a super device or subsystem device
//
// subsystem devices always has the format xxxx:yy.z, whereas super devices have the format xxxx:yy