From a935a968a31ce0305859141f2f3e7d19c442b1cf Mon Sep 17 00:00:00 2001 From: Morio Date: Mon, 4 Dec 2023 15:01:44 -0800 Subject: [PATCH] Fix device type for IMG0-9 This is for issue https://github.com/ZuluSCSI/ZuluSCSI-firmware/issues/345 The bug was introduced in https://github.com/ZuluSCSI/ZuluSCSI-firmware/releases/tag/v2023.10.20 This fixes an issue when the device specific options in the `zuluscsi.ini` file `IMG0`-`IMG9` are set along with `Type` set to anything besides 0. The type would be ignored and the device would always be set to a fixed device (Type=0). The underlying fix was to add a new device type `S2S_CFG_NOT_SET`, which is only used in initialization to determine where the device type should be overwritten. --- lib/SCSI2SD/include/scsi2sd.h | 3 ++- src/ZuluSCSI_config.h | 2 +- src/ZuluSCSI_disk.cpp | 6 ++++++ src/ZuluSCSI_settings.cpp | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/SCSI2SD/include/scsi2sd.h b/lib/SCSI2SD/include/scsi2sd.h index 014f41ea..594660e7 100755 --- a/lib/SCSI2SD/include/scsi2sd.h +++ b/lib/SCSI2SD/include/scsi2sd.h @@ -77,7 +77,8 @@ typedef enum S2S_CFG_FLOPPY_14MB = 3, S2S_CFG_MO = 4, S2S_CFG_SEQUENTIAL = 5, - S2S_CFG_NETWORK = 6 + S2S_CFG_NETWORK = 6, + S2S_CFG_NOT_SET = 255 } S2S_CFG_TYPE; diff --git a/src/ZuluSCSI_config.h b/src/ZuluSCSI_config.h index 9974506b..2bae8336 100644 --- a/src/ZuluSCSI_config.h +++ b/src/ZuluSCSI_config.h @@ -28,7 +28,7 @@ #include // Use variables for version number -#define FW_VER_NUM "23.11.28" +#define FW_VER_NUM "23.12.04" #define FW_VER_SUFFIX "dev" #define ZULU_FW_VERSION FW_VER_NUM "-" FW_VER_SUFFIX diff --git a/src/ZuluSCSI_disk.cpp b/src/ZuluSCSI_disk.cpp index 5e243355..6cd30637 100644 --- a/src/ZuluSCSI_disk.cpp +++ b/src/ZuluSCSI_disk.cpp @@ -296,6 +296,12 @@ bool scsiDiskOpenHDDImage(int target_idx, const char *filename, int scsi_id, int logmsg("---- WARNING: file ", filename, " is not contiguous. This will increase read latency."); } + S2S_CFG_TYPE setting_type = (S2S_CFG_TYPE) g_scsi_settings.getDevice(target_idx)->deviceType; + if ( setting_type != S2S_CFG_NOT_SET) + { + type = setting_type; + } + if (type == S2S_CFG_FIXED) { logmsg("---- Configuring as disk drive drive"); diff --git a/src/ZuluSCSI_settings.cpp b/src/ZuluSCSI_settings.cpp index 24ea4c3d..559bda95 100644 --- a/src/ZuluSCSI_settings.cpp +++ b/src/ZuluSCSI_settings.cpp @@ -281,7 +281,7 @@ scsi_system_settings_t *ZuluSCSISettings::initSystem(const char *presetName) cfgSys.useFATAllocSize = false; // setting set for all or specific devices - cfgDev.deviceType = 0; + cfgDev.deviceType = S2S_CFG_NOT_SET; cfgDev.deviceTypeModifier = 0; cfgDev.sectorsPerTrack = 63; cfgDev.headsPerCylinder = 255;