svn commit: r188678 - head/lib/libusb20

Andrew Thompson thompsa at FreeBSD.org
Mon Feb 16 07:32:13 PST 2009


Author: thompsa
Date: Mon Feb 16 15:32:12 2009
New Revision: 188678
URL: http://svn.freebsd.org/changeset/base/188678

Log:
  MFp4 //depot/projects/usb at 157783
  
  libusb20: Make return value compatible with libusb0.12.x in case of a USB
  transfer timeout.
  
  Submitted by:	Hans Petter Selasky

Modified:
  head/lib/libusb20/libusb20_compat01.c

Modified: head/lib/libusb20/libusb20_compat01.c
==============================================================================
--- head/lib/libusb20/libusb20_compat01.c	Mon Feb 16 15:17:26 2009	(r188677)
+++ head/lib/libusb20/libusb20_compat01.c	Mon Feb 16 15:32:12 2009	(r188678)
@@ -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,
 			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);
 


More information about the svn-src-head mailing list