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 56 57 58 59 60 61 62 63 64 65 66 67 68
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (C) 2011 Hans de Goede <hdegoede@redhat.com>
*
* Licensed under the GNU Lesser General Public License Version 2.1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <libusb.h>
#include "gusb-util.h"
/* libusb_strerror is not going upstream in the forseeable 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";
}
|