diff options
author | pancake <pancake@dazo> | 2007-06-12 15:29:07 +0200 |
---|---|---|
committer | pancake <pancake@dazo> | 2007-06-12 15:29:07 +0200 |
commit | ea97ac427eb9ff7ec48baf3a5ab7cc293fc34b70 (patch) | |
tree | 271288556a4a431a25746e5da596feb3dd580d64 /libusb/error.c | |
parent | a3af55acb4141cd0d23f53b2ec0c5c1d2434aa22 (diff) | |
download | 0xFFFF-ea97ac427eb9ff7ec48baf3a5ab7cc293fc34b70.tar.bz2 |
* Initial import of the libusb source tree into the flasher - optional, but useful for embedding - avoids gnu autosux problems
Diffstat (limited to 'libusb/error.c')
-rw-r--r-- | libusb/error.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/libusb/error.c b/libusb/error.c new file mode 100644 index 0000000..f7d496d --- /dev/null +++ b/libusb/error.c @@ -0,0 +1,36 @@ +/* + * USB Error messages + * + * Copyright (c) 2000-2001 Johannes Erdfelt <johannes@erdfelt.com> + * + * This library is covered by the LGPL, read LICENSE for details. + */ + +#include <errno.h> +#include <string.h> + +#include "usb.h" +#include "error.h" + +char usb_error_str[1024] = ""; +int usb_error_errno = 0; +usb_error_type_t usb_error_type = USB_ERROR_TYPE_NONE; + +char *usb_strerror(void) +{ + switch (usb_error_type) { + case USB_ERROR_TYPE_NONE: + return "No error"; + case USB_ERROR_TYPE_STRING: + return usb_error_str; + case USB_ERROR_TYPE_ERRNO: + if (usb_error_errno > -USB_ERROR_BEGIN) + return strerror(usb_error_errno); + else + /* Any error we don't know falls under here */ + return "Unknown error"; + } + + return "Unknown error"; +} + |