From e9e1e456ad4ce2876381dee5ab10e613e759c48f Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 29 Nov 2017 15:19:04 +0000 Subject: [PATCH] Added long sector sizes for floppies and SuperDisk. --- DiscImageChef.Core/Devices/ReaderSCSI.cs | 36 ++++++++++++------- .../Devices/Report/SCSI/General.cs | 27 ++++++++++---- 2 files changed, 44 insertions(+), 19 deletions(-) diff --git a/DiscImageChef.Core/Devices/ReaderSCSI.cs b/DiscImageChef.Core/Devices/ReaderSCSI.cs index 25394889..2b392c99 100644 --- a/DiscImageChef.Core/Devices/ReaderSCSI.cs +++ b/DiscImageChef.Core/Devices/ReaderSCSI.cs @@ -152,8 +152,13 @@ namespace DiscImageChef.Core.Devices { if(blockSize == 512) { - // Long sector sizes for 512-byte magneto-opticals - foreach(ushort testSize in new[] { 600, 610, 630 }) + foreach(ushort testSize in new[] { + // Long sector sizes for floppies + 514, + // Long sector sizes for SuperDisk + 536, 558, + // Long sector sizes for 512-byte magneto-opticals + 600, 610, 630 }) { testSense = dev.ReadLong16(out readBuffer, out senseBuf, false, 0, testSize, timeout, out duration); if(!testSense && !dev.Error) @@ -176,21 +181,28 @@ namespace DiscImageChef.Core.Devices } else if(blockSize == 1024) { - testSense = dev.ReadLong16(out readBuffer, out senseBuf, false, 0, 1200, timeout, out duration); - if(!testSense && !dev.Error) + foreach(ushort testSize in new[] { + // Long sector sizes for floppies + 1026, + // Long sector sizes for 1024-byte magneto-opticals + 1200 }) { - readLong16 = true; - longBlockSize = 1200; - readRaw = true; - } - else - { - testSense = dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, 1200, timeout, out duration); + testSense = dev.ReadLong16(out readBuffer, out senseBuf, false, 0, testSize, timeout, out duration); + if(!testSense && !dev.Error) + { + readLong16 = true; + longBlockSize = testSize; + readRaw = true; + break; + } + + testSense = dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, testSize, timeout, out duration); if(!testSense && !dev.Error) { readLong10 = true; - longBlockSize = 1200; + longBlockSize = testSize; readRaw = true; + break; } } } diff --git a/DiscImageChef.Core/Devices/Report/SCSI/General.cs b/DiscImageChef.Core/Devices/Report/SCSI/General.cs index cec28ccd..ac5fcc99 100644 --- a/DiscImageChef.Core/Devices/Report/SCSI/General.cs +++ b/DiscImageChef.Core/Devices/Report/SCSI/General.cs @@ -527,8 +527,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI { if(mediaTest.BlockSize == 512) { - // Long sector sizes for 512-byte magneto-opticals - foreach(ushort testSize in new[] { 600, 610, 630 }) + foreach(ushort testSize in new[] { + // Long sector sizes for floppies + 514, + // Long sector sizes for SuperDisk + 536, 558, + // Long sector sizes for 512-byte magneto-opticals + 600, 610, 630 }) { sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, timeout, out duration); if(!sense && !dev.Error) @@ -542,12 +547,20 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } else if(mediaTest.BlockSize == 1024) { - sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 1200, timeout, out duration); - if(!sense && !dev.Error) + foreach(ushort testSize in new[] { + // Long sector sizes for floppies + 1026, + // Long sector sizes for 1024-byte magneto-opticals + 1200 }) { - mediaTest.SupportsReadLong = true; - mediaTest.LongBlockSize = 1200; - mediaTest.LongBlockSizeSpecified = true; + sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, timeout, out duration); + if(!sense && !dev.Error) + { + mediaTest.SupportsReadLong = true; + mediaTest.LongBlockSize = testSize; + mediaTest.LongBlockSizeSpecified = true; + break; + } } } else if(mediaTest.BlockSize == 2048)