aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-01-22 11:58:34 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2007-02-07 18:44:40 -0500
commit1096f780d0b9d6bade2d42bf823e81db3e553abe (patch)
treed72bf456ec6a0d1b720839d157d5867059051775 /drivers
parent629e4427aa817d5c9f11885420abf54b8f5967dc (diff)
usb-storage: use first bulk endpoints, not last
According to the Bulk-Only spec, usb-storage is supposed to use the _first_ bulk-in and bulk-out endpoints it finds, not the _last_. And while we're at it, we ought to test the direction of the interrupt endpoint as well. This patch (as842) makes both changes. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/storage/usb.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 70644506651f..7e7ec29782f1 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -731,26 +731,27 @@ static int get_pipes(struct us_data *us)
731 struct usb_endpoint_descriptor *ep_int = NULL; 731 struct usb_endpoint_descriptor *ep_int = NULL;
732 732
733 /* 733 /*
734 * Find the endpoints we need. 734 * Find the first endpoint of each type we need.
735 * We are expecting a minimum of 2 endpoints - in and out (bulk). 735 * We are expecting a minimum of 2 endpoints - in and out (bulk).
736 * An optional interrupt is OK (necessary for CBI protocol). 736 * An optional interrupt-in is OK (necessary for CBI protocol).
737 * We will ignore any others. 737 * We will ignore any others.
738 */ 738 */
739 for (i = 0; i < altsetting->desc.bNumEndpoints; i++) { 739 for (i = 0; i < altsetting->desc.bNumEndpoints; i++) {
740 ep = &altsetting->endpoint[i].desc; 740 ep = &altsetting->endpoint[i].desc;
741 741
742 /* Is it a BULK endpoint? */
743 if (usb_endpoint_xfer_bulk(ep)) { 742 if (usb_endpoint_xfer_bulk(ep)) {
744 /* BULK in or out? */ 743 if (usb_endpoint_dir_in(ep)) {
745 if (usb_endpoint_dir_in(ep)) 744 if (!ep_in)
746 ep_in = ep; 745 ep_in = ep;
747 else 746 } else {
748 ep_out = ep; 747 if (!ep_out)
748 ep_out = ep;
749 }
749 } 750 }
750 751
751 /* Is it an interrupt endpoint? */ 752 else if (usb_endpoint_is_int_in(ep)) {
752 else if (usb_endpoint_xfer_int(ep)) { 753 if (!ep_int)
753 ep_int = ep; 754 ep_int = ep;
754 } 755 }
755 } 756 }
756 757