diff options
author | Ludovic Rousseau <ludovic.rousseau@gmail.com> | 2012-05-08 15:53:56 +0200 |
---|---|---|
committer | Pete Batard <pete@akeo.ie> | 2012-05-08 17:35:45 +0100 |
commit | 30ccbd773bc02d5dfd21e02bfba6d58234f59393 (patch) | |
tree | da04427f4651f3206e11c928e0c11ccfba8ac23d | |
parent | 6d47fa1bc52562f673c30e5fd36f8ae44ed102e8 (diff) | |
download | libusb-30ccbd773bc02d5dfd21e02bfba6d58234f59393.tar.gz |
Core: Handle TRANSFER_ERROR/TRANSFER_CANCELLED for sync transfers
* Return the more appropriate LIBUSB_ERROR_IO instead of
LIBUSB_ERROR_OTHER for the cases LIBUSB_TRANSFER_ERROR and
LIBUSB_TRANSFER_CANCELLED
* Fixes warnings similar to the following when using the GCC
option -Wswitch-enum:
warning: enumeration value ‘LIBUSB_TRANSFER_ERROR’ not handled in switch
-rw-r--r-- | libusb/sync.c | 8 | ||||
-rw-r--r-- | libusb/version.h | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/libusb/sync.c b/libusb/sync.c index c3c92eb..6bdc3e1 100644 --- a/libusb/sync.c +++ b/libusb/sync.c @@ -135,6 +135,10 @@ int API_EXPORTED libusb_control_transfer(libusb_device_handle *dev_handle, case LIBUSB_TRANSFER_OVERFLOW: r = LIBUSB_ERROR_OVERFLOW; break; + case LIBUSB_TRANSFER_ERROR: + case LIBUSB_TRANSFER_CANCELLED: + r = LIBUSB_ERROR_IO; + break; default: usbi_warn(HANDLE_CTX(dev_handle), "unrecognised status code %d", transfer->status); @@ -205,6 +209,10 @@ static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle, case LIBUSB_TRANSFER_NO_DEVICE: r = LIBUSB_ERROR_NO_DEVICE; break; + case LIBUSB_TRANSFER_ERROR: + case LIBUSB_TRANSFER_CANCELLED: + r = LIBUSB_ERROR_IO; + break; default: usbi_warn(HANDLE_CTX(dev_handle), "unrecognised status code %d", transfer->status); diff --git a/libusb/version.h b/libusb/version.h index dfc15f1..01ad7fc 100644 --- a/libusb/version.h +++ b/libusb/version.h @@ -9,7 +9,7 @@ #define LIBUSB_MICRO 11 #endif #ifndef LIBUSB_NANO -#define LIBUSB_NANO 10496 +#define LIBUSB_NANO 10497 #endif /* LIBUSB_RC is the release candidate suffix. Should normally be empty. */ #ifndef LIBUSB_RC |