1 Commits

Author SHA1 Message Date
Hadi 2c54df832c Use the hash instead of ID to get the Status
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
2026-05-05 19:47:01 +02:00
2 changed files with 5 additions and 3 deletions
+3 -3
View File
@@ -29,7 +29,7 @@ func ListDevices() ([]Device, error) {
}
d, err := parseLine(line)
if err == nil {
d.Permanent = rules[d.VidPid] == d.Status
d.Permanent = rules[d.Hash] == d.Status
devices = append(devices, d)
}
}
@@ -47,8 +47,8 @@ func listRules() map[string]Status {
continue
}
d, err := parseLine(line)
if err == nil {
rules[d.VidPid] = d.Status
if err == nil && d.Hash != "" {
rules[d.Hash] = d.Status
}
}
return rules
+2
View File
@@ -20,6 +20,7 @@ type Device struct {
Name string
Status Status
VidPid string
Hash string
Permanent bool
}
@@ -57,6 +58,7 @@ func parseLine(line string) (Device, error) {
Name: name,
Status: status,
VidPid: extractUnquoted(rest, "id"),
Hash: extractField(rest, "hash"),
}, nil
}