Added some debug code for Issue #2. This will print out a warning when we get an unhandled mode page code, instead of crashing

This commit is contained in:
akuker 2020-07-09 17:56:04 -05:00
parent 4954d20f98
commit c0e607eb9d

View File

@ -2660,7 +2660,7 @@ int FASTCALL SCSIHD::Inquiry(
//---------------------------------------------------------------------------
BOOL FASTCALL SCSIHD::ModeSelect(const DWORD *cdb, const BYTE *buf, int length)
{
int page;
BYTE page;
int size;
ASSERT(this);
@ -2702,8 +2702,23 @@ BOOL FASTCALL SCSIHD::ModeSelect(const DWORD *cdb, const BYTE *buf, int length)
}
break;
// CD-ROM Parameters
// According to the SONY CDU-541 manual, Page code 8 is supposed
// to set the Logical Block Adress Format, as well as the
// inactivity timer multiplier
case 0x08:
// Debug code for Issue #2:
// https://github.com/akuker/RASCSI/issues/2
printf("\[Unhandled page code\] Received mode page code 8 with total length %d\n ", length);
for (int i = 0; i<length; i++)
{
printf("%02X ", buf[i]);
}
printf("\n");
break;
// Other page
default:
printf("Unknown Mode Select page code received: %02X\n",page);
break;
}
@ -7856,6 +7871,30 @@ void FASTCALL SASIDEV::FlushUnit()
ctrl.unit[lun]->Flush();
}
break;
// Mode Select (6)
case 0x15:
// MODE SELECT(10)
case 0x55:
// Debug code related to Issue #2 on github, where we get an unhandled Model select when
// the mac is rebooted
// https://github.com/akuker/RASCSI/issues/2
Log(Log::Warning, "Received \'Mode Select\' \[%02X\]\n");
Log(Log::Warning, " Operation Code: \[%02X\]\n", ctrl.cmd[0]);
Log(Log::Warning, " Logical Unit %01X, PF %01X, SP %01X \[%02X\]\n", ctrl.cmd[1] >> 5, 1 & (ctrl.cmd[1] >> 4), ctrl.cmd[1] & 1, ctrl.cmd[1]);
Log(Log::Warning, " Reserved: %02X\n", ctrl.cmd[2]);
Log(Log::Warning, " Reserved: %02X\n", ctrl.cmd[3]);
Log(Log::Warning, " Parameter List Len %02X\n", ctrl.cmd[4]);
Log(Log::Warning, " Reserved: %02X\n", ctrl.cmd[5]);
Log(Log::Warning, " Ctrl Len: %08X\n",ctrl.length);
if (!ctrl.unit[lun]->ModeSelect(
ctrl.cmd, ctrl.buffer, ctrl.offset)) {
// MODE SELECT failed
Log(Log::Warning, "Error occured while processing Mode Select command %02X\n", ctrl.cmd[0]);
return;
}
break;
default:
printf("Received an invalid flush command %08X!!!!!\n",ctrl.cmd[0]);
ASSERT(FALSE);