From 4d1a10cb6b27a2dfef9b3e798d28f4c743f08d2d Mon Sep 17 00:00:00 2001 From: Uwe Seimet <48174652+uweseimet@users.noreply.github.com> Date: Sun, 26 Nov 2023 05:25:54 +0100 Subject: [PATCH] Fix missing logging for a LUN when the LUN is explicitly specified (#1379) * Fix missing logging for a LUN when the LUN is explicitly specified * Do not suppress controller messages when LUN is specified * Fix misleading logging for DaynaPort --- cpp/controllers/scsi_controller.cpp | 4 ++++ cpp/devices/device_logger.cpp | 18 ++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/cpp/controllers/scsi_controller.cpp b/cpp/controllers/scsi_controller.cpp index 09752595..773b06dd 100644 --- a/cpp/controllers/scsi_controller.cpp +++ b/cpp/controllers/scsi_controller.cpp @@ -865,6 +865,10 @@ bool ScsiController::XferOutBlockOriented(bool cont) LogTrace("Done with DaynaPort Set Multicast Address"); break; + case scsi_command::eCmdSetIfaceMode: + LogTrace("Done with setting DaynaPort MAC address (ignore)"); + break; + default: stringstream s; s << "Received an unexpected command ($" << setfill('0') << setw(2) << hex diff --git a/cpp/devices/device_logger.cpp b/cpp/devices/device_logger.cpp index 65afb129..4d78364a 100644 --- a/cpp/devices/device_logger.cpp +++ b/cpp/devices/device_logger.cpp @@ -39,16 +39,14 @@ void DeviceLogger::Error(const string& message) const void DeviceLogger::Log(level::level_enum level, const string& message) const { - if (!message.empty() && - (log_device_id == -1 || - (log_device_id == id && (log_device_lun == -1 || log_device_lun == lun)))) { - if (lun == -1) { - log(level, "(ID " + to_string(id) + ") - " + message); - } - else { - log(level, "(ID:LUN " + to_string(id) + ":" + to_string(lun) + ") - " + message); - } - } + if ((log_device_id == -1 || log_device_id == id) && (lun == -1 || log_device_lun == -1 || log_device_lun == lun)) { + if (lun == -1) { + log(level, "(ID " + to_string(id) + ") - " + message); + } + else { + log(level, "(ID:LUN " + to_string(id) + ":" + to_string(lun) + ") - " + message); + } + } } void DeviceLogger::SetIdAndLun(int i, int l)