diff options
author | Peter Stuge <peter@stuge.se> | 2011-09-14 03:00:14 +0200 |
---|---|---|
committer | Peter Stuge <peter@stuge.se> | 2011-10-17 16:25:50 +0200 |
commit | 1b0f758a334d78d3832d17d694ac0c931da36050 (patch) | |
tree | 0da1241850cda23dc9a7d25331760984982c300f /libusb/libusb.h | |
parent | e16805130a04b2642891e86b8f479e6343ca17da (diff) | |
download | android_external_libusbx-1b0f758a334d78d3832d17d694ac0c931da36050.tar.gz android_external_libusbx-1b0f758a334d78d3832d17d694ac0c931da36050.tar.bz2 android_external_libusbx-1b0f758a334d78d3832d17d694ac0c931da36050.zip |
Add libusb_error_name() API function
Until we have i18ned error messages we can at least offer easy
translation from numeric error code to the error code's name.
[hansg: switch() on enum to get a compiler warning if a case is missing]
[hansg: Better return value when called with an unknown error code]
[hansg: Fix DEFAULT_VISIBILITY in definition to compile on all platforms]
Diffstat (limited to 'libusb/libusb.h')
-rw-r--r-- | libusb/libusb.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libusb/libusb.h b/libusb/libusb.h index ae09907..aa440a3 100644 --- a/libusb/libusb.h +++ b/libusb/libusb.h @@ -707,6 +707,8 @@ enum libusb_speed { /** \ingroup misc * Error codes. Most libusb functions return 0 on success or one of these * codes on failure. + * You can call \ref libusb_error_name() to retrieve a string representation + * of an error code. */ enum libusb_error { /** Success (no error) */ @@ -748,6 +750,9 @@ enum libusb_error { /** Operation not supported or unimplemented on this platform */ LIBUSB_ERROR_NOT_SUPPORTED = -12, + /* NB! Remember to update libusb_error_name() + when adding new error codes here. */ + /** Other error */ LIBUSB_ERROR_OTHER = -99 }; @@ -899,6 +904,7 @@ int LIBUSB_CALL libusb_init(libusb_context **ctx); void LIBUSB_CALL libusb_exit(libusb_context *ctx); void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level); int LIBUSB_CALL libusb_has_capability(uint32_t capability); +const char * LIBUSB_CALL libusb_error_name(int errcode); ssize_t LIBUSB_CALL libusb_get_device_list(libusb_context *ctx, libusb_device ***list); |