diff options
author | thompsa <thompsa@FreeBSD.org> | 2009-02-16 15:32:12 +0000 |
---|---|---|
committer | thompsa <thompsa@FreeBSD.org> | 2009-02-16 15:32:12 +0000 |
commit | 1b7deeea5b4cb723f5f040720ccadf16b78574b0 (patch) | |
tree | 4572095489ec01db8d216fb432081b743053b240 /lib | |
parent | 30905a584587209ee82da31eb6a3ca7856659f89 (diff) | |
download | FreeBSD-src-1b7deeea5b4cb723f5f040720ccadf16b78574b0.zip FreeBSD-src-1b7deeea5b4cb723f5f040720ccadf16b78574b0.tar.gz |
MFp4 //depot/projects/usb@157783
libusb20: Make return value compatible with libusb0.12.x in case of a USB
transfer timeout.
Submitted by: Hans Petter Selasky
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libusb20/libusb20_compat01.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/libusb20/libusb20_compat01.c b/lib/libusb20/libusb20_compat01.c index 3700c7f..5d3f0d3 100644 --- a/lib/libusb20/libusb20_compat01.c +++ b/lib/libusb20/libusb20_compat01.c @@ -32,6 +32,7 @@ #include <stdlib.h> #include <stdio.h> +#include <errno.h> #include "libusb20.h" #include "libusb20_desc.h" @@ -617,9 +618,16 @@ usb_std_io(usb_dev_handle * dev, int ep, char *bytes, int size, libusb20_dev_wait_process((void *)dev, -1); } - if (libusb20_tr_get_status(xfer)) { - /* transfer error */ - return (-1); + switch (libusb20_tr_get_status(xfer)) { + case 0: + /* success */ + break; + case LIBUSB20_TRANSFER_TIMED_OUT: + /* transfer timeout */ + return (-ETIMEDOUT); + default: + /* other transfer error */ + return (-ENXIO); } actlen = libusb20_tr_get_actual_length(xfer); |