From 2e15aca382e56a2793b12ab3e55446f01ef8c2aa Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 21 Jan 2017 01:17:49 +0100 Subject: [PATCH] The error code in cdrom.c now logs errors; Illegal LUN is now invalid LUN and 05/25/00. --- src/cdrom.c | 9 +++++---- src/scsi.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/cdrom.c b/src/cdrom.c index e7cb9c63f..f1e006b4c 100644 --- a/src/cdrom.c +++ b/src/cdrom.c @@ -929,6 +929,7 @@ static void cdrom_cmd_error(uint8_t id) cdrom[id].phase = 3; cdrom[id].packet_status = 0x80; cdrom[id].callback = 50 * CDROM_TIME; + cdrom_log("CD-ROM %i: ERROR: %02X/%02X/%02X\n", id cdrom_sense_key, cdrom_asc, cdrom_ascq); } static void cdrom_unit_attention(uint8_t id) @@ -942,6 +943,7 @@ static void cdrom_unit_attention(uint8_t id) cdrom[id].phase = 3; cdrom[id].packet_status = 0x80; cdrom[id].callback = 50 * CDROM_TIME; + cdrom_log("CD-ROM %i: UNIT ATTENTION\n", id); } static void cdrom_not_ready(uint8_t id) @@ -952,11 +954,10 @@ static void cdrom_not_ready(uint8_t id) cdrom_cmd_error(id); } -/* This is 05/00/00, based on what a Daemon Tools drive returns for such a case. */ -static void cdrom_illegal_lun(uint8_t id) +static void cdrom_invalid_lun(uint8_t id) { cdrom_sense_key = SENSE_ILLEGAL_REQUEST; - cdrom_asc = 0; + cdrom_asc = ASC_INV_LUN; cdrom_ascq = 0; cdrom_cmd_error(id); } @@ -1427,7 +1428,7 @@ int cdrom_pre_execution_check(uint8_t id, uint8_t *cdb) if (((cdrom[id].request_length >> 5) & 7) != cdrom_drives[id].scsi_device_lun) { cdrom_log("CD-ROM %i: Attempting to execute a unknown command targeted at SCSI LUN %i\n", id, ((cdrom[id].request_length >> 5) & 7)); - cdrom_illegal_lun(id); + cdrom_invalid_lun(id); return 0; } } diff --git a/src/scsi.h b/src/scsi.h index b3f4becaf..1400823cc 100644 --- a/src/scsi.h +++ b/src/scsi.h @@ -78,6 +78,7 @@ #define ASC_ILLEGAL_OPCODE 0x20 #define ASC_LBA_OUT_OF_RANGE 0x21 #define ASC_INV_FIELD_IN_CMD_PACKET 0x24 +#define ASC_INV_LUN 0x25 #define ASC_INV_FIELD_IN_PARAMETER_LIST 0x26 #define ASC_MEDIUM_MAY_HAVE_CHANGED 0x28 #define ASC_INCOMPATIBLE_FORMAT 0x30