Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Nov 2008 18:34:46 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 152476 for review
Message-ID:  <200811041834.mA4IYkGF039497@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=152476

Change 152476 by hselasky@hselasky_laptop001 on 2008/11/04 18:34:37

	
	Some USB drivers do not pass the endpoint direction
	mask correctly to the libusb API functions. Force
	correct endpoint direction.

Affected files ...

.. //depot/projects/usb/src/lib/libusb20/libusb20_compat01.c#5 edit

Differences ...

==== //depot/projects/usb/src/lib/libusb20/libusb20_compat01.c#5 (text+ko) ====

@@ -131,7 +131,7 @@
 	x = (ep_no & LIBUSB20_ENDPOINT_ADDRESS_MASK) * 2;
 
 	if (ep_no & LIBUSB20_ENDPOINT_DIR_MASK) {
-		/* this is a IN endpoint */
+		/* this is an IN endpoint */
 		x |= 1;
 	}
 	speed = libusb20_dev_get_speed(pdev);
@@ -616,28 +616,32 @@
 usb_bulk_write(usb_dev_handle * dev, int ep, char *bytes,
     int size, int timeout)
 {
-	return (usb_std_io(dev, ep, bytes, size, timeout, 0));
+	return (usb_std_io(dev, ep & ~USB_ENDPOINT_DIR_MASK,
+	    bytes, size, timeout, 0));
 }
 
 int
 usb_bulk_read(usb_dev_handle * dev, int ep, char *bytes,
     int size, int timeout)
 {
-	return (usb_std_io(dev, ep, bytes, size, timeout, 0));
+	return (usb_std_io(dev, ep | USB_ENDPOINT_DIR_MASK,
+	    bytes, size, timeout, 0));
 }
 
 int
 usb_interrupt_write(usb_dev_handle * dev, int ep, char *bytes,
     int size, int timeout)
 {
-	return (usb_std_io(dev, ep, bytes, size, timeout, 1));
+	return (usb_std_io(dev, ep & ~USB_ENDPOINT_DIR_MASK,
+	    bytes, size, timeout, 1));
 }
 
 int
 usb_interrupt_read(usb_dev_handle * dev, int ep, char *bytes,
     int size, int timeout)
 {
-	return (usb_std_io(dev, ep, bytes, size, timeout, 1));
+	return (usb_std_io(dev, ep | USB_ENDPOINT_DIR_MASK,
+	    bytes, size, timeout, 1));
 }
 
 int



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811041834.mA4IYkGF039497>