[PATCH] USB: fix Bug in usb-skeleton.c
authorConger, Chris A <CHRIS.A.CONGER@saic.com>
Fri, 29 Jul 2005 19:18:23 +0000 (12:18 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 29 Jul 2005 20:12:54 +0000 (13:12 -0700)
Compare endpoint address to USB_ENDPOINT_DIR_MASK to determine endpoint
direction...

From: "Conger, Chris A." <CHRIS.A.CONGER@saic.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/usb/usb-skeleton.c

index 6051a64..353f24d 100644 (file)
@@ -257,7 +257,8 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i
                endpoint = &iface_desc->endpoint[i].desc;
 
                if (!dev->bulk_in_endpointAddr &&
-                   (endpoint->bEndpointAddress & USB_DIR_IN) &&
+                   ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK)
+                                       == USB_DIR_IN) &&
                    ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
                                        == USB_ENDPOINT_XFER_BULK)) {
                        /* we found a bulk in endpoint */
@@ -272,7 +273,8 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i
                }
 
                if (!dev->bulk_out_endpointAddr &&
-                   !(endpoint->bEndpointAddress & USB_DIR_OUT) &&
+                   ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK)
+                                       == USB_DIR_OUT) &&
                    ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
                                        == USB_ENDPOINT_XFER_BULK)) {
                        /* we found a bulk out endpoint */