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.

1034 /* get the status again */<br />

1035 US_DEBUGP("Attempting to get CSW (2nd try)...\n");<br />

1036 result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe,<br />

1037 bcs, US_BULK_CS_WRAP_LEN, NULL);<br />

1038 }<br />

1039<br />

1040 /* if we still have a failure at this point, we're in trouble */<br />

1041 US_DEBUGP("Bulk status result = %d\n", result);<br />

1042 if (result != USB_STOR_XFER_GOOD)<br />

1043 return USB_STOR_TRANSPORT_ERROR;<br />

1044<br />

1045 /* check bulk status */<br />

1046 residue = le32_to_cpu(bcs->Residue);<br />

1047 US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n",<br />

1048 le32_to_cpu(bcs->Signature), bcs->Tag,<br />

1049 residue, bcs->Status);<br />

1050 if ((bcs->Signature != cpu_to_le32(US_BULK_CS_SIGN) &&<br />

1051 bcs->Signature !=<br />

cpu_to_le32(US_BULK_CS_OLYMPUS_SIGN)) ||<br />

1052 bcs->Tag != srb->serial_number ||<br />

153<br />

1053 bcs->Status > US_BULK_STAT_PHASE) {<br />

1054 US_DEBUGP("Bulk logical error\n");<br />

1055 return USB_STOR_TRANSPORT_ERROR;<br />

1056 }<br />

1057<br />

1058 /* try to compute the actual residue, based on how much data<br />

1059 * was really transferred and what the device tells us */<br />

1060 if (residue) {<br />

1061 if (!(us->flags & US_FL_IGNORE_RESIDUE) ||<br />

1062 srb->sc_data_direction == DMA_TO_DEVICE) {<br />

1063 residue = min(residue, transfer_length);<br />

1064 srb->resid = max(srb->resid, (int) residue);<br />

1065 }<br />

1066 }<br />

1067<br />

1068 /* based on the status code, we report good or bad */<br />

1069 switch (bcs->Status) {<br />

1070 case US_BULK_STAT_OK:<br />

1071 /* device babbled -- return fake sense data */<br />

1072 if (fake_sense) {<br />

1073 memcpy(srb->sense_buffer,<br />

1074 usb_stor_sense_invalidCDB,<br />

1075 size<strong>of</strong>(usb_stor_sense_invalidCDB));

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

Saved successfully!

Ooh no, something went wrong!