You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
然后是get_pipes().drivers/usb/storage/usb.c:<br />
698 /* Get the pipe settings */<br />
699 static int get_pipes(struct us_data *us)<br />
700 {<br />
701 struct usb_host_interface *altsetting =<br />
702 us->pusb_intf->cur_altsetting;<br />
703 int i;<br />
704 struct usb_endpoint_descriptor *ep;<br />
705 struct usb_endpoint_descriptor *ep_in = NULL;<br />
706 struct usb_endpoint_descriptor *ep_out = NULL;<br />
707 struct usb_endpoint_descriptor *ep_int = NULL;<br />
708<br />
709 /*<br />
710 * Find the endpoints we need.<br />
711 * We are expecting a minimum <strong>of</strong> 2 endpoints - in and out (bulk).<br />
712 * An optional interrupt is OK (necessary for CBI protocol).<br />
713 * We will ignore any others.<br />
54<br />
714 */<br />
715 for (i = 0; i < altsetting->desc.bNumEndpoints; i++) {<br />
716 ep = &altsetting->endpoint[i].desc;<br />
717<br />
718 /* Is it a BULK endpoint? */<br />
719 if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)<br />
720 == USB_ENDPOINT_XFER_BULK) {<br />
721 /* BULK in or out? */<br />
722 if (ep->bEndpointAddress & USB_DIR_IN)<br />
723 ep_in = ep;<br />
724 else<br />
725 ep_out = ep;<br />
726 }<br />
727<br />
728 /* Is it an interrupt endpoint? */<br />
729 else if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)<br />
730 == USB_ENDPOINT_XFER_INT) {<br />
731 ep_int = ep;<br />
732 }<br />
733 }<br />
734<br />
735 if (!ep_in || !ep_out || (us->protocol == US_PR_CBI && !ep_int)) {<br />
736 US_DEBUGP("Endpoint sanity check failed! Rejecting dev.\n");<br />
737 return -EIO;<br />
738 }<br />
739