shares/resources/usbid: Only load the database once

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
This commit is contained in:
Stéphane Graber 2025-11-28 00:46:24 -05:00
parent edbfefb528
commit 185a340466
No known key found for this signature in database
GPG Key ID: C638974D64792D67

View File

@ -32,6 +32,11 @@ var (
// Load reads the USB database from disk.
func Load() {
// Only load the database once.
if Vendors != nil && Classes != nil {
return
}
usbidFile := os.Getenv("INCUS_USBIDS_PATH")
if usbidFile == "" {
usbidFile = "/usr/share/misc/usb.ids"