Re: [PATCH] [USB] Use normalized sense when emulating autosense

From: Alan Stern
Date: Fri Oct 22 2010 - 10:33:28 EST


On Thu, 21 Oct 2010, Luben Tuikov wrote:

> This patch solves two things:
> 1) Enables autosense emulation code to correctly
> interpret descriptor format sense data, and
> 2) Fixes a bug whereby the autosense emulation
> code would overwrite descriptor format sense data
> with SENSE KEY HARDWARE ERROR in fixed format, to
> incorrectly look like this:

...

> @@ -794,12 +793,7 @@ Retry_Sense:
> * everything worked or that there was an unspecified
> * problem. We have to decide which.
> */
> - if ( /* 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) {
> -
> + if (sshdr.sense_key == 0 && sshdr.asc == 0 && sshdr.ascq == 0) {
> /* If things are really okay, then let's show that.
> * Zero out the sense buffer so the higher layers
> * won't realize we did an unsolicited auto-sense.

What about the Filemark and ILI tests? You mustn't get rid of them;
they are needed for tape drives.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/