Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
580 /*<br />
581 * If we have a failure, we're going to do a REQUEST_SENSE<br />
582 * automatically. Note that we differentiate between a command<br />
583 * "failure" and an "error" in the transport mechanism.<br />
584 */<br />
585 if (result == USB_STOR_TRANSPORT_FAILED) {<br />
586 US_DEBUGP("-- transport indicates command failure\n");<br />
587 need_auto_sense = 1;<br />
588 }<br />
589<br />
590 /*<br />
591 * A short transfer on a command where we don't expect it<br />
592 * is unusual, but it doesn't mean we need to auto-sense.<br />
593 */<br />
594 if ((srb->resid > 0) &&<br />
595 !((srb->cmnd[0] == REQUEST_SENSE) ||<br />
596 (srb->cmnd[0] == INQUIRY) ||<br />
597 (srb->cmnd[0] == MODE_SENSE) ||<br />
598 (srb->cmnd[0] == LOG_SENSE) ||<br />
599 (srb->cmnd[0] == MODE_SENSE_10))) {<br />
600 US_DEBUGP("-- unexpectedly short transfer\n");<br />
601 }<br />
147<br />
602<br />
603 /* Now, if we need to do the auto-sense, let's do it */<br />
604 if (need_auto_sense) {<br />
605 int temp_result;<br />
606 void* old_request_buffer;<br />
607 unsigned short old_sg;<br />
608 unsigned old_request_bufflen;<br />
609 unsigned char old_sc_data_direction;<br />
610 unsigned char old_cmd_len;<br />
611 unsigned char old_cmnd[MAX_COMMAND_SIZE];<br />
612 unsigned long old_serial_number;<br />
613 int old_resid;<br />
614<br />
615 US_DEBUGP("Issuing auto-REQUEST_SENSE\n");<br />
616<br />
617 /* save the old command */<br />
618 memcpy(old_cmnd, srb->cmnd, MAX_COMMAND_SIZE);<br />
619 old_cmd_len = srb->cmd_len;<br />
620<br />
621 /* set the command and the LUN */<br />
622 memset(srb->cmnd, 0, MAX_COMMAND_SIZE);