Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
1192 USB_TYPE_CLASS | USB_RECIP_INTERFACE,<br />
1193 0, us->ifnum, NULL, 0);<br />
1194 }<br />
进入这个函数一看,很简单,也不干别的,就是调用usb_stor_reset_common().于是,咱们接着来到了<br />
这个来自driver/usb/storage/transport.c 中的usb_stor_reset_common()函数.<br />
1101 /* This is the common part <strong>of</strong> the device reset code.<br />
1102 *<br />
1103 * It's handy that every transport mechanism uses the control endpoint for<br />
1104 * resets.<br />
1105 *<br />
1106 * Basically, we send a reset with a 20-second timeout, so we don't get<br />
1107 * jammed attempting to do the reset.<br />
1108 */<br />
185<br />
1109 static int usb_stor_reset_common(struct us_data *us,<br />
1110 u8 request, u8 requesttype,<br />
1111 u16 value, u16 index, void *data, u16 size)<br />
1112 {<br />
1113 int result;<br />
1114 int result2;<br />
1115 int rc = FAILED;<br />
1116<br />
1117 /* Let the SCSI layer know we are doing a reset, set the<br />
1118 * RESETTING bit, and clear the ABORTING bit so that the reset<br />
1119 * may proceed.<br />
1120 */<br />
1121 scsi_lock(us->host);<br />
1122 usb_stor_report_device_reset(us);<br />
1123 set_bit(US_FLIDX_RESETTING, &us->flags);<br />
1124 clear_bit(US_FLIDX_ABORTING, &us->flags);<br />
1125 scsi_unlock(us->host);<br />
1126<br />
1127 /* A 20-second timeout may seem rather long, but a LaCie<br />
1128 * StudioDrive USB2 device takes 16+ seconds to get going<br />
1129 * following a powerup or USB attach event.<br />
1130 */<br />
1131 result = usb_stor_control_msg(us, us->send_ctrl_pipe,<br />
1132 request, requesttype, value, index, data, size,<br />
1133 20*HZ);<br />
1134 if (result < 0) {<br />
1135 US_DEBUGP("S<strong>of</strong>t reset failed: %d\n", result);<br />
1136 goto Done;<br />
1137 }<br />
1138