lib: Parse sense specific descriptor

Extend struct scsi_sense with sense specific descriptor information,
introduce the function scsi_parse_sense_data() and let that function
parse the sense specific descriptor.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
This commit is contained in:
Bart Van Assche
2015-04-21 14:13:15 +02:00
committed by Ronnie Sahlberg
parent fbc87ab12f
commit 8435f9722e
5 changed files with 72 additions and 28 deletions

View File

@@ -317,19 +317,7 @@ static struct scsi_task *send_scsi_command(struct scsi_device *sdev, struct scsi
/* now for the error processing */
if(io_hdr.sb_len_wr > 0){
task->status = SCSI_STATUS_CHECK_CONDITION;
task->sense.error_type = sense[0] & 0x7f;
switch (task->sense.error_type) {
case 0x70:
case 0x71:
task->sense.key = sense[2] & 0x0f;
task->sense.ascq = scsi_get_uint16(&sense[12]);
break;
case 0x72:
case 0x73:
task->sense.key = sense[1] & 0x0f;
task->sense.ascq = scsi_get_uint16(&sense[2]);
break;
}
scsi_parse_sense_data(&task->sense, sense);
sense_len=io_hdr.sb_len_wr;
snprintf(buf, sizeof(buf), "SENSE KEY:%s(%d) ASCQ:%s(0x%04x)",
scsi_sense_key_str(task->sense.key),