mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
REFACTOR: Final cleanup of DiscImageChef.Core.
This commit is contained in:
@@ -40,12 +40,12 @@ using DiscImageChef.Metadata;
|
||||
namespace DiscImageChef.Core.Devices.Report
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements creating a report for an ATA device
|
||||
/// Implements creating a report for an ATA device
|
||||
/// </summary>
|
||||
public static class Ata
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a report of an ATA device
|
||||
/// Creates a report of an ATA device
|
||||
/// </summary>
|
||||
/// <param name="dev">Device</param>
|
||||
/// <param name="report">Device report</param>
|
||||
@@ -81,8 +81,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
report.CompactFlashSpecified = true;
|
||||
removable = false;
|
||||
}
|
||||
else if(!removable &&
|
||||
ataId.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.Removable))
|
||||
else if(!removable && ataId.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.Removable))
|
||||
{
|
||||
pressedKey = new ConsoleKeyInfo();
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
@@ -558,8 +557,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
mediaTest.BlocksSpecified = true;
|
||||
}
|
||||
|
||||
if(ataId.CurrentCylinders > 0 && ataId.CurrentHeads > 0 &&
|
||||
ataId.CurrentSectorsPerTrack > 0)
|
||||
if(ataId.CurrentCylinders > 0 && ataId.CurrentHeads > 0 && ataId.CurrentSectorsPerTrack > 0)
|
||||
{
|
||||
mediaTest.CurrentCHS = new chsType
|
||||
{
|
||||
@@ -569,8 +567,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
};
|
||||
if(mediaTest.Blocks == 0)
|
||||
mediaTest.Blocks =
|
||||
(ulong)(ataId.CurrentCylinders * ataId.CurrentHeads *
|
||||
ataId.CurrentSectorsPerTrack);
|
||||
(ulong)(ataId.CurrentCylinders * ataId.CurrentHeads * ataId.CurrentSectorsPerTrack);
|
||||
mediaTest.BlocksSpecified = true;
|
||||
}
|
||||
|
||||
@@ -606,8 +603,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
|
||||
uint logicalsectorsize;
|
||||
uint physicalsectorsize;
|
||||
if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 &&
|
||||
(ataId.PhysLogSectorSize & 0x4000) == 0x4000)
|
||||
if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000)
|
||||
{
|
||||
if((ataId.PhysLogSectorSize & 0x1000) == 0x1000)
|
||||
if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF)
|
||||
@@ -616,10 +612,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
else logicalsectorsize = 512;
|
||||
|
||||
if((ataId.PhysLogSectorSize & 0x2000) == 0x2000)
|
||||
{
|
||||
physicalsectorsize =
|
||||
(uint)(logicalsectorsize * ((1 << ataId.PhysLogSectorSize) & 0xF));
|
||||
}
|
||||
physicalsectorsize = (uint)(logicalsectorsize * ((1 << ataId.PhysLogSectorSize) & 0xF));
|
||||
else physicalsectorsize = logicalsectorsize;
|
||||
}
|
||||
else
|
||||
@@ -692,207 +685,179 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
bool sense;
|
||||
|
||||
DicConsole.WriteLine("Trying READ SECTOR(S) in CHS mode...");
|
||||
sense = dev.Read(out byte[] readBuf, out AtaErrorRegistersChs errorChs, false, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
mediaTest.SupportsRead =
|
||||
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
sense = dev.Read(out byte[] readBuf, out AtaErrorRegistersChs errorChs, false, 0, 0, 1, 1,
|
||||
TIMEOUT, out _);
|
||||
mediaTest.SupportsRead = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
if(debug)
|
||||
DataFile.WriteTo("ATA Report", "readsectorschs",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
readBuf);
|
||||
"_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 _);
|
||||
mediaTest.SupportsReadRetry =
|
||||
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
mediaTest.SupportsReadRetry = !sense && (errorChs.Status & 0x01) != 0x01 &&
|
||||
errorChs.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
if(debug)
|
||||
DataFile.WriteTo("ATA Report", "readsectorsretrychs",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
readBuf);
|
||||
"_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 _);
|
||||
mediaTest.SupportsReadDma =
|
||||
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
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",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
if(debug)
|
||||
DataFile.WriteTo("ATA Report", "readdmachs",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
readBuf);
|
||||
DataFile.WriteTo("ATA Report", "readdmachs", "_debug_" + mediaTest.MediumTypeName + ".bin",
|
||||
"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 _);
|
||||
mediaTest.SupportsReadDmaRetry =
|
||||
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
mediaTest.SupportsReadDmaRetry = !sense && (errorChs.Status & 0x01) != 0x01 &&
|
||||
errorChs.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
if(debug)
|
||||
DataFile.WriteTo("ATA Report", "readdmaretrychs",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
readBuf);
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying SEEK in CHS mode...");
|
||||
sense = dev.Seek(out errorChs, 0, 0, 1, TIMEOUT, out _);
|
||||
mediaTest.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);
|
||||
mediaTest.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 _);
|
||||
mediaTest.SupportsReadLba =
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
mediaTest.SupportsReadLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
if(debug)
|
||||
DataFile.WriteTo("ATA Report", "readsectors",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
readBuf);
|
||||
DataFile.WriteTo("ATA Report", "readsectors", "_debug_" + mediaTest.MediumTypeName + ".bin",
|
||||
"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 _);
|
||||
mediaTest.SupportsReadRetryLba =
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
mediaTest.SupportsReadRetryLba = !sense && (errorLba.Status & 0x01) != 0x01 &&
|
||||
errorLba.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
if(debug)
|
||||
DataFile.WriteTo("ATA Report", "readsectorsretry",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
readBuf);
|
||||
"_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 _);
|
||||
mediaTest.SupportsReadDmaLba =
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
mediaTest.SupportsReadDmaLba = !sense && (errorLba.Status & 0x01) != 0x01 &&
|
||||
errorLba.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
if(debug)
|
||||
DataFile.WriteTo("ATA Report", "readdma",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
readBuf);
|
||||
DataFile.WriteTo("ATA Report", "readdma", "_debug_" + mediaTest.MediumTypeName + ".bin",
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA RETRY in LBA mode...");
|
||||
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;
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
if(debug)
|
||||
DataFile.WriteTo("ATA Report", "readdmaretry",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
readBuf);
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying SEEK in LBA mode...");
|
||||
sense = dev.Seek(out errorLba, 0, TIMEOUT, out _);
|
||||
mediaTest.SupportsSeekLba =
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", sense,
|
||||
errorChs.Status, errorChs.Error);
|
||||
mediaTest.SupportsSeekLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.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 LBA48 mode...");
|
||||
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;
|
||||
mediaTest.SupportsReadLba48 = !sense && (errorLba48.Status & 0x01) != 0x01 &&
|
||||
errorLba48.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
if(debug)
|
||||
DataFile.WriteTo("ATA Report", "readsectors48",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
readBuf);
|
||||
"_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 _);
|
||||
mediaTest.SupportsReadDmaLba48 =
|
||||
!sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
mediaTest.SupportsReadDmaLba48 = !sense && (errorLba48.Status & 0x01) != 0x01 &&
|
||||
errorLba48.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
if(debug)
|
||||
DataFile.WriteTo("ATA Report", "readdma48",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
readBuf);
|
||||
DataFile.WriteTo("ATA Report", "readdma48", "_debug_" + mediaTest.MediumTypeName + ".bin",
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ LONG in CHS mode...");
|
||||
sense = dev.ReadLong(out readBuf, out errorChs, false, 0, 0, 1, mediaTest.LongBlockSize,
|
||||
TIMEOUT, out _);
|
||||
mediaTest.SupportsReadLong =
|
||||
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 &&
|
||||
readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
||||
mediaTest.SupportsReadLong = !sense && (errorChs.Status & 0x01) != 0x01 &&
|
||||
errorChs.Error == 0 && readBuf.Length > 0 &&
|
||||
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
if(debug)
|
||||
DataFile.WriteTo("ATA Report", "readlongchs",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
readBuf);
|
||||
DataFile.WriteTo("ATA Report", "readlongchs", "_debug_" + mediaTest.MediumTypeName + ".bin",
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ LONG RETRY in CHS mode...");
|
||||
sense = dev.ReadLong(out readBuf, out errorChs, true, 0, 0, 1, mediaTest.LongBlockSize,
|
||||
TIMEOUT, out _);
|
||||
sense = dev.ReadLong(out readBuf, out errorChs, true, 0, 0, 1, mediaTest.LongBlockSize, TIMEOUT,
|
||||
out _);
|
||||
mediaTest.SupportsReadLongRetry =
|
||||
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 &&
|
||||
readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
||||
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0 &&
|
||||
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
if(debug)
|
||||
DataFile.WriteTo("ATA Report", "readlongretrychs",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
readBuf);
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ LONG in LBA mode...");
|
||||
sense = dev.ReadLong(out readBuf, out errorLba, false, 0, mediaTest.LongBlockSize,
|
||||
TIMEOUT, out _);
|
||||
mediaTest.SupportsReadLongLba =
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 &&
|
||||
readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
||||
sense = dev.ReadLong(out readBuf, out errorLba, false, 0, mediaTest.LongBlockSize, TIMEOUT,
|
||||
out _);
|
||||
mediaTest.SupportsReadLongLba = !sense && (errorLba.Status & 0x01) != 0x01 &&
|
||||
errorLba.Error == 0 && readBuf.Length > 0 &&
|
||||
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
if(debug)
|
||||
DataFile.WriteTo("ATA Report", "readlong",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
readBuf);
|
||||
DataFile.WriteTo("ATA Report", "readlong", "_debug_" + mediaTest.MediumTypeName + ".bin",
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ LONG RETRY in LBA mode...");
|
||||
sense = dev.ReadLong(out readBuf, out errorLba, true, 0, mediaTest.LongBlockSize,
|
||||
TIMEOUT, out _);
|
||||
sense = dev.ReadLong(out readBuf, out errorLba, true, 0, mediaTest.LongBlockSize, TIMEOUT,
|
||||
out _);
|
||||
mediaTest.SupportsReadLongRetryLba =
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 &&
|
||||
readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0 &&
|
||||
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
if(debug)
|
||||
DataFile.WriteTo("ATA Report", "readlongretry",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
readBuf);
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf);
|
||||
}
|
||||
else mediaTest.MediaIsRecognized = false;
|
||||
|
||||
@@ -924,8 +889,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
Heads = ataId.Heads,
|
||||
Sectors = ataId.SectorsPerTrack
|
||||
};
|
||||
report.ATA.ReadCapabilities.Blocks =
|
||||
(ulong)(ataId.Cylinders * ataId.Heads * ataId.SectorsPerTrack);
|
||||
report.ATA.ReadCapabilities.Blocks = (ulong)(ataId.Cylinders * ataId.Heads * ataId.SectorsPerTrack);
|
||||
report.ATA.ReadCapabilities.BlocksSpecified = true;
|
||||
}
|
||||
|
||||
@@ -977,16 +941,12 @@ 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)
|
||||
logicalsectorsize = 512;
|
||||
if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) logicalsectorsize = 512;
|
||||
else logicalsectorsize = ataId.LogicalSectorWords * 2;
|
||||
else logicalsectorsize = 512;
|
||||
|
||||
if((ataId.PhysLogSectorSize & 0x2000) == 0x2000)
|
||||
{
|
||||
physicalsectorsize = logicalsectorsize *
|
||||
(uint)Math.Pow(2, ataId.PhysLogSectorSize & 0xF);
|
||||
}
|
||||
physicalsectorsize = logicalsectorsize * (uint)Math.Pow(2, ataId.PhysLogSectorSize & 0xF);
|
||||
else physicalsectorsize = logicalsectorsize;
|
||||
}
|
||||
else
|
||||
@@ -1059,7 +1019,8 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
bool sense;
|
||||
|
||||
DicConsole.WriteLine("Trying READ SECTOR(S) in CHS mode...");
|
||||
sense = dev.Read(out byte[] readBuf, out AtaErrorRegistersChs errorChs, false, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
sense = dev.Read(out byte[] readBuf, out AtaErrorRegistersChs errorChs, false, 0, 0, 1, 1, TIMEOUT,
|
||||
out _);
|
||||
report.ATA.ReadCapabilities.SupportsRead =
|
||||
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -1088,8 +1049,8 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
if(debug)
|
||||
DataFile.WriteTo("ATA Report", "readdmachs", "_debug_" + report.ATA.Model + ".bin",
|
||||
"read results", readBuf);
|
||||
DataFile.WriteTo("ATA Report", "readdmachs", "_debug_" + report.ATA.Model + ".bin", "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 _);
|
||||
@@ -1117,8 +1078,8 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorLba.Status, errorLba.Error, readBuf.Length);
|
||||
if(debug)
|
||||
DataFile.WriteTo("ATA Report", "readsectors", "_debug_" + report.ATA.Model + ".bin",
|
||||
"read results", readBuf);
|
||||
DataFile.WriteTo("ATA Report", "readsectors", "_debug_" + report.ATA.Model + ".bin", "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 _);
|
||||
@@ -1179,8 +1140,8 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorLba48.Status, errorLba48.Error, readBuf.Length);
|
||||
if(debug)
|
||||
DataFile.WriteTo("ATA Report", "readdma48", "_debug_" + report.ATA.Model + ".bin",
|
||||
"read results", readBuf);
|
||||
DataFile.WriteTo("ATA Report", "readdma48", "_debug_" + report.ATA.Model + ".bin", "read results",
|
||||
readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ LONG in CHS mode...");
|
||||
sense = dev.ReadLong(out readBuf, out errorChs, false, 0, 0, 1,
|
||||
@@ -1192,8 +1153,8 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
if(debug)
|
||||
DataFile.WriteTo("ATA Report", "readlongchs", "_debug_" + report.ATA.Model + ".bin",
|
||||
"read results", readBuf);
|
||||
DataFile.WriteTo("ATA Report", "readlongchs", "_debug_" + report.ATA.Model + ".bin", "read results",
|
||||
readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ LONG RETRY in CHS mode...");
|
||||
sense = dev.ReadLong(out readBuf, out errorChs, true, 0, 0, 1,
|
||||
@@ -1218,8 +1179,8 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorLba.Status, errorLba.Error, readBuf.Length);
|
||||
if(debug)
|
||||
DataFile.WriteTo("ATA Report", "readlong", "_debug_" + report.ATA.Model + ".bin",
|
||||
"read results", readBuf);
|
||||
DataFile.WriteTo("ATA Report", "readlong", "_debug_" + report.ATA.Model + ".bin", "read results",
|
||||
readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ LONG RETRY in LBA mode...");
|
||||
sense = dev.ReadLong(out readBuf, out errorLba, true, 0, report.ATA.ReadCapabilities.LongBlockSize,
|
||||
|
||||
@@ -38,12 +38,12 @@ using DiscImageChef.Metadata;
|
||||
namespace DiscImageChef.Core.Devices.Report
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements creating a report for an ATAPI device
|
||||
/// Implements creating a report for an ATAPI device
|
||||
/// </summary>
|
||||
static class Atapi
|
||||
{
|
||||
/// <summary>
|
||||
/// Fills a SCSI device report with parameters specific to an ATAPI device
|
||||
/// Fills a SCSI device report with parameters specific to an ATAPI device
|
||||
/// </summary>
|
||||
/// <param name="dev">Device</param>
|
||||
/// <param name="report">Device report</param>
|
||||
@@ -61,7 +61,8 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
if(!Identify.Decode(buffer).HasValue) return;
|
||||
|
||||
Identify.IdentifyDevice? atapiIdNullable = Identify.Decode(buffer);
|
||||
if(atapiIdNullable != null) {
|
||||
if(atapiIdNullable != null)
|
||||
{
|
||||
Identify.IdentifyDevice atapiId = atapiIdNullable.Value;
|
||||
|
||||
report.ATAPI = new ataType();
|
||||
|
||||
@@ -38,12 +38,12 @@ using DiscImageChef.Metadata;
|
||||
namespace DiscImageChef.Core.Devices.Report
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements creating a report for a FireWire device
|
||||
/// Implements creating a report for a FireWire device
|
||||
/// </summary>
|
||||
static class FireWire
|
||||
{
|
||||
{
|
||||
/// <summary>
|
||||
/// Fills a device report with parameters specific to a FireWire device
|
||||
/// Fills a device report with parameters specific to a FireWire device
|
||||
/// </summary>
|
||||
/// <param name="dev">Device</param>
|
||||
/// <param name="report">Device report</param>
|
||||
|
||||
@@ -37,12 +37,12 @@ using DiscImageChef.Metadata;
|
||||
namespace DiscImageChef.Core.Devices.Report
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements creating a report for a PCMCIA device
|
||||
/// Implements creating a report for a PCMCIA device
|
||||
/// </summary>
|
||||
static class Pcmcia
|
||||
{
|
||||
/// <summary>
|
||||
/// Fills a device report with parameters specific to a PCMCIA device
|
||||
/// Fills a device report with parameters specific to a PCMCIA device
|
||||
/// </summary>
|
||||
/// <param name="dev">Device</param>
|
||||
/// <param name="report">Device report</param>
|
||||
@@ -53,7 +53,8 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
if(tuples == null) return;
|
||||
|
||||
foreach(Tuple tuple in tuples)
|
||||
switch(tuple.Code) {
|
||||
switch(tuple.Code)
|
||||
{
|
||||
case TupleCodes.CISTPL_MANFID:
|
||||
ManufacturerIdentificationTuple manfid = CIS.DecodeManufacturerIdentificationTuple(tuple);
|
||||
|
||||
|
||||
@@ -43,12 +43,13 @@ using DiscImageChef.Metadata;
|
||||
namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements creating a report of SCSI and ATAPI devices
|
||||
/// Implements creating a report of SCSI and ATAPI devices
|
||||
/// </summary>
|
||||
public static class General
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a report of SCSI and ATAPI devices, and if appropiate calls the report creators for MultiMedia and Streaming devices
|
||||
/// Creates a report of SCSI and ATAPI devices, and if appropiate calls the report creators for MultiMedia and
|
||||
/// Streaming devices
|
||||
/// </summary>
|
||||
/// <param name="dev">Device</param>
|
||||
/// <param name="report">Device report</param>
|
||||
@@ -150,8 +151,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
}
|
||||
|
||||
report.SCSI.Inquiry.PeripheralQualifier = (PeripheralQualifiers)inq.PeripheralQualifier;
|
||||
report.SCSI.Inquiry.PeripheralDeviceType =
|
||||
(PeripheralDeviceTypes)inq.PeripheralDeviceType;
|
||||
report.SCSI.Inquiry.PeripheralDeviceType = (PeripheralDeviceTypes)inq.PeripheralDeviceType;
|
||||
report.SCSI.Inquiry.AsymmetricalLUNAccess = (TGPSValues)inq.TPGS;
|
||||
report.SCSI.Inquiry.SPIClocking = (SPIClocking)inq.Clocking;
|
||||
|
||||
@@ -194,7 +194,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(evpdPages != null && evpdPages.Length > 0)
|
||||
{
|
||||
List<pageType> evpds = new List<pageType>();
|
||||
foreach(byte page in evpdPages.Where(page => page != 0x80)) {
|
||||
foreach(byte page in evpdPages.Where(page => page != 0x80))
|
||||
{
|
||||
DicConsole.WriteLine("Querying SCSI EVPD {0:X2}h...", page);
|
||||
sense = dev.ScsiInquiry(out buffer, out senseBuffer, page);
|
||||
if(sense) continue;
|
||||
@@ -209,7 +210,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
if(removable)
|
||||
{
|
||||
switch(dev.ScsiType) {
|
||||
switch(dev.ScsiType)
|
||||
{
|
||||
case PeripheralDeviceTypes.MultiMediaDevice:
|
||||
dev.AllowMediumRemoval(out senseBuffer, TIMEOUT, out _);
|
||||
dev.EjectTray(out senseBuffer, TIMEOUT, out _);
|
||||
@@ -266,8 +268,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
}
|
||||
else report.SCSI.SupportsModeSubpages = true;
|
||||
|
||||
if(!sense && !dev.Error && !decMode.HasValue)
|
||||
decMode = Modes.DecodeMode6(mode6Buffer, devType);
|
||||
if(!sense && !dev.Error && !decMode.HasValue) decMode = Modes.DecodeMode6(mode6Buffer, devType);
|
||||
|
||||
report.SCSI.SupportsModeSense6 |= !sense && !dev.Error;
|
||||
|
||||
@@ -310,17 +311,21 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
};
|
||||
modePages.Add(modePage);
|
||||
|
||||
if(modePage.page == 0x2A && modePage.subpage == 0x00) cdromMode = Modes.DecodeModePage_2A(page.PageResponse);
|
||||
if(modePage.page == 0x2A && modePage.subpage == 0x00)
|
||||
cdromMode = Modes.DecodeModePage_2A(page.PageResponse);
|
||||
}
|
||||
|
||||
if(modePages.Count > 0) report.SCSI.ModeSense.ModePages = modePages.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
switch(dev.ScsiType) {
|
||||
case PeripheralDeviceTypes.MultiMediaDevice: Mmc.Report(dev, ref report, debug, ref cdromMode);
|
||||
switch(dev.ScsiType)
|
||||
{
|
||||
case PeripheralDeviceTypes.MultiMediaDevice:
|
||||
Mmc.Report(dev, ref report, debug, ref cdromMode);
|
||||
break;
|
||||
case PeripheralDeviceTypes.SequentialAccess: Ssc.Report(dev, ref report, debug);
|
||||
case PeripheralDeviceTypes.SequentialAccess:
|
||||
Ssc.Report(dev, ref report, debug);
|
||||
break;
|
||||
default:
|
||||
if(removable)
|
||||
@@ -405,8 +410,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
mediaTest.SupportsReadCapacity = true;
|
||||
mediaTest.Blocks =
|
||||
(ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) +
|
||||
buffer[3]) + 1;
|
||||
(ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3]) +
|
||||
1;
|
||||
mediaTest.BlockSize =
|
||||
(uint)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]);
|
||||
mediaTest.BlocksSpecified = true;
|
||||
@@ -423,8 +428,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
Array.Reverse(temp);
|
||||
mediaTest.Blocks = BitConverter.ToUInt64(temp, 0) + 1;
|
||||
mediaTest.BlockSize =
|
||||
(uint)((buffer[8] << 24) + (buffer[9] << 16) + (buffer[10] << 8) +
|
||||
buffer[11]);
|
||||
(uint)((buffer[8] << 24) + (buffer[9] << 16) + (buffer[10] << 8) + buffer[11]);
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlockSizeSpecified = true;
|
||||
}
|
||||
@@ -433,8 +437,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE (10)...");
|
||||
sense = dev.ModeSense10(out buffer, out senseBuffer, false, true,
|
||||
ScsiModeSensePageControl.Current, 0x3F, 0x00, TIMEOUT,
|
||||
out _);
|
||||
ScsiModeSensePageControl.Current, 0x3F, 0x00, TIMEOUT, out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
@@ -447,8 +450,7 @@ 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;
|
||||
}
|
||||
|
||||
@@ -471,8 +473,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaTest.SupportsReadLongSpecified = true;
|
||||
|
||||
DicConsole.WriteLine("Trying SCSI READ (6)...");
|
||||
mediaTest.SupportsRead = !dev.Read6(out buffer, out senseBuffer, 0, mediaTest.BlockSize,
|
||||
TIMEOUT, out _);
|
||||
mediaTest.SupportsRead =
|
||||
!dev.Read6(out buffer, out senseBuffer, 0, mediaTest.BlockSize, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read6",
|
||||
@@ -616,7 +618,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
if(pressedKey.Key == ConsoleKey.Y)
|
||||
{
|
||||
for(ushort i = (ushort)mediaTest.BlockSize; ; i++)
|
||||
for(ushort i = (ushort)mediaTest.BlockSize;; i++)
|
||||
{
|
||||
DicConsole.Write("\rTrying to READ LONG with a size of {0} bytes...", i);
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, i,
|
||||
@@ -697,8 +699,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
decMode = null;
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE (10)...");
|
||||
sense = dev.ModeSense10(out buffer, out senseBuffer, false, true, ScsiModeSensePageControl.Current,
|
||||
0x3F, 0x00, TIMEOUT, out _);
|
||||
sense = dev.ModeSense10(out buffer, out senseBuffer, false, true,
|
||||
ScsiModeSensePageControl.Current, 0x3F, 0x00, TIMEOUT, out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
@@ -735,14 +737,15 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.ReadCapabilities.SupportsReadLongSpecified = true;
|
||||
|
||||
DicConsole.WriteLine("Trying SCSI READ (6)...");
|
||||
report.SCSI.ReadCapabilities.SupportsRead = !dev.Read6(out buffer, out senseBuffer, 0,
|
||||
report.SCSI.ReadCapabilities.BlockSize,
|
||||
TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !report.SCSI.ReadCapabilities.SupportsRead);
|
||||
report.SCSI.ReadCapabilities.SupportsRead =
|
||||
!dev.Read6(out buffer, out senseBuffer, 0, report.SCSI.ReadCapabilities.BlockSize, TIMEOUT,
|
||||
out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
|
||||
!report.SCSI.ReadCapabilities.SupportsRead);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read6",
|
||||
"_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin", "read results",
|
||||
buffer);
|
||||
"_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin",
|
||||
"read results", buffer);
|
||||
|
||||
DicConsole.WriteLine("Trying SCSI READ (10)...");
|
||||
report.SCSI.ReadCapabilities.SupportsRead10 =
|
||||
@@ -752,8 +755,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
!report.SCSI.ReadCapabilities.SupportsRead10);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read10",
|
||||
"_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin", "read results",
|
||||
buffer);
|
||||
"_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin",
|
||||
"read results", buffer);
|
||||
|
||||
DicConsole.WriteLine("Trying SCSI READ (12)...");
|
||||
report.SCSI.ReadCapabilities.SupportsRead12 =
|
||||
@@ -763,8 +766,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
!report.SCSI.ReadCapabilities.SupportsRead12);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read12",
|
||||
"_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin", "read results",
|
||||
buffer);
|
||||
"_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin",
|
||||
"read results", buffer);
|
||||
|
||||
DicConsole.WriteLine("Trying SCSI READ (16)...");
|
||||
report.SCSI.ReadCapabilities.SupportsRead16 =
|
||||
@@ -774,8 +777,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
!report.SCSI.ReadCapabilities.SupportsRead16);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read16",
|
||||
"_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin", "read results",
|
||||
buffer);
|
||||
"_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin",
|
||||
"read results", buffer);
|
||||
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = report.SCSI.ReadCapabilities.BlockSize;
|
||||
DicConsole.WriteLine("Trying SCSI READ LONG (10)...");
|
||||
@@ -784,8 +787,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)
|
||||
if(decSense.Value.SenseKey == SenseKeys.IllegalRequest && decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
{
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
||||
@@ -797,8 +800,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
}
|
||||
}
|
||||
|
||||
if(report.SCSI.ReadCapabilities.SupportsReadLong && report.SCSI.ReadCapabilities.LongBlockSize ==
|
||||
report.SCSI.ReadCapabilities.BlockSize)
|
||||
if(report.SCSI.ReadCapabilities.SupportsReadLong &&
|
||||
report.SCSI.ReadCapabilities.LongBlockSize == report.SCSI.ReadCapabilities.BlockSize)
|
||||
if(report.SCSI.ReadCapabilities.BlockSize == 512)
|
||||
foreach(ushort testSize in new[]
|
||||
{
|
||||
@@ -810,8 +813,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
600, 610, 630
|
||||
})
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, TIMEOUT,
|
||||
out _);
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize,
|
||||
TIMEOUT, out _);
|
||||
if(sense || dev.Error) continue;
|
||||
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
@@ -828,8 +831,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
1200
|
||||
})
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, TIMEOUT,
|
||||
out _);
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize,
|
||||
TIMEOUT, out _);
|
||||
if(sense || dev.Error) continue;
|
||||
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
@@ -871,8 +874,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
}
|
||||
}
|
||||
|
||||
if(report.SCSI.ReadCapabilities.SupportsReadLong && report.SCSI.ReadCapabilities.LongBlockSize ==
|
||||
report.SCSI.ReadCapabilities.BlockSize)
|
||||
if(report.SCSI.ReadCapabilities.SupportsReadLong &&
|
||||
report.SCSI.ReadCapabilities.LongBlockSize == report.SCSI.ReadCapabilities.BlockSize)
|
||||
{
|
||||
pressedKey = new ConsoleKeyInfo();
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
@@ -885,7 +888,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
if(pressedKey.Key == ConsoleKey.Y)
|
||||
{
|
||||
for(ushort i = (ushort)report.SCSI.ReadCapabilities.BlockSize; ; i++)
|
||||
for(ushort i = (ushort)report.SCSI.ReadCapabilities.BlockSize;; i++)
|
||||
{
|
||||
DicConsole.Write("\rTrying to READ LONG with a size of {0} bytes...", i);
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, i, TIMEOUT,
|
||||
@@ -895,8 +898,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(debug)
|
||||
{
|
||||
FileStream bingo =
|
||||
new FileStream($"{dev.Model}_readlong.bin",
|
||||
FileMode.Create);
|
||||
new FileStream($"{dev.Model}_readlong.bin", FileMode.Create);
|
||||
bingo.Write(buffer, 0, buffer.Length);
|
||||
bingo.Close();
|
||||
}
|
||||
@@ -917,8 +919,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.ReadCapabilities.LongBlockSize != report.SCSI.ReadCapabilities.BlockSize)
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0,
|
||||
(ushort)report.SCSI.ReadCapabilities.LongBlockSize, TIMEOUT,
|
||||
out _);
|
||||
(ushort)report.SCSI.ReadCapabilities.LongBlockSize, TIMEOUT, out _);
|
||||
if(!sense)
|
||||
DataFile.WriteTo("SCSI Report", "readlong10",
|
||||
"_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin",
|
||||
|
||||
@@ -44,12 +44,12 @@ using DiscImageChef.Metadata;
|
||||
namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements creating a report for a SCSI MultiMedia device
|
||||
/// Implements creating a report for a SCSI MultiMedia device
|
||||
/// </summary>
|
||||
static class Mmc
|
||||
{
|
||||
/// <summary>
|
||||
/// Fills a SCSI device report with parameters and media tests specific to a MultiMedia device
|
||||
/// Fills a SCSI device report with parameters and media tests specific to a MultiMedia device
|
||||
/// </summary>
|
||||
/// <param name="dev">Device</param>
|
||||
/// <param name="report">Device report</param>
|
||||
@@ -181,8 +181,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
case 0x0001:
|
||||
{
|
||||
Feature_0001? ftr0001 =
|
||||
Features.Decode_0001(desc.Data);
|
||||
Feature_0001? ftr0001 = Features.Decode_0001(desc.Data);
|
||||
if(ftr0001.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandard =
|
||||
@@ -203,8 +202,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
break;
|
||||
case 0x0003:
|
||||
{
|
||||
Feature_0003? ftr0003 =
|
||||
Features.Decode_0003(desc.Data);
|
||||
Feature_0003? ftr0003 = Features.Decode_0003(desc.Data);
|
||||
if(ftr0003.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.LoadingMechanismType =
|
||||
@@ -220,8 +218,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
break;
|
||||
case 0x0004:
|
||||
{
|
||||
Feature_0004? ftr0004 =
|
||||
Features.Decode_0004(desc.Data);
|
||||
Feature_0004? ftr0004 = Features.Decode_0004(desc.Data);
|
||||
if(ftr0004.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsWriteProtectPAC = ftr0004.Value.DWP;
|
||||
@@ -233,8 +230,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
break;
|
||||
case 0x0010:
|
||||
{
|
||||
Feature_0010? ftr0010 =
|
||||
Features.Decode_0010(desc.Data);
|
||||
Feature_0010? ftr0010 = Features.Decode_0010(desc.Data);
|
||||
if(ftr0010.HasValue)
|
||||
{
|
||||
if(ftr0010.Value.LogicalBlockSize > 0)
|
||||
@@ -259,8 +255,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
case 0x001E:
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadCD = true;
|
||||
Feature_001E? ftr001E =
|
||||
Features.Decode_001E(desc.Data);
|
||||
Feature_001E? ftr001E = Features.Decode_001E(desc.Data);
|
||||
if(ftr001E.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsDAP = ftr001E.Value.DAP;
|
||||
@@ -272,8 +267,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
case 0x001F:
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVD = true;
|
||||
Feature_001F? ftr001F =
|
||||
Features.Decode_001F(desc.Data);
|
||||
Feature_001F? ftr001F = Features.Decode_001F(desc.Data);
|
||||
if(ftr001F.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.DVDMultiRead = ftr001F.Value.MULTI110;
|
||||
@@ -288,8 +282,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
case 0x0023:
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanFormat = true;
|
||||
Feature_0023? ftr0023 =
|
||||
Features.Decode_0023(desc.Data);
|
||||
Feature_0023? ftr0023 = Features.Decode_0023(desc.Data);
|
||||
if(ftr0023.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanFormatBDREWithoutSpare =
|
||||
@@ -311,8 +304,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
case 0x0028:
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadCDMRW = true;
|
||||
Feature_0028? ftr0028 =
|
||||
Features.Decode_0028(desc.Data);
|
||||
Feature_0028? ftr0028 = Features.Decode_0028(desc.Data);
|
||||
if(ftr0028.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusMRW = ftr0028.Value.DVDPRead;
|
||||
@@ -324,24 +316,23 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
case 0x002A:
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRW = true;
|
||||
Feature_002A? ftr002A =
|
||||
Features.Decode_002A(desc.Data);
|
||||
if(ftr002A.HasValue) report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusRW = ftr002A.Value.Write;
|
||||
Feature_002A? ftr002A = Features.Decode_002A(desc.Data);
|
||||
if(ftr002A.HasValue)
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusRW = ftr002A.Value.Write;
|
||||
}
|
||||
break;
|
||||
case 0x002B:
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusR = true;
|
||||
Feature_002B? ftr002B =
|
||||
Features.Decode_002B(desc.Data);
|
||||
if(ftr002B.HasValue) report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusR = ftr002B.Value.Write;
|
||||
Feature_002B? ftr002B = Features.Decode_002B(desc.Data);
|
||||
if(ftr002B.HasValue)
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusR = ftr002B.Value.Write;
|
||||
}
|
||||
break;
|
||||
case 0x002D:
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteCDTAO = true;
|
||||
Feature_002D? ftr002D =
|
||||
Features.Decode_002D(desc.Data);
|
||||
Feature_002D? ftr002D = Features.Decode_002D(desc.Data);
|
||||
if(ftr002D.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.BufferUnderrunFreeInTAO = ftr002D.Value.BUF;
|
||||
@@ -359,8 +350,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
case 0x002E:
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteCDSAO = true;
|
||||
Feature_002E? ftr002E =
|
||||
Features.Decode_002E(desc.Data);
|
||||
Feature_002E? ftr002E = Features.Decode_002E(desc.Data);
|
||||
if(ftr002E.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.BufferUnderrunFreeInSAO = ftr002E.Value.BUF;
|
||||
@@ -375,8 +365,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
case 0x002F:
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteDVDR = true;
|
||||
Feature_002F? ftr002F =
|
||||
Features.Decode_002F(desc.Data);
|
||||
Feature_002F? ftr002F = Features.Decode_002F(desc.Data);
|
||||
if(ftr002F.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.BufferUnderrunFreeInDVD = ftr002F.Value.BUF;
|
||||
@@ -392,8 +381,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
case 0x0031:
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteDDCDR = true;
|
||||
Feature_0031? ftr0031 =
|
||||
Features.Decode_0031(desc.Data);
|
||||
Feature_0031? ftr0031 = Features.Decode_0031(desc.Data);
|
||||
if(ftr0031.HasValue)
|
||||
report.SCSI.MultiMediaDevice.Features.CanTestWriteDDCDR = ftr0031.Value.TestWrite;
|
||||
}
|
||||
@@ -410,8 +398,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
case 0x003A:
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRWDL = true;
|
||||
Feature_003A? ftr003A =
|
||||
Features.Decode_003A(desc.Data);
|
||||
Feature_003A? ftr003A = Features.Decode_003A(desc.Data);
|
||||
if(ftr003A.HasValue)
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusRWDL = ftr003A.Value.Write;
|
||||
}
|
||||
@@ -419,8 +406,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
case 0x003B:
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRDL = true;
|
||||
Feature_003B? ftr003B =
|
||||
Features.Decode_003B(desc.Data);
|
||||
Feature_003B? ftr003B = Features.Decode_003B(desc.Data);
|
||||
if(ftr003B.HasValue)
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusRDL = ftr003B.Value.Write;
|
||||
}
|
||||
@@ -428,8 +414,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
case 0x0040:
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBD = true;
|
||||
Feature_0040? ftr0040 =
|
||||
Features.Decode_0040(desc.Data);
|
||||
Feature_0040? ftr0040 = Features.Decode_0040(desc.Data);
|
||||
if(ftr0040.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBluBCA = ftr0040.Value.BCA;
|
||||
@@ -446,8 +431,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
case 0x0041:
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteBD = true;
|
||||
Feature_0041? ftr0041 =
|
||||
Features.Decode_0041(desc.Data);
|
||||
Feature_0041? ftr0041 = Features.Decode_0041(desc.Data);
|
||||
if(ftr0041.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteBDRE2 = ftr0041.Value.RE2;
|
||||
@@ -461,8 +445,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
case 0x0050:
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadHDDVD = true;
|
||||
Feature_0050? ftr0050 =
|
||||
Features.Decode_0050(desc.Data);
|
||||
Feature_0050? ftr0050 = Features.Decode_0050(desc.Data);
|
||||
if(ftr0050.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadHDDVDR = ftr0050.Value.HDDVDR;
|
||||
@@ -473,8 +456,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
case 0x0051:
|
||||
{
|
||||
// TODO: Write HD DVD-RW
|
||||
Feature_0051? ftr0051 =
|
||||
Features.Decode_0051(desc.Data);
|
||||
Feature_0051? ftr0051 = Features.Decode_0051(desc.Data);
|
||||
if(ftr0051.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteHDDVDR = ftr0051.Value.HDDVDR;
|
||||
@@ -491,8 +473,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
case 0x0102:
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.EmbeddedChanger = true;
|
||||
Feature_0102? ftr0102 =
|
||||
Features.Decode_0102(desc.Data);
|
||||
Feature_0102? ftr0102 = Features.Decode_0102(desc.Data);
|
||||
if(ftr0102.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.ChangerIsSideChangeCapable =
|
||||
@@ -507,8 +488,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
case 0x0103:
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanPlayCDAudio = true;
|
||||
Feature_0103? ftr0103 =
|
||||
Features.Decode_0103(desc.Data);
|
||||
Feature_0103? ftr0103 = Features.Decode_0103(desc.Data);
|
||||
if(ftr0103.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanAudioScan = ftr0103.Value.Scan;
|
||||
@@ -528,8 +508,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
case 0x0106:
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsCSS = true;
|
||||
Feature_0106? ftr0106 =
|
||||
Features.Decode_0106(desc.Data);
|
||||
Feature_0106? ftr0106 = Features.Decode_0106(desc.Data);
|
||||
if(ftr0106.HasValue)
|
||||
if(ftr0106.Value.CSSVersion > 0)
|
||||
{
|
||||
@@ -547,8 +526,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
case 0x010B:
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsCPRM = true;
|
||||
Feature_010B? ftr010B =
|
||||
Features.Decode_010B(desc.Data);
|
||||
Feature_010B? ftr010B = Features.Decode_010B(desc.Data);
|
||||
if(ftr010B.HasValue)
|
||||
if(ftr010B.Value.CPRMVersion > 0)
|
||||
{
|
||||
@@ -559,8 +537,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
break;
|
||||
case 0x010C:
|
||||
{
|
||||
Feature_010C? ftr010C =
|
||||
Features.Decode_010C(desc.Data);
|
||||
Feature_010C? ftr010C = Features.Decode_010C(desc.Data);
|
||||
if(ftr010C.HasValue)
|
||||
{
|
||||
byte[] temp = new byte[4];
|
||||
@@ -600,8 +577,10 @@ 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
|
||||
catch { // ignored
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
}
|
||||
}
|
||||
@@ -609,8 +588,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
case 0x010D:
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsAACS = true;
|
||||
Feature_010D? ftr010D =
|
||||
Features.Decode_010D(desc.Data);
|
||||
Feature_010D? ftr010D = Features.Decode_010D(desc.Data);
|
||||
if(ftr010D.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDriveAACSCertificate =
|
||||
@@ -681,7 +659,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!mediaTypes.Contains("CD-RW")) mediaTypes.Add("CD-RW");
|
||||
}
|
||||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadCDMRW) if(!mediaTypes.Contains("CD-MRW")) mediaTypes.Add("CD-MRW");
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadCDMRW)
|
||||
if(!mediaTypes.Contains("CD-MRW")) mediaTypes.Add("CD-MRW");
|
||||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadDDCD)
|
||||
{
|
||||
@@ -706,7 +685,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!mediaTypes.Contains("DVD+R DL")) mediaTypes.Add("DVD+R DL");
|
||||
}
|
||||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusMRW) if(!mediaTypes.Contains("DVD+MRW")) mediaTypes.Add("DVD+MRW");
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusMRW)
|
||||
if(!mediaTypes.Contains("DVD+MRW")) mediaTypes.Add("DVD+MRW");
|
||||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadHDDVD ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadHDDVDR)
|
||||
@@ -716,7 +696,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!mediaTypes.Contains("HD DVD-RW")) mediaTypes.Add("HD DVD-RW");
|
||||
}
|
||||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadHDDVDRAM) if(!mediaTypes.Contains("HD DVD-RAM")) mediaTypes.Add("HD DVD-RAM");
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadHDDVDRAM)
|
||||
if(!mediaTypes.Contains("HD DVD-RAM")) mediaTypes.Add("HD DVD-RAM");
|
||||
}
|
||||
|
||||
bool tryPlextor = false, tryHldtst = false, tryPioneer = false, tryNec = false;
|
||||
@@ -893,8 +874,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaType + ".bin", "read results", buffer);
|
||||
|
||||
DicConsole.WriteLine("Querying CD Full TOC...");
|
||||
mediaTest.CanReadFullTOC =
|
||||
!dev.ReadRawToc(out buffer, out senseBuffer, 1, TIMEOUT, out _);
|
||||
mediaTest.CanReadFullTOC = !dev.ReadRawToc(out buffer, out senseBuffer, 1, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadFullTOC);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "readfulltoc",
|
||||
@@ -931,8 +911,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
DicConsole.WriteLine("Querying DVD PFI...");
|
||||
mediaTest.CanReadPFI =
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
|
||||
MmcDiscStructureFormat.PhysicalInformation, 0, TIMEOUT,
|
||||
out _);
|
||||
MmcDiscStructureFormat.PhysicalInformation, 0, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPFI);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "pfi",
|
||||
@@ -956,8 +935,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
DicConsole.WriteLine("Querying DVD CMI...");
|
||||
mediaTest.CanReadCMI =
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
|
||||
MmcDiscStructureFormat.CopyrightInformation, 0, TIMEOUT,
|
||||
out _);
|
||||
MmcDiscStructureFormat.CopyrightInformation, 0, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadCMI);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "cmi",
|
||||
@@ -965,14 +943,15 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaType + ".bin", "read results", buffer);
|
||||
}
|
||||
|
||||
switch(mediaType) {
|
||||
switch(mediaType)
|
||||
{
|
||||
case "DVD-ROM":
|
||||
case "HD DVD-ROM":
|
||||
mediaTest.CanReadBCASpecified = true;
|
||||
DicConsole.WriteLine("Querying DVD BCA...");
|
||||
mediaTest.CanReadBCA =
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
|
||||
MmcDiscStructureFormat.BurstCuttingArea, 0, TIMEOUT,
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd,
|
||||
0, 0, MmcDiscStructureFormat.BurstCuttingArea, 0, TIMEOUT,
|
||||
out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadBCA);
|
||||
if(debug)
|
||||
@@ -982,8 +961,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaTest.CanReadAACSSpecified = true;
|
||||
DicConsole.WriteLine("Querying DVD AACS...");
|
||||
mediaTest.CanReadAACS =
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
|
||||
MmcDiscStructureFormat.DvdAacs, 0, TIMEOUT, out _);
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd,
|
||||
0, 0, MmcDiscStructureFormat.DvdAacs, 0, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadAACS);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "aacs",
|
||||
@@ -994,8 +973,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaTest.CanReadBCASpecified = true;
|
||||
DicConsole.WriteLine("Querying BD BCA...");
|
||||
mediaTest.CanReadBCA =
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Bd, 0, 0,
|
||||
MmcDiscStructureFormat.BdBurstCuttingArea, 0, TIMEOUT,
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Bd, 0,
|
||||
0, MmcDiscStructureFormat.BdBurstCuttingArea, 0, TIMEOUT,
|
||||
out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadBCA);
|
||||
if(debug)
|
||||
@@ -1008,17 +987,17 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaTest.CanReadDDSSpecified = true;
|
||||
mediaTest.CanReadSpareAreaInformationSpecified = true;
|
||||
mediaTest.CanReadDDS =
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
|
||||
MmcDiscStructureFormat.DvdramDds, 0, TIMEOUT, out _);
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd,
|
||||
0, 0, MmcDiscStructureFormat.DvdramDds, 0, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadDDS);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "dds",
|
||||
"_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" +
|
||||
mediaType + ".bin", "read results", buffer);
|
||||
mediaTest.CanReadSpareAreaInformation =
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
|
||||
MmcDiscStructureFormat.DvdramSpareAreaInformation, 0, TIMEOUT,
|
||||
out _);
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd,
|
||||
0, 0, MmcDiscStructureFormat.DvdramSpareAreaInformation, 0,
|
||||
TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
|
||||
!mediaTest.CanReadSpareAreaInformation);
|
||||
if(debug)
|
||||
@@ -1060,8 +1039,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
DicConsole.WriteLine("Querying DVD PRI...");
|
||||
mediaTest.CanReadPRI =
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
|
||||
MmcDiscStructureFormat.PreRecordedInfo, 0, TIMEOUT,
|
||||
out _);
|
||||
MmcDiscStructureFormat.PreRecordedInfo, 0, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPRI);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "pri",
|
||||
@@ -1076,8 +1054,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
DicConsole.WriteLine("Querying DVD Media ID...");
|
||||
mediaTest.CanReadMediaID =
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
|
||||
MmcDiscStructureFormat.DvdrMediaIdentifier, 0, TIMEOUT,
|
||||
out _);
|
||||
MmcDiscStructureFormat.DvdrMediaIdentifier, 0, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadMediaID);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "mediaid",
|
||||
@@ -1140,8 +1117,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
DicConsole.WriteLine("Querying DVD Layer Capacity...");
|
||||
mediaTest.CanReadLayerCapacity =
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
|
||||
MmcDiscStructureFormat.DvdrLayerCapacity, 0, TIMEOUT,
|
||||
out _);
|
||||
MmcDiscStructureFormat.DvdrLayerCapacity, 0, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadLayerCapacity);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "layer",
|
||||
@@ -1156,8 +1132,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
DicConsole.WriteLine("Querying BD Disc Information...");
|
||||
mediaTest.CanReadDiscInformation =
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Bd, 0, 0,
|
||||
MmcDiscStructureFormat.DiscInformation, 0, TIMEOUT,
|
||||
out _);
|
||||
MmcDiscStructureFormat.DiscInformation, 0, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadDiscInformation);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "di",
|
||||
@@ -1180,8 +1155,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaTest.SupportsRead16Specified = true;
|
||||
|
||||
DicConsole.WriteLine("Trying SCSI READ (6)...");
|
||||
mediaTest.SupportsRead =
|
||||
!dev.Read6(out buffer, out senseBuffer, 0, 2048, TIMEOUT, out _);
|
||||
mediaTest.SupportsRead = !dev.Read6(out buffer, out senseBuffer, 0, 2048, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read6",
|
||||
@@ -1380,8 +1354,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
MmcSectorTypes.Cdda, false, false, false,
|
||||
MmcHeaderCodes.None, true, false,
|
||||
MmcErrorField.C2PointersAndBlock,
|
||||
MmcSubchannel.None, TIMEOUT,
|
||||
out _);
|
||||
MmcSubchannel.None, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadC2Pointers);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "readcdc2",
|
||||
@@ -1389,32 +1362,28 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaType + ".bin", "read results", buffer);
|
||||
|
||||
DicConsole.WriteLine("Trying to read subchannels...");
|
||||
mediaTest.CanReadPQSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2368, 1,
|
||||
MmcSectorTypes.Cdda, false, false, false,
|
||||
MmcHeaderCodes.None, true, false,
|
||||
MmcErrorField.None, MmcSubchannel.Q16,
|
||||
TIMEOUT, out _);
|
||||
mediaTest.CanReadPQSubchannel =
|
||||
!dev.ReadCd(out buffer, out senseBuffer, 0, 2368, 1, MmcSectorTypes.Cdda, false,
|
||||
false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None,
|
||||
MmcSubchannel.Q16, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPQSubchannel);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "readcdpq",
|
||||
"_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" +
|
||||
mediaType + ".bin", "read results", buffer);
|
||||
mediaTest.CanReadRWSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2448, 1,
|
||||
MmcSectorTypes.Cdda, false, false, false,
|
||||
MmcHeaderCodes.None, true, false,
|
||||
MmcErrorField.None, MmcSubchannel.Raw,
|
||||
TIMEOUT, out _);
|
||||
mediaTest.CanReadRWSubchannel =
|
||||
!dev.ReadCd(out buffer, out senseBuffer, 0, 2448, 1, MmcSectorTypes.Cdda, false,
|
||||
false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None,
|
||||
MmcSubchannel.Raw, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadRWSubchannel);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "readcdrw",
|
||||
"_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" +
|
||||
mediaType + ".bin", "read results", buffer);
|
||||
mediaTest.CanReadCorrectedSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2448,
|
||||
1, MmcSectorTypes.Cdda, false, false,
|
||||
false, MmcHeaderCodes.None, true,
|
||||
false, MmcErrorField.None,
|
||||
MmcSubchannel.Rw, TIMEOUT,
|
||||
out _);
|
||||
mediaTest.CanReadCorrectedSubchannel =
|
||||
!dev.ReadCd(out buffer, out senseBuffer, 0, 2448, 1, MmcSectorTypes.Cdda, false,
|
||||
false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None,
|
||||
MmcSubchannel.Rw, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
|
||||
!mediaTest.CanReadCorrectedSubchannel);
|
||||
if(debug)
|
||||
@@ -1427,8 +1396,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
1, MmcSectorTypes.Cdda, false, false,
|
||||
false, MmcHeaderCodes.None, true,
|
||||
false, MmcErrorField.C2Pointers,
|
||||
MmcSubchannel.Q16, TIMEOUT,
|
||||
out _);
|
||||
MmcSubchannel.Q16, TIMEOUT, out _);
|
||||
if(!mediaTest.CanReadPQSubchannelWithC2)
|
||||
mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0,
|
||||
2664, 1, MmcSectorTypes.Cdda,
|
||||
@@ -1448,8 +1416,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
1, MmcSectorTypes.Cdda, false, false,
|
||||
false, MmcHeaderCodes.None, true,
|
||||
false, MmcErrorField.C2Pointers,
|
||||
MmcSubchannel.Raw, TIMEOUT,
|
||||
out _);
|
||||
MmcSubchannel.Raw, TIMEOUT, out _);
|
||||
if(!mediaTest.CanReadRWSubchannelWithC2)
|
||||
mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0,
|
||||
2714, 1, MmcSectorTypes.Cdda,
|
||||
@@ -1465,20 +1432,15 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
"_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" +
|
||||
mediaType + ".bin", "read results", buffer);
|
||||
|
||||
mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0,
|
||||
2712, 1, MmcSectorTypes.Cdda,
|
||||
false, false, false,
|
||||
MmcHeaderCodes.None, true,
|
||||
false,
|
||||
MmcErrorField.C2Pointers,
|
||||
MmcSubchannel.Rw, TIMEOUT,
|
||||
out _);
|
||||
mediaTest.CanReadCorrectedSubchannelWithC2 =
|
||||
!dev.ReadCd(out buffer, out senseBuffer, 0, 2712, 1, MmcSectorTypes.Cdda, false,
|
||||
false, false, MmcHeaderCodes.None, true, false,
|
||||
MmcErrorField.C2Pointers, MmcSubchannel.Rw, TIMEOUT, out _);
|
||||
if(!mediaTest.CanReadCorrectedSubchannelWithC2)
|
||||
mediaTest.CanReadCorrectedSubchannelWithC2 =
|
||||
!dev.ReadCd(out buffer, out senseBuffer, 0, 2714, 1, MmcSectorTypes.Cdda, false,
|
||||
false, false, MmcHeaderCodes.None, true, false,
|
||||
MmcErrorField.C2PointersAndBlock, MmcSubchannel.Rw, TIMEOUT,
|
||||
out _);
|
||||
MmcErrorField.C2PointersAndBlock, MmcSubchannel.Rw, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
|
||||
!mediaTest.CanReadCorrectedSubchannelWithC2);
|
||||
if(debug)
|
||||
@@ -1499,8 +1461,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
MmcSectorTypes.AllTypes, false, false,
|
||||
true, MmcHeaderCodes.AllHeaders, true,
|
||||
true, MmcErrorField.C2PointersAndBlock,
|
||||
MmcSubchannel.None, TIMEOUT,
|
||||
out _);
|
||||
MmcSubchannel.None, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadC2Pointers);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "readcdc2",
|
||||
@@ -1533,8 +1494,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
false, true,
|
||||
MmcHeaderCodes.AllHeaders, true,
|
||||
true, MmcErrorField.None,
|
||||
MmcSubchannel.Rw, TIMEOUT,
|
||||
out _);
|
||||
MmcSubchannel.Rw, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
|
||||
!mediaTest.CanReadCorrectedSubchannel);
|
||||
if(debug)
|
||||
@@ -1548,8 +1508,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
false, true,
|
||||
MmcHeaderCodes.AllHeaders, true, true,
|
||||
MmcErrorField.C2Pointers,
|
||||
MmcSubchannel.Q16, TIMEOUT,
|
||||
out _);
|
||||
MmcSubchannel.Q16, TIMEOUT, out _);
|
||||
if(!mediaTest.CanReadPQSubchannelWithC2)
|
||||
mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0,
|
||||
2664, 1, MmcSectorTypes.AllTypes,
|
||||
@@ -1571,8 +1530,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
false, true,
|
||||
MmcHeaderCodes.AllHeaders, true, true,
|
||||
MmcErrorField.C2Pointers,
|
||||
MmcSubchannel.Raw, TIMEOUT,
|
||||
out _);
|
||||
MmcSubchannel.Raw, TIMEOUT, out _);
|
||||
if(!mediaTest.CanReadRWSubchannelWithC2)
|
||||
mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0,
|
||||
2714, 1, MmcSectorTypes.AllTypes,
|
||||
@@ -1602,8 +1560,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaTest.CanReadCorrectedSubchannelWithC2 =
|
||||
!dev.ReadCd(out buffer, out senseBuffer, 0, 2714, 1, MmcSectorTypes.AllTypes,
|
||||
false, false, true, MmcHeaderCodes.AllHeaders, true, true,
|
||||
MmcErrorField.C2PointersAndBlock, MmcSubchannel.Rw, TIMEOUT,
|
||||
out _);
|
||||
MmcErrorField.C2PointersAndBlock, MmcSubchannel.Rw, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
|
||||
!mediaTest.CanReadCorrectedSubchannelWithC2);
|
||||
if(debug)
|
||||
@@ -1624,8 +1581,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
MmcSectorTypes.AllTypes, false, false,
|
||||
false, MmcHeaderCodes.None, true, false,
|
||||
MmcErrorField.C2PointersAndBlock,
|
||||
MmcSubchannel.None, TIMEOUT,
|
||||
out _);
|
||||
MmcSubchannel.None, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadC2Pointers);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "readcdc2",
|
||||
@@ -1657,8 +1613,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
1, MmcSectorTypes.AllTypes, false,
|
||||
false, false, MmcHeaderCodes.None,
|
||||
true, false, MmcErrorField.None,
|
||||
MmcSubchannel.Rw, TIMEOUT,
|
||||
out _);
|
||||
MmcSubchannel.Rw, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
|
||||
!mediaTest.CanReadCorrectedSubchannel);
|
||||
if(debug)
|
||||
@@ -1671,8 +1626,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
1, MmcSectorTypes.AllTypes, false,
|
||||
false, false, MmcHeaderCodes.None,
|
||||
true, false, MmcErrorField.C2Pointers,
|
||||
MmcSubchannel.Q16, TIMEOUT,
|
||||
out _);
|
||||
MmcSubchannel.Q16, TIMEOUT, out _);
|
||||
if(!mediaTest.CanReadPQSubchannelWithC2)
|
||||
mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0,
|
||||
2360, 1, MmcSectorTypes.AllTypes,
|
||||
@@ -1692,8 +1646,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
1, MmcSectorTypes.AllTypes, false,
|
||||
false, false, MmcHeaderCodes.None,
|
||||
true, false, MmcErrorField.C2Pointers,
|
||||
MmcSubchannel.Raw, TIMEOUT,
|
||||
out _);
|
||||
MmcSubchannel.Raw, TIMEOUT, out _);
|
||||
if(!mediaTest.CanReadRWSubchannelWithC2)
|
||||
mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0,
|
||||
2440, 1, MmcSectorTypes.AllTypes,
|
||||
@@ -1709,21 +1662,15 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
"_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" +
|
||||
mediaType + ".bin", "read results", buffer);
|
||||
|
||||
mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0,
|
||||
2438, 1,
|
||||
MmcSectorTypes.AllTypes, false,
|
||||
false, false,
|
||||
MmcHeaderCodes.None, true,
|
||||
false,
|
||||
MmcErrorField.C2Pointers,
|
||||
MmcSubchannel.Rw, TIMEOUT,
|
||||
out _);
|
||||
mediaTest.CanReadCorrectedSubchannelWithC2 =
|
||||
!dev.ReadCd(out buffer, out senseBuffer, 0, 2438, 1, MmcSectorTypes.AllTypes, false,
|
||||
false, false, MmcHeaderCodes.None, true, false,
|
||||
MmcErrorField.C2Pointers, MmcSubchannel.Rw, TIMEOUT, out _);
|
||||
if(!mediaTest.CanReadCorrectedSubchannelWithC2)
|
||||
mediaTest.CanReadCorrectedSubchannelWithC2 =
|
||||
!dev.ReadCd(out buffer, out senseBuffer, 0, 2440, 1, MmcSectorTypes.AllTypes,
|
||||
false, false, false, MmcHeaderCodes.None, true, false,
|
||||
MmcErrorField.C2PointersAndBlock, MmcSubchannel.Rw, TIMEOUT,
|
||||
out _);
|
||||
MmcErrorField.C2PointersAndBlock, MmcSubchannel.Rw, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
|
||||
!mediaTest.CanReadCorrectedSubchannelWithC2);
|
||||
if(debug)
|
||||
@@ -1820,14 +1767,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
mediaTest.LongBlockSize = mediaTest.BlockSize;
|
||||
DicConsole.WriteLine("Trying SCSI READ LONG (10)...");
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 0xFFFF, TIMEOUT,
|
||||
out _);
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 0xFFFF, TIMEOUT, out _);
|
||||
if(sense && !dev.Error)
|
||||
{
|
||||
FixedSense? decSense = Sense.DecodeFixed(senseBuffer);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.SenseKey == SenseKeys.IllegalRequest &&
|
||||
decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00)
|
||||
if(decSense.Value.SenseKey == SenseKeys.IllegalRequest && decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
||||
@@ -1856,8 +1802,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize)
|
||||
{
|
||||
// DVDs
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 37856, TIMEOUT,
|
||||
out _);
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 37856, TIMEOUT, out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
@@ -1909,7 +1854,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
if(pressedKey.Key == ConsoleKey.Y)
|
||||
{
|
||||
for(ushort i = (ushort)mediaTest.BlockSize; ; i++)
|
||||
for(ushort i = (ushort)mediaTest.BlockSize;; i++)
|
||||
{
|
||||
DicConsole.Write("\rTrying to READ LONG with a size of {0} bytes...", i);
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, i, TIMEOUT,
|
||||
@@ -1919,8 +1864,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(debug)
|
||||
{
|
||||
FileStream bingo =
|
||||
new FileStream($"{mediaType}_readlong.bin",
|
||||
FileMode.Create);
|
||||
new FileStream($"{mediaType}_readlong.bin", FileMode.Create);
|
||||
bingo.Write(buffer, 0, buffer.Length);
|
||||
bingo.Close();
|
||||
}
|
||||
|
||||
@@ -42,12 +42,12 @@ using DiscImageChef.Metadata;
|
||||
namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements creating a report for a SCSI Streaming device
|
||||
/// Implements creating a report for a SCSI Streaming device
|
||||
/// </summary>
|
||||
static class Ssc
|
||||
{
|
||||
/// <summary>
|
||||
/// Fills a SCSI device report with parameters and media tests specific to a Streaming device
|
||||
/// Fills a SCSI device report with parameters and media tests specific to a Streaming device
|
||||
/// </summary>
|
||||
/// <param name="dev">Device</param>
|
||||
/// <param name="report">Device report</param>
|
||||
@@ -90,8 +90,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
sense = dev.ReportDensitySupport(out buffer, out senseBuffer, false, false, TIMEOUT, out _);
|
||||
if(!sense)
|
||||
{
|
||||
DensitySupport.DensitySupportHeader? dsh =
|
||||
DensitySupport.DecodeDensity(buffer);
|
||||
DensitySupport.DensitySupportHeader? dsh = DensitySupport.DecodeDensity(buffer);
|
||||
if(dsh.HasValue)
|
||||
{
|
||||
report.SCSI.SequentialDevice.SupportedDensities =
|
||||
@@ -124,8 +123,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
sense = dev.ReportDensitySupport(out buffer, out senseBuffer, true, false, TIMEOUT, out _);
|
||||
if(!sense)
|
||||
{
|
||||
DensitySupport.MediaTypeSupportHeader? mtsh =
|
||||
DensitySupport.DecodeMediumType(buffer);
|
||||
DensitySupport.MediaTypeSupportHeader? mtsh = DensitySupport.DecodeMediumType(buffer);
|
||||
if(mtsh.HasValue)
|
||||
{
|
||||
report.SCSI.SequentialDevice.SupportedMediaTypes =
|
||||
@@ -225,8 +223,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
Modes.DecodedMode? decMode = null;
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE (10)...");
|
||||
sense = dev.ModeSense10(out buffer, out senseBuffer, false, true,
|
||||
ScsiModeSensePageControl.Current, 0x3F, 0x00, TIMEOUT, out _);
|
||||
sense = dev.ModeSense10(out buffer, out senseBuffer, false, true, ScsiModeSensePageControl.Current,
|
||||
0x3F, 0x00, TIMEOUT, out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
@@ -260,8 +258,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
sense = dev.ReportDensitySupport(out buffer, out senseBuffer, false, true, TIMEOUT, out _);
|
||||
if(!sense)
|
||||
{
|
||||
DensitySupport.DensitySupportHeader? dsh =
|
||||
DensitySupport.DecodeDensity(buffer);
|
||||
DensitySupport.DensitySupportHeader? dsh = DensitySupport.DecodeDensity(buffer);
|
||||
if(dsh.HasValue)
|
||||
{
|
||||
seqTest.SupportedDensities = new SupportedDensity[dsh.Value.descriptors.Length];
|
||||
@@ -287,8 +284,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
sense = dev.ReportDensitySupport(out buffer, out senseBuffer, true, true, TIMEOUT, out _);
|
||||
if(!sense)
|
||||
{
|
||||
DensitySupport.MediaTypeSupportHeader? mtsh =
|
||||
DensitySupport.DecodeMediumType(buffer);
|
||||
DensitySupport.MediaTypeSupportHeader? mtsh = DensitySupport.DecodeMediumType(buffer);
|
||||
if(mtsh.HasValue)
|
||||
{
|
||||
seqTest.SupportedMediaTypes = new SupportedMedia[mtsh.Value.descriptors.Length];
|
||||
@@ -313,8 +309,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
seqTest.CanReadMediaSerialSpecified = true;
|
||||
DicConsole.WriteLine("Trying SCSI READ MEDIA SERIAL NUMBER...");
|
||||
seqTest.CanReadMediaSerial =
|
||||
!dev.ReadMediaSerialNumber(out buffer, out senseBuffer, TIMEOUT, out _);
|
||||
seqTest.CanReadMediaSerial = !dev.ReadMediaSerialNumber(out buffer, out senseBuffer, TIMEOUT, out _);
|
||||
seqTests.Add(seqTest);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,12 +37,12 @@ using DiscImageChef.Metadata;
|
||||
namespace DiscImageChef.Core.Devices.Report
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements creating a device report for a SecureDigital or MultiMediaCard flash card
|
||||
/// Implements creating a device report for a SecureDigital or MultiMediaCard flash card
|
||||
/// </summary>
|
||||
public static class SecureDigital
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a device report for a SecureDigital or MultiMediaCard flash card
|
||||
/// Creates a device report for a SecureDigital or MultiMediaCard flash card
|
||||
/// </summary>
|
||||
/// <param name="dev">Device</param>
|
||||
/// <param name="report">Device report</param>
|
||||
@@ -50,10 +50,13 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
{
|
||||
if(report == null) return;
|
||||
|
||||
switch(dev.Type) {
|
||||
case DeviceType.MMC: report.MultiMediaCard = new mmcsdType();
|
||||
switch(dev.Type)
|
||||
{
|
||||
case DeviceType.MMC:
|
||||
report.MultiMediaCard = new mmcsdType();
|
||||
break;
|
||||
case DeviceType.SecureDigital: report.SecureDigital = new mmcsdType();
|
||||
case DeviceType.SecureDigital:
|
||||
report.SecureDigital = new mmcsdType();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -64,7 +67,8 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
{
|
||||
DicConsole.WriteLine("CID obtained correctly...");
|
||||
|
||||
switch(dev.Type) {
|
||||
switch(dev.Type)
|
||||
{
|
||||
case DeviceType.SecureDigital:
|
||||
// Clear serial number and manufacturing date
|
||||
cid[9] = 0;
|
||||
@@ -95,16 +99,20 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
{
|
||||
DicConsole.WriteLine("CSD obtained correctly...");
|
||||
|
||||
switch(dev.Type) {
|
||||
case DeviceType.MMC: report.MultiMediaCard.CSD = csd;
|
||||
switch(dev.Type)
|
||||
{
|
||||
case DeviceType.MMC:
|
||||
report.MultiMediaCard.CSD = csd;
|
||||
break;
|
||||
case DeviceType.SecureDigital: report.SecureDigital.CSD = csd;
|
||||
case DeviceType.SecureDigital:
|
||||
report.SecureDigital.CSD = csd;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else DicConsole.WriteLine("Could not read CSD...");
|
||||
|
||||
switch(dev.Type) {
|
||||
switch(dev.Type)
|
||||
{
|
||||
case DeviceType.MMC:
|
||||
{
|
||||
DicConsole.WriteLine("Trying to get OCR...");
|
||||
|
||||
@@ -38,12 +38,12 @@ using DiscImageChef.Metadata;
|
||||
namespace DiscImageChef.Core.Devices.Report
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements creating a report for a USB device
|
||||
/// Implements creating a report for a USB device
|
||||
/// </summary>
|
||||
static class Usb
|
||||
{
|
||||
/// <summary>
|
||||
/// Fills a device report with parameters specific to a USB device
|
||||
/// Fills a device report with parameters specific to a USB device
|
||||
/// </summary>
|
||||
/// <param name="dev">Device</param>
|
||||
/// <param name="report">Device report</param>
|
||||
|
||||
Reference in New Issue
Block a user