diff options
author | hselasky <hselasky@FreeBSD.org> | 2011-09-19 08:52:06 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2011-09-19 08:52:06 +0000 |
commit | c186259e3181ae2f836aef914837c5abff6820fc (patch) | |
tree | 5f1edfe8c0f6f8eefa57d51cf108c2d03e053aa5 /lib/libusb/libusb10.c | |
parent | d3ab0cf954ad6a22d6d4abd24a9711534e70af19 (diff) | |
download | FreeBSD-src-c186259e3181ae2f836aef914837c5abff6820fc.zip FreeBSD-src-c186259e3181ae2f836aef914837c5abff6820fc.tar.gz |
Implement missing USB debug information functions.
Approved by: re (kib)
MFC after: 1 week
Diffstat (limited to 'lib/libusb/libusb10.c')
-rw-r--r-- | lib/libusb/libusb10.c | 71 |
1 files changed, 69 insertions, 2 deletions
diff --git a/lib/libusb/libusb10.c b/lib/libusb/libusb10.c index b66ccb6..e02b90a 100644 --- a/lib/libusb/libusb10.c +++ b/lib/libusb/libusb10.c @@ -1449,6 +1449,73 @@ libusb_le16_to_cpu(uint16_t x) const char * libusb_strerror(int code) { - /* TODO */ - return ("Unknown error"); + switch (code) { + case LIBUSB_SUCCESS: + return ("Success"); + case LIBUSB_ERROR_IO: + return ("I/O error"); + case LIBUSB_ERROR_INVALID_PARAM: + return ("Invalid parameter"); + case LIBUSB_ERROR_ACCESS: + return ("Permissions error"); + case LIBUSB_ERROR_NO_DEVICE: + return ("No device"); + case LIBUSB_ERROR_NOT_FOUND: + return ("Not found"); + case LIBUSB_ERROR_BUSY: + return ("Device busy"); + case LIBUSB_ERROR_TIMEOUT: + return ("Timeout"); + case LIBUSB_ERROR_OVERFLOW: + return ("Overflow"); + case LIBUSB_ERROR_PIPE: + return ("Pipe error"); + case LIBUSB_ERROR_INTERRUPTED: + return ("Interrupted"); + case LIBUSB_ERROR_NO_MEM: + return ("Out of memory"); + case LIBUSB_ERROR_NOT_SUPPORTED: + return ("Not supported"); + case LIBUSB_ERROR_OTHER: + return ("Other error"); + default: + return ("Unknown error"); + } +} + +const char * +libusb_error_name(int code) +{ + switch (code) { + case LIBUSB_SUCCESS: + return ("LIBUSB_SUCCESS"); + case LIBUSB_ERROR_IO: + return ("LIBUSB_ERROR_IO"); + case LIBUSB_ERROR_INVALID_PARAM: + return ("LIBUSB_ERROR_INVALID_PARAM"); + case LIBUSB_ERROR_ACCESS: + return ("LIBUSB_ERROR_ACCESS"); + case LIBUSB_ERROR_NO_DEVICE: + return ("LIBUSB_ERROR_NO_DEVICE"); + case LIBUSB_ERROR_NOT_FOUND: + return ("LIBUSB_ERROR_NOT_FOUND"); + case LIBUSB_ERROR_BUSY: + return ("LIBUSB_ERROR_BUSY"); + case LIBUSB_ERROR_TIMEOUT: + return ("LIBUSB_ERROR_TIMEOUT"); + case LIBUSB_ERROR_OVERFLOW: + return ("LIBUSB_ERROR_OVERFLOW"); + case LIBUSB_ERROR_PIPE: + return ("LIBUSB_ERROR_PIPE"); + case LIBUSB_ERROR_INTERRUPTED: + return ("LIBUSB_ERROR_INTERRUPTED"); + case LIBUSB_ERROR_NO_MEM: + return ("LIBUSB_ERROR_NO_MEM"); + case LIBUSB_ERROR_NOT_SUPPORTED: + return ("LIBUSB_ERROR_NOT_SUPPORTED"); + case LIBUSB_ERROR_OTHER: + return ("LIBUSB_ERROR_OTHER"); + default: + return ("LIBUSB_ERROR_UNKNOWN"); + } } |