ChangeSet 1.1608.24.11, 2004/02/26 14:18:57-08:00, mdharm-usb@one-eyed-alien.net [PATCH] USB Storage: tighten sense-clearing code This patch tightens up the conditions under which an auto-sense will be cleared. It also fixes the comment associated with the code. drivers/usb/storage/transport.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c --- a/drivers/usb/storage/transport.c Tue Mar 16 15:06:28 2004 +++ b/drivers/usb/storage/transport.c Tue Mar 16 15:06:28 2004 @@ -563,9 +563,9 @@ /* * If we're running the CB transport, which is incapable - * of determining status on its own, we need to auto-sense + * of determining status on its own, we will auto-sense * unless the operation involved a data-in transfer. Devices - * can signal data-in errors by stalling the bulk-in pipe. + * can signal most data-in errors by stalling the bulk-in pipe. */ if ((us->protocol == US_PR_CB || us->protocol == US_PR_DPCM_USB) && srb->sc_data_direction != SCSI_DATA_READ) { @@ -698,7 +698,11 @@ * out the sense buffer so the higher layers won't realize * we did an unsolicited auto-sense. */ if (result == USB_STOR_TRANSPORT_GOOD && - (srb->sense_buffer[2] & 0xf) == 0x0) { + /* Filemark 0, ignore EOM, ILI 0, no sense */ + (srb->sense_buffer[2] & 0xaf) == 0 && + /* No ASC or ASCQ */ + srb->sense_buffer[12] == 0 && + srb->sense_buffer[13] == 0) { srb->result = SAM_STAT_GOOD; srb->sense_buffer[0] = 0x0; }