* Initial import of the libusb source tree into the flasher - optional, but useful for embedding - avoids gnu autosux problems
This commit is contained in:
1 parent
a3af55acb4
commit
ea97ac427e
13 files changed
+4964
No files matched your search
@@ -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";
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user