blob: c38775203819507eb3602841950b55f80e631662 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (C) 2011 Hans de Goede <hdegoede@redhat.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
#include <libusb.h>
#include "gusb-util.h"
/* libusb_strerror is not going upstream in the foreseeable future because of
i18n worries, provide our own implementation for now, later this can
hopefully became just a wrapper of the upstream version */
const gchar *
g_usb_strerror (gint error_code)
{
enum libusb_error error = error_code;
switch (error) {
case LIBUSB_SUCCESS:
return "Success";
case LIBUSB_ERROR_IO:
return "Input/output error";
case LIBUSB_ERROR_INVALID_PARAM:
return "Invalid parameter";
case LIBUSB_ERROR_ACCESS:
return "Access denied (insufficient permissions)";
case LIBUSB_ERROR_NO_DEVICE:
return "No such device (it may have been disconnected)";
case LIBUSB_ERROR_NOT_FOUND:
return "Entity not found";
case LIBUSB_ERROR_BUSY:
return "Resource busy";
case LIBUSB_ERROR_TIMEOUT:
return "Operation timed out";
case LIBUSB_ERROR_OVERFLOW:
return "Overflow";
case LIBUSB_ERROR_PIPE:
return "Pipe error";
case LIBUSB_ERROR_INTERRUPTED:
return "System call interrupted (perhaps due to signal)";
case LIBUSB_ERROR_NO_MEM:
return "Insufficient memory";
case LIBUSB_ERROR_NOT_SUPPORTED:
return "Operation not supported or unimplemented on this platform";
case LIBUSB_ERROR_OTHER:
return "Other error";
default:
break;
}
return "Unknown error";
}
|