mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Code cleanup.
This commit is contained in:
@@ -814,9 +814,9 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
// If a subchannel is supported, check if output plugin allows us to write it.
|
||||
if(supportedSubchannel != MmcSubchannel.None)
|
||||
{
|
||||
dev.ReadCd(out readBuffer, out senseBuf, 0, blockSize, 1, MmcSectorTypes.AllTypes, false, false,
|
||||
true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, supportedSubchannel,
|
||||
dev.Timeout, out _);
|
||||
dev.ReadCd(out readBuffer, out senseBuf, 0, blockSize, 1, MmcSectorTypes.AllTypes, false, false, true,
|
||||
MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, supportedSubchannel, dev.Timeout,
|
||||
out _);
|
||||
|
||||
byte[] tmpBuf = new byte[subSize];
|
||||
Array.Copy(readBuffer, SECTOR_SIZE, tmpBuf, 0, subSize);
|
||||
@@ -1031,14 +1031,11 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
DicConsole.Write("\rTrimming sector {0}", badSector);
|
||||
|
||||
double cmdDuration = 0;
|
||||
|
||||
|
||||
if(readcd)
|
||||
{
|
||||
sense = dev.ReadCd(out readBuffer, out senseBuf, (uint)badSector, blockSize, 1,
|
||||
MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true,
|
||||
true, MmcErrorField.None, supportedSubchannel, dev.Timeout,
|
||||
out cmdDuration);
|
||||
}
|
||||
true, MmcErrorField.None, supportedSubchannel, dev.Timeout, out cmdDuration);
|
||||
else if(read16)
|
||||
sense = dev.Read16(out readBuffer, out senseBuf, 0, false, true, false, badSector, blockSize, 0,
|
||||
blocksToRead, false, dev.Timeout, out cmdDuration);
|
||||
|
||||
@@ -203,7 +203,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
}
|
||||
|
||||
Reader scsiReader = new Reader(dev, dev.Timeout, null, dumpRaw);
|
||||
ulong blocks = scsiReader.GetDeviceBlocks();
|
||||
ulong blocks = scsiReader.GetDeviceBlocks();
|
||||
dumpLog.WriteLine("Device reports disc has {0} blocks", blocks);
|
||||
Dictionary<MediaTagType, byte[]> mediaTags = new Dictionary<MediaTagType, byte[]>();
|
||||
|
||||
|
||||
@@ -43,14 +43,15 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
{
|
||||
public static class NvMe
|
||||
{
|
||||
public static void Dump(Device dev, string devicePath, IWritableImage outputPlugin, ushort retryPasses,
|
||||
bool force, bool dumpRaw, bool persistent, bool stopOnError,
|
||||
ref Resume resume,
|
||||
ref
|
||||
DumpLog dumpLog, Encoding encoding, string outputPrefix,
|
||||
string outputPath,
|
||||
Dictionary<string, string>
|
||||
formatOptions, CICMMetadataType preSidecar, uint skip, bool nometadata, bool notrim)
|
||||
public static void Dump(Device dev, string devicePath,
|
||||
IWritableImage outputPlugin, ushort retryPasses,
|
||||
bool force, bool dumpRaw,
|
||||
bool persistent, bool stopOnError, ref Resume resume,
|
||||
ref DumpLog dumpLog, Encoding encoding,
|
||||
string outputPrefix, string outputPath,
|
||||
Dictionary<string, string> formatOptions, CICMMetadataType preSidecar,
|
||||
uint skip,
|
||||
bool nometadata, bool notrim)
|
||||
{
|
||||
throw new NotImplementedException("NVMe devices not yet supported.");
|
||||
}
|
||||
|
||||
@@ -63,11 +63,10 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
/// If the provided resume does not correspond with the current in
|
||||
/// progress dump
|
||||
/// </exception>
|
||||
internal static void Process(bool isLba, bool removable, ulong blocks,
|
||||
string manufacturer, string model,
|
||||
string serial, PlatformID platform, ref Resume resume,
|
||||
ref DumpHardwareType currentTry,
|
||||
ref ExtentsULong extents)
|
||||
internal static void Process(bool isLba, bool removable, ulong blocks,
|
||||
string manufacturer, string model,
|
||||
string serial, PlatformID platform, ref Resume resume,
|
||||
ref DumpHardwareType currentTry, ref ExtentsULong extents)
|
||||
{
|
||||
if(resume != null)
|
||||
{
|
||||
|
||||
@@ -107,8 +107,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
|
||||
dumpLog.WriteLine("Initializing reader.");
|
||||
Reader scsiReader = new Reader(dev, dev.Timeout, null, dumpRaw);
|
||||
ulong blocks = scsiReader.GetDeviceBlocks();
|
||||
uint blockSize = scsiReader.LogicalBlockSize;
|
||||
ulong blocks = scsiReader.GetDeviceBlocks();
|
||||
uint blockSize = scsiReader.LogicalBlockSize;
|
||||
if(scsiReader.FindReadCommand())
|
||||
{
|
||||
dumpLog.WriteLine("ERROR: Cannot find correct read command: {0}.", scsiReader.ErrorMessage);
|
||||
@@ -131,8 +131,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
return;
|
||||
}
|
||||
|
||||
uint blocksToRead = scsiReader.BlocksToRead;
|
||||
uint logicalBlockSize = blockSize;
|
||||
uint blocksToRead = scsiReader.BlocksToRead;
|
||||
uint logicalBlockSize = blockSize;
|
||||
uint physicalBlockSize = scsiReader.PhysicalBlockSize;
|
||||
|
||||
if(blocks == 0)
|
||||
@@ -460,45 +460,39 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
if(persistent)
|
||||
{
|
||||
Modes.ModePage_01_MMC pgMmc;
|
||||
Modes.ModePage_01 pg;
|
||||
|
||||
Modes.ModePage_01 pg;
|
||||
|
||||
sense = dev.ModeSense6(out readBuffer, out _, false, ScsiModeSensePageControl.Current, 0x01,
|
||||
dev.Timeout, out _);
|
||||
if(sense)
|
||||
{
|
||||
sense = dev.ModeSense10(out readBuffer, out _, false, ScsiModeSensePageControl.Current,
|
||||
0x01, dev.Timeout, out _);
|
||||
sense = dev.ModeSense10(out readBuffer, out _, false, ScsiModeSensePageControl.Current, 0x01,
|
||||
dev.Timeout, out _);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
Modes.DecodedMode? dcMode10 =
|
||||
Modes.DecodeMode10(readBuffer, dev.ScsiType);
|
||||
|
||||
Modes.DecodedMode? dcMode10 = Modes.DecodeMode10(readBuffer, dev.ScsiType);
|
||||
|
||||
if(dcMode10.HasValue)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode10.Value.Pages)
|
||||
if(modePage.Page == 0x01 && modePage.Subpage == 0x00) currentModePage = modePage;
|
||||
}
|
||||
if(modePage.Page == 0x01 && modePage.Subpage == 0x00)
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Modes.DecodedMode? dcMode6 =
|
||||
Modes.DecodeMode6(readBuffer, dev.ScsiType);
|
||||
Modes.DecodedMode? dcMode6 = Modes.DecodeMode6(readBuffer, dev.ScsiType);
|
||||
|
||||
if(dcMode6.HasValue)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages)
|
||||
if(modePage.Page == 0x01 && modePage.Subpage == 0x00)
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
|
||||
if(currentModePage == null)
|
||||
{
|
||||
if(dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice)
|
||||
{
|
||||
|
||||
pgMmc = new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 32, Parameter = 0x00};
|
||||
currentModePage = new Modes.ModePage
|
||||
{
|
||||
@@ -522,21 +516,19 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
DCR = false,
|
||||
ReadRetryCount = 32
|
||||
};
|
||||
|
||||
currentModePage =
|
||||
new Modes.ModePage
|
||||
{
|
||||
Page = 0x01,
|
||||
Subpage = 0x00,
|
||||
PageResponse = Modes.EncodeModePage_01(pg)
|
||||
} ;
|
||||
|
||||
currentModePage = new Modes.ModePage
|
||||
{
|
||||
Page = 0x01,
|
||||
Subpage = 0x00,
|
||||
PageResponse = Modes.EncodeModePage_01(pg)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if(dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice)
|
||||
{
|
||||
pgMmc =
|
||||
new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 255, Parameter = 0x20};
|
||||
pgMmc = new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 255, Parameter = 0x20};
|
||||
Modes.DecodedMode md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
|
||||
@@ -58,9 +58,9 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
/// <param name="outputPrefix">Prefix for output data files</param>
|
||||
/// <param name="resume">Information for dump resuming</param>
|
||||
/// <param name="dumpLog">Dump logger</param>
|
||||
internal static void Dump(Device dev, string outputPrefix, string devicePath, ref Resume resume,
|
||||
ref DumpLog dumpLog,
|
||||
CICMMetadataType preSidecar)
|
||||
internal static void Dump(Device dev, string outputPrefix, string devicePath,
|
||||
ref Resume resume,
|
||||
ref DumpLog dumpLog, CICMMetadataType preSidecar)
|
||||
{
|
||||
FixedSense? fxSense;
|
||||
bool aborted;
|
||||
@@ -107,13 +107,13 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
fxSense = Sense.DecodeFixed(senseBuf, out strSense);
|
||||
}
|
||||
while(fxSense.HasValue && fxSense.Value.ASC == 0x00 &&
|
||||
(fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ != 0x04));
|
||||
(fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ != 0x04));
|
||||
|
||||
dev.RequestSense(out senseBuf, dev.Timeout, out duration);
|
||||
fxSense = Sense.DecodeFixed(senseBuf, out strSense);
|
||||
|
||||
// And yet, did not rewind!
|
||||
if(fxSense.HasValue &&
|
||||
if(fxSense.HasValue &&
|
||||
(fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ != 0x04 || fxSense.Value.ASC != 0x00))
|
||||
{
|
||||
DicConsole.WriteLine();
|
||||
@@ -138,7 +138,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
// Anyway, <=SCSI-1 tapes do not support partitions
|
||||
fxSense = Sense.DecodeFixed(senseBuf, out strSense);
|
||||
|
||||
if(fxSense.HasValue && (fxSense.Value.ASC == 0x20 && fxSense.Value.ASCQ != 0x00 ||
|
||||
if(fxSense.HasValue && (fxSense.Value.ASC == 0x20 && fxSense.Value.ASCQ != 0x00 ||
|
||||
fxSense.Value.ASC != 0x20 &&
|
||||
fxSense.Value.SenseKey != SenseKeys.IllegalRequest))
|
||||
{
|
||||
@@ -180,7 +180,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
fxSense = Sense.DecodeFixed(senseBuf, out strSense);
|
||||
}
|
||||
while(fxSense.HasValue && fxSense.Value.ASC == 0x00 &&
|
||||
(fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ == 0x19));
|
||||
(fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ == 0x19));
|
||||
|
||||
// And yet, did not rewind!
|
||||
if(fxSense.HasValue && (fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ != 0x04 ||
|
||||
@@ -220,8 +220,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
}
|
||||
}
|
||||
|
||||
sidecar.BlockMedia = new BlockMediaType[1];
|
||||
sidecar.BlockMedia[0] = new BlockMediaType {SCSI = new SCSIType()};
|
||||
sidecar.BlockMedia = new BlockMediaType[1];
|
||||
sidecar.BlockMedia[0] = new BlockMediaType {SCSI = new SCSIType()};
|
||||
byte scsiMediumTypeTape = 0;
|
||||
byte scsiDensityCodeTape = 0;
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
if(!sense && !dev.Error)
|
||||
if(Modes.DecodeMode10(cmdBuf, dev.ScsiType).HasValue)
|
||||
{
|
||||
decMode = Modes.DecodeMode10(cmdBuf, dev.ScsiType);
|
||||
decMode = Modes.DecodeMode10(cmdBuf, dev.ScsiType);
|
||||
sidecar.BlockMedia[0].SCSI.ModeSense10 = new DumpType
|
||||
{
|
||||
Image = outputPrefix + ".modesense10.bin",
|
||||
@@ -258,7 +258,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
if(!sense && !dev.Error)
|
||||
if(Modes.DecodeMode6(cmdBuf, dev.ScsiType).HasValue)
|
||||
{
|
||||
decMode = Modes.DecodeMode6(cmdBuf, dev.ScsiType);
|
||||
decMode = Modes.DecodeMode6(cmdBuf, dev.ScsiType);
|
||||
sidecar.BlockMedia[0].SCSI.ModeSense = new DumpType
|
||||
{
|
||||
Image = outputPrefix + ".modesense.bin",
|
||||
@@ -274,7 +274,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
scsiMediumTypeTape = (byte)decMode.Value.Header.MediumType;
|
||||
if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length >= 1)
|
||||
scsiDensityCodeTape = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
blockSize = decMode.Value.Header.BlockDescriptors[0].BlockLength;
|
||||
blockSize = decMode.Value.Header.BlockDescriptors[0].BlockLength;
|
||||
dumpLog.WriteLine("Device reports {0} blocks ({1} bytes).", blocks, blocks * blockSize);
|
||||
}
|
||||
else blockSize = 1;
|
||||
@@ -328,8 +328,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
|
||||
fixedLen = true;
|
||||
transferLen = 1;
|
||||
sense = dev.Read6(out cmdBuf, out senseBuf, false, fixedLen, transferLen, blockSize,
|
||||
dev.Timeout, out duration);
|
||||
sense = dev.Read6(out cmdBuf, out senseBuf, false, fixedLen, transferLen, blockSize,
|
||||
dev.Timeout, out duration);
|
||||
if(sense)
|
||||
{
|
||||
DicConsole.WriteLine();
|
||||
@@ -382,9 +382,9 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
DicConsole.WriteLine();
|
||||
DataFile dumpFile = new DataFile(outputPrefix + ".bin");
|
||||
Checksum dataChk = new Checksum();
|
||||
start = DateTime.UtcNow;
|
||||
MhddLog mhddLog = new MhddLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, 1);
|
||||
IbgLog ibgLog = new IbgLog(outputPrefix + ".ibg", 0x0008);
|
||||
start = DateTime.UtcNow;
|
||||
MhddLog mhddLog = new MhddLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, 1);
|
||||
IbgLog ibgLog = new IbgLog(outputPrefix + ".ibg", 0x0008);
|
||||
|
||||
TapeFileType currentTapeFile = new TapeFileType
|
||||
{
|
||||
@@ -399,7 +399,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
StartBlock = (long)currentBlock,
|
||||
BlockSize = blockSize
|
||||
};
|
||||
Checksum fileChk = new Checksum();
|
||||
Checksum fileChk = new Checksum();
|
||||
TapePartitionType currentTapePartition = new TapePartitionType
|
||||
{
|
||||
Image = new ImageType
|
||||
@@ -454,9 +454,9 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
StartBlock = (long)currentBlock,
|
||||
BlockSize = blockSize
|
||||
};
|
||||
currentFileSize = 0;
|
||||
fileChk = new Checksum();
|
||||
files = new List<TapeFileType>();
|
||||
currentFileSize = 0;
|
||||
fileChk = new Checksum();
|
||||
files = new List<TapeFileType>();
|
||||
currentTapePartition = new TapePartitionType
|
||||
{
|
||||
Image = new ImageType
|
||||
@@ -524,37 +524,33 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
continue;
|
||||
}
|
||||
|
||||
if(fxSense.Value.SenseKey == SenseKeys.BlankCheck)
|
||||
switch(fxSense.Value.SenseKey)
|
||||
{
|
||||
if(currentBlock == 0)
|
||||
{
|
||||
case SenseKeys.BlankCheck when currentBlock == 0:
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.ErrorWriteLine("Cannot dump a blank tape...");
|
||||
dumpFile.Close();
|
||||
dumpLog.WriteLine("Cannot dump a blank tape...");
|
||||
return;
|
||||
}
|
||||
|
||||
// For sure this is an end-of-tape/partition
|
||||
if(fxSense.Value.ASC == 0x00 &&
|
||||
(fxSense.Value.ASCQ == 0x02 || fxSense.Value.ASCQ == 0x05 || fxSense.Value.EOM))
|
||||
{
|
||||
case SenseKeys.BlankCheck when fxSense.Value.ASC == 0x00 &&
|
||||
(fxSense.Value.ASCQ == 0x02 || fxSense.Value.ASCQ == 0x05 ||
|
||||
fxSense.Value.EOM):
|
||||
// TODO: Detect end of partition
|
||||
endOfMedia = true;
|
||||
dumpLog.WriteLine("Found end-of-tape/partition...");
|
||||
continue;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Blank block found, end of tape?");
|
||||
endOfMedia = true;
|
||||
dumpLog.WriteLine("Blank block found, end of tape?...");
|
||||
continue;
|
||||
case SenseKeys.BlankCheck:
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Blank block found, end of tape?");
|
||||
endOfMedia = true;
|
||||
dumpLog.WriteLine("Blank block found, end of tape?...");
|
||||
continue;
|
||||
}
|
||||
|
||||
if((fxSense.Value.SenseKey == SenseKeys.NoSense ||
|
||||
fxSense.Value.SenseKey == SenseKeys.RecoveredError) &&
|
||||
(fxSense.Value.ASCQ == 0x02 || fxSense.Value.ASCQ == 0x05 || fxSense.Value.EOM))
|
||||
(fxSense.Value.ASCQ == 0x02 || fxSense.Value.ASCQ == 0x05 || fxSense.Value.EOM))
|
||||
{
|
||||
// TODO: Detect end of partition
|
||||
endOfMedia = true;
|
||||
@@ -564,7 +560,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
|
||||
if((fxSense.Value.SenseKey == SenseKeys.NoSense ||
|
||||
fxSense.Value.SenseKey == SenseKeys.RecoveredError) &&
|
||||
(fxSense.Value.ASCQ == 0x01 || fxSense.Value.Filemark))
|
||||
(fxSense.Value.ASCQ == 0x01 || fxSense.Value.Filemark))
|
||||
{
|
||||
currentTapeFile.Checksums = fileChk.End().ToArray();
|
||||
currentTapeFile.EndBlock = (long)(currentBlock - 1);
|
||||
@@ -614,7 +610,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
partitionChk.Update(cmdBuf);
|
||||
DateTime chkEnd = DateTime.UtcNow;
|
||||
double chkDuration = (chkEnd - chkStart).TotalMilliseconds;
|
||||
totalChkDuration += chkDuration;
|
||||
totalChkDuration += chkDuration;
|
||||
|
||||
if(currentBlock % 10 == 0)
|
||||
{
|
||||
@@ -633,10 +629,9 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
end = DateTime.UtcNow;
|
||||
mhddLog.Close();
|
||||
ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(blocks + 1) /
|
||||
1024 / (totalDuration / 1000), devicePath);
|
||||
dumpLog.WriteLine("Dump finished in {0} seconds.",
|
||||
(end - start).TotalSeconds);
|
||||
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000),
|
||||
devicePath);
|
||||
dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds);
|
||||
dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.",
|
||||
(double)blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
|
||||
dumpLog.WriteLine("Average checksum speed {0:F3} KiB/sec.",
|
||||
@@ -660,13 +655,13 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
format = "Raw disk image (sector by sector copy)",
|
||||
Value = outputPrefix + ".bin"
|
||||
};
|
||||
sidecar.BlockMedia[0].LogicalBlocks = (long)blocks;
|
||||
sidecar.BlockMedia[0].Size = (long)currentSize;
|
||||
sidecar.BlockMedia[0].DumpHardwareArray = new DumpHardwareType[1];
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0] =
|
||||
new DumpHardwareType {Extents = new ExtentType[1]};
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0].Extents[0] =
|
||||
new ExtentType {Start = 0, End = blocks - 1};
|
||||
sidecar.BlockMedia[0].LogicalBlocks = (long)blocks;
|
||||
sidecar.BlockMedia[0].Size = (long)currentSize;
|
||||
sidecar.BlockMedia[0].DumpHardwareArray = new DumpHardwareType[1];
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0] =
|
||||
new DumpHardwareType {Extents = new ExtentType[1]};
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0].Extents[0] =
|
||||
new ExtentType {Start = 0, End = blocks - 1};
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0].Manufacturer = dev.Manufacturer;
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0].Model = dev.Model;
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0].Revision = dev.Revision;
|
||||
|
||||
@@ -149,7 +149,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
return;
|
||||
}
|
||||
|
||||
ulong totalSize = (ulong)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + readBuffer[3]);
|
||||
ulong totalSize =
|
||||
(ulong)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + readBuffer[3]);
|
||||
dumpLog.WriteLine("Reading Physical Format Information.");
|
||||
sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
|
||||
MmcDiscStructureFormat.PhysicalInformation, 0, 0, out _);
|
||||
@@ -164,7 +165,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
Array.Copy(readBuffer, 4, tmpBuf, 0, readBuffer.Length - 4);
|
||||
mediaTags.Add(MediaTagType.DVD_PFI, tmpBuf);
|
||||
DicConsole.DebugWriteLine("Dump-media command", "Video partition total size: {0} sectors", totalSize);
|
||||
ulong l0Video = PFI.Decode(readBuffer).Value.Layer0EndPSN - PFI.Decode(readBuffer).Value.DataAreaStartPSN + 1;
|
||||
ulong l0Video = PFI.Decode(readBuffer).Value.Layer0EndPSN - PFI.Decode(readBuffer).Value.DataAreaStartPSN +
|
||||
1;
|
||||
ulong l1Video = totalSize - l0Video + 1;
|
||||
dumpLog.WriteLine("Reading Disc Manufacturing Information.");
|
||||
sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
|
||||
@@ -200,8 +202,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
return;
|
||||
}
|
||||
|
||||
ulong gameSize = (ulong)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + readBuffer[3]) +
|
||||
1;
|
||||
ulong gameSize =
|
||||
(ulong)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + readBuffer[3]) + 1;
|
||||
DicConsole.DebugWriteLine("Dump-media command", "Game partition total size: {0} sectors", gameSize);
|
||||
|
||||
// Get middle zone size
|
||||
@@ -237,9 +239,10 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
|
||||
DicConsole.DebugWriteLine("Dump-media command", "Unlocked total size: {0} sectors", totalSize);
|
||||
ulong blocks = totalSize + 1;
|
||||
ulong middleZone = totalSize - (PFI.Decode(readBuffer).Value.Layer0EndPSN -
|
||||
PFI.Decode(readBuffer).Value.DataAreaStartPSN +
|
||||
1) - gameSize + 1;
|
||||
ulong middleZone =
|
||||
totalSize - (PFI.Decode(readBuffer).Value.Layer0EndPSN -
|
||||
PFI.Decode(readBuffer).Value.DataAreaStartPSN +
|
||||
1) - gameSize + 1;
|
||||
|
||||
tmpBuf = new byte[readBuffer.Length - 4];
|
||||
Array.Copy(readBuffer, 4, tmpBuf, 0, readBuffer.Length - 4);
|
||||
@@ -259,7 +262,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
Array.Copy(readBuffer, 4, tmpBuf, 0, readBuffer.Length - 4);
|
||||
mediaTags.Add(MediaTagType.Xbox_DMI, tmpBuf);
|
||||
|
||||
totalSize = l0Video + l1Video + middleZone * 2 + gameSize;
|
||||
totalSize = l0Video + l1Video + middleZone * 2 + gameSize;
|
||||
ulong layerBreak = l0Video + middleZone + gameSize / 2;
|
||||
|
||||
DicConsole.WriteLine("Video layer 0 size: {0} sectors", l0Video);
|
||||
@@ -705,24 +708,23 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
if(persistent)
|
||||
{
|
||||
Modes.ModePage_01_MMC pgMmc;
|
||||
|
||||
|
||||
sense = dev.ModeSense6(out readBuffer, out _, false, ScsiModeSensePageControl.Current, 0x01,
|
||||
dev.Timeout, out _);
|
||||
if(sense)
|
||||
{
|
||||
sense = dev.ModeSense10(out readBuffer, out _, false, ScsiModeSensePageControl.Current,
|
||||
0x01, dev.Timeout, out _);
|
||||
sense = dev.ModeSense10(out readBuffer, out _, false, ScsiModeSensePageControl.Current, 0x01,
|
||||
dev.Timeout, out _);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
Modes.DecodedMode? dcMode10 =
|
||||
Modes.DecodeMode10(readBuffer, PeripheralDeviceTypes.MultiMediaDevice);
|
||||
|
||||
|
||||
if(dcMode10.HasValue)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode10.Value.Pages)
|
||||
if(modePage.Page == 0x01 && modePage.Subpage == 0x00) currentModePage = modePage;
|
||||
}
|
||||
if(modePage.Page == 0x01 && modePage.Subpage == 0x00)
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -731,18 +733,14 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
Modes.DecodeMode6(readBuffer, PeripheralDeviceTypes.MultiMediaDevice);
|
||||
|
||||
if(dcMode6.HasValue)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages)
|
||||
if(modePage.Page == 0x01 && modePage.Subpage == 0x00)
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
|
||||
if(currentModePage == null)
|
||||
{
|
||||
|
||||
pgMmc =
|
||||
new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 0x20, Parameter = 0x00};
|
||||
pgMmc = new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 0x20, Parameter = 0x00};
|
||||
currentModePage = new Modes.ModePage
|
||||
{
|
||||
Page = 0x01,
|
||||
@@ -750,9 +748,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
PageResponse = Modes.EncodeModePage_01_MMC(pgMmc)
|
||||
};
|
||||
}
|
||||
|
||||
pgMmc =
|
||||
new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 255, Parameter = 0x20};
|
||||
|
||||
pgMmc = new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 255, Parameter = 0x20};
|
||||
Modes.DecodedMode md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
@@ -782,7 +779,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
}
|
||||
else runningPersistent = true;
|
||||
}
|
||||
|
||||
|
||||
repeatRetry:
|
||||
ulong[] tmpArray = resume.BadBlocks.ToArray();
|
||||
foreach(ulong badSector in tmpArray)
|
||||
|
||||
@@ -42,34 +42,34 @@ namespace DiscImageChef.Core.Devices
|
||||
partial class Reader
|
||||
{
|
||||
Device dev;
|
||||
uint timeout;
|
||||
uint timeout;
|
||||
|
||||
internal Reader(Device dev, uint timeout, byte[] identification, bool raw = false)
|
||||
{
|
||||
this.dev = dev;
|
||||
this.dev = dev;
|
||||
this.timeout = timeout;
|
||||
BlocksToRead = 64;
|
||||
CanReadRaw = raw;
|
||||
CanReadRaw = raw;
|
||||
|
||||
switch(dev.Type)
|
||||
{
|
||||
case DeviceType.ATA:
|
||||
Identify.IdentifyDevice? ataIdNullable = Identify.Decode(identification);
|
||||
if(ataIdNullable.HasValue) ataId = ataIdNullable.Value;
|
||||
if(ataIdNullable.HasValue) ataId = ataIdNullable.Value;
|
||||
break;
|
||||
case DeviceType.NVMe: throw new NotImplementedException("NVMe devices not yet supported.");
|
||||
}
|
||||
}
|
||||
|
||||
internal string ErrorMessage { get; private set; }
|
||||
internal ulong Blocks { get; private set; }
|
||||
internal uint BlocksToRead { get; private set; }
|
||||
internal uint LogicalBlockSize { get; private set; }
|
||||
internal uint PhysicalBlockSize { get; private set; }
|
||||
internal uint LongBlockSize { get; private set; }
|
||||
internal bool CanReadRaw { get; private set; }
|
||||
internal bool CanSeek => ataSeek || seek6 || seek10;
|
||||
internal bool CanSeekLba => ataSeekLba || seek6 || seek10;
|
||||
internal string ErrorMessage { get; private set; }
|
||||
internal ulong Blocks { get; private set; }
|
||||
internal uint BlocksToRead { get; private set; }
|
||||
internal uint LogicalBlockSize { get; private set; }
|
||||
internal uint PhysicalBlockSize { get; private set; }
|
||||
internal uint LongBlockSize { get; private set; }
|
||||
internal bool CanReadRaw { get; private set; }
|
||||
internal bool CanSeek => ataSeek || seek6 || seek10;
|
||||
internal bool CanSeekLba => ataSeekLba || seek6 || seek10;
|
||||
|
||||
internal ulong GetDeviceBlocks()
|
||||
{
|
||||
@@ -141,7 +141,7 @@ namespace DiscImageChef.Core.Devices
|
||||
case DeviceType.ATAPI:
|
||||
case DeviceType.SCSI: return ScsiReadBlocks(out buffer, block, count, out duration);
|
||||
default:
|
||||
buffer = null;
|
||||
buffer = null;
|
||||
duration = 0d;
|
||||
return true;
|
||||
}
|
||||
@@ -153,7 +153,7 @@ namespace DiscImageChef.Core.Devices
|
||||
{
|
||||
case DeviceType.ATA: return AtaReadChs(out buffer, cylinder, head, sector, out duration);
|
||||
default:
|
||||
buffer = null;
|
||||
buffer = null;
|
||||
duration = 0d;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -40,23 +40,23 @@ namespace DiscImageChef.Core.Devices
|
||||
partial class Reader
|
||||
{
|
||||
Identify.IdentifyDevice ataId;
|
||||
bool ataRead;
|
||||
bool ataReadDma;
|
||||
bool ataReadDmaLba;
|
||||
bool ataReadDmaLba48;
|
||||
bool ataReadDmaRetry;
|
||||
bool ataReadDmaRetryLba;
|
||||
bool ataReadLba;
|
||||
bool ataReadLba48;
|
||||
bool ataReadRetry;
|
||||
bool ataReadRetryLba;
|
||||
bool ataSeek;
|
||||
bool ataSeekLba;
|
||||
bool ataRead;
|
||||
bool ataReadDma;
|
||||
bool ataReadDmaLba;
|
||||
bool ataReadDmaLba48;
|
||||
bool ataReadDmaRetry;
|
||||
bool ataReadDmaRetryLba;
|
||||
bool ataReadLba;
|
||||
bool ataReadLba48;
|
||||
bool ataReadRetry;
|
||||
bool ataReadRetryLba;
|
||||
bool ataSeek;
|
||||
bool ataSeekLba;
|
||||
|
||||
internal bool IsLba { get; private set; }
|
||||
internal bool IsLba { get; private set; }
|
||||
internal ushort Cylinders { get; private set; }
|
||||
internal byte Heads { get; private set; }
|
||||
internal byte Sectors { get; private set; }
|
||||
internal byte Heads { get; private set; }
|
||||
internal byte Sectors { get; private set; }
|
||||
|
||||
(uint, byte, byte) GetDeviceChs()
|
||||
{
|
||||
@@ -65,19 +65,20 @@ namespace DiscImageChef.Core.Devices
|
||||
if(ataId.CurrentCylinders > 0 && ataId.CurrentHeads > 0 && ataId.CurrentSectorsPerTrack > 0)
|
||||
{
|
||||
Cylinders = ataId.CurrentCylinders;
|
||||
Heads = (byte)ataId.CurrentHeads;
|
||||
Sectors = (byte)ataId.CurrentSectorsPerTrack;
|
||||
Blocks = (ulong)(Cylinders * Heads * Sectors);
|
||||
Heads = (byte)ataId.CurrentHeads;
|
||||
Sectors = (byte)ataId.CurrentSectorsPerTrack;
|
||||
Blocks = (ulong)(Cylinders * Heads * Sectors);
|
||||
}
|
||||
|
||||
if(ataId.CurrentCylinders != 0 && ataId.CurrentHeads != 0 && ataId.CurrentSectorsPerTrack != 0 ||
|
||||
ataId.Cylinders <= 0 || ataId.Heads <= 0 ||
|
||||
ataId.Cylinders <= 0 ||
|
||||
ataId.Heads <= 0 ||
|
||||
ataId.SectorsPerTrack <= 0) return (Cylinders, Heads, Sectors);
|
||||
|
||||
Cylinders = ataId.Cylinders;
|
||||
Heads = (byte)ataId.Heads;
|
||||
Sectors = (byte)ataId.SectorsPerTrack;
|
||||
Blocks = (ulong)(Cylinders * Heads * Sectors);
|
||||
Heads = (byte)ataId.Heads;
|
||||
Sectors = (byte)ataId.SectorsPerTrack;
|
||||
Blocks = (ulong)(Cylinders * Heads * Sectors);
|
||||
|
||||
return (Cylinders, Heads, Sectors);
|
||||
}
|
||||
@@ -89,13 +90,13 @@ namespace DiscImageChef.Core.Devices
|
||||
if(ataId.Capabilities.HasFlag(Identify.CapabilitiesBit.LBASupport))
|
||||
{
|
||||
Blocks = ataId.LBASectors;
|
||||
IsLba = true;
|
||||
IsLba = true;
|
||||
}
|
||||
|
||||
if(!ataId.CommandSet2.HasFlag(Identify.CommandSetBit2.LBA48)) return Blocks;
|
||||
|
||||
Blocks = ataId.LBA48Sectors;
|
||||
IsLba = true;
|
||||
IsLba = true;
|
||||
|
||||
return Blocks;
|
||||
}
|
||||
@@ -104,31 +105,31 @@ namespace DiscImageChef.Core.Devices
|
||||
{
|
||||
bool sense = dev.Read(out byte[] cmdBuf, out AtaErrorRegistersChs errorChs, false, 0, 0, 1, 1, timeout,
|
||||
out _);
|
||||
ataRead = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.Read(out cmdBuf, out errorChs, true, 0, 0, 1, 1, timeout, out _);
|
||||
ataReadRetry = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.ReadDma(out cmdBuf, out errorChs, false, 0, 0, 1, 1, timeout, out _);
|
||||
ataReadDma = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.ReadDma(out cmdBuf, out errorChs, true, 0, 0, 1, 1, timeout, out _);
|
||||
ataRead = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.Read(out cmdBuf, out errorChs, true, 0, 0, 1, 1, timeout, out _);
|
||||
ataReadRetry = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.ReadDma(out cmdBuf, out errorChs, false, 0, 0, 1, 1, timeout, out _);
|
||||
ataReadDma = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.ReadDma(out cmdBuf, out errorChs, true, 0, 0, 1, 1, timeout, out _);
|
||||
ataReadDmaRetry = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0;
|
||||
|
||||
sense = dev.Read(out cmdBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, timeout, out _);
|
||||
ataReadLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.Read(out cmdBuf, out errorLba, true, 0, 1, timeout, out _);
|
||||
ataReadRetryLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.ReadDma(out cmdBuf, out errorLba, false, 0, 1, timeout, out _);
|
||||
ataReadDmaLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.ReadDma(out cmdBuf, out errorLba, true, 0, 1, timeout, out _);
|
||||
sense = dev.Read(out cmdBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, timeout, out _);
|
||||
ataReadLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.Read(out cmdBuf, out errorLba, true, 0, 1, timeout, out _);
|
||||
ataReadRetryLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.ReadDma(out cmdBuf, out errorLba, false, 0, 1, timeout, out _);
|
||||
ataReadDmaLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.ReadDma(out cmdBuf, out errorLba, true, 0, 1, timeout, out _);
|
||||
ataReadDmaRetryLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0;
|
||||
|
||||
sense = dev.Read(out cmdBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, timeout, out _);
|
||||
ataReadLba48 = !sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.ReadDma(out cmdBuf, out errorLba48, 0, 1, timeout, out _);
|
||||
sense = dev.Read(out cmdBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, timeout, out _);
|
||||
ataReadLba48 = !sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.ReadDma(out cmdBuf, out errorLba48, 0, 1, timeout, out _);
|
||||
ataReadDmaLba48 = !sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && cmdBuf.Length > 0;
|
||||
|
||||
sense = dev.Seek(out errorChs, 0, 0, 1, timeout, out _);
|
||||
ataSeek = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0;
|
||||
sense = dev.Seek(out errorLba, 0, timeout, out _);
|
||||
sense = dev.Seek(out errorChs, 0, 0, 1, timeout, out _);
|
||||
ataSeek = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0;
|
||||
sense = dev.Seek(out errorLba, 0, timeout, out _);
|
||||
ataSeekLba = !sense && (errorLba.Status & 0x27) == 0 && errorChs.Error == 0;
|
||||
|
||||
if(IsLba)
|
||||
@@ -178,17 +179,19 @@ namespace DiscImageChef.Core.Devices
|
||||
if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000)
|
||||
{
|
||||
if((ataId.PhysLogSectorSize & 0x1000) == 0x1000)
|
||||
if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) LogicalBlockSize = 512;
|
||||
else LogicalBlockSize = ataId.LogicalSectorWords * 2;
|
||||
if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF)
|
||||
LogicalBlockSize = 512;
|
||||
else
|
||||
LogicalBlockSize = ataId.LogicalSectorWords * 2;
|
||||
else LogicalBlockSize = 512;
|
||||
|
||||
if((ataId.PhysLogSectorSize & 0x2000) == 0x2000)
|
||||
PhysicalBlockSize = LogicalBlockSize * (uint)Math.Pow(2, ataId.PhysLogSectorSize & 0xF);
|
||||
PhysicalBlockSize = LogicalBlockSize * (uint)Math.Pow(2, ataId.PhysLogSectorSize & 0xF);
|
||||
else PhysicalBlockSize = LogicalBlockSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogicalBlockSize = 512;
|
||||
LogicalBlockSize = 512;
|
||||
PhysicalBlockSize = 512;
|
||||
}
|
||||
|
||||
@@ -212,8 +215,8 @@ namespace DiscImageChef.Core.Devices
|
||||
|
||||
while(IsLba)
|
||||
{
|
||||
byte[] cmdBuf;
|
||||
bool sense;
|
||||
byte[] cmdBuf;
|
||||
bool sense;
|
||||
AtaErrorRegistersLba48 errorLba48;
|
||||
if(ataReadDmaLba48)
|
||||
{
|
||||
@@ -264,54 +267,56 @@ namespace DiscImageChef.Core.Devices
|
||||
|
||||
bool AtaReadBlocks(out byte[] buffer, ulong block, uint count, out double duration)
|
||||
{
|
||||
bool error = true;
|
||||
bool sense;
|
||||
bool error = true;
|
||||
bool sense;
|
||||
AtaErrorRegistersLba28 errorLba;
|
||||
AtaErrorRegistersLba48 errorLba48;
|
||||
byte status = 0, errorByte = 0;
|
||||
buffer = null;
|
||||
byte status = 0, errorByte = 0;
|
||||
buffer = null;
|
||||
duration = 0;
|
||||
|
||||
if(ataReadDmaLba48)
|
||||
{
|
||||
sense = dev.ReadDma(out buffer, out errorLba48, block, (byte)count, timeout, out duration);
|
||||
error = !(!sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba48.Status;
|
||||
sense = dev.ReadDma(out buffer, out errorLba48, block, (byte)count, timeout, out duration);
|
||||
error = !(!sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba48.Status;
|
||||
errorByte = errorLba48.Error;
|
||||
}
|
||||
else if(ataReadLba48)
|
||||
{
|
||||
sense = dev.Read(out buffer, out errorLba48, block, (byte)count, timeout, out duration);
|
||||
error = !(!sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba48.Status;
|
||||
sense = dev.Read(out buffer, out errorLba48, block, (byte)count, timeout, out duration);
|
||||
error = !(!sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba48.Status;
|
||||
errorByte = errorLba48.Error;
|
||||
}
|
||||
else if(ataReadDmaRetryLba)
|
||||
{
|
||||
sense = dev.ReadDma(out buffer, out errorLba, true, (uint)block, (byte)count, timeout, out duration);
|
||||
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba.Status;
|
||||
sense = dev.ReadDma(out buffer, out errorLba, true, (uint)block, (byte)count, timeout,
|
||||
out duration);
|
||||
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba.Status;
|
||||
errorByte = errorLba.Error;
|
||||
}
|
||||
else if(ataReadDmaLba)
|
||||
{
|
||||
sense = dev.ReadDma(out buffer, out errorLba, false, (uint)block, (byte)count, timeout, out duration);
|
||||
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba.Status;
|
||||
sense = dev.ReadDma(out buffer, out errorLba, false, (uint)block, (byte)count, timeout,
|
||||
out duration);
|
||||
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba.Status;
|
||||
errorByte = errorLba.Error;
|
||||
}
|
||||
else if(ataReadRetryLba)
|
||||
{
|
||||
sense = dev.Read(out buffer, out errorLba, true, (uint)block, (byte)count, timeout, out duration);
|
||||
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba.Status;
|
||||
sense = dev.Read(out buffer, out errorLba, true, (uint)block, (byte)count, timeout, out duration);
|
||||
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba.Status;
|
||||
errorByte = errorLba.Error;
|
||||
}
|
||||
else if(ataReadLba)
|
||||
{
|
||||
sense = dev.Read(out buffer, out errorLba, false, (uint)block, (byte)count, timeout, out duration);
|
||||
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba.Status;
|
||||
sense = dev.Read(out buffer, out errorLba, false, (uint)block, (byte)count, timeout, out duration);
|
||||
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba.Status;
|
||||
errorByte = errorLba.Error;
|
||||
}
|
||||
|
||||
@@ -322,39 +327,41 @@ namespace DiscImageChef.Core.Devices
|
||||
|
||||
bool AtaReadChs(out byte[] buffer, ushort cylinder, byte head, byte sectir, out double duration)
|
||||
{
|
||||
bool error = true;
|
||||
bool sense;
|
||||
bool error = true;
|
||||
bool sense;
|
||||
AtaErrorRegistersChs errorChs;
|
||||
byte status = 0, errorByte = 0;
|
||||
buffer = null;
|
||||
byte status = 0, errorByte = 0;
|
||||
buffer = null;
|
||||
duration = 0;
|
||||
|
||||
if(ataReadDmaRetry)
|
||||
{
|
||||
sense = dev.ReadDma(out buffer, out errorChs, true, cylinder, head, sectir, 1, timeout, out duration);
|
||||
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
|
||||
status = errorChs.Status;
|
||||
sense = dev.ReadDma(out buffer, out errorChs, true, cylinder, head, sectir, 1, timeout,
|
||||
out duration);
|
||||
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
|
||||
status = errorChs.Status;
|
||||
errorByte = errorChs.Error;
|
||||
}
|
||||
else if(ataReadDma)
|
||||
{
|
||||
sense = dev.ReadDma(out buffer, out errorChs, false, cylinder, head, sectir, 1, timeout, out duration);
|
||||
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
|
||||
status = errorChs.Status;
|
||||
sense = dev.ReadDma(out buffer, out errorChs, false, cylinder, head, sectir, 1, timeout,
|
||||
out duration);
|
||||
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
|
||||
status = errorChs.Status;
|
||||
errorByte = errorChs.Error;
|
||||
}
|
||||
else if(ataReadRetry)
|
||||
{
|
||||
sense = dev.Read(out buffer, out errorChs, true, cylinder, head, sectir, 1, timeout, out duration);
|
||||
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
|
||||
status = errorChs.Status;
|
||||
sense = dev.Read(out buffer, out errorChs, true, cylinder, head, sectir, 1, timeout, out duration);
|
||||
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
|
||||
status = errorChs.Status;
|
||||
errorByte = errorChs.Error;
|
||||
}
|
||||
else if(ataRead)
|
||||
{
|
||||
sense = dev.Read(out buffer, out errorChs, false, cylinder, head, sectir, 1, timeout, out duration);
|
||||
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
|
||||
status = errorChs.Status;
|
||||
sense = dev.Read(out buffer, out errorChs, false, cylinder, head, sectir, 1, timeout, out duration);
|
||||
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
|
||||
status = errorChs.Status;
|
||||
errorByte = errorChs.Error;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace DiscImageChef.Core.Devices
|
||||
decSense = Sense.DecodeFixed(senseBuf);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.SenseKey == SenseKeys.IllegalRequest && decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
{
|
||||
CanReadRaw = true;
|
||||
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
||||
@@ -156,9 +156,9 @@ namespace DiscImageChef.Core.Devices
|
||||
testSense = dev.ReadLong16(out _, out senseBuf, false, 0, testSize, timeout, out _);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
readLong16 = true;
|
||||
readLong16 = true;
|
||||
LongBlockSize = testSize;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -166,9 +166,9 @@ namespace DiscImageChef.Core.Devices
|
||||
out _);
|
||||
if(testSense || dev.Error) continue;
|
||||
|
||||
readLong10 = true;
|
||||
readLong10 = true;
|
||||
LongBlockSize = testSize;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
break;
|
||||
}
|
||||
else if(LogicalBlockSize == 1024)
|
||||
@@ -184,9 +184,9 @@ namespace DiscImageChef.Core.Devices
|
||||
testSense = dev.ReadLong16(out _, out senseBuf, false, 0, testSize, timeout, out _);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
readLong16 = true;
|
||||
readLong16 = true;
|
||||
LongBlockSize = testSize;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -194,9 +194,9 @@ namespace DiscImageChef.Core.Devices
|
||||
out _);
|
||||
if(testSense || dev.Error) continue;
|
||||
|
||||
readLong10 = true;
|
||||
readLong10 = true;
|
||||
LongBlockSize = testSize;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
break;
|
||||
}
|
||||
else if(LogicalBlockSize == 2048)
|
||||
@@ -204,18 +204,18 @@ namespace DiscImageChef.Core.Devices
|
||||
testSense = dev.ReadLong16(out _, out senseBuf, false, 0, 2380, timeout, out _);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
readLong16 = true;
|
||||
readLong16 = true;
|
||||
LongBlockSize = 2380;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
testSense = dev.ReadLong10(out _, out senseBuf, false, false, 0, 2380, timeout, out _);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
readLong10 = true;
|
||||
readLong10 = true;
|
||||
LongBlockSize = 2380;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -224,18 +224,18 @@ namespace DiscImageChef.Core.Devices
|
||||
testSense = dev.ReadLong16(out _, out senseBuf, false, 0, 4760, timeout, out _);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
readLong16 = true;
|
||||
readLong16 = true;
|
||||
LongBlockSize = 4760;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
testSense = dev.ReadLong10(out _, out senseBuf, false, false, 0, 4760, timeout, out _);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
readLong10 = true;
|
||||
readLong10 = true;
|
||||
LongBlockSize = 4760;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -244,18 +244,18 @@ namespace DiscImageChef.Core.Devices
|
||||
testSense = dev.ReadLong16(out _, out senseBuf, false, 0, 9424, timeout, out _);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
readLong16 = true;
|
||||
readLong16 = true;
|
||||
LongBlockSize = 9424;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
testSense = dev.ReadLong10(out _, out senseBuf, false, false, 0, 9424, timeout, out _);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
readLong10 = true;
|
||||
readLong10 = true;
|
||||
LongBlockSize = 9424;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -268,7 +268,7 @@ namespace DiscImageChef.Core.Devices
|
||||
decSense = Sense.DecodeFixed(senseBuf);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.SenseKey == SenseKeys.IllegalRequest && decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
{
|
||||
CanReadRaw = true;
|
||||
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
||||
@@ -287,7 +287,8 @@ namespace DiscImageChef.Core.Devices
|
||||
decSense = Sense.DecodeFixed(senseBuf);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.SenseKey == SenseKeys.IllegalRequest &&
|
||||
decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00)
|
||||
decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
{
|
||||
CanReadRaw = true;
|
||||
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
||||
@@ -307,9 +308,9 @@ namespace DiscImageChef.Core.Devices
|
||||
testSense = dev.SyQuestReadLong6(out _, out senseBuf, 0, 262, timeout, out _);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
syqReadLong6 = true;
|
||||
syqReadLong6 = true;
|
||||
LongBlockSize = 262;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -328,7 +329,7 @@ namespace DiscImageChef.Core.Devices
|
||||
|
||||
if(hldtstReadRaw || plextorReadRaw)
|
||||
{
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
LongBlockSize = 2064;
|
||||
}
|
||||
|
||||
@@ -338,9 +339,9 @@ namespace DiscImageChef.Core.Devices
|
||||
testSense = dev.ReadLong10(out _, out senseBuf, false, false, 0, 37856, timeout, out _);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
readLongDvd = true;
|
||||
readLongDvd = true;
|
||||
LongBlockSize = 37856;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -371,8 +372,8 @@ namespace DiscImageChef.Core.Devices
|
||||
sense = dev.ReadCapacity(out byte[] cmdBuf, out byte[] senseBuf, timeout, out _);
|
||||
if(!sense)
|
||||
{
|
||||
Blocks = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + cmdBuf[3]);
|
||||
LogicalBlockSize = (uint)((cmdBuf[5] << 24) + (cmdBuf[5] << 16) + (cmdBuf[6] << 8) + cmdBuf[7]);
|
||||
Blocks = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + cmdBuf[3]);
|
||||
LogicalBlockSize = (uint)((cmdBuf[5] << 24) + (cmdBuf[5] << 16) + (cmdBuf[6] << 8) + cmdBuf[7]);
|
||||
}
|
||||
|
||||
if(sense || Blocks == 0xFFFFFFFF)
|
||||
@@ -393,13 +394,13 @@ namespace DiscImageChef.Core.Devices
|
||||
|
||||
Array.Copy(cmdBuf, 0, temp, 0, 8);
|
||||
Array.Reverse(temp);
|
||||
Blocks = BitConverter.ToUInt64(temp, 0);
|
||||
Blocks = BitConverter.ToUInt64(temp, 0);
|
||||
LogicalBlockSize = (uint)((cmdBuf[5] << 24) + (cmdBuf[5] << 16) + (cmdBuf[6] << 8) + cmdBuf[7]);
|
||||
}
|
||||
}
|
||||
|
||||
PhysicalBlockSize = LogicalBlockSize;
|
||||
LongBlockSize = LogicalBlockSize;
|
||||
LongBlockSize = LogicalBlockSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -445,9 +446,9 @@ namespace DiscImageChef.Core.Devices
|
||||
|
||||
bool ScsiReadBlocks(out byte[] buffer, ulong block, uint count, out double duration)
|
||||
{
|
||||
bool sense;
|
||||
bool sense;
|
||||
byte[] senseBuf;
|
||||
buffer = null;
|
||||
buffer = null;
|
||||
duration = 0;
|
||||
|
||||
if(CanReadRaw)
|
||||
@@ -498,7 +499,7 @@ namespace DiscImageChef.Core.Devices
|
||||
bool sense = true;
|
||||
duration = 0;
|
||||
|
||||
if(seek6) sense = dev.Seek6(out _, (uint)block, timeout, out duration);
|
||||
if(seek6) sense = dev.Seek6(out _, (uint)block, timeout, out duration);
|
||||
else if(seek10) sense = dev.Seek10(out _, (uint)block, timeout, out duration);
|
||||
|
||||
return sense;
|
||||
|
||||
@@ -666,7 +666,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
mediaTest.BlocksSpecified = true;
|
||||
}
|
||||
|
||||
if(ataId.NominalRotationRate != 0x0000 && ataId.NominalRotationRate != 0xFFFF)
|
||||
if(ataId.NominalRotationRate != 0x0000 && ataId.NominalRotationRate != 0xFFFF)
|
||||
if(ataId.NominalRotationRate == 0x0001)
|
||||
{
|
||||
mediaTest.SolidStateDevice = true;
|
||||
@@ -685,14 +685,13 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000)
|
||||
{
|
||||
if((ataId.PhysLogSectorSize & 0x1000) == 0x1000)
|
||||
if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF)
|
||||
if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF)
|
||||
logicalsectorsize = 512;
|
||||
else
|
||||
logicalsectorsize = ataId.LogicalSectorWords * 2;
|
||||
else logicalsectorsize = 512;
|
||||
else logicalsectorsize = 512;
|
||||
|
||||
if((ataId.PhysLogSectorSize &
|
||||
0x2000) == 0x2000)
|
||||
if((ataId.PhysLogSectorSize & 0x2000) == 0x2000)
|
||||
physicalsectorsize =
|
||||
(uint)(logicalsectorsize * ((1 << ataId.PhysLogSectorSize) & 0xF));
|
||||
else physicalsectorsize = logicalsectorsize;
|
||||
@@ -724,7 +723,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
if(ataId.UnformattedBPS > logicalsectorsize &&
|
||||
if(ataId.UnformattedBPS > logicalsectorsize &&
|
||||
(!mediaTest.LongBlockSizeSpecified || mediaTest.LongBlockSize == 516))
|
||||
{
|
||||
mediaTest.LongBlockSize = ataId.UnformattedBPS;
|
||||
@@ -779,8 +778,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in CHS mode...");
|
||||
sense =
|
||||
dev.Read(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
sense = dev.Read(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
mediaTest.SupportsReadRetry = !sense && (errorChs.Status & 0x01) != 0x01 &&
|
||||
errorChs.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -791,8 +789,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA in CHS mode...");
|
||||
sense =
|
||||
dev.ReadDma(out readBuf, out errorChs, false, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
sense = dev.ReadDma(out readBuf, out errorChs, false, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
mediaTest.SupportsReadDma = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -803,8 +800,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA RETRY in CHS mode...");
|
||||
sense =
|
||||
dev.ReadDma(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
sense = dev.ReadDma(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
mediaTest.SupportsReadDmaRetry = !sense && (errorChs.Status & 0x01) != 0x01 &&
|
||||
errorChs.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
@@ -822,8 +818,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
sense, errorChs.Status, errorChs.Error);
|
||||
|
||||
DicConsole.WriteLine("Trying READ SECTOR(S) in LBA mode...");
|
||||
sense = dev.Read(out readBuf, out AtaErrorRegistersLba28 errorLba, false, 0,
|
||||
1, TIMEOUT, out _);
|
||||
sense = dev.Read(out readBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, TIMEOUT, out _);
|
||||
mediaTest.SupportsReadLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -834,8 +829,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in LBA mode...");
|
||||
sense =
|
||||
dev.Read(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.Read(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
|
||||
mediaTest.SupportsReadRetryLba = !sense && (errorLba.Status & 0x01) != 0x01 &&
|
||||
errorLba.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
@@ -847,8 +841,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA in LBA mode...");
|
||||
sense =
|
||||
dev.ReadDma(out readBuf, out errorLba, false, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.ReadDma(out readBuf, out errorLba, false, 0, 1, TIMEOUT, out _);
|
||||
mediaTest.SupportsReadDmaLba = !sense && (errorLba.Status & 0x01) != 0x01 &&
|
||||
errorLba.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -859,8 +852,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA RETRY in LBA mode...");
|
||||
sense =
|
||||
dev.ReadDma(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.ReadDma(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
|
||||
mediaTest.SupportsReadDmaRetryLba =
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -877,8 +869,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
sense, errorChs.Status, errorChs.Error);
|
||||
|
||||
DicConsole.WriteLine("Trying READ SECTOR(S) in LBA48 mode...");
|
||||
sense =
|
||||
dev.Read(out readBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.Read(out readBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, TIMEOUT, out _);
|
||||
mediaTest.SupportsReadLba48 = !sense && (errorLba48.Status & 0x01) != 0x01 &&
|
||||
errorLba48.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
@@ -890,7 +881,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA in LBA48 mode...");
|
||||
sense = dev.ReadDma(out readBuf, out errorLba48, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.ReadDma(out readBuf, out errorLba48, 0, 1, TIMEOUT, out _);
|
||||
mediaTest.SupportsReadDmaLba48 = !sense && (errorLba48.Status & 0x01) != 0x01 &&
|
||||
errorLba48.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
@@ -918,7 +909,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
if(ataId.UnformattedBPS > logicalsectorsize &&
|
||||
if(ataId.UnformattedBPS > logicalsectorsize &&
|
||||
(!mediaTest.LongBlockSizeSpecified || mediaTest.LongBlockSize == 516))
|
||||
{
|
||||
mediaTest.LongBlockSize = ataId.UnformattedBPS;
|
||||
@@ -1044,7 +1035,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
report.ATA.ReadCapabilities.BlocksSpecified = true;
|
||||
}
|
||||
|
||||
if(ataId.NominalRotationRate != 0x0000 && ataId.NominalRotationRate != 0xFFFF)
|
||||
if(ataId.NominalRotationRate != 0x0000 && ataId.NominalRotationRate != 0xFFFF)
|
||||
if(ataId.NominalRotationRate == 0x0001)
|
||||
{
|
||||
report.ATA.ReadCapabilities.SolidStateDevice = true;
|
||||
@@ -1063,14 +1054,13 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000)
|
||||
{
|
||||
if((ataId.PhysLogSectorSize & 0x1000) == 0x1000)
|
||||
if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF)
|
||||
if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF)
|
||||
logicalsectorsize = 512;
|
||||
else
|
||||
logicalsectorsize = ataId.LogicalSectorWords * 2;
|
||||
else logicalsectorsize = 512;
|
||||
else logicalsectorsize = 512;
|
||||
|
||||
if((ataId.PhysLogSectorSize & 0x2000) ==
|
||||
0x2000)
|
||||
if((ataId.PhysLogSectorSize & 0x2000) == 0x2000)
|
||||
physicalsectorsize = logicalsectorsize * (uint)Math.Pow(2, ataId.PhysLogSectorSize & 0xF);
|
||||
else physicalsectorsize = logicalsectorsize;
|
||||
}
|
||||
@@ -1157,8 +1147,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in CHS mode...");
|
||||
sense =
|
||||
dev.Read(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
sense = dev.Read(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsReadRetry =
|
||||
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -1169,8 +1158,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA in CHS mode...");
|
||||
sense =
|
||||
dev.ReadDma(out readBuf, out errorChs, false, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
sense = dev.ReadDma(out readBuf, out errorChs, false, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsReadDma =
|
||||
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -1181,8 +1169,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA RETRY in CHS mode...");
|
||||
sense =
|
||||
dev.ReadDma(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
sense = dev.ReadDma(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsReadDmaRetry =
|
||||
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -1193,15 +1180,14 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying SEEK in CHS mode...");
|
||||
sense = dev.Seek(out errorChs, 0, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.Seek(out errorChs, 0, 0, 1, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsSeek =
|
||||
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0;
|
||||
DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", sense,
|
||||
errorChs.Status, errorChs.Error);
|
||||
|
||||
DicConsole.WriteLine("Trying READ SECTOR(S) in LBA mode...");
|
||||
sense =
|
||||
dev.Read(out readBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.Read(out readBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsReadLba =
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -1212,8 +1198,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in LBA mode...");
|
||||
sense =
|
||||
dev.Read(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.Read(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsReadRetryLba =
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -1224,8 +1209,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA in LBA mode...");
|
||||
sense =
|
||||
dev.ReadDma(out readBuf, out errorLba, false, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.ReadDma(out readBuf, out errorLba, false, 0, 1, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsReadDmaLba =
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -1236,8 +1220,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA RETRY in LBA mode...");
|
||||
sense =
|
||||
dev.ReadDma(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.ReadDma(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsReadDmaRetryLba =
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -1248,15 +1231,14 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying SEEK in LBA mode...");
|
||||
sense = dev.Seek(out errorLba, 0, TIMEOUT, out _);
|
||||
sense = dev.Seek(out errorLba, 0, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsSeekLba =
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0;
|
||||
DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", sense,
|
||||
errorLba.Status, errorLba.Error);
|
||||
|
||||
DicConsole.WriteLine("Trying READ SECTOR(S) in LBA48 mode...");
|
||||
sense =
|
||||
dev.Read(out readBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.Read(out readBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsReadLba48 =
|
||||
!sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -1267,8 +1249,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA in LBA48 mode...");
|
||||
sense =
|
||||
dev.ReadDma(out readBuf, out errorLba48, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.ReadDma(out readBuf, out errorLba48, 0, 1, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsReadDmaLba48 =
|
||||
!sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
|
||||
@@ -69,400 +69,479 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(atapiId.AdditionalPID))
|
||||
{
|
||||
report.ATAPI.AdditionalPID = atapiId.AdditionalPID;
|
||||
report.ATAPI.AdditionalPID = atapiId.AdditionalPID;
|
||||
report.ATAPI.AdditionalPIDSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.APIOSupported != 0)
|
||||
{
|
||||
report.ATAPI.APIOSupported = atapiId.APIOSupported;
|
||||
report.ATAPI.APIOSupported = atapiId.APIOSupported;
|
||||
report.ATAPI.APIOSupportedSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.ATAPIByteCount != 0)
|
||||
{
|
||||
report.ATAPI.ATAPIByteCount = atapiId.ATAPIByteCount;
|
||||
report.ATAPI.ATAPIByteCount = atapiId.ATAPIByteCount;
|
||||
report.ATAPI.ATAPIByteCountSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.BufferType != 0)
|
||||
{
|
||||
report.ATAPI.BufferType = atapiId.BufferType;
|
||||
report.ATAPI.BufferType = atapiId.BufferType;
|
||||
report.ATAPI.BufferTypeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.BufferSize != 0)
|
||||
{
|
||||
report.ATAPI.BufferSize = atapiId.BufferSize;
|
||||
report.ATAPI.BufferSize = atapiId.BufferSize;
|
||||
report.ATAPI.BufferSizeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.Capabilities != 0)
|
||||
{
|
||||
report.ATAPI.Capabilities = atapiId.Capabilities;
|
||||
report.ATAPI.Capabilities = atapiId.Capabilities;
|
||||
report.ATAPI.CapabilitiesSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.Capabilities2 != 0)
|
||||
{
|
||||
report.ATAPI.Capabilities2 = atapiId.Capabilities2;
|
||||
report.ATAPI.Capabilities2 = atapiId.Capabilities2;
|
||||
report.ATAPI.Capabilities2Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.Capabilities3 != 0)
|
||||
{
|
||||
report.ATAPI.Capabilities3 = atapiId.Capabilities3;
|
||||
report.ATAPI.Capabilities3 = atapiId.Capabilities3;
|
||||
report.ATAPI.Capabilities3Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.CFAPowerMode != 0)
|
||||
{
|
||||
report.ATAPI.CFAPowerMode = atapiId.CFAPowerMode;
|
||||
report.ATAPI.CFAPowerMode = atapiId.CFAPowerMode;
|
||||
report.ATAPI.CFAPowerModeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.CommandSet != 0)
|
||||
{
|
||||
report.ATAPI.CommandSet = atapiId.CommandSet;
|
||||
report.ATAPI.CommandSet = atapiId.CommandSet;
|
||||
report.ATAPI.CommandSetSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.CommandSet2 != 0)
|
||||
{
|
||||
report.ATAPI.CommandSet2 = atapiId.CommandSet2;
|
||||
report.ATAPI.CommandSet2 = atapiId.CommandSet2;
|
||||
report.ATAPI.CommandSet2Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.CommandSet3 != 0)
|
||||
{
|
||||
report.ATAPI.CommandSet3 = atapiId.CommandSet3;
|
||||
report.ATAPI.CommandSet3 = atapiId.CommandSet3;
|
||||
report.ATAPI.CommandSet3Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.CommandSet4 != 0)
|
||||
{
|
||||
report.ATAPI.CommandSet4 = atapiId.CommandSet4;
|
||||
report.ATAPI.CommandSet4 = atapiId.CommandSet4;
|
||||
report.ATAPI.CommandSet4Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.CommandSet5 != 0)
|
||||
{
|
||||
report.ATAPI.CommandSet5 = atapiId.CommandSet5;
|
||||
report.ATAPI.CommandSet5 = atapiId.CommandSet5;
|
||||
report.ATAPI.CommandSet5Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.CurrentAAM != 0)
|
||||
{
|
||||
report.ATAPI.CurrentAAM = atapiId.CurrentAAM;
|
||||
report.ATAPI.CurrentAAM = atapiId.CurrentAAM;
|
||||
report.ATAPI.CurrentAAMSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.CurrentAPM != 0)
|
||||
{
|
||||
report.ATAPI.CurrentAPM = atapiId.CurrentAPM;
|
||||
report.ATAPI.CurrentAPM = atapiId.CurrentAPM;
|
||||
report.ATAPI.CurrentAPMSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.DataSetMgmt != 0)
|
||||
{
|
||||
report.ATAPI.DataSetMgmt = atapiId.DataSetMgmt;
|
||||
report.ATAPI.DataSetMgmt = atapiId.DataSetMgmt;
|
||||
report.ATAPI.DataSetMgmtSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.DataSetMgmtSize != 0)
|
||||
{
|
||||
report.ATAPI.DataSetMgmtSize = atapiId.DataSetMgmtSize;
|
||||
report.ATAPI.DataSetMgmtSize = atapiId.DataSetMgmtSize;
|
||||
report.ATAPI.DataSetMgmtSizeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.DeviceFormFactor != 0)
|
||||
{
|
||||
report.ATAPI.DeviceFormFactor = atapiId.DeviceFormFactor;
|
||||
report.ATAPI.DeviceFormFactor = atapiId.DeviceFormFactor;
|
||||
report.ATAPI.DeviceFormFactorSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.DMAActive != 0)
|
||||
{
|
||||
report.ATAPI.DMAActive = atapiId.DMAActive;
|
||||
report.ATAPI.DMAActive = atapiId.DMAActive;
|
||||
report.ATAPI.DMAActiveSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.DMASupported != 0)
|
||||
{
|
||||
report.ATAPI.DMASupported = atapiId.DMASupported;
|
||||
report.ATAPI.DMASupported = atapiId.DMASupported;
|
||||
report.ATAPI.DMASupportedSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.DMATransferTimingMode != 0)
|
||||
{
|
||||
report.ATAPI.DMATransferTimingMode = atapiId.DMATransferTimingMode;
|
||||
report.ATAPI.DMATransferTimingMode = atapiId.DMATransferTimingMode;
|
||||
report.ATAPI.DMATransferTimingModeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.EnhancedSecurityEraseTime != 0)
|
||||
{
|
||||
report.ATAPI.EnhancedSecurityEraseTime = atapiId.EnhancedSecurityEraseTime;
|
||||
report.ATAPI.EnhancedSecurityEraseTime = atapiId.EnhancedSecurityEraseTime;
|
||||
report.ATAPI.EnhancedSecurityEraseTimeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.EnabledCommandSet != 0)
|
||||
{
|
||||
report.ATAPI.EnabledCommandSet = atapiId.EnabledCommandSet;
|
||||
report.ATAPI.EnabledCommandSet = atapiId.EnabledCommandSet;
|
||||
report.ATAPI.EnabledCommandSetSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.EnabledCommandSet2 != 0)
|
||||
{
|
||||
report.ATAPI.EnabledCommandSet2 = atapiId.EnabledCommandSet2;
|
||||
report.ATAPI.EnabledCommandSet2 = atapiId.EnabledCommandSet2;
|
||||
report.ATAPI.EnabledCommandSet2Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.EnabledCommandSet3 != 0)
|
||||
{
|
||||
report.ATAPI.EnabledCommandSet3 = atapiId.EnabledCommandSet3;
|
||||
report.ATAPI.EnabledCommandSet3 = atapiId.EnabledCommandSet3;
|
||||
report.ATAPI.EnabledCommandSet3Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.EnabledCommandSet4 != 0)
|
||||
{
|
||||
report.ATAPI.EnabledCommandSet4 = atapiId.EnabledCommandSet4;
|
||||
report.ATAPI.EnabledCommandSet4 = atapiId.EnabledCommandSet4;
|
||||
report.ATAPI.EnabledCommandSet4Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.EnabledSATAFeatures != 0)
|
||||
{
|
||||
report.ATAPI.EnabledSATAFeatures = atapiId.EnabledSATAFeatures;
|
||||
report.ATAPI.EnabledSATAFeatures = atapiId.EnabledSATAFeatures;
|
||||
report.ATAPI.EnabledSATAFeaturesSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.ExtendedUserSectors != 0)
|
||||
{
|
||||
report.ATAPI.ExtendedUserSectors = atapiId.ExtendedUserSectors;
|
||||
report.ATAPI.ExtendedUserSectors = atapiId.ExtendedUserSectors;
|
||||
report.ATAPI.ExtendedUserSectorsSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.FreeFallSensitivity != 0)
|
||||
{
|
||||
report.ATAPI.FreeFallSensitivity = atapiId.FreeFallSensitivity;
|
||||
report.ATAPI.FreeFallSensitivity = atapiId.FreeFallSensitivity;
|
||||
report.ATAPI.FreeFallSensitivitySpecified = true;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(atapiId.FirmwareRevision))
|
||||
{
|
||||
report.ATAPI.FirmwareRevision = atapiId.FirmwareRevision;
|
||||
report.ATAPI.FirmwareRevision = atapiId.FirmwareRevision;
|
||||
report.ATAPI.FirmwareRevisionSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.GeneralConfiguration != 0)
|
||||
{
|
||||
report.ATAPI.GeneralConfiguration = atapiId.GeneralConfiguration;
|
||||
report.ATAPI.GeneralConfiguration = atapiId.GeneralConfiguration;
|
||||
report.ATAPI.GeneralConfigurationSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.HardwareResetResult != 0)
|
||||
{
|
||||
report.ATAPI.HardwareResetResult = atapiId.HardwareResetResult;
|
||||
report.ATAPI.HardwareResetResult = atapiId.HardwareResetResult;
|
||||
report.ATAPI.HardwareResetResultSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.InterseekDelay != 0)
|
||||
{
|
||||
report.ATAPI.InterseekDelay = atapiId.InterseekDelay;
|
||||
report.ATAPI.InterseekDelay = atapiId.InterseekDelay;
|
||||
report.ATAPI.InterseekDelaySpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MajorVersion != 0)
|
||||
{
|
||||
report.ATAPI.MajorVersion = atapiId.MajorVersion;
|
||||
report.ATAPI.MajorVersion = atapiId.MajorVersion;
|
||||
report.ATAPI.MajorVersionSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MasterPasswordRevisionCode != 0)
|
||||
{
|
||||
report.ATAPI.MasterPasswordRevisionCode = atapiId.MasterPasswordRevisionCode;
|
||||
report.ATAPI.MasterPasswordRevisionCode = atapiId.MasterPasswordRevisionCode;
|
||||
report.ATAPI.MasterPasswordRevisionCodeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MaxDownloadMicroMode3 != 0)
|
||||
{
|
||||
report.ATAPI.MaxDownloadMicroMode3 = atapiId.MaxDownloadMicroMode3;
|
||||
report.ATAPI.MaxDownloadMicroMode3 = atapiId.MaxDownloadMicroMode3;
|
||||
report.ATAPI.MaxDownloadMicroMode3Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MaxQueueDepth != 0)
|
||||
{
|
||||
report.ATAPI.MaxQueueDepth = atapiId.MaxQueueDepth;
|
||||
report.ATAPI.MaxQueueDepth = atapiId.MaxQueueDepth;
|
||||
report.ATAPI.MaxQueueDepthSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MDMAActive != 0)
|
||||
{
|
||||
report.ATAPI.MDMAActive = atapiId.MDMAActive;
|
||||
report.ATAPI.MDMAActive = atapiId.MDMAActive;
|
||||
report.ATAPI.MDMAActiveSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MDMASupported != 0)
|
||||
{
|
||||
report.ATAPI.MDMASupported = atapiId.MDMASupported;
|
||||
report.ATAPI.MDMASupported = atapiId.MDMASupported;
|
||||
report.ATAPI.MDMASupportedSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MinDownloadMicroMode3 != 0)
|
||||
{
|
||||
report.ATAPI.MinDownloadMicroMode3 = atapiId.MinDownloadMicroMode3;
|
||||
report.ATAPI.MinDownloadMicroMode3 = atapiId.MinDownloadMicroMode3;
|
||||
report.ATAPI.MinDownloadMicroMode3Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MinMDMACycleTime != 0)
|
||||
{
|
||||
report.ATAPI.MinMDMACycleTime = atapiId.MinMDMACycleTime;
|
||||
report.ATAPI.MinMDMACycleTime = atapiId.MinMDMACycleTime;
|
||||
report.ATAPI.MinMDMACycleTimeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MinorVersion != 0)
|
||||
{
|
||||
report.ATAPI.MinorVersion = atapiId.MinorVersion;
|
||||
report.ATAPI.MinorVersion = atapiId.MinorVersion;
|
||||
report.ATAPI.MinorVersionSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MinPIOCycleTimeNoFlow != 0)
|
||||
{
|
||||
report.ATAPI.MinPIOCycleTimeNoFlow = atapiId.MinPIOCycleTimeNoFlow;
|
||||
report.ATAPI.MinPIOCycleTimeNoFlow = atapiId.MinPIOCycleTimeNoFlow;
|
||||
report.ATAPI.MinPIOCycleTimeNoFlowSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MinPIOCycleTimeFlow != 0)
|
||||
{
|
||||
report.ATAPI.MinPIOCycleTimeFlow = atapiId.MinPIOCycleTimeFlow;
|
||||
report.ATAPI.MinPIOCycleTimeFlow = atapiId.MinPIOCycleTimeFlow;
|
||||
report.ATAPI.MinPIOCycleTimeFlowSpecified = true;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(atapiId.Model))
|
||||
{
|
||||
report.ATAPI.Model = atapiId.Model;
|
||||
report.ATAPI.Model = atapiId.Model;
|
||||
report.ATAPI.ModelSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MultipleMaxSectors != 0)
|
||||
{
|
||||
report.ATAPI.MultipleMaxSectors = atapiId.MultipleMaxSectors;
|
||||
report.ATAPI.MultipleMaxSectors = atapiId.MultipleMaxSectors;
|
||||
report.ATAPI.MultipleMaxSectorsSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MultipleSectorNumber != 0)
|
||||
{
|
||||
report.ATAPI.MultipleSectorNumber = atapiId.MultipleSectorNumber;
|
||||
report.ATAPI.MultipleSectorNumber = atapiId.MultipleSectorNumber;
|
||||
report.ATAPI.MultipleSectorNumberSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.NVCacheCaps != 0)
|
||||
{
|
||||
report.ATAPI.NVCacheCaps = atapiId.NVCacheCaps;
|
||||
report.ATAPI.NVCacheCaps = atapiId.NVCacheCaps;
|
||||
report.ATAPI.NVCacheCapsSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.NVCacheSize != 0)
|
||||
{
|
||||
report.ATAPI.NVCacheSize = atapiId.NVCacheSize;
|
||||
report.ATAPI.NVCacheSize = atapiId.NVCacheSize;
|
||||
report.ATAPI.NVCacheSizeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.NVCacheWriteSpeed != 0)
|
||||
{
|
||||
report.ATAPI.NVCacheWriteSpeed = atapiId.NVCacheWriteSpeed;
|
||||
report.ATAPI.NVCacheWriteSpeed = atapiId.NVCacheWriteSpeed;
|
||||
report.ATAPI.NVCacheWriteSpeedSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.NVEstimatedSpinUp != 0)
|
||||
{
|
||||
report.ATAPI.NVEstimatedSpinUp = atapiId.NVEstimatedSpinUp;
|
||||
report.ATAPI.NVEstimatedSpinUp = atapiId.NVEstimatedSpinUp;
|
||||
report.ATAPI.NVEstimatedSpinUpSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.PacketBusRelease != 0)
|
||||
{
|
||||
report.ATAPI.PacketBusRelease = atapiId.PacketBusRelease;
|
||||
report.ATAPI.PacketBusRelease = atapiId.PacketBusRelease;
|
||||
report.ATAPI.PacketBusReleaseSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.PIOTransferTimingMode != 0)
|
||||
{
|
||||
report.ATAPI.PIOTransferTimingMode = atapiId.PIOTransferTimingMode;
|
||||
report.ATAPI.PIOTransferTimingMode = atapiId.PIOTransferTimingMode;
|
||||
report.ATAPI.PIOTransferTimingModeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.RecommendedAAM != 0)
|
||||
{
|
||||
report.ATAPI.RecommendedAAM = atapiId.RecommendedAAM;
|
||||
report.ATAPI.RecommendedAAM = atapiId.RecommendedAAM;
|
||||
report.ATAPI.RecommendedAAMSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.RecMDMACycleTime != 0)
|
||||
{
|
||||
report.ATAPI.RecommendedMDMACycleTime = atapiId.RecMDMACycleTime;
|
||||
report.ATAPI.RecommendedMDMACycleTime = atapiId.RecMDMACycleTime;
|
||||
report.ATAPI.RecommendedMDMACycleTimeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.RemovableStatusSet != 0)
|
||||
{
|
||||
report.ATAPI.RemovableStatusSet = atapiId.RemovableStatusSet;
|
||||
report.ATAPI.RemovableStatusSet = atapiId.RemovableStatusSet;
|
||||
report.ATAPI.RemovableStatusSetSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.SATACapabilities != 0)
|
||||
{
|
||||
report.ATAPI.SATACapabilities = atapiId.SATACapabilities;
|
||||
report.ATAPI.SATACapabilities = atapiId.SATACapabilities;
|
||||
report.ATAPI.SATACapabilitiesSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.SATACapabilities2 != 0)
|
||||
{
|
||||
report.ATAPI.SATACapabilities2 = atapiId.SATACapabilities2;
|
||||
report.ATAPI.SATACapabilities2 = atapiId.SATACapabilities2;
|
||||
report.ATAPI.SATACapabilities2Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.SATAFeatures != 0)
|
||||
{
|
||||
report.ATAPI.SATAFeatures = atapiId.SATAFeatures;
|
||||
report.ATAPI.SATAFeatures = atapiId.SATAFeatures;
|
||||
report.ATAPI.SATAFeaturesSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.SCTCommandTransport != 0)
|
||||
{
|
||||
report.ATAPI.SCTCommandTransport = atapiId.SCTCommandTransport;
|
||||
report.ATAPI.SCTCommandTransport = atapiId.SCTCommandTransport;
|
||||
report.ATAPI.SCTCommandTransportSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.SectorsPerCard != 0)
|
||||
{
|
||||
report.ATAPI.SectorsPerCard = atapiId.SectorsPerCard;
|
||||
report.ATAPI.SectorsPerCard = atapiId.SectorsPerCard;
|
||||
report.ATAPI.SectorsPerCardSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.SecurityEraseTime != 0)
|
||||
{
|
||||
report.ATAPI.SecurityEraseTime = atapiId.SecurityEraseTime;
|
||||
report.ATAPI.SecurityEraseTime = atapiId.SecurityEraseTime;
|
||||
report.ATAPI.SecurityEraseTimeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.SecurityStatus != 0)
|
||||
{
|
||||
report.ATAPI.SecurityStatus = atapiId.SecurityStatus;
|
||||
report.ATAPI.SecurityStatus = atapiId.SecurityStatus;
|
||||
report.ATAPI.SecurityStatusSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.ServiceBusyClear != 0)
|
||||
{
|
||||
report.ATAPI.ServiceBusyClear = atapiId.ServiceBusyClear;
|
||||
report.ATAPI.ServiceBusyClear = atapiId.ServiceBusyClear;
|
||||
report.ATAPI.ServiceBusyClearSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.SpecificConfiguration != 0)
|
||||
{
|
||||
report.ATAPI.SpecificConfiguration = atapiId.SpecificConfiguration;
|
||||
report.ATAPI.SpecificConfiguration = atapiId.SpecificConfiguration;
|
||||
report.ATAPI.SpecificConfigurationSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.StreamAccessLatency != 0)
|
||||
{
|
||||
report.ATAPI.StreamAccessLatency = atapiId.StreamAccessLatency;
|
||||
report.ATAPI.StreamAccessLatency = atapiId.StreamAccessLatency;
|
||||
report.ATAPI.StreamAccessLatencySpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.StreamMinReqSize != 0)
|
||||
{
|
||||
report.ATAPI.StreamMinReqSize = atapiId.StreamMinReqSize;
|
||||
report.ATAPI.StreamMinReqSize = atapiId.StreamMinReqSize;
|
||||
report.ATAPI.StreamMinReqSizeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.StreamPerformanceGranularity != 0)
|
||||
{
|
||||
report.ATAPI.StreamPerformanceGranularity = atapiId.StreamPerformanceGranularity;
|
||||
report.ATAPI.StreamPerformanceGranularity = atapiId.StreamPerformanceGranularity;
|
||||
report.ATAPI.StreamPerformanceGranularitySpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.StreamTransferTimeDMA != 0)
|
||||
{
|
||||
report.ATAPI.StreamTransferTimeDMA = atapiId.StreamTransferTimeDMA;
|
||||
report.ATAPI.StreamTransferTimeDMA = atapiId.StreamTransferTimeDMA;
|
||||
report.ATAPI.StreamTransferTimeDMASpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.StreamTransferTimePIO != 0)
|
||||
{
|
||||
report.ATAPI.StreamTransferTimePIO = atapiId.StreamTransferTimePIO;
|
||||
report.ATAPI.StreamTransferTimePIO = atapiId.StreamTransferTimePIO;
|
||||
report.ATAPI.StreamTransferTimePIOSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.TransportMajorVersion != 0)
|
||||
{
|
||||
report.ATAPI.TransportMajorVersion = atapiId.TransportMajorVersion;
|
||||
report.ATAPI.TransportMajorVersion = atapiId.TransportMajorVersion;
|
||||
report.ATAPI.TransportMajorVersionSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.TransportMinorVersion != 0)
|
||||
{
|
||||
report.ATAPI.TransportMinorVersion = atapiId.TransportMinorVersion;
|
||||
report.ATAPI.TransportMinorVersion = atapiId.TransportMinorVersion;
|
||||
report.ATAPI.TransportMinorVersionSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.TrustedComputing != 0)
|
||||
{
|
||||
report.ATAPI.TrustedComputing = atapiId.TrustedComputing;
|
||||
report.ATAPI.TrustedComputing = atapiId.TrustedComputing;
|
||||
report.ATAPI.TrustedComputingSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.UDMAActive != 0)
|
||||
{
|
||||
report.ATAPI.UDMAActive = atapiId.UDMAActive;
|
||||
report.ATAPI.UDMAActive = atapiId.UDMAActive;
|
||||
report.ATAPI.UDMAActiveSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.UDMASupported != 0)
|
||||
{
|
||||
report.ATAPI.UDMASupported = atapiId.UDMASupported;
|
||||
report.ATAPI.UDMASupported = atapiId.UDMASupported;
|
||||
report.ATAPI.UDMASupportedSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.WRVMode != 0)
|
||||
{
|
||||
report.ATAPI.WRVMode = atapiId.WRVMode;
|
||||
report.ATAPI.WRVMode = atapiId.WRVMode;
|
||||
report.ATAPI.WRVModeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.WRVSectorCountMode3 != 0)
|
||||
{
|
||||
report.ATAPI.WRVSectorCountMode3 = atapiId.WRVSectorCountMode3;
|
||||
report.ATAPI.WRVSectorCountMode3 = atapiId.WRVSectorCountMode3;
|
||||
report.ATAPI.WRVSectorCountMode3Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.WRVSectorCountMode2 != 0)
|
||||
{
|
||||
report.ATAPI.WRVSectorCountMode2 = atapiId.WRVSectorCountMode2;
|
||||
report.ATAPI.WRVSectorCountMode2 = atapiId.WRVSectorCountMode2;
|
||||
report.ATAPI.WRVSectorCountMode2Specified = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(debug) report.ATAPI.Identify = buffer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,9 +65,9 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
report.FireWire = new firewireType
|
||||
{
|
||||
Manufacturer = dev.FireWireVendorName,
|
||||
Product = dev.FireWireModelName,
|
||||
ProductID = dev.FireWireModel,
|
||||
VendorID = dev.FireWireVendor
|
||||
Product = dev.FireWireModelName,
|
||||
ProductID = dev.FireWireModel,
|
||||
VendorID = dev.FireWireVendor
|
||||
};
|
||||
|
||||
pressedKey = new ConsoleKeyInfo();
|
||||
@@ -79,7 +79,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
}
|
||||
|
||||
report.FireWire.RemovableMedia = pressedKey.Key == ConsoleKey.Y;
|
||||
removable = report.FireWire.RemovableMedia;
|
||||
removable = report.FireWire.RemovableMedia;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,22 +60,24 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
|
||||
if(manfid != null)
|
||||
{
|
||||
report.PCMCIA.ManufacturerCode = manfid.ManufacturerID;
|
||||
report.PCMCIA.CardCode = manfid.CardID;
|
||||
report.PCMCIA.ManufacturerCode = manfid.ManufacturerID;
|
||||
report.PCMCIA.CardCode = manfid.CardID;
|
||||
report.PCMCIA.ManufacturerCodeSpecified = true;
|
||||
report.PCMCIA.CardCodeSpecified = true;
|
||||
report.PCMCIA.CardCodeSpecified = true;
|
||||
}
|
||||
|
||||
break;
|
||||
case TupleCodes.CISTPL_VERS_1:
|
||||
Level1VersionTuple vers = CIS.DecodeLevel1VersionTuple(tuple);
|
||||
|
||||
if(vers != null)
|
||||
{
|
||||
report.PCMCIA.Manufacturer = vers.Manufacturer;
|
||||
report.PCMCIA.ProductName = vers.Product;
|
||||
report.PCMCIA.Compliance = $"{vers.MajorVersion}.{vers.MinorVersion}";
|
||||
report.PCMCIA.Manufacturer = vers.Manufacturer;
|
||||
report.PCMCIA.ProductName = vers.Product;
|
||||
report.PCMCIA.Compliance = $"{vers.MajorVersion}.{vers.MinorVersion}";
|
||||
report.PCMCIA.AdditionalInformation = vers.AdditionalInformation;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,8 +59,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
if(report == null) return;
|
||||
|
||||
bool sense;
|
||||
const uint TIMEOUT = 5;
|
||||
bool sense;
|
||||
const uint TIMEOUT = 5;
|
||||
ConsoleKeyInfo pressedKey;
|
||||
|
||||
if(dev.IsUsb) Usb.Report(dev, ref report, debug, ref removable);
|
||||
@@ -98,29 +98,34 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
if(inq.DeviceTypeModifier != 0)
|
||||
{
|
||||
report.SCSI.Inquiry.DeviceTypeModifier = inq.DeviceTypeModifier;
|
||||
report.SCSI.Inquiry.DeviceTypeModifier = inq.DeviceTypeModifier;
|
||||
report.SCSI.Inquiry.DeviceTypeModifierSpecified = true;
|
||||
}
|
||||
|
||||
if(inq.ISOVersion != 0)
|
||||
{
|
||||
report.SCSI.Inquiry.ISOVersion = inq.ISOVersion;
|
||||
report.SCSI.Inquiry.ISOVersion = inq.ISOVersion;
|
||||
report.SCSI.Inquiry.ISOVersionSpecified = true;
|
||||
}
|
||||
|
||||
if(inq.ECMAVersion != 0)
|
||||
{
|
||||
report.SCSI.Inquiry.ECMAVersion = inq.ECMAVersion;
|
||||
report.SCSI.Inquiry.ECMAVersion = inq.ECMAVersion;
|
||||
report.SCSI.Inquiry.ECMAVersionSpecified = true;
|
||||
}
|
||||
|
||||
if(inq.ANSIVersion != 0)
|
||||
{
|
||||
report.SCSI.Inquiry.ANSIVersion = inq.ANSIVersion;
|
||||
report.SCSI.Inquiry.ANSIVersion = inq.ANSIVersion;
|
||||
report.SCSI.Inquiry.ANSIVersionSpecified = true;
|
||||
}
|
||||
|
||||
if(inq.ResponseDataFormat != 0)
|
||||
{
|
||||
report.SCSI.Inquiry.ResponseDataFormat = inq.ResponseDataFormat;
|
||||
report.SCSI.Inquiry.ResponseDataFormat = inq.ResponseDataFormat;
|
||||
report.SCSI.Inquiry.ResponseDataFormatSpecified = true;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.VendorIdentification)))
|
||||
{
|
||||
report.SCSI.Inquiry.VendorIdentification =
|
||||
@@ -128,6 +133,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.VendorIdentification))
|
||||
report.SCSI.Inquiry.VendorIdentificationSpecified = true;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.ProductIdentification)))
|
||||
{
|
||||
report.SCSI.Inquiry.ProductIdentification =
|
||||
@@ -135,6 +141,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.ProductIdentification))
|
||||
report.SCSI.Inquiry.ProductIdentificationSpecified = true;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.ProductRevisionLevel)))
|
||||
{
|
||||
report.SCSI.Inquiry.ProductRevisionLevel =
|
||||
@@ -142,6 +149,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.ProductRevisionLevel))
|
||||
report.SCSI.Inquiry.ProductRevisionLevelSpecified = true;
|
||||
}
|
||||
|
||||
if(inq.VersionDescriptors != null)
|
||||
{
|
||||
versionDescriptors.AddRange(inq.VersionDescriptors.Where(descriptor => descriptor != 0));
|
||||
@@ -150,37 +158,37 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.Inquiry.VersionDescriptors = versionDescriptors.ToArray();
|
||||
}
|
||||
|
||||
report.SCSI.Inquiry.PeripheralQualifier = (PeripheralQualifiers)inq.PeripheralQualifier;
|
||||
report.SCSI.Inquiry.PeripheralDeviceType = (PeripheralDeviceTypes)inq.PeripheralDeviceType;
|
||||
report.SCSI.Inquiry.PeripheralQualifier = (PeripheralQualifiers)inq.PeripheralQualifier;
|
||||
report.SCSI.Inquiry.PeripheralDeviceType = (PeripheralDeviceTypes)inq.PeripheralDeviceType;
|
||||
report.SCSI.Inquiry.AsymmetricalLUNAccess = (TGPSValues)inq.TPGS;
|
||||
report.SCSI.Inquiry.SPIClocking = (SPIClocking)inq.Clocking;
|
||||
report.SCSI.Inquiry.SPIClocking = (SPIClocking)inq.Clocking;
|
||||
|
||||
report.SCSI.Inquiry.AccessControlCoordinator = inq.ACC;
|
||||
report.SCSI.Inquiry.ACKRequests = inq.ACKREQQ;
|
||||
report.SCSI.Inquiry.AERCSupported = inq.AERC;
|
||||
report.SCSI.Inquiry.Address16 = inq.Addr16;
|
||||
report.SCSI.Inquiry.Address32 = inq.Addr32;
|
||||
report.SCSI.Inquiry.BasicQueueing = inq.BQue;
|
||||
report.SCSI.Inquiry.EnclosureServices = inq.EncServ;
|
||||
report.SCSI.Inquiry.HierarchicalLUN = inq.HiSup;
|
||||
report.SCSI.Inquiry.IUS = inq.IUS;
|
||||
report.SCSI.Inquiry.LinkedCommands = inq.Linked;
|
||||
report.SCSI.Inquiry.MediumChanger = inq.MChngr;
|
||||
report.SCSI.Inquiry.MultiPortDevice = inq.MultiP;
|
||||
report.SCSI.Inquiry.NormalACA = inq.NormACA;
|
||||
report.SCSI.Inquiry.Protection = inq.Protect;
|
||||
report.SCSI.Inquiry.QAS = inq.QAS;
|
||||
report.SCSI.Inquiry.RelativeAddressing = inq.RelAddr;
|
||||
report.SCSI.Inquiry.Removable = inq.RMB;
|
||||
report.SCSI.Inquiry.TaggedCommandQueue = inq.CmdQue;
|
||||
report.SCSI.Inquiry.TerminateTaskSupported = inq.TrmTsk;
|
||||
report.SCSI.Inquiry.ThirdPartyCopy = inq.ThreePC;
|
||||
report.SCSI.Inquiry.TranferDisable = inq.TranDis;
|
||||
report.SCSI.Inquiry.SoftReset = inq.SftRe;
|
||||
report.SCSI.Inquiry.StorageArrayController = inq.SCCS;
|
||||
report.SCSI.Inquiry.SyncTransfer = inq.Sync;
|
||||
report.SCSI.Inquiry.WideBus16 = inq.WBus16;
|
||||
report.SCSI.Inquiry.WideBus32 = inq.WBus32;
|
||||
report.SCSI.Inquiry.ACKRequests = inq.ACKREQQ;
|
||||
report.SCSI.Inquiry.AERCSupported = inq.AERC;
|
||||
report.SCSI.Inquiry.Address16 = inq.Addr16;
|
||||
report.SCSI.Inquiry.Address32 = inq.Addr32;
|
||||
report.SCSI.Inquiry.BasicQueueing = inq.BQue;
|
||||
report.SCSI.Inquiry.EnclosureServices = inq.EncServ;
|
||||
report.SCSI.Inquiry.HierarchicalLUN = inq.HiSup;
|
||||
report.SCSI.Inquiry.IUS = inq.IUS;
|
||||
report.SCSI.Inquiry.LinkedCommands = inq.Linked;
|
||||
report.SCSI.Inquiry.MediumChanger = inq.MChngr;
|
||||
report.SCSI.Inquiry.MultiPortDevice = inq.MultiP;
|
||||
report.SCSI.Inquiry.NormalACA = inq.NormACA;
|
||||
report.SCSI.Inquiry.Protection = inq.Protect;
|
||||
report.SCSI.Inquiry.QAS = inq.QAS;
|
||||
report.SCSI.Inquiry.RelativeAddressing = inq.RelAddr;
|
||||
report.SCSI.Inquiry.Removable = inq.RMB;
|
||||
report.SCSI.Inquiry.TaggedCommandQueue = inq.CmdQue;
|
||||
report.SCSI.Inquiry.TerminateTaskSupported = inq.TrmTsk;
|
||||
report.SCSI.Inquiry.ThirdPartyCopy = inq.ThreePC;
|
||||
report.SCSI.Inquiry.TranferDisable = inq.TranDis;
|
||||
report.SCSI.Inquiry.SoftReset = inq.SftRe;
|
||||
report.SCSI.Inquiry.StorageArrayController = inq.SCCS;
|
||||
report.SCSI.Inquiry.SyncTransfer = inq.Sync;
|
||||
report.SCSI.Inquiry.WideBus16 = inq.WBus16;
|
||||
report.SCSI.Inquiry.WideBus32 = inq.WBus32;
|
||||
|
||||
if(debug) report.SCSI.Inquiry.Data = buffer;
|
||||
}
|
||||
@@ -227,7 +235,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
System.Console.ReadKey(true);
|
||||
}
|
||||
|
||||
Modes.DecodedMode? decMode = null;
|
||||
Modes.DecodedMode? decMode = null;
|
||||
PeripheralDeviceTypes devType = dev.ScsiType;
|
||||
|
||||
DicConsole.WriteLine("Querying all mode pages and subpages using SCSI MODE SENSE (10)...");
|
||||
@@ -240,16 +248,16 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
ScsiModeSensePageControl.Default, 0x3F, 0x00, TIMEOUT, out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
report.SCSI.SupportsModeSubpages = false;
|
||||
decMode = Modes.DecodeMode10(mode10Buffer, devType);
|
||||
decMode = Modes.DecodeMode10(mode10Buffer, devType);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
report.SCSI.SupportsModeSubpages = true;
|
||||
decMode = Modes.DecodeMode10(mode10Buffer, devType);
|
||||
decMode = Modes.DecodeMode10(mode10Buffer, devType);
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying all mode pages and subpages using SCSI MODE SENSE (6)...");
|
||||
@@ -274,7 +282,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
Modes.ModePage_2A? cdromMode = null;
|
||||
|
||||
if(debug && report.SCSI.SupportsModeSense6) report.SCSI.ModeSense6Data = mode6Buffer;
|
||||
if(debug && report.SCSI.SupportsModeSense6) report.SCSI.ModeSense6Data = mode6Buffer;
|
||||
if(debug && report.SCSI.SupportsModeSense10) report.SCSI.ModeSense10Data = mode10Buffer;
|
||||
|
||||
if(decMode.HasValue)
|
||||
@@ -282,19 +290,19 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.ModeSense = new modeType
|
||||
{
|
||||
BlankCheckEnabled = decMode.Value.Header.EBC,
|
||||
DPOandFUA = decMode.Value.Header.DPOFUA,
|
||||
WriteProtected = decMode.Value.Header.WriteProtected
|
||||
DPOandFUA = decMode.Value.Header.DPOFUA,
|
||||
WriteProtected = decMode.Value.Header.WriteProtected
|
||||
};
|
||||
|
||||
if(decMode.Value.Header.BufferedMode > 0)
|
||||
{
|
||||
report.SCSI.ModeSense.BufferedMode = decMode.Value.Header.BufferedMode;
|
||||
report.SCSI.ModeSense.BufferedMode = decMode.Value.Header.BufferedMode;
|
||||
report.SCSI.ModeSense.BufferedModeSpecified = true;
|
||||
}
|
||||
|
||||
if(decMode.Value.Header.Speed > 0)
|
||||
{
|
||||
report.SCSI.ModeSense.Speed = decMode.Value.Header.Speed;
|
||||
report.SCSI.ModeSense.Speed = decMode.Value.Header.Speed;
|
||||
report.SCSI.ModeSense.SpeedSpecified = true;
|
||||
}
|
||||
|
||||
@@ -305,9 +313,9 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
modePageType modePage = new modePageType
|
||||
{
|
||||
page = page.Page,
|
||||
page = page.Page,
|
||||
subpage = page.Subpage,
|
||||
value = page.PageResponse
|
||||
value = page.PageResponse
|
||||
};
|
||||
modePages.Add(modePage);
|
||||
|
||||
@@ -357,8 +365,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaTest.Model = System.Console.ReadLine();
|
||||
|
||||
mediaTest.ManufacturerSpecified = true;
|
||||
mediaTest.ModelSpecified = true;
|
||||
mediaTest.MediaIsRecognized = true;
|
||||
mediaTest.ModelSpecified = true;
|
||||
mediaTest.MediaIsRecognized = true;
|
||||
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, TIMEOUT, out _);
|
||||
if(sense)
|
||||
@@ -401,7 +409,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
if(mediaTest.MediaIsRecognized)
|
||||
{
|
||||
mediaTest.SupportsReadCapacitySpecified = true;
|
||||
mediaTest.SupportsReadCapacitySpecified = true;
|
||||
mediaTest.SupportsReadCapacity16Specified = true;
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI READ CAPACITY...");
|
||||
@@ -414,7 +422,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
1;
|
||||
mediaTest.BlockSize =
|
||||
(uint)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]);
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
@@ -429,7 +437,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaTest.Blocks = BitConverter.ToUInt64(temp, 0) + 1;
|
||||
mediaTest.BlockSize =
|
||||
(uint)((buffer[8] << 24) + (buffer[9] << 16) + (buffer[10] << 8) + buffer[11]);
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
@@ -441,7 +449,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
decMode = Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
decMode = Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
if(debug) mediaTest.ModeSense10Data = buffer;
|
||||
}
|
||||
|
||||
@@ -450,26 +458,27 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense6 = true;
|
||||
if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(debug) mediaTest.ModeSense6Data = buffer;
|
||||
}
|
||||
|
||||
if(decMode.HasValue)
|
||||
{
|
||||
mediaTest.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
mediaTest.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
mediaTest.MediumTypeSpecified = true;
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
decMode.Value.Header.BlockDescriptors.Length > 0)
|
||||
{
|
||||
mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
mediaTest.Density =
|
||||
(byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
mediaTest.DensitySpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
mediaTest.SupportsReadSpecified = true;
|
||||
mediaTest.SupportsRead10Specified = true;
|
||||
mediaTest.SupportsRead12Specified = true;
|
||||
mediaTest.SupportsRead16Specified = true;
|
||||
mediaTest.SupportsReadSpecified = true;
|
||||
mediaTest.SupportsRead10Specified = true;
|
||||
mediaTest.SupportsRead12Specified = true;
|
||||
mediaTest.SupportsRead16Specified = true;
|
||||
mediaTest.SupportsReadLongSpecified = true;
|
||||
|
||||
DicConsole.WriteLine("Trying SCSI READ (6)...");
|
||||
@@ -520,7 +529,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
FixedSense? decSense = Sense.DecodeFixed(senseBuffer);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.SenseKey == SenseKeys.IllegalRequest &&
|
||||
decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00)
|
||||
decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
||||
@@ -549,8 +559,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
testSize, TIMEOUT, out _);
|
||||
if(sense || dev.Error) continue;
|
||||
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = testSize;
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = testSize;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
@@ -568,8 +578,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
(ushort)i, TIMEOUT, out _);
|
||||
if(sense || dev.Error) continue;
|
||||
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = testSize;
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = testSize;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
@@ -579,8 +589,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
TIMEOUT, out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 2380;
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 2380;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
@@ -590,8 +600,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
TIMEOUT, out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 4760;
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 4760;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
@@ -601,8 +611,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
TIMEOUT, out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 9424;
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 9424;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
@@ -613,7 +623,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
DicConsole
|
||||
.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): ");
|
||||
.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
@@ -627,7 +637,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
TIMEOUT, out _);
|
||||
if(!sense)
|
||||
{
|
||||
mediaTest.LongBlockSize = i;
|
||||
mediaTest.LongBlockSize = i;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
@@ -663,11 +673,11 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
}
|
||||
else
|
||||
{
|
||||
report.SCSI.ReadCapabilities = new testedMediaType();
|
||||
report.SCSI.ReadCapabilitiesSpecified = true;
|
||||
report.SCSI.ReadCapabilities = new testedMediaType();
|
||||
report.SCSI.ReadCapabilitiesSpecified = true;
|
||||
report.SCSI.ReadCapabilities.MediaIsRecognized = true;
|
||||
|
||||
report.SCSI.ReadCapabilities.SupportsReadCapacitySpecified = true;
|
||||
report.SCSI.ReadCapabilities.SupportsReadCapacitySpecified = true;
|
||||
report.SCSI.ReadCapabilities.SupportsReadCapacity16Specified = true;
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI READ CAPACITY...");
|
||||
@@ -679,7 +689,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
(ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3]) + 1;
|
||||
report.SCSI.ReadCapabilities.BlockSize =
|
||||
(uint)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]);
|
||||
report.SCSI.ReadCapabilities.BlocksSpecified = true;
|
||||
report.SCSI.ReadCapabilities.BlocksSpecified = true;
|
||||
report.SCSI.ReadCapabilities.BlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
@@ -694,7 +704,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.ReadCapabilities.Blocks = BitConverter.ToUInt64(temp, 0) + 1;
|
||||
report.SCSI.ReadCapabilities.BlockSize =
|
||||
(uint)((buffer[8] << 24) + (buffer[9] << 16) + (buffer[10] << 8) + buffer[11]);
|
||||
report.SCSI.ReadCapabilities.BlocksSpecified = true;
|
||||
report.SCSI.ReadCapabilities.BlocksSpecified = true;
|
||||
report.SCSI.ReadCapabilities.BlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
@@ -706,7 +716,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
decMode = Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
decMode = Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
if(debug) report.SCSI.ReadCapabilities.ModeSense10Data = buffer;
|
||||
}
|
||||
|
||||
@@ -715,15 +725,16 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense6 = true;
|
||||
if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(!decMode.HasValue)
|
||||
decMode = Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(debug) report.SCSI.ReadCapabilities.ModeSense6Data = buffer;
|
||||
}
|
||||
|
||||
if(decMode.HasValue)
|
||||
{
|
||||
report.SCSI.ReadCapabilities.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
report.SCSI.ReadCapabilities.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
report.SCSI.ReadCapabilities.MediumTypeSpecified = true;
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
decMode.Value.Header.BlockDescriptors.Length > 0)
|
||||
{
|
||||
report.SCSI.ReadCapabilities.Density =
|
||||
@@ -732,10 +743,10 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
}
|
||||
}
|
||||
|
||||
report.SCSI.ReadCapabilities.SupportsReadSpecified = true;
|
||||
report.SCSI.ReadCapabilities.SupportsRead10Specified = true;
|
||||
report.SCSI.ReadCapabilities.SupportsRead12Specified = true;
|
||||
report.SCSI.ReadCapabilities.SupportsRead16Specified = true;
|
||||
report.SCSI.ReadCapabilities.SupportsReadSpecified = true;
|
||||
report.SCSI.ReadCapabilities.SupportsRead10Specified = true;
|
||||
report.SCSI.ReadCapabilities.SupportsRead12Specified = true;
|
||||
report.SCSI.ReadCapabilities.SupportsRead16Specified = true;
|
||||
report.SCSI.ReadCapabilities.SupportsReadLongSpecified = true;
|
||||
|
||||
DicConsole.WriteLine("Trying SCSI READ (6)...");
|
||||
@@ -790,7 +801,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
FixedSense? decSense = Sense.DecodeFixed(senseBuffer);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.SenseKey == SenseKeys.IllegalRequest && decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
{
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
||||
@@ -820,8 +831,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
TIMEOUT, out _);
|
||||
if(sense || dev.Error) continue;
|
||||
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = testSize;
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = testSize;
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
@@ -839,8 +850,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
TIMEOUT, out _);
|
||||
if(sense || dev.Error) continue;
|
||||
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = testSize;
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = testSize;
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
@@ -850,8 +861,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = 2380;
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = 2380;
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
@@ -861,8 +872,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = 4760;
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = 4760;
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
@@ -872,8 +883,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = 9424;
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = 9424;
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
@@ -885,7 +896,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
DicConsole
|
||||
.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): ");
|
||||
.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
@@ -906,7 +917,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
bingo.Write(buffer, 0, buffer.Length);
|
||||
bingo.Close();
|
||||
}
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = i;
|
||||
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = i;
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
@@ -918,7 +930,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
}
|
||||
}
|
||||
|
||||
if(debug && report.SCSI.ReadCapabilities.SupportsReadLong &&
|
||||
if(debug &&
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong &&
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified &&
|
||||
report.SCSI.ReadCapabilities.LongBlockSize != report.SCSI.ReadCapabilities.BlockSize)
|
||||
{
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
if(report == null) return;
|
||||
|
||||
bool sense;
|
||||
bool sense;
|
||||
const uint TIMEOUT = 5;
|
||||
|
||||
List<string> mediaTypes = new List<string>();
|
||||
@@ -70,41 +70,49 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A = new mmcModeType();
|
||||
if(cdromMode.Value.BufferSize != 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.BufferSize = cdromMode.Value.BufferSize;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.BufferSize = cdromMode.Value.BufferSize;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.BufferSizeSpecified = true;
|
||||
}
|
||||
|
||||
if(cdromMode.Value.CurrentSpeed != 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CurrentSpeed = cdromMode.Value.CurrentSpeed;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CurrentSpeed = cdromMode.Value.CurrentSpeed;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CurrentSpeedSpecified = true;
|
||||
}
|
||||
|
||||
if(cdromMode.Value.CurrentWriteSpeed != 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeed = cdromMode.Value.CurrentWriteSpeed;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeed =
|
||||
cdromMode.Value.CurrentWriteSpeed;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeedSpecified = true;
|
||||
}
|
||||
|
||||
if(cdromMode.Value.CurrentWriteSpeedSelected != 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeedSelected =
|
||||
cdromMode.Value.CurrentWriteSpeedSelected;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeedSelectedSpecified = true;
|
||||
}
|
||||
|
||||
if(cdromMode.Value.MaximumSpeed != 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.MaximumSpeed = cdromMode.Value.MaximumSpeed;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.MaximumSpeed = cdromMode.Value.MaximumSpeed;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.MaximumSpeedSpecified = true;
|
||||
}
|
||||
|
||||
if(cdromMode.Value.MaxWriteSpeed != 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.MaximumWriteSpeed = cdromMode.Value.MaxWriteSpeed;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.MaximumWriteSpeed = cdromMode.Value.MaxWriteSpeed;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.MaximumWriteSpeedSpecified = true;
|
||||
}
|
||||
|
||||
if(cdromMode.Value.RotationControlSelected != 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.RotationControlSelected =
|
||||
cdromMode.Value.RotationControlSelected;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.RotationControlSelectedSpecified = true;
|
||||
}
|
||||
|
||||
if(cdromMode.Value.SupportedVolumeLevels != 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.SupportedVolumeLevels =
|
||||
@@ -112,49 +120,49 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.SupportedVolumeLevelsSpecified = true;
|
||||
}
|
||||
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.AccurateCDDA = cdromMode.Value.AccurateCDDA;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.BCK = cdromMode.Value.BCK;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.AccurateCDDA = cdromMode.Value.AccurateCDDA;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.BCK = cdromMode.Value.BCK;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.BufferUnderRunProtection = cdromMode.Value.BUF;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CanEject = cdromMode.Value.Eject;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CanLockMedia = cdromMode.Value.Lock;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CDDACommand = cdromMode.Value.CDDACommand;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CompositeAudioVideo = cdromMode.Value.Composite;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CSSandCPPMSupported = cdromMode.Value.CMRSupported == 1;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CanEject = cdromMode.Value.Eject;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CanLockMedia = cdromMode.Value.Lock;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CDDACommand = cdromMode.Value.CDDACommand;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CompositeAudioVideo = cdromMode.Value.Composite;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CSSandCPPMSupported = cdromMode.Value.CMRSupported == 1;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.DeterministicSlotChanger = cdromMode.Value.SDP;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.DigitalPort1 = cdromMode.Value.DigitalPort1;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.DigitalPort2 = cdromMode.Value.DigitalPort2;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.LeadInPW = cdromMode.Value.LeadInPW;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.LoadingMechanismType = cdromMode.Value.LoadingMechanism;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.LockStatus = cdromMode.Value.LockState;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.LSBF = cdromMode.Value.LSBF;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.PlaysAudio = cdromMode.Value.AudioPlay;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.PreventJumperStatus = cdromMode.Value.PreventJumper;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.RCK = cdromMode.Value.RCK;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsBarcode = cdromMode.Value.ReadBarcode;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsBothSides = cdromMode.Value.SCC;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsCDR = cdromMode.Value.ReadCDR;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsCDRW = cdromMode.Value.ReadCDRW;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.DigitalPort1 = cdromMode.Value.DigitalPort1;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.DigitalPort2 = cdromMode.Value.DigitalPort2;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.LeadInPW = cdromMode.Value.LeadInPW;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.LoadingMechanismType = cdromMode.Value.LoadingMechanism;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.LockStatus = cdromMode.Value.LockState;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.LSBF = cdromMode.Value.LSBF;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.PlaysAudio = cdromMode.Value.AudioPlay;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.PreventJumperStatus = cdromMode.Value.PreventJumper;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.RCK = cdromMode.Value.RCK;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsBarcode = cdromMode.Value.ReadBarcode;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsBothSides = cdromMode.Value.SCC;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsCDR = cdromMode.Value.ReadCDR;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsCDRW = cdromMode.Value.ReadCDRW;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDeinterlavedSubchannel =
|
||||
cdromMode.Value.DeinterlaveSubchannel;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDR = cdromMode.Value.ReadDVDR;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDRAM = cdromMode.Value.ReadDVDRAM;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDROM = cdromMode.Value.ReadDVDROM;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsISRC = cdromMode.Value.ISRC;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsMode2Form2 = cdromMode.Value.Mode2Form2;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsMode2Form1 = cdromMode.Value.Mode2Form1;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsPacketCDR = cdromMode.Value.Method2;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsSubchannel = cdromMode.Value.Subchannel;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsUPC = cdromMode.Value.UPC;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReturnsC2Pointers = cdromMode.Value.C2Pointer;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.SeparateChannelMute = cdromMode.Value.SeparateChannelMute;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDR = cdromMode.Value.ReadDVDR;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDRAM = cdromMode.Value.ReadDVDRAM;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDROM = cdromMode.Value.ReadDVDROM;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsISRC = cdromMode.Value.ISRC;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsMode2Form2 = cdromMode.Value.Mode2Form2;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsMode2Form1 = cdromMode.Value.Mode2Form1;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsPacketCDR = cdromMode.Value.Method2;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsSubchannel = cdromMode.Value.Subchannel;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsUPC = cdromMode.Value.UPC;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReturnsC2Pointers = cdromMode.Value.C2Pointer;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.SeparateChannelMute = cdromMode.Value.SeparateChannelMute;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.SeparateChannelVolume = cdromMode.Value.SeparateChannelVolume;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.SSS = cdromMode.Value.SSS;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.SupportsMultiSession = cdromMode.Value.MultiSession;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.TestWrite = cdromMode.Value.TestWrite;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.WritesCDR = cdromMode.Value.WriteCDR;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.WritesCDRW = cdromMode.Value.WriteCDRW;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.WritesDVDR = cdromMode.Value.WriteDVDR;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.WritesDVDRAM = cdromMode.Value.WriteDVDRAM;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.SSS = cdromMode.Value.SSS;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.SupportsMultiSession = cdromMode.Value.MultiSession;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.TestWrite = cdromMode.Value.TestWrite;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.WritesCDR = cdromMode.Value.WriteCDR;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.WritesCDRW = cdromMode.Value.WriteCDRW;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.WritesDVDR = cdromMode.Value.WriteDVDR;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.WritesDVDRAM = cdromMode.Value.WriteDVDRAM;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.WriteSpeedPerformanceDescriptors =
|
||||
cdromMode.Value.WriteSpeedPerformanceDescriptors;
|
||||
|
||||
@@ -196,6 +204,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandard =
|
||||
PhysicalInterfaces.Unspecified;
|
||||
}
|
||||
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsDeviceBusyEvent = ftr0001.Value.DBE;
|
||||
}
|
||||
}
|
||||
@@ -208,11 +217,16 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.MultiMediaDevice.Features.LoadingMechanismType =
|
||||
ftr0003.Value.LoadingMechanismType;
|
||||
report.SCSI.MultiMediaDevice.Features.LoadingMechanismTypeSpecified = true;
|
||||
report.SCSI.MultiMediaDevice.Features.CanLoad = ftr0003.Value.Load;
|
||||
report.SCSI.MultiMediaDevice.Features.CanEject = ftr0003.Value.Eject;
|
||||
report.SCSI.MultiMediaDevice.Features.PreventJumper = ftr0003.Value.PreventJumper;
|
||||
report.SCSI.MultiMediaDevice.Features.DBML = ftr0003.Value.DBML;
|
||||
report.SCSI.MultiMediaDevice.Features.Locked = ftr0003.Value.Lock;
|
||||
report.SCSI.MultiMediaDevice.Features.CanLoad =
|
||||
ftr0003.Value.Load;
|
||||
report.SCSI.MultiMediaDevice.Features.CanEject =
|
||||
ftr0003.Value.Eject;
|
||||
report.SCSI.MultiMediaDevice.Features.PreventJumper =
|
||||
ftr0003.Value.PreventJumper;
|
||||
report.SCSI.MultiMediaDevice.Features.DBML =
|
||||
ftr0003.Value.DBML;
|
||||
report.SCSI.MultiMediaDevice.Features.Locked =
|
||||
ftr0003.Value.Lock;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -223,8 +237,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsWriteProtectPAC = ftr0004.Value.DWP;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsWriteInhibitDCB = ftr0004.Value.WDCB;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsPWP = ftr0004.Value.SPWP;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsSWPP = ftr0004.Value.SSWPP;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsPWP = ftr0004.Value.SPWP;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsSWPP = ftr0004.Value.SSWPP;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -239,12 +253,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
ftr0010.Value.LogicalBlockSize;
|
||||
report.SCSI.MultiMediaDevice.Features.LogicalBlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
if(ftr0010.Value.Blocking > 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.BlocksPerReadableUnit =
|
||||
ftr0010.Value.Blocking;
|
||||
report.SCSI.MultiMediaDevice.Features.BlocksPerReadableUnitSpecified = true;
|
||||
}
|
||||
|
||||
report.SCSI.MultiMediaDevice.Features.ErrorRecoveryPage = ftr0010.Value.PP;
|
||||
}
|
||||
}
|
||||
@@ -258,8 +274,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
Feature_001E? ftr001E = Features.Decode_001E(desc.Data);
|
||||
if(ftr001E.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsDAP = ftr001E.Value.DAP;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsC2 = ftr001E.Value.C2;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsDAP = ftr001E.Value.DAP;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsC2 = ftr001E.Value.C2;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadLeadInCDText = ftr001E.Value.CDText;
|
||||
}
|
||||
}
|
||||
@@ -270,9 +286,9 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
Feature_001F? ftr001F = Features.Decode_001F(desc.Data);
|
||||
if(ftr001F.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.DVDMultiRead = ftr001F.Value.MULTI110;
|
||||
report.SCSI.MultiMediaDevice.Features.DVDMultiRead = ftr001F.Value.MULTI110;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadAllDualRW = ftr001F.Value.DualRW;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadAllDualR = ftr001F.Value.DualR;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadAllDualR = ftr001F.Value.DualR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -288,10 +304,10 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.MultiMediaDevice.Features.CanFormatBDREWithoutSpare =
|
||||
ftr0023.Value.RENoSA;
|
||||
report.SCSI.MultiMediaDevice.Features.CanExpandBDRESpareArea = ftr0023.Value.Expand;
|
||||
report.SCSI.MultiMediaDevice.Features.CanFormatQCert = ftr0023.Value.QCert;
|
||||
report.SCSI.MultiMediaDevice.Features.CanFormatCert = ftr0023.Value.Cert;
|
||||
report.SCSI.MultiMediaDevice.Features.CanFormatFRF = ftr0023.Value.FRF;
|
||||
report.SCSI.MultiMediaDevice.Features.CanFormatRRM = ftr0023.Value.RRM;
|
||||
report.SCSI.MultiMediaDevice.Features.CanFormatQCert = ftr0023.Value.QCert;
|
||||
report.SCSI.MultiMediaDevice.Features.CanFormatCert = ftr0023.Value.Cert;
|
||||
report.SCSI.MultiMediaDevice.Features.CanFormatFRF = ftr0023.Value.FRF;
|
||||
report.SCSI.MultiMediaDevice.Features.CanFormatRRM = ftr0023.Value.RRM;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -307,9 +323,9 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
Feature_0028? ftr0028 = Features.Decode_0028(desc.Data);
|
||||
if(ftr0028.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusMRW = ftr0028.Value.DVDPRead;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusMRW = ftr0028.Value.DVDPRead;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusMRW = ftr0028.Value.DVDPWrite;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteCDMRW = ftr0028.Value.Write;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteCDMRW = ftr0028.Value.Write;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -340,7 +356,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
ftr002D.Value.RWRaw;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWritePackedSubchannelInTAO =
|
||||
ftr002D.Value.RWPack;
|
||||
report.SCSI.MultiMediaDevice.Features.CanTestWriteInTAO = ftr002D.Value.TestWrite;
|
||||
report.SCSI.MultiMediaDevice.Features.CanTestWriteInTAO =
|
||||
ftr002D.Value.TestWrite;
|
||||
report.SCSI.MultiMediaDevice.Features.CanOverwriteTAOTrack = ftr002D.Value.CDRW;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteRWSubchannelInTAO =
|
||||
ftr002D.Value.RWSubchannel;
|
||||
@@ -354,10 +371,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(ftr002E.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.BufferUnderrunFreeInSAO = ftr002E.Value.BUF;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteRawMultiSession = ftr002E.Value.RAWMS;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteRawMultiSession =
|
||||
ftr002E.Value.RAWMS;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteRaw = ftr002E.Value.RAW;
|
||||
report.SCSI.MultiMediaDevice.Features.CanTestWriteInSAO = ftr002E.Value.TestWrite;
|
||||
report.SCSI.MultiMediaDevice.Features.CanOverwriteSAOTrack = ftr002E.Value.CDRW;
|
||||
report.SCSI.MultiMediaDevice.Features.CanTestWriteInSAO =
|
||||
ftr002E.Value.TestWrite;
|
||||
report.SCSI.MultiMediaDevice.Features.CanOverwriteSAOTrack =
|
||||
ftr002E.Value.CDRW;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteRWSubchannelInSAO = ftr002E.Value.RW;
|
||||
}
|
||||
}
|
||||
@@ -369,8 +389,9 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(ftr002F.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.BufferUnderrunFreeInDVD = ftr002F.Value.BUF;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteDVDRDL = ftr002F.Value.RDL;
|
||||
report.SCSI.MultiMediaDevice.Features.CanTestWriteDVD = ftr002F.Value.TestWrite;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteDVDRDL = ftr002F.Value.RDL;
|
||||
report.SCSI.MultiMediaDevice.Features.CanTestWriteDVD =
|
||||
ftr002F.Value.TestWrite;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteDVDRW = ftr002F.Value.DVDRW;
|
||||
}
|
||||
}
|
||||
@@ -417,13 +438,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
Feature_0040? ftr0040 = Features.Decode_0040(desc.Data);
|
||||
if(ftr0040.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBluBCA = ftr0040.Value.BCA;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDRE2 = ftr0040.Value.RE2;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDRE1 = ftr0040.Value.RE1;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadOldBDRE = ftr0040.Value.OldRE;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDR = ftr0040.Value.R;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadOldBDR = ftr0040.Value.OldR;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDROM = ftr0040.Value.ROM;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBluBCA = ftr0040.Value.BCA;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDRE2 = ftr0040.Value.RE2;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDRE1 = ftr0040.Value.RE1;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadOldBDRE = ftr0040.Value.OldRE;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDR = ftr0040.Value.R;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadOldBDR = ftr0040.Value.OldR;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDROM = ftr0040.Value.ROM;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadOldBDROM = ftr0040.Value.OldROM;
|
||||
}
|
||||
}
|
||||
@@ -434,11 +455,11 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
Feature_0041? ftr0041 = Features.Decode_0041(desc.Data);
|
||||
if(ftr0041.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteBDRE2 = ftr0041.Value.RE2;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteBDRE1 = ftr0041.Value.RE1;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteBDRE2 = ftr0041.Value.RE2;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteBDRE1 = ftr0041.Value.RE1;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteOldBDRE = ftr0041.Value.OldRE;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteBDR = ftr0041.Value.R;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteOldBDR = ftr0041.Value.OldR;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteBDR = ftr0041.Value.R;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteOldBDR = ftr0041.Value.OldR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -448,7 +469,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
Feature_0050? ftr0050 = Features.Decode_0050(desc.Data);
|
||||
if(ftr0050.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadHDDVDR = ftr0050.Value.HDDVDR;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadHDDVDR = ftr0050.Value.HDDVDR;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadHDDVDRAM = ftr0050.Value.HDDVDRAM;
|
||||
}
|
||||
}
|
||||
@@ -459,7 +480,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
Feature_0051? ftr0051 = Features.Decode_0051(desc.Data);
|
||||
if(ftr0051.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteHDDVDR = ftr0051.Value.HDDVDR;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteHDDVDR = ftr0051.Value.HDDVDR;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteHDDVDRAM = ftr0051.Value.HDDVDRAM;
|
||||
}
|
||||
}
|
||||
@@ -491,13 +512,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
Feature_0103? ftr0103 = Features.Decode_0103(desc.Data);
|
||||
if(ftr0103.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanAudioScan = ftr0103.Value.Scan;
|
||||
report.SCSI.MultiMediaDevice.Features.CanAudioScan = ftr0103.Value.Scan;
|
||||
report.SCSI.MultiMediaDevice.Features.CanMuteSeparateChannels = ftr0103.Value.SCM;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsSeparateVolume = ftr0103.Value.SV;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsSeparateVolume = ftr0103.Value.SV;
|
||||
if(ftr0103.Value.VolumeLevels > 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.VolumeLevelsSpecified = true;
|
||||
report.SCSI.MultiMediaDevice.Features.VolumeLevels = ftr0103.Value.VolumeLevels;
|
||||
report.SCSI.MultiMediaDevice.Features.VolumeLevels =
|
||||
ftr0103.Value.VolumeLevels;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -513,7 +535,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(ftr0106.Value.CSSVersion > 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CSSVersionSpecified = true;
|
||||
report.SCSI.MultiMediaDevice.Features.CSSVersion = ftr0106.Value.CSSVersion;
|
||||
report.SCSI.MultiMediaDevice.Features.CSSVersion =
|
||||
ftr0106.Value.CSSVersion;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -531,7 +554,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(ftr010B.Value.CPRMVersion > 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CPRMVersionSpecified = true;
|
||||
report.SCSI.MultiMediaDevice.Features.CPRMVersion = ftr010B.Value.CPRMVersion;
|
||||
report.SCSI.MultiMediaDevice.Features.CPRMVersion =
|
||||
ftr010B.Value.CPRMVersion;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -546,23 +570,23 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
temp[2] = (byte)((ftr010C.Value.Year & 0xFF00) >> 8);
|
||||
temp[3] = (byte)(ftr010C.Value.Year & 0xFF);
|
||||
string syear = Encoding.ASCII.GetString(temp);
|
||||
temp = new byte[2];
|
||||
temp = new byte[2];
|
||||
temp[0] = (byte)((ftr010C.Value.Month & 0xFF00) >> 8);
|
||||
temp[1] = (byte)(ftr010C.Value.Month & 0xFF);
|
||||
string smonth = Encoding.ASCII.GetString(temp);
|
||||
temp = new byte[2];
|
||||
temp = new byte[2];
|
||||
temp[0] = (byte)((ftr010C.Value.Day & 0xFF00) >> 8);
|
||||
temp[1] = (byte)(ftr010C.Value.Day & 0xFF);
|
||||
string sday = Encoding.ASCII.GetString(temp);
|
||||
temp = new byte[2];
|
||||
temp = new byte[2];
|
||||
temp[0] = (byte)((ftr010C.Value.Hour & 0xFF00) >> 8);
|
||||
temp[1] = (byte)(ftr010C.Value.Hour & 0xFF);
|
||||
string shour = Encoding.ASCII.GetString(temp);
|
||||
temp = new byte[2];
|
||||
temp = new byte[2];
|
||||
temp[0] = (byte)((ftr010C.Value.Minute & 0xFF00) >> 8);
|
||||
temp[1] = (byte)(ftr010C.Value.Minute & 0xFF);
|
||||
string sminute = Encoding.ASCII.GetString(temp);
|
||||
temp = new byte[2];
|
||||
temp = new byte[2];
|
||||
temp[0] = (byte)((ftr010C.Value.Second & 0xFF00) >> 8);
|
||||
temp[1] = (byte)(ftr010C.Value.Second & 0xFF);
|
||||
string ssecond = Encoding.ASCII.GetString(temp);
|
||||
@@ -576,12 +600,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
report.SCSI.MultiMediaDevice.Features.FirmwareDateSpecified = true;
|
||||
}
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -596,7 +620,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadCPRM_MKB = ftr010D.Value.RMC;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteBusEncryptedBlocks =
|
||||
ftr010D.Value.WBE;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsBusEncryption = ftr010D.Value.BEC;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsBusEncryption = ftr010D.Value.BEC;
|
||||
report.SCSI.MultiMediaDevice.Features.CanGenerateBindingNonce = ftr010D.Value.BNG;
|
||||
|
||||
if(ftr010D.Value.BindNonceBlocks > 0)
|
||||
@@ -609,13 +633,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(ftr010D.Value.AGIDs > 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.AGIDsSpecified = true;
|
||||
report.SCSI.MultiMediaDevice.Features.AGIDs = ftr010D.Value.AGIDs;
|
||||
report.SCSI.MultiMediaDevice.Features.AGIDs = ftr010D.Value.AGIDs;
|
||||
}
|
||||
|
||||
if(ftr010D.Value.AACSVersion > 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.AACSVersionSpecified = true;
|
||||
report.SCSI.MultiMediaDevice.Features.AACSVersion = ftr010D.Value.AACSVersion;
|
||||
report.SCSI.MultiMediaDevice.Features.AACSVersion =
|
||||
ftr010D.Value.AACSVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -635,12 +660,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
}
|
||||
}
|
||||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadBD ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDR ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDRE1 ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDRE2 ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDROM ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadOldBDR ||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadBD ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDR ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDRE1 ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDRE2 ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDROM ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadOldBDR ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadOldBDRE ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadOldBDROM)
|
||||
{
|
||||
@@ -660,7 +685,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
}
|
||||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadCDMRW)
|
||||
if(!mediaTypes.Contains("CD-MRW")) mediaTypes.Add("CD-MRW");
|
||||
if(!mediaTypes.Contains("CD-MRW"))
|
||||
mediaTypes.Add("CD-MRW");
|
||||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadDDCD)
|
||||
{
|
||||
@@ -669,11 +695,11 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!mediaTypes.Contains("DDCD-RW")) mediaTypes.Add("DDCD-RW");
|
||||
}
|
||||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadDVD ||
|
||||
report.SCSI.MultiMediaDevice.Features.DVDMultiRead ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusR ||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadDVD ||
|
||||
report.SCSI.MultiMediaDevice.Features.DVDMultiRead ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusR ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRDL ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRW ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRW ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRWDL)
|
||||
{
|
||||
if(!mediaTypes.Contains("DVD-ROM")) mediaTypes.Add("DVD-ROM");
|
||||
@@ -686,7 +712,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
}
|
||||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusMRW)
|
||||
if(!mediaTypes.Contains("DVD+MRW")) mediaTypes.Add("DVD+MRW");
|
||||
if(!mediaTypes.Contains("DVD+MRW"))
|
||||
mediaTypes.Add("DVD+MRW");
|
||||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadHDDVD ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadHDDVDR)
|
||||
@@ -697,15 +724,16 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
}
|
||||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadHDDVDRAM)
|
||||
if(!mediaTypes.Contains("HD DVD-RAM")) mediaTypes.Add("HD DVD-RAM");
|
||||
if(!mediaTypes.Contains("HD DVD-RAM"))
|
||||
mediaTypes.Add("HD DVD-RAM");
|
||||
}
|
||||
|
||||
bool tryPlextor = false, tryHldtst = false, tryPioneer = false, tryNec = false;
|
||||
|
||||
tryPlextor |= dev.Manufacturer.ToLowerInvariant() == "plextor";
|
||||
tryHldtst |= dev.Manufacturer.ToLowerInvariant() == "hl-dt-st";
|
||||
tryHldtst |= dev.Manufacturer.ToLowerInvariant() == "hl-dt-st";
|
||||
tryPioneer |= dev.Manufacturer.ToLowerInvariant() == "pioneer";
|
||||
tryNec |= dev.Manufacturer.ToLowerInvariant() == "nec";
|
||||
tryNec |= dev.Manufacturer.ToLowerInvariant() == "nec";
|
||||
|
||||
// Very old CD drives do not contain mode page 2Ah neither GET CONFIGURATION, so just try all CDs on them
|
||||
// Also don't get confident, some drives didn't know CD-RW but are able to read them
|
||||
@@ -796,7 +824,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
if(mediaTest.MediaIsRecognized)
|
||||
{
|
||||
mediaTest.SupportsReadCapacitySpecified = true;
|
||||
mediaTest.SupportsReadCapacitySpecified = true;
|
||||
mediaTest.SupportsReadCapacity16Specified = true;
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI READ CAPACITY...");
|
||||
@@ -808,7 +836,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
(ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3]) + 1;
|
||||
mediaTest.BlockSize =
|
||||
(uint)((buffer[5] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]);
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
@@ -823,7 +851,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaTest.Blocks = BitConverter.ToUInt64(temp, 0) + 1;
|
||||
mediaTest.BlockSize =
|
||||
(uint)((buffer[5] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]);
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
@@ -835,34 +863,35 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
decMode = Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
decMode = Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
if(debug) mediaTest.ModeSense10Data = buffer;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE...");
|
||||
sense = dev.ModeSense(out buffer, out senseBuffer, TIMEOUT, out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense6 = true;
|
||||
if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(debug) mediaTest.ModeSense6Data = buffer;
|
||||
}
|
||||
|
||||
if(decMode.HasValue)
|
||||
{
|
||||
mediaTest.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
mediaTest.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
mediaTest.MediumTypeSpecified = true;
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
decMode.Value.Header.BlockDescriptors.Length > 0)
|
||||
{
|
||||
mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
mediaTest.DensitySpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(mediaType.StartsWith("CD-", StringComparison.Ordinal) ||
|
||||
if(mediaType.StartsWith("CD-", StringComparison.Ordinal) ||
|
||||
mediaType.StartsWith("DDCD-", StringComparison.Ordinal) || mediaType == "Audio CD")
|
||||
{
|
||||
mediaTest.CanReadTOCSpecified = true;
|
||||
mediaTest.CanReadTOCSpecified = true;
|
||||
mediaTest.CanReadFullTOCSpecified = true;
|
||||
DicConsole.WriteLine("Querying CD TOC...");
|
||||
mediaTest.CanReadTOC =
|
||||
@@ -882,11 +911,11 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaType + ".bin", "read results", buffer);
|
||||
}
|
||||
|
||||
if(mediaType.StartsWith("CD-R", StringComparison.Ordinal) ||
|
||||
if(mediaType.StartsWith("CD-R", StringComparison.Ordinal) ||
|
||||
mediaType.StartsWith("DDCD-R", StringComparison.Ordinal))
|
||||
{
|
||||
mediaTest.CanReadATIPSpecified = true;
|
||||
mediaTest.CanReadPMASpecified = true;
|
||||
mediaTest.CanReadPMASpecified = true;
|
||||
DicConsole.WriteLine("Querying CD ATIP...");
|
||||
mediaTest.CanReadATIP = !dev.ReadAtip(out buffer, out senseBuffer, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadATIP);
|
||||
@@ -903,7 +932,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaType + ".bin", "read results", buffer);
|
||||
}
|
||||
|
||||
if(mediaType.StartsWith("DVD-", StringComparison.Ordinal) ||
|
||||
if(mediaType.StartsWith("DVD-", StringComparison.Ordinal) ||
|
||||
mediaType.StartsWith("HD DVD-", StringComparison.Ordinal))
|
||||
{
|
||||
mediaTest.CanReadPFISpecified = true;
|
||||
@@ -984,7 +1013,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
break;
|
||||
case "DVD-RAM":
|
||||
case "HD DVD-RAM":
|
||||
mediaTest.CanReadDDSSpecified = true;
|
||||
mediaTest.CanReadDDSSpecified = true;
|
||||
mediaTest.CanReadSpareAreaInformationSpecified = true;
|
||||
mediaTest.CanReadDDS =
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd,
|
||||
@@ -1009,7 +1038,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
if(mediaType.StartsWith("BD-R", StringComparison.Ordinal) && mediaType != "BD-ROM")
|
||||
{
|
||||
mediaTest.CanReadDDSSpecified = true;
|
||||
mediaTest.CanReadDDSSpecified = true;
|
||||
mediaTest.CanReadSpareAreaInformationSpecified = true;
|
||||
DicConsole.WriteLine("Querying BD DDS...");
|
||||
mediaTest.CanReadDDS =
|
||||
@@ -1049,7 +1078,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
if(mediaType == "DVD-R" || mediaType == "DVD-RW" || mediaType == "HD DVD-R")
|
||||
{
|
||||
mediaTest.CanReadMediaIDSpecified = true;
|
||||
mediaTest.CanReadMediaIDSpecified = true;
|
||||
mediaTest.CanReadRecordablePFISpecified = true;
|
||||
DicConsole.WriteLine("Querying DVD Media ID...");
|
||||
mediaTest.CanReadMediaID =
|
||||
@@ -1075,7 +1104,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(mediaType.StartsWith("DVD+R", StringComparison.Ordinal) || mediaType == "DVD+MRW")
|
||||
{
|
||||
mediaTest.CanReadADIPSpecified = true;
|
||||
mediaTest.CanReadDCBSpecified = true;
|
||||
mediaTest.CanReadDCBSpecified = true;
|
||||
DicConsole.WriteLine("Querying DVD ADIP...");
|
||||
mediaTest.CanReadADIP =
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
|
||||
@@ -1128,7 +1157,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(mediaType.StartsWith("BD-R", StringComparison.Ordinal))
|
||||
{
|
||||
mediaTest.CanReadDiscInformationSpecified = true;
|
||||
mediaTest.CanReadPACSpecified = true;
|
||||
mediaTest.CanReadPACSpecified = true;
|
||||
DicConsole.WriteLine("Querying BD Disc Information...");
|
||||
mediaTest.CanReadDiscInformation =
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Bd, 0, 0,
|
||||
@@ -1149,7 +1178,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaType + ".bin", "read results", buffer);
|
||||
}
|
||||
|
||||
mediaTest.SupportsReadSpecified = true;
|
||||
mediaTest.SupportsReadSpecified = true;
|
||||
mediaTest.SupportsRead10Specified = true;
|
||||
mediaTest.SupportsRead12Specified = true;
|
||||
mediaTest.SupportsRead16Specified = true;
|
||||
@@ -1193,7 +1222,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
DicConsole
|
||||
.Write("Do you have want to try Plextor vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): ");
|
||||
.Write("Do you have want to try Plextor vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
@@ -1201,22 +1230,22 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
tryPlextor |= pressedKey.Key == ConsoleKey.Y;
|
||||
}
|
||||
|
||||
if(mediaType.StartsWith("CD-", StringComparison.Ordinal) ||
|
||||
if(mediaType.StartsWith("CD-", StringComparison.Ordinal) ||
|
||||
mediaType.StartsWith("DDCD-", StringComparison.Ordinal) || mediaType == "Audio CD")
|
||||
{
|
||||
mediaTest.CanReadC2PointersSpecified = true;
|
||||
mediaTest.CanReadCorrectedSubchannelSpecified = true;
|
||||
mediaTest.CanReadC2PointersSpecified = true;
|
||||
mediaTest.CanReadCorrectedSubchannelSpecified = true;
|
||||
mediaTest.CanReadCorrectedSubchannelWithC2Specified = true;
|
||||
mediaTest.CanReadLeadInSpecified = true;
|
||||
mediaTest.CanReadLeadOutSpecified = true;
|
||||
mediaTest.CanReadPQSubchannelSpecified = true;
|
||||
mediaTest.CanReadPQSubchannelWithC2Specified = true;
|
||||
mediaTest.CanReadRWSubchannelSpecified = true;
|
||||
mediaTest.CanReadRWSubchannelWithC2Specified = true;
|
||||
mediaTest.SupportsReadCdMsfSpecified = true;
|
||||
mediaTest.SupportsReadCdSpecified = true;
|
||||
mediaTest.SupportsReadCdMsfRawSpecified = true;
|
||||
mediaTest.SupportsReadCdRawSpecified = true;
|
||||
mediaTest.CanReadLeadInSpecified = true;
|
||||
mediaTest.CanReadLeadOutSpecified = true;
|
||||
mediaTest.CanReadPQSubchannelSpecified = true;
|
||||
mediaTest.CanReadPQSubchannelWithC2Specified = true;
|
||||
mediaTest.CanReadRWSubchannelSpecified = true;
|
||||
mediaTest.CanReadRWSubchannelWithC2Specified = true;
|
||||
mediaTest.SupportsReadCdMsfSpecified = true;
|
||||
mediaTest.SupportsReadCdSpecified = true;
|
||||
mediaTest.SupportsReadCdMsfRawSpecified = true;
|
||||
mediaTest.SupportsReadCdRawSpecified = true;
|
||||
|
||||
if(mediaType == "Audio CD")
|
||||
{
|
||||
@@ -1687,7 +1716,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
DicConsole
|
||||
.Write("Do you have want to try NEC vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): ");
|
||||
.Write("Do you have want to try NEC vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
@@ -1701,7 +1730,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
DicConsole
|
||||
.Write("Do you have want to try Pioneer vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): ");
|
||||
.Write("Do you have want to try Pioneer vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
@@ -1727,7 +1756,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
if(tryPioneer)
|
||||
{
|
||||
mediaTest.SupportsPioneerReadCDDASpecified = true;
|
||||
mediaTest.SupportsPioneerReadCDDASpecified = true;
|
||||
mediaTest.SupportsPioneerReadCDDAMSFSpecified = true;
|
||||
DicConsole.WriteLine("Trying Pioneer READ CD-DA...");
|
||||
mediaTest.SupportsPioneerReadCDDA =
|
||||
@@ -1773,12 +1802,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
FixedSense? decSense = Sense.DecodeFixed(senseBuffer);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.SenseKey == SenseKeys.IllegalRequest && decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
||||
{
|
||||
mediaTest.LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF);
|
||||
mediaTest.LongBlockSize =
|
||||
0xFFFF - (decSense.Value.Information & 0xFFFF);
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
@@ -1791,7 +1821,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
DicConsole
|
||||
.Write("Do you have want to try HL-DT-ST (aka LG) vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): ");
|
||||
.Write("Do you have want to try HL-DT-ST (aka LG) vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
@@ -1805,8 +1835,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 37856, TIMEOUT, out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 37856;
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 37856;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
@@ -1847,7 +1877,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
DicConsole
|
||||
.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): ");
|
||||
.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
@@ -1868,7 +1898,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
bingo.Write(buffer, 0, buffer.Length);
|
||||
bingo.Close();
|
||||
}
|
||||
mediaTest.LongBlockSize = i;
|
||||
|
||||
mediaTest.LongBlockSize = i;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -56,8 +56,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
if(report == null) return;
|
||||
|
||||
bool sense;
|
||||
const uint TIMEOUT = 5;
|
||||
bool sense;
|
||||
const uint TIMEOUT = 5;
|
||||
ConsoleKeyInfo pressedKey;
|
||||
|
||||
report.SCSI.SequentialDevice = new sscType();
|
||||
@@ -71,17 +71,19 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(decBl.Value.granularity > 0)
|
||||
{
|
||||
report.SCSI.SequentialDevice.BlockSizeGranularitySpecified = true;
|
||||
report.SCSI.SequentialDevice.BlockSizeGranularity = decBl.Value.granularity;
|
||||
report.SCSI.SequentialDevice.BlockSizeGranularity = decBl.Value.granularity;
|
||||
}
|
||||
|
||||
if(decBl.Value.maxBlockLen > 0)
|
||||
{
|
||||
report.SCSI.SequentialDevice.MaxBlockLengthSpecified = true;
|
||||
report.SCSI.SequentialDevice.MaxBlockLength = decBl.Value.maxBlockLen;
|
||||
report.SCSI.SequentialDevice.MaxBlockLength = decBl.Value.maxBlockLen;
|
||||
}
|
||||
|
||||
if(decBl.Value.minBlockLen > 0)
|
||||
{
|
||||
report.SCSI.SequentialDevice.MinBlockLengthSpecified = true;
|
||||
report.SCSI.SequentialDevice.MinBlockLength = decBl.Value.minBlockLen;
|
||||
report.SCSI.SequentialDevice.MinBlockLength = decBl.Value.minBlockLen;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,7 +100,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
for(int i = 0; i < dsh.Value.descriptors.Length; i++)
|
||||
{
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].BitsPerMm = dsh.Value.descriptors[i].bpmm;
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].Capacity = dsh.Value.descriptors[i].capacity;
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].Capacity =
|
||||
dsh.Value.descriptors[i].capacity;
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].DefaultDensity =
|
||||
dsh.Value.descriptors[i].defaultDensity;
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].Description =
|
||||
@@ -112,8 +115,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
dsh.Value.descriptors[i].primaryCode;
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].SecondaryCode =
|
||||
dsh.Value.descriptors[i].secondaryCode;
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].Tracks = dsh.Value.descriptors[i].tracks;
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].Width = dsh.Value.descriptors[i].width;
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].Tracks = dsh.Value.descriptors[i].tracks;
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].Width = dsh.Value.descriptors[i].width;
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].Writable = dsh.Value.descriptors[i].writable;
|
||||
}
|
||||
}
|
||||
@@ -228,7 +231,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
decMode = Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
decMode = Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
if(debug) seqTest.ModeSense10Data = buffer;
|
||||
}
|
||||
|
||||
@@ -237,18 +240,18 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense6 = true;
|
||||
if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(debug) seqTest.ModeSense6Data = buffer;
|
||||
}
|
||||
|
||||
if(decMode.HasValue)
|
||||
{
|
||||
seqTest.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
seqTest.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
seqTest.MediumTypeSpecified = true;
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
decMode.Value.Header.BlockDescriptors.Length > 0)
|
||||
{
|
||||
seqTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
seqTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
seqTest.DensitySpecified = true;
|
||||
}
|
||||
}
|
||||
@@ -264,18 +267,18 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
seqTest.SupportedDensities = new SupportedDensity[dsh.Value.descriptors.Length];
|
||||
for(int i = 0; i < dsh.Value.descriptors.Length; i++)
|
||||
{
|
||||
seqTest.SupportedDensities[i].BitsPerMm = dsh.Value.descriptors[i].bpmm;
|
||||
seqTest.SupportedDensities[i].Capacity = dsh.Value.descriptors[i].capacity;
|
||||
seqTest.SupportedDensities[i].BitsPerMm = dsh.Value.descriptors[i].bpmm;
|
||||
seqTest.SupportedDensities[i].Capacity = dsh.Value.descriptors[i].capacity;
|
||||
seqTest.SupportedDensities[i].DefaultDensity = dsh.Value.descriptors[i].defaultDensity;
|
||||
seqTest.SupportedDensities[i].Description = dsh.Value.descriptors[i].description;
|
||||
seqTest.SupportedDensities[i].Duplicate = dsh.Value.descriptors[i].duplicate;
|
||||
seqTest.SupportedDensities[i].Name = dsh.Value.descriptors[i].name;
|
||||
seqTest.SupportedDensities[i].Organization = dsh.Value.descriptors[i].organization;
|
||||
seqTest.SupportedDensities[i].PrimaryCode = dsh.Value.descriptors[i].primaryCode;
|
||||
seqTest.SupportedDensities[i].SecondaryCode = dsh.Value.descriptors[i].secondaryCode;
|
||||
seqTest.SupportedDensities[i].Tracks = dsh.Value.descriptors[i].tracks;
|
||||
seqTest.SupportedDensities[i].Width = dsh.Value.descriptors[i].width;
|
||||
seqTest.SupportedDensities[i].Writable = dsh.Value.descriptors[i].writable;
|
||||
seqTest.SupportedDensities[i].Description = dsh.Value.descriptors[i].description;
|
||||
seqTest.SupportedDensities[i].Duplicate = dsh.Value.descriptors[i].duplicate;
|
||||
seqTest.SupportedDensities[i].Name = dsh.Value.descriptors[i].name;
|
||||
seqTest.SupportedDensities[i].Organization = dsh.Value.descriptors[i].organization;
|
||||
seqTest.SupportedDensities[i].PrimaryCode = dsh.Value.descriptors[i].primaryCode;
|
||||
seqTest.SupportedDensities[i].SecondaryCode = dsh.Value.descriptors[i].secondaryCode;
|
||||
seqTest.SupportedDensities[i].Tracks = dsh.Value.descriptors[i].tracks;
|
||||
seqTest.SupportedDensities[i].Width = dsh.Value.descriptors[i].width;
|
||||
seqTest.SupportedDensities[i].Writable = dsh.Value.descriptors[i].writable;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -290,12 +293,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
seqTest.SupportedMediaTypes = new SupportedMedia[mtsh.Value.descriptors.Length];
|
||||
for(int i = 0; i < mtsh.Value.descriptors.Length; i++)
|
||||
{
|
||||
seqTest.SupportedMediaTypes[i].Description = mtsh.Value.descriptors[i].description;
|
||||
seqTest.SupportedMediaTypes[i].Length = mtsh.Value.descriptors[i].length;
|
||||
seqTest.SupportedMediaTypes[i].MediumType = mtsh.Value.descriptors[i].mediumType;
|
||||
seqTest.SupportedMediaTypes[i].Name = mtsh.Value.descriptors[i].name;
|
||||
seqTest.SupportedMediaTypes[i].Description = mtsh.Value.descriptors[i].description;
|
||||
seqTest.SupportedMediaTypes[i].Length = mtsh.Value.descriptors[i].length;
|
||||
seqTest.SupportedMediaTypes[i].MediumType = mtsh.Value.descriptors[i].mediumType;
|
||||
seqTest.SupportedMediaTypes[i].Name = mtsh.Value.descriptors[i].name;
|
||||
seqTest.SupportedMediaTypes[i].Organization = mtsh.Value.descriptors[i].organization;
|
||||
seqTest.SupportedMediaTypes[i].Width = mtsh.Value.descriptors[i].width;
|
||||
seqTest.SupportedMediaTypes[i].Width = mtsh.Value.descriptors[i].width;
|
||||
if(mtsh.Value.descriptors[i].densityCodes == null) continue;
|
||||
|
||||
seqTest.SupportedMediaTypes[i].DensityCodes =
|
||||
|
||||
@@ -71,21 +71,21 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
{
|
||||
case DeviceType.SecureDigital:
|
||||
// Clear serial number and manufacturing date
|
||||
cid[9] = 0;
|
||||
cid[10] = 0;
|
||||
cid[11] = 0;
|
||||
cid[12] = 0;
|
||||
cid[13] = 0;
|
||||
cid[14] = 0;
|
||||
cid[9] = 0;
|
||||
cid[10] = 0;
|
||||
cid[11] = 0;
|
||||
cid[12] = 0;
|
||||
cid[13] = 0;
|
||||
cid[14] = 0;
|
||||
report.SecureDigital.CID = cid;
|
||||
break;
|
||||
case DeviceType.MMC:
|
||||
// Clear serial number and manufacturing date
|
||||
cid[10] = 0;
|
||||
cid[11] = 0;
|
||||
cid[12] = 0;
|
||||
cid[13] = 0;
|
||||
cid[14] = 0;
|
||||
cid[10] = 0;
|
||||
cid[11] = 0;
|
||||
cid[12] = 0;
|
||||
cid[13] = 0;
|
||||
cid[14] = 0;
|
||||
report.MultiMediaCard.CID = cid;
|
||||
break;
|
||||
}
|
||||
@@ -134,6 +134,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
report.MultiMediaCard.ExtendedCSD = ecsd;
|
||||
}
|
||||
else DicConsole.WriteLine("Could not read Extended CSD...");
|
||||
|
||||
break;
|
||||
}
|
||||
case DeviceType.SecureDigital:
|
||||
@@ -157,6 +158,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
report.SecureDigital.SCR = scr;
|
||||
}
|
||||
else DicConsole.WriteLine("Could not read SCR...");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,9 +66,9 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
report.USB = new usbType
|
||||
{
|
||||
Manufacturer = dev.UsbManufacturerString,
|
||||
Product = dev.UsbProductString,
|
||||
ProductID = dev.UsbProductId,
|
||||
VendorID = dev.UsbVendorId
|
||||
Product = dev.UsbProductString,
|
||||
ProductID = dev.UsbProductId,
|
||||
VendorID = dev.UsbVendorId
|
||||
};
|
||||
|
||||
pressedKey = new ConsoleKeyInfo();
|
||||
@@ -80,7 +80,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
}
|
||||
|
||||
report.USB.RemovableMedia = pressedKey.Key == ConsoleKey.Y;
|
||||
removable = report.USB.RemovableMedia;
|
||||
removable = report.USB.RemovableMedia;
|
||||
if(debug) report.USB.Descriptors = dev.UsbDescriptors;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,11 +55,11 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
public static ScanResults Scan(string mhddLogPath, string ibgLogPath, string devicePath, Device dev)
|
||||
{
|
||||
ScanResults results = new ScanResults();
|
||||
bool aborted;
|
||||
bool sense;
|
||||
bool aborted;
|
||||
bool sense;
|
||||
results.Blocks = 0;
|
||||
const ushort ATA_PROFILE = 0x0001;
|
||||
const uint TIMEOUT = 5;
|
||||
const uint TIMEOUT = 5;
|
||||
|
||||
sense = dev.AtaIdentify(out byte[] cmdBuf, out _);
|
||||
if(!sense && Identify.Decode(cmdBuf).HasValue)
|
||||
@@ -73,6 +73,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.ErrorWriteLine(ataReader.ErrorMessage);
|
||||
return results;
|
||||
}
|
||||
|
||||
// Check block sizes
|
||||
if(ataReader.GetBlockSize())
|
||||
{
|
||||
@@ -88,46 +89,46 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
return results;
|
||||
}
|
||||
|
||||
uint blocksToRead = ataReader.BlocksToRead;
|
||||
ushort cylinders = ataReader.Cylinders;
|
||||
byte heads = ataReader.Heads;
|
||||
byte sectors = ataReader.Sectors;
|
||||
uint blocksToRead = ataReader.BlocksToRead;
|
||||
ushort cylinders = ataReader.Cylinders;
|
||||
byte heads = ataReader.Heads;
|
||||
byte sectors = ataReader.Sectors;
|
||||
|
||||
results.A = 0; // <3ms
|
||||
results.B = 0; // >=3ms, <10ms
|
||||
results.C = 0; // >=10ms, <50ms
|
||||
results.D = 0; // >=50ms, <150ms
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.A = 0; // <3ms
|
||||
results.B = 0; // >=3ms, <10ms
|
||||
results.C = 0; // >=10ms, <50ms
|
||||
results.D = 0; // >=50ms, <150ms
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.Errored = 0;
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
results.ProcessingTime = 0;
|
||||
double currentSpeed = 0;
|
||||
results.MaxSpeed = double.MinValue;
|
||||
results.MinSpeed = double.MaxValue;
|
||||
results.MaxSpeed = double.MinValue;
|
||||
results.MinSpeed = double.MaxValue;
|
||||
results.UnreadableSectors = new List<ulong>();
|
||||
results.SeekMax = double.MinValue;
|
||||
results.SeekMin = double.MaxValue;
|
||||
results.SeekTotal = 0;
|
||||
results.SeekMax = double.MinValue;
|
||||
results.SeekMin = double.MaxValue;
|
||||
results.SeekTotal = 0;
|
||||
const int SEEK_TIMES = 1000;
|
||||
|
||||
double seekCur;
|
||||
|
||||
Random rnd = new Random();
|
||||
|
||||
aborted = false;
|
||||
aborted = false;
|
||||
System.Console.CancelKeyPress += (sender, e) => e.Cancel = aborted = true;
|
||||
|
||||
MhddLog mhddLog;
|
||||
IbgLog ibgLog;
|
||||
double duration;
|
||||
IbgLog ibgLog;
|
||||
double duration;
|
||||
if(ataReader.IsLba)
|
||||
{
|
||||
DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead);
|
||||
|
||||
mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
|
||||
ibgLog = new IbgLog(ibgLogPath, ATA_PROFILE);
|
||||
ibgLog = new IbgLog(ibgLogPath, ATA_PROFILE);
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
for(ulong i = 0; i < results.Blocks; i += blocksToRead)
|
||||
@@ -136,10 +137,10 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
|
||||
if(results.Blocks - i < blocksToRead) blocksToRead = (byte)(results.Blocks - i);
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
if(currentSpeed > results.MaxSpeed && currentSpeed != 0) results.MaxSpeed = currentSpeed;
|
||||
if(currentSpeed < results.MinSpeed && currentSpeed != 0) results.MinSpeed = currentSpeed;
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
|
||||
DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, results.Blocks,
|
||||
currentSpeed);
|
||||
@@ -148,12 +149,12 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
|
||||
if(!error)
|
||||
{
|
||||
if(duration >= 500) results.F += blocksToRead;
|
||||
if(duration >= 500) results.F += blocksToRead;
|
||||
else if(duration >= 150) results.E += blocksToRead;
|
||||
else if(duration >= 50) results.D += blocksToRead;
|
||||
else if(duration >= 10) results.C += blocksToRead;
|
||||
else if(duration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
else if(duration >= 50) results.D += blocksToRead;
|
||||
else if(duration >= 10) results.C += blocksToRead;
|
||||
else if(duration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
|
||||
mhddLog.Write(i, duration);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
@@ -168,7 +169,8 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
ibgLog.Write(i, 0);
|
||||
}
|
||||
|
||||
double newSpeed = (double)blockSize * blocksToRead / 1048576 / (duration / 1000);
|
||||
double newSpeed =
|
||||
(double)blockSize * blocksToRead / 1048576 / (duration / 1000);
|
||||
if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed;
|
||||
}
|
||||
|
||||
@@ -176,7 +178,8 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.WriteLine();
|
||||
mhddLog.Close();
|
||||
ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000),
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 /
|
||||
(results.ProcessingTime / 1000),
|
||||
devicePath);
|
||||
|
||||
if(ataReader.CanSeekLba)
|
||||
@@ -190,10 +193,10 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
|
||||
ataReader.Seek(seekPos, out seekCur);
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
if(seekCur > results.SeekMax && seekCur != 0) results.SeekMax = seekCur;
|
||||
if(seekCur < results.SeekMin && seekCur != 0) results.SeekMin = seekCur;
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
|
||||
results.SeekTotal += seekCur;
|
||||
GC.Collect();
|
||||
@@ -202,11 +205,11 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
else
|
||||
{
|
||||
mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
|
||||
ibgLog = new IbgLog(ibgLogPath, ATA_PROFILE);
|
||||
ibgLog = new IbgLog(ibgLogPath, ATA_PROFILE);
|
||||
|
||||
ulong currentBlock = 0;
|
||||
results.Blocks = (ulong)(cylinders * heads * sectors);
|
||||
start = DateTime.UtcNow;
|
||||
start = DateTime.UtcNow;
|
||||
for(ushort cy = 0; cy < cylinders; cy++)
|
||||
{
|
||||
for(byte hd = 0; hd < heads; hd++)
|
||||
@@ -215,12 +218,12 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
{
|
||||
if(aborted) break;
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
if(currentSpeed > results.MaxSpeed && currentSpeed != 0)
|
||||
results.MaxSpeed = currentSpeed;
|
||||
if(currentSpeed < results.MinSpeed && currentSpeed != 0)
|
||||
results.MinSpeed = currentSpeed;
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
|
||||
DicConsole.Write("\rReading cylinder {0} head {1} sector {2} ({3:F3} MiB/sec.)", cy, hd,
|
||||
sc, currentSpeed);
|
||||
@@ -229,12 +232,12 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
|
||||
if(!error)
|
||||
{
|
||||
if(duration >= 500) results.F += blocksToRead;
|
||||
if(duration >= 500) results.F += blocksToRead;
|
||||
else if(duration >= 150) results.E += blocksToRead;
|
||||
else if(duration >= 50) results.D += blocksToRead;
|
||||
else if(duration >= 10) results.C += blocksToRead;
|
||||
else if(duration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
else if(duration >= 50) results.D += blocksToRead;
|
||||
else if(duration >= 10) results.C += blocksToRead;
|
||||
else if(duration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
|
||||
mhddLog.Write(currentBlock, duration);
|
||||
ibgLog.Write(currentBlock, currentSpeed * 1024);
|
||||
@@ -248,7 +251,8 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
ibgLog.Write(currentBlock, 0);
|
||||
}
|
||||
|
||||
double newSpeed = blockSize / (double)1048576 / (duration / 1000);
|
||||
double newSpeed =
|
||||
blockSize / (double)1048576 / (duration / 1000);
|
||||
if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed;
|
||||
|
||||
currentBlock++;
|
||||
@@ -260,7 +264,8 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.WriteLine();
|
||||
mhddLog.Close();
|
||||
ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000),
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 /
|
||||
(results.ProcessingTime / 1000),
|
||||
devicePath);
|
||||
|
||||
if(ataReader.CanSeek)
|
||||
@@ -269,18 +274,18 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
if(aborted) break;
|
||||
|
||||
ushort seekCy = (ushort)rnd.Next(cylinders);
|
||||
byte seekHd = (byte)rnd.Next(heads);
|
||||
byte seekSc = (byte)rnd.Next(sectors);
|
||||
byte seekHd = (byte)rnd.Next(heads);
|
||||
byte seekSc = (byte)rnd.Next(sectors);
|
||||
|
||||
DicConsole.Write("\rSeeking to cylinder {0}, head {1}, sector {2}...\t\t", seekCy, seekHd,
|
||||
seekSc);
|
||||
|
||||
ataReader.SeekChs(seekCy, seekHd, seekSc, out seekCur);
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
if(seekCur > results.SeekMax && seekCur != 0) results.SeekMax = seekCur;
|
||||
if(seekCur < results.SeekMin && seekCur != 0) results.SeekMin = seekCur;
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
|
||||
results.SeekTotal += seekCur;
|
||||
GC.Collect();
|
||||
@@ -290,9 +295,9 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.WriteLine();
|
||||
|
||||
results.ProcessingTime /= 1000;
|
||||
results.TotalTime = (end - start).TotalSeconds;
|
||||
results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime;
|
||||
results.SeekTimes = SEEK_TIMES;
|
||||
results.TotalTime = (end - start).TotalSeconds;
|
||||
results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime;
|
||||
results.SeekTimes = SEEK_TIMES;
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -50,13 +50,13 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
public static ScanResults Scan(string mhddLogPath, string ibgLogPath, string devicePath, Device dev)
|
||||
{
|
||||
ScanResults results = new ScanResults();
|
||||
bool aborted;
|
||||
MhddLog mhddLog;
|
||||
IbgLog ibgLog;
|
||||
byte[] senseBuf;
|
||||
bool sense = false;
|
||||
bool aborted;
|
||||
MhddLog mhddLog;
|
||||
IbgLog ibgLog;
|
||||
byte[] senseBuf;
|
||||
bool sense = false;
|
||||
results.Blocks = 0;
|
||||
uint blockSize = 0;
|
||||
uint blockSize = 0;
|
||||
ushort currentProfile = 0x0001;
|
||||
|
||||
if(dev.IsRemovable)
|
||||
@@ -150,7 +150,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
case PeripheralDeviceTypes.OpticalDevice:
|
||||
case PeripheralDeviceTypes.SimplifiedDevice:
|
||||
case PeripheralDeviceTypes.WriteOnceDevice:
|
||||
scsiReader = new Reader(dev, dev.Timeout, null);
|
||||
scsiReader = new Reader(dev, dev.Timeout, null);
|
||||
results.Blocks = scsiReader.GetDeviceBlocks();
|
||||
if(scsiReader.FindReadCommand())
|
||||
{
|
||||
@@ -166,6 +166,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)",
|
||||
results.Blocks, blockSize, results.Blocks * (ulong)blockSize);
|
||||
}
|
||||
|
||||
break;
|
||||
case PeripheralDeviceTypes.SequentialAccess:
|
||||
DicConsole.WriteLine("Scanning will never be supported on SCSI Streaming Devices.");
|
||||
@@ -179,8 +180,8 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
return results;
|
||||
}
|
||||
|
||||
bool compactDisc = true;
|
||||
FullTOC.CDFullTOC? toc = null;
|
||||
bool compactDisc = true;
|
||||
FullTOC.CDFullTOC? toc = null;
|
||||
|
||||
if(dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice)
|
||||
{
|
||||
@@ -212,7 +213,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
currentProfile = 0x0008;
|
||||
// We discarded all discs that falsify a TOC before requesting a real TOC
|
||||
// No TOC, no CD (or an empty one)
|
||||
bool tocSense = dev.ReadRawToc(out cmdBuf, out senseBuf, 1, dev.Timeout, out _);
|
||||
bool tocSense = dev.ReadRawToc(out cmdBuf, out senseBuf, 1, dev.Timeout, out _);
|
||||
if(!tocSense) toc = FullTOC.Decode(cmdBuf);
|
||||
}
|
||||
}
|
||||
@@ -220,23 +221,23 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
|
||||
uint blocksToRead = 64;
|
||||
|
||||
results.A = 0; // <3ms
|
||||
results.B = 0; // >=3ms, <10ms
|
||||
results.C = 0; // >=10ms, <50ms
|
||||
results.D = 0; // >=50ms, <150ms
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.A = 0; // <3ms
|
||||
results.B = 0; // >=3ms, <10ms
|
||||
results.C = 0; // >=10ms, <50ms
|
||||
results.D = 0; // >=50ms, <150ms
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.Errored = 0;
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
results.ProcessingTime = 0;
|
||||
results.TotalTime = 0;
|
||||
results.TotalTime = 0;
|
||||
double currentSpeed = 0;
|
||||
results.MaxSpeed = double.MinValue;
|
||||
results.MinSpeed = double.MaxValue;
|
||||
results.MaxSpeed = double.MinValue;
|
||||
results.MinSpeed = double.MaxValue;
|
||||
results.UnreadableSectors = new List<ulong>();
|
||||
|
||||
aborted = false;
|
||||
aborted = false;
|
||||
System.Console.CancelKeyPress += (sender, e) => e.Cancel = aborted = true;
|
||||
|
||||
if(compactDisc)
|
||||
@@ -277,7 +278,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead);
|
||||
|
||||
mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
|
||||
ibgLog = new IbgLog(ibgLogPath, currentProfile);
|
||||
ibgLog = new IbgLog(ibgLogPath, currentProfile);
|
||||
|
||||
for(ulong i = 0; i < results.Blocks; i += blocksToRead)
|
||||
{
|
||||
@@ -287,10 +288,10 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
|
||||
if(results.Blocks - i < blocksToRead) blocksToRead = (uint)(results.Blocks - i);
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
if(currentSpeed > results.MaxSpeed && currentSpeed != 0) results.MaxSpeed = currentSpeed;
|
||||
if(currentSpeed < results.MinSpeed && currentSpeed != 0) results.MinSpeed = currentSpeed;
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
|
||||
DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, results.Blocks, currentSpeed);
|
||||
|
||||
@@ -304,12 +305,12 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
if(cmdDuration >= 500) results.F += blocksToRead;
|
||||
if(cmdDuration >= 500) results.F += blocksToRead;
|
||||
else if(cmdDuration >= 150) results.E += blocksToRead;
|
||||
else if(cmdDuration >= 50) results.D += blocksToRead;
|
||||
else if(cmdDuration >= 10) results.C += blocksToRead;
|
||||
else if(cmdDuration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
else if(cmdDuration >= 50) results.D += blocksToRead;
|
||||
else if(cmdDuration >= 10) results.C += blocksToRead;
|
||||
else if(cmdDuration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
|
||||
mhddLog.Write(i, cmdDuration);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
@@ -347,7 +348,8 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
}
|
||||
}
|
||||
|
||||
double newSpeed = (double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000);
|
||||
double newSpeed =
|
||||
(double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000);
|
||||
if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed;
|
||||
}
|
||||
|
||||
@@ -355,7 +357,8 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.WriteLine();
|
||||
mhddLog.Close();
|
||||
ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000),
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 /
|
||||
(results.ProcessingTime / 1000),
|
||||
devicePath);
|
||||
}
|
||||
else
|
||||
@@ -365,7 +368,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead);
|
||||
|
||||
mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
|
||||
ibgLog = new IbgLog(ibgLogPath, currentProfile);
|
||||
ibgLog = new IbgLog(ibgLogPath, currentProfile);
|
||||
|
||||
for(ulong i = 0; i < results.Blocks; i += blocksToRead)
|
||||
{
|
||||
@@ -373,24 +376,24 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
|
||||
if(results.Blocks - i < blocksToRead) blocksToRead = (uint)(results.Blocks - i);
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
if(currentSpeed > results.MaxSpeed && currentSpeed != 0) results.MaxSpeed = currentSpeed;
|
||||
if(currentSpeed < results.MinSpeed && currentSpeed != 0) results.MinSpeed = currentSpeed;
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
|
||||
DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, results.Blocks, currentSpeed);
|
||||
|
||||
sense = scsiReader.ReadBlocks(out _, i, blocksToRead, out double cmdDuration);
|
||||
sense = scsiReader.ReadBlocks(out _, i, blocksToRead, out double cmdDuration);
|
||||
results.ProcessingTime += cmdDuration;
|
||||
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
if(cmdDuration >= 500) results.F += blocksToRead;
|
||||
if(cmdDuration >= 500) results.F += blocksToRead;
|
||||
else if(cmdDuration >= 150) results.E += blocksToRead;
|
||||
else if(cmdDuration >= 50) results.D += blocksToRead;
|
||||
else if(cmdDuration >= 10) results.C += blocksToRead;
|
||||
else if(cmdDuration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
else if(cmdDuration >= 50) results.D += blocksToRead;
|
||||
else if(cmdDuration >= 10) results.C += blocksToRead;
|
||||
else if(cmdDuration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
|
||||
mhddLog.Write(i, cmdDuration);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
@@ -405,7 +408,8 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
ibgLog.Write(i, 0);
|
||||
}
|
||||
|
||||
double newSpeed = (double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000);
|
||||
double newSpeed =
|
||||
(double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000);
|
||||
if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed;
|
||||
}
|
||||
|
||||
@@ -413,12 +417,13 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.WriteLine();
|
||||
mhddLog.Close();
|
||||
ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000),
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 /
|
||||
(results.ProcessingTime / 1000),
|
||||
devicePath);
|
||||
}
|
||||
|
||||
results.SeekMax = double.MinValue;
|
||||
results.SeekMin = double.MaxValue;
|
||||
results.SeekMax = double.MinValue;
|
||||
results.SeekMin = double.MaxValue;
|
||||
results.SeekTotal = 0;
|
||||
const int SEEK_TIMES = 1000;
|
||||
|
||||
@@ -436,10 +441,10 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
if(scsiReader.CanSeek) scsiReader.Seek(seekPos, out seekCur);
|
||||
else scsiReader.ReadBlock(out _, seekPos, out seekCur);
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
if(seekCur > results.SeekMax && seekCur != 0) results.SeekMax = seekCur;
|
||||
if(seekCur < results.SeekMin && seekCur != 0) results.SeekMin = seekCur;
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
|
||||
results.SeekTotal += seekCur;
|
||||
GC.Collect();
|
||||
@@ -448,9 +453,9 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.WriteLine();
|
||||
|
||||
results.ProcessingTime /= 1000;
|
||||
results.TotalTime = (end - start).TotalSeconds;
|
||||
results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime;
|
||||
results.SeekTimes = SEEK_TIMES;
|
||||
results.TotalTime = (end - start).TotalSeconds;
|
||||
results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime;
|
||||
results.SeekTimes = SEEK_TIMES;
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -47,16 +47,16 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
public static ScanResults Scan(string mhddLogPath, string ibgLogPath, string devicePath, Device dev)
|
||||
{
|
||||
ScanResults results = new ScanResults();
|
||||
bool aborted;
|
||||
byte[] cmdBuf;
|
||||
bool sense;
|
||||
bool aborted;
|
||||
byte[] cmdBuf;
|
||||
bool sense;
|
||||
results.Blocks = 0;
|
||||
const uint TIMEOUT = 5;
|
||||
double duration;
|
||||
const ushort SD_PROFILE = 0x0001;
|
||||
uint blocksToRead = 128;
|
||||
uint blockSize = 512;
|
||||
bool byteAddressed = true;
|
||||
const uint TIMEOUT = 5;
|
||||
double duration;
|
||||
const ushort SD_PROFILE = 0x0001;
|
||||
uint blocksToRead = 128;
|
||||
uint blockSize = 512;
|
||||
bool byteAddressed = true;
|
||||
|
||||
switch(dev.Type)
|
||||
{
|
||||
@@ -66,9 +66,9 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
if(!sense)
|
||||
{
|
||||
ExtendedCSD ecsd = Decoders.MMC.Decoders.DecodeExtendedCSD(cmdBuf);
|
||||
blocksToRead = ecsd.OptimalReadSize;
|
||||
blocksToRead = ecsd.OptimalReadSize;
|
||||
results.Blocks = ecsd.SectorCount;
|
||||
blockSize = (uint)(ecsd.SectorSize == 1 ? 4096 : 512);
|
||||
blockSize = (uint)(ecsd.SectorSize == 1 ? 4096 : 512);
|
||||
// Supposing it's high-capacity MMC if it has Extended CSD...
|
||||
byteAddressed = false;
|
||||
}
|
||||
@@ -80,9 +80,10 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
{
|
||||
CSD csd = Decoders.MMC.Decoders.DecodeCSD(cmdBuf);
|
||||
results.Blocks = (ulong)((csd.Size + 1) * Math.Pow(2, csd.SizeMultiplier + 2));
|
||||
blockSize = (uint)Math.Pow(2, csd.ReadBlockLength);
|
||||
blockSize = (uint)Math.Pow(2, csd.ReadBlockLength);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case DeviceType.SecureDigital:
|
||||
@@ -98,6 +99,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
// Structure >=1 for SDHC/SDXC, so that's block addressed
|
||||
byteAddressed = csd.Structure == 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -123,34 +125,34 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
return results;
|
||||
}
|
||||
|
||||
results.A = 0; // <3ms
|
||||
results.B = 0; // >=3ms, <10ms
|
||||
results.C = 0; // >=10ms, <50ms
|
||||
results.D = 0; // >=50ms, <150ms
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.A = 0; // <3ms
|
||||
results.B = 0; // >=3ms, <10ms
|
||||
results.C = 0; // >=10ms, <50ms
|
||||
results.D = 0; // >=50ms, <150ms
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.Errored = 0;
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
results.ProcessingTime = 0;
|
||||
double currentSpeed = 0;
|
||||
results.MaxSpeed = double.MinValue;
|
||||
results.MinSpeed = double.MaxValue;
|
||||
results.MaxSpeed = double.MinValue;
|
||||
results.MinSpeed = double.MaxValue;
|
||||
results.UnreadableSectors = new List<ulong>();
|
||||
results.SeekMax = double.MinValue;
|
||||
results.SeekMin = double.MaxValue;
|
||||
results.SeekTotal = 0;
|
||||
results.SeekMax = double.MinValue;
|
||||
results.SeekMin = double.MaxValue;
|
||||
results.SeekTotal = 0;
|
||||
const int SEEK_TIMES = 1000;
|
||||
|
||||
Random rnd = new Random();
|
||||
|
||||
aborted = false;
|
||||
aborted = false;
|
||||
System.Console.CancelKeyPress += (sender, e) => e.Cancel = aborted = true;
|
||||
|
||||
DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead);
|
||||
|
||||
MhddLog mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
|
||||
IbgLog ibgLog = new IbgLog(ibgLogPath, SD_PROFILE);
|
||||
IbgLog ibgLog = new IbgLog(ibgLogPath, SD_PROFILE);
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
for(ulong i = 0; i < results.Blocks; i += blocksToRead)
|
||||
@@ -159,10 +161,10 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
|
||||
if(results.Blocks - i < blocksToRead) blocksToRead = (byte)(results.Blocks - i);
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
if(currentSpeed > results.MaxSpeed && currentSpeed != 0) results.MaxSpeed = currentSpeed;
|
||||
if(currentSpeed < results.MinSpeed && currentSpeed != 0) results.MinSpeed = currentSpeed;
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
|
||||
DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, results.Blocks, currentSpeed);
|
||||
|
||||
@@ -171,12 +173,12 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
|
||||
if(!error)
|
||||
{
|
||||
if(duration >= 500) results.F += blocksToRead;
|
||||
if(duration >= 500) results.F += blocksToRead;
|
||||
else if(duration >= 150) results.E += blocksToRead;
|
||||
else if(duration >= 50) results.D += blocksToRead;
|
||||
else if(duration >= 10) results.C += blocksToRead;
|
||||
else if(duration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
else if(duration >= 50) results.D += blocksToRead;
|
||||
else if(duration >= 10) results.C += blocksToRead;
|
||||
else if(duration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
|
||||
mhddLog.Write(i, duration);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
@@ -191,7 +193,8 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
ibgLog.Write(i, 0);
|
||||
}
|
||||
|
||||
double newSpeed = (double)blockSize * blocksToRead / 1048576 / (duration / 1000);
|
||||
double newSpeed =
|
||||
(double)blockSize * blocksToRead / 1048576 / (duration / 1000);
|
||||
if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed;
|
||||
}
|
||||
|
||||
@@ -199,7 +202,8 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.WriteLine();
|
||||
mhddLog.Close();
|
||||
ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000), devicePath);
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 /
|
||||
(results.ProcessingTime / 1000), devicePath);
|
||||
|
||||
for(int i = 0; i < SEEK_TIMES; i++)
|
||||
{
|
||||
@@ -212,10 +216,10 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
dev.Read(out cmdBuf, out _, seekPos, blockSize, blocksToRead, byteAddressed, TIMEOUT,
|
||||
out double seekCur);
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
if(seekCur > results.SeekMax && seekCur != 0) results.SeekMax = seekCur;
|
||||
if(seekCur < results.SeekMin && seekCur != 0) results.SeekMin = seekCur;
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
|
||||
results.SeekTotal += seekCur;
|
||||
GC.Collect();
|
||||
@@ -224,9 +228,9 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.WriteLine();
|
||||
|
||||
results.ProcessingTime /= 1000;
|
||||
results.TotalTime = (end - start).TotalSeconds;
|
||||
results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime;
|
||||
results.SeekTimes = SEEK_TIMES;
|
||||
results.TotalTime = (end - start).TotalSeconds;
|
||||
results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime;
|
||||
results.SeekTimes = SEEK_TIMES;
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user