07.06.2013 Views

Scsi - Index of

Scsi - Index of

Scsi - Index of

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

920 US_DEBUGP("GetMaxLUN command result is %d, data is %d\n",<br />

921 result, us->iobuf[0]);<br />

922<br />

923 /* if we have a successful request, return the result */<br />

924 if (result > 0)<br />

925 return us->iobuf[0];<br />

926<br />

927 /*<br />

928 * Some devices (i.e. Iomega Zip100) need this -- apparently<br />

929 * the bulk pipes get STALLed when the GetMaxLUN request is<br />

930 * processed. This is, in theory, harmless to all other devices<br />

931 * (regardless <strong>of</strong> if they stall or not).<br />

932 */<br />

933 if (result == -EPIPE) {<br />

934 usb_stor_clear_halt(us, us->recv_bulk_pipe);<br />

935 usb_stor_clear_halt(us, us->send_bulk_pipe);<br />

936 }<br />

937<br />

938 /*<br />

73<br />

939 * Some devices don't like GetMaxLUN. They may STALL the control<br />

940 * pipe, they may return a zero-length result, they may do nothing at<br />

941 * all and timeout, or they may fail in even more bizarrely creative<br />

942 * ways. In these cases the best approach is to use the default<br />

943 * value: only one LUN.<br />

944 */<br />

945 return 0;<br />

946 }<br />

代码不长,不过并不容易.首先914 行, usb_stor_control_msg()函数被调用,这也是我们自己定义的函<br />

数,所以也得讲,同样来自drivers/usb/storage/transport.c:<br />

209<br />

210 /*<br />

211 * Transfer one control message, with timeouts, and allowing early<br />

212 * termination. Return codes are usual -Exxx, *not* USB_STOR_XFER_xxx.<br />

213 */<br />

214 int usb_stor_control_msg(struct us_data *us, unsigned int pipe,<br />

215 u8 request, u8 requesttype, u16 value, u16 index,<br />

216 void *data, u16 size, int timeout)<br />

217 {<br />

218 int status;<br />

219<br />

220 US_DEBUGP("%s: rq=%02x rqtype=%02x value=%04x index=%02x<br />

len=%u\n",<br />

221 __FUNCTION__, request, requesttype,

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!