diff --git a/src/raspberrypi/controllers/sasidev_ctrl.cpp b/src/raspberrypi/controllers/sasidev_ctrl.cpp index 97c0e703..cb445a67 100644 --- a/src/raspberrypi/controllers/sasidev_ctrl.cpp +++ b/src/raspberrypi/controllers/sasidev_ctrl.cpp @@ -355,6 +355,12 @@ void SASIDEV::Execute() ctrl.blocks = 1; ctrl.execstart = SysTimer::GetTimerLow(); + // Discard pending sense data from the previous command if the current command is not REQUEST SENSE + if(SASIDEV::eCmdRequestSense != (SASIDEV::sasi_command)ctrl.cmd[0]) { + ctrl.status = 0; + ctrl.device->SetStatusCode(0); + } + // Process by command // TODO This code does not belong here. Each device type needs such a dispatcher, which the controller has to call. switch ((SASIDEV::sasi_command)ctrl.cmd[0]) { diff --git a/src/raspberrypi/controllers/scsidev_ctrl.cpp b/src/raspberrypi/controllers/scsidev_ctrl.cpp index 6f52239e..59a2e06b 100644 --- a/src/raspberrypi/controllers/scsidev_ctrl.cpp +++ b/src/raspberrypi/controllers/scsidev_ctrl.cpp @@ -262,6 +262,11 @@ void SCSIDEV::Execute() ctrl.device = ctrl.unit[lun]; + // Discard pending sense data from the previous command + if ((SCSIDEV::scsi_command)ctrl.cmd[0] != eCmdRequestSense) { + ctrl.device->SetStatusCode(0); + } + if (!ctrl.device->Dispatch(this)) { LOGTRACE("ID %d LUN %d received unsupported command: $%02X", GetSCSIID(), lun, (BYTE)ctrl.cmd[0]);