mirror of
https://github.com/anotherhadi/usbguard-tui.git
synced 2026-05-11 22:02:34 +02:00
Use the hash instead of ID to get the Status
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
@@ -29,7 +29,7 @@ func ListDevices() ([]Device, error) {
|
|||||||
}
|
}
|
||||||
d, err := parseLine(line)
|
d, err := parseLine(line)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
d.Permanent = rules[d.VidPid] == d.Status
|
d.Permanent = rules[d.Hash] == d.Status
|
||||||
devices = append(devices, d)
|
devices = append(devices, d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,8 +47,8 @@ func listRules() map[string]Status {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
d, err := parseLine(line)
|
d, err := parseLine(line)
|
||||||
if err == nil {
|
if err == nil && d.Hash != "" {
|
||||||
rules[d.VidPid] = d.Status
|
rules[d.Hash] = d.Status
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rules
|
return rules
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ type Device struct {
|
|||||||
Name string
|
Name string
|
||||||
Status Status
|
Status Status
|
||||||
VidPid string
|
VidPid string
|
||||||
|
Hash string
|
||||||
Permanent bool
|
Permanent bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,6 +58,7 @@ func parseLine(line string) (Device, error) {
|
|||||||
Name: name,
|
Name: name,
|
||||||
Status: status,
|
Status: status,
|
||||||
VidPid: extractUnquoted(rest, "id"),
|
VidPid: extractUnquoted(rest, "id"),
|
||||||
|
Hash: extractField(rest, "hash"),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user