From ed1e8009454b725527cc6df247a33ae53e3f4bbe Mon Sep 17 00:00:00 2001 From: Jonathan Vogt Date: Tue, 17 Dec 2024 11:34:11 +0100 Subject: [PATCH] new library returns error --- yubikey/yubikey.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/yubikey/yubikey.go b/yubikey/yubikey.go index 7e7845b..56bd8bc 100644 --- a/yubikey/yubikey.go +++ b/yubikey/yubikey.go @@ -12,7 +12,11 @@ const yubiKeyVendorID uint16 = 0x1050 func IsAttached() bool { // List all USB devices matching the YubiKey vendor ID - devices := hid.Enumerate(yubiKeyVendorID, 0) + devices, err := hid.Enumerate(yubiKeyVendorID, 0) + if err != nil { + log.WithError(err).Error("Failed to enumerate USB devices") + return false + } if len(devices) == 0 { log.Debug("No YubiKey device detected")