]> err.no Git - yubikey-personalization/commitdiff
better strerror() for windows usb issues
authorKlas Lindfors <klas@yubico.com>
Thu, 20 Dec 2012 13:01:24 +0000 (14:01 +0100)
committerKlas Lindfors <klas@yubico.com>
Thu, 20 Dec 2012 13:01:24 +0000 (14:01 +0100)
ykcore/ykcore_windows.c

index c82ae8507c8b9fcf3b6b00468a9e353b0b89c232..d91ef45045521545041c1910b84f2812448e2924 100644 (file)
@@ -182,5 +182,8 @@ int _ykusb_write(void *dev, int report_type, int report_number,
 
 const char *_ykusb_strerror(void)
 {
-       return "USB error\n";
+       static char buf[1024];
+       FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0,
+                       buf, sizeof(buf), NULL);
+       return buf;
 }