From dcbee64750508a1a41ed6b6c4adf1b4794e2c92e Mon Sep 17 00:00:00 2001 From: Uwe Seimet <48174652+uweseimet@users.noreply.github.com> Date: Sun, 24 Oct 2021 08:10:31 +0200 Subject: [PATCH] Do not consider NONE operation an error (#369) * Do not consider NONE operation an error * Cleanup * Code cleanup from other PR --- src/raspberrypi/controllers/sasidev_ctrl.cpp | 2 +- src/raspberrypi/controllers/scsidev_ctrl.cpp | 2 +- src/raspberrypi/rascsi.cpp | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/raspberrypi/controllers/sasidev_ctrl.cpp b/src/raspberrypi/controllers/sasidev_ctrl.cpp index cb445a67..89276f0d 100644 --- a/src/raspberrypi/controllers/sasidev_ctrl.cpp +++ b/src/raspberrypi/controllers/sasidev_ctrl.cpp @@ -356,7 +356,7 @@ void SASIDEV::Execute() 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]) { + if ((SASIDEV::sasi_command)ctrl.cmd[0] != SASIDEV::eCmdRequestSense) { ctrl.status = 0; ctrl.device->SetStatusCode(0); } diff --git a/src/raspberrypi/controllers/scsidev_ctrl.cpp b/src/raspberrypi/controllers/scsidev_ctrl.cpp index 59a2e06b..c07d35b6 100644 --- a/src/raspberrypi/controllers/scsidev_ctrl.cpp +++ b/src/raspberrypi/controllers/scsidev_ctrl.cpp @@ -262,7 +262,7 @@ void SCSIDEV::Execute() ctrl.device = ctrl.unit[lun]; - // Discard pending sense data from the previous command + // Discard pending sense data from the previous command if the current command is not REQUEST SENSE if ((SCSIDEV::scsi_command)ctrl.cmd[0] != eCmdRequestSense) { ctrl.device->SetStatusCode(0); } diff --git a/src/raspberrypi/rascsi.cpp b/src/raspberrypi/rascsi.cpp index 4381fccf..29a10757 100644 --- a/src/raspberrypi/rascsi.cpp +++ b/src/raspberrypi/rascsi.cpp @@ -959,6 +959,11 @@ bool ProcessCmd(int fd, const PbDeviceDefinition& pb_device, const PbCommand& co assert(dryRun); break; + case NONE: + // Do nothing, just log + LOGTRACE("Received %s command", PbOperation_Name(operation).c_str()); + break; + default: return ReturnStatus(fd, false, "Unknown operation"); }