libusb_strerror is not going upstream because of i18n worries, provide our own for now.
Signed-off-by: Hans de Goede <[email protected]> --- gtk/channel-usbredir.c | 40 +++++++++++++++++++++++++++++++++++++--- 1 files changed, 37 insertions(+), 3 deletions(-) diff --git a/gtk/channel-usbredir.c b/gtk/channel-usbredir.c index b567fcc..57b5a5a 100644 --- a/gtk/channel-usbredir.c +++ b/gtk/channel-usbredir.c @@ -33,8 +33,42 @@ #include "spice-channel-priv.h" -/* libusb_strerror is awaiting merging upstream */ -#define libusb_strerror(error) "unknown" +/* libusb_strerror is not going upstream because of i18n worries, provide + our own for now */ +static const char* my_libusb_strerror(enum libusb_error errcode) +{ + switch (errcode) { + 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"; + } + return "Unknown error"; +} /** * SECTION:channel-usbredir @@ -140,7 +174,7 @@ gboolean spice_usbredir_channel_connect(SpiceUsbredirChannel *channel, if (rc != 0) { g_set_error(err, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, "Could not open usb device: %s [%i]", - libusb_strerror(rc), rc); + my_libusb_strerror(rc), rc); return FALSE; } -- 1.7.6.1 _______________________________________________ Spice-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/spice-devel
