Alan Stern wrote: > On Sat, 15 Oct 2005, Douglas Gilbert wrote: > > >>Alan, >>In include/scsi/scsi_eh.h there are several helper functions >>to aid processing SCSI errors. This includes SCSI sense data >>descriptor format (which won't be needed for DVD/HD/BD for >>some time with a (2**32 * 2048) byte maximum using existing >>fixed sense data format). However there is >>scsi_get_sense_info_fld() to fetch the info field. >> >>sd, st and sg have been converted to use these helpers, >>where appropriate. >> >>MMC-4 does not mention that the valid bit needs to >>be set on a MEDIUM/HARDWARE error and I have seen >>real life examples of this. [So it's poorly defined >>if one gets a medium error on lba 0.] You may also like to >>consider deferred errors which can occur according to >>MMC-4. > > > I just read the scsi_get_sense_info_fld routine. For fixed format data, > it won't return anything if the Valid bit isn't set! > > This makes it hard to adopt both your first two suggestions... :-) Alan, Ouch. Here is the linux kernel version (scsi_error.c): case 0x70: case 0x71: if (sense_buffer[0] & 0x80) { *info_out = (sense_buffer[3] << 24) + (sense_buffer[4] << 16) + (sense_buffer[5] << 8) + sense_buffer[6]; return 1; } else return 0; and here is the sg3_utils version (sg_lib.c): case 0x70: case 0x71: if (info_outp) *info_outp = (sensep[3] << 24) + (sensep[4] << 16) + (sensep[5] << 8) + sensep[6]; return (sensep[0] & 0x80) ? 1 : 0; The latter implementation takes account of MMC devices. So I probably need to send a patch. Doug Gilbert - : send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html