From: Klas Lindfors Date: Wed, 10 Oct 2012 13:43:20 +0000 (+0200) Subject: add better error returns for osx, return the error names, can't find a good strerror... X-Git-Tag: v1.8.1~9 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af9d27c87393563b0580ec142c1ca2a64aa17d24;p=yubikey-personalization add better error returns for osx, return the error names, can't find a good strerror() from apple --- diff --git a/ykcore/ykcore_osx.c b/ykcore/ykcore_osx.c index b3b6e63..839809a 100644 --- a/ykcore/ykcore_osx.c +++ b/ykcore/ykcore_osx.c @@ -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"; + } }