From 5cd847d50b6638ed27ef54af435d1026f8023f82 Mon Sep 17 00:00:00 2001 From: Michael McMaster Date: Tue, 19 Nov 2019 16:13:46 +1000 Subject: [PATCH] Fix for VMS 5.5-2 for incorrect Inquiry command allocation lengths --- CHANGELOG | 6 ++++++ include/scsi2sd.h | 3 ++- src/firmware/inquiry.c | 8 ++++++++ src/scsi2sd-util6/ConfigUtil.cc | 9 +++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 61da61ef..39059f9e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +20191119 6.X.X + - Fix to prevent sending floppy geometry mode page when not configured as + a floppy (Thanks Landon Rodgers) + - Fix for VMS 5.5-2 Inquiry allocation lengths. Requires setting "vms" quirk + mode in the XML config (Thanks Landon Rodgers) + 20191030 6.2.8 - Fix incorrect results from the self-test function. diff --git a/include/scsi2sd.h b/include/scsi2sd.h index 7a7217e5..c5a4aaed 100755 --- a/include/scsi2sd.h +++ b/include/scsi2sd.h @@ -81,7 +81,8 @@ typedef enum S2S_CFG_QUIRKS_NONE = 0, S2S_CFG_QUIRKS_APPLE = 1, S2S_CFG_QUIRKS_OMTI = 2, - S2S_CFG_QUIRKS_XEBEC = 4 + S2S_CFG_QUIRKS_XEBEC = 4, + S2S_CFG_QUIRKS_VMS = 8 } S2S_CFG_QUIRKS; typedef enum diff --git a/src/firmware/inquiry.c b/src/firmware/inquiry.c index 99bb8dc0..138e8c21 100755 --- a/src/firmware/inquiry.c +++ b/src/firmware/inquiry.c @@ -1,4 +1,5 @@ // Copyright (C) 2013 Michael McMaster +// Copyright (C) 2019 Landon Rodgers // // This file is part of SCSI2SD. // @@ -154,6 +155,13 @@ void s2s_scsiInquiry() if (scsiDev.phase == DATA_IN) { + // VAX workaround + if (allocationLength == 255 && + (scsiDev.target->cfg->quirks & S2S_CFG_QUIRKS_VMS)) + { + allocationLength = 254; + } + // "real" hard drives send back exactly allocationLenth bytes, padded // with zeroes. This only seems to happen for Inquiry responses, and not // other commands that also supply an allocation length such as Mode Sense or diff --git a/src/scsi2sd-util6/ConfigUtil.cc b/src/scsi2sd-util6/ConfigUtil.cc index 33edaff9..3080c332 100755 --- a/src/scsi2sd-util6/ConfigUtil.cc +++ b/src/scsi2sd-util6/ConfigUtil.cc @@ -168,6 +168,7 @@ ConfigUtil::toBytes(const S2S_TargetCfg& _config) config.headsPerCylinder = fromLE16(config.headsPerCylinder); const uint8_t* begin = reinterpret_cast(&config); + return std::vector(begin, begin + sizeof(config)); } @@ -229,6 +230,10 @@ ConfigUtil::toXML(const S2S_TargetCfg& config) { s << "xebec"; } + else if (config.quirks == S2S_CFG_QUIRKS_VMS) + { + s << "vms"; + } s << "\n" << @@ -465,6 +470,10 @@ parseTarget(wxXmlNode* node) { result.quirks |= S2S_CFG_QUIRKS_XEBEC; } + else if (quirk == "vms") + { + result.quirks |= S2S_CFG_QUIRKS_VMS; + } } } else if (child->GetName() == "deviceType") -- 2.38.5