PERFORCE change 152476 for review

Hans Petter Selasky hselasky at FreeBSD.org
Tue Nov 4 10:34:47 PST 2008


http://perforce.freebsd.org/chv.cgi?CH=152476

Change 152476 by hselasky at 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


More information about the p4-projects mailing list