]> err.no Git - yubikey-personalization/commitdiff
add better error returns for osx, return the error names, can't find a good strerror...
authorKlas Lindfors <klas@yubico.com>
Wed, 10 Oct 2012 13:43:20 +0000 (15:43 +0200)
committerKlas Lindfors <klas@yubico.com>
Wed, 10 Oct 2012 13:43:20 +0000 (15:43 +0200)
ykcore/ykcore_osx.c

index b3b6e63f63a9cc0cbf28f3fdf2a64e959f60dde6..839809adcb34d8cdb78f6be4c9ca030c61a6c45c 100644 (file)
@@ -190,6 +190,28 @@ int _ykusb_write(void *dev, int report_type, int report_number,
 
 const char *_ykusb_strerror()
 {
-       return "USB error\n";
-//     fprintf(out, "USB error: %x\n", _ykusb_IOReturn);
+       switch (_ykusb_IOReturn) {
+               case kIOReturnSuccess:
+                       return "kIOReturnSuccess";
+               case kIOReturnNotOpen:
+                       return "kIOReturnNotOpen";
+               case kIOReturnNoDevice:
+                       return "kIOReturnNoDevice";
+               case kIOReturnExclusiveAccess:
+                       return "kIOReturnExclusiveAccess";
+               case kIOReturnError:
+                       return "kIOReturnError";
+               case kIOReturnBadArgument:
+                       return "kIOReturnBadArgument";
+               case kIOReturnAborted:
+                       return "kIOReturnAborted";
+               case kIOReturnNotResponding:
+                       return "kIOReturnNotResponding";
+               case kIOReturnOverrun:
+                       return "kIOReturnOverrun";
+               case kIOReturnCannotWire:
+                       return "kIOReturnCannotWire";
+               default:
+                       return "unknown error";
+       }
 }