mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
REFACTOR: Reformat code.
This commit is contained in:
@@ -56,8 +56,7 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
{
|
||||
ushort len = (ushort)((response[0] << 8) + response[1]);
|
||||
|
||||
if(len + 2 != response.Length)
|
||||
return null;
|
||||
if(len + 2 != response.Length) return null;
|
||||
|
||||
List<Capability> caps = new List<Capability>();
|
||||
|
||||
@@ -76,5 +75,4 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
return caps.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -312,5 +312,4 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
SCSI2 = 3,
|
||||
SCSI3 = 4
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -51,21 +51,23 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
public static class Inquiry
|
||||
{
|
||||
#region Public methods
|
||||
|
||||
public static SCSIInquiry? Decode(byte[] SCSIInquiryResponse)
|
||||
{
|
||||
if(SCSIInquiryResponse == null)
|
||||
return null;
|
||||
if(SCSIInquiryResponse == null) return null;
|
||||
|
||||
if(SCSIInquiryResponse.Length < 36 && SCSIInquiryResponse.Length != 5)
|
||||
{
|
||||
DicConsole.DebugWriteLine("SCSI INQUIRY decoder", "INQUIRY response is {0} bytes, less than minimum of 36 bytes, decoded data can be incorrect, not decoding.", SCSIInquiryResponse.Length);
|
||||
DicConsole.DebugWriteLine("SCSI INQUIRY decoder",
|
||||
"INQUIRY response is {0} bytes, less than minimum of 36 bytes, decoded data can be incorrect, not decoding.",
|
||||
SCSIInquiryResponse.Length);
|
||||
return null;
|
||||
}
|
||||
|
||||
if(SCSIInquiryResponse.Length < SCSIInquiryResponse[4] + 5)
|
||||
{
|
||||
DicConsole.DebugWriteLine("SCSI INQUIRY decoder", "INQUIRY response length ({0} bytes) is different than specified in length field ({1} bytes), decoded data can be incorrect, not decoding.", SCSIInquiryResponse.Length, SCSIInquiryResponse[4] + 4);
|
||||
DicConsole.DebugWriteLine("SCSI INQUIRY decoder",
|
||||
"INQUIRY response length ({0} bytes) is different than specified in length field ({1} bytes), decoded data can be incorrect, not decoding.",
|
||||
SCSIInquiryResponse.Length, SCSIInquiryResponse[4] + 4);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -95,8 +97,7 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
decoded.HiSup = Convert.ToBoolean((SCSIInquiryResponse[3] & 0x10));
|
||||
decoded.ResponseDataFormat = (byte)(SCSIInquiryResponse[3] & 0x07);
|
||||
}
|
||||
if(SCSIInquiryResponse.Length >= 5)
|
||||
decoded.AdditionalLength = SCSIInquiryResponse[4];
|
||||
if(SCSIInquiryResponse.Length >= 5) decoded.AdditionalLength = SCSIInquiryResponse[4];
|
||||
if(SCSIInquiryResponse.Length >= 6)
|
||||
{
|
||||
decoded.SCCS = Convert.ToBoolean((SCSIInquiryResponse[5] & 0x80));
|
||||
@@ -159,7 +160,8 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
decoded.KreonVersion = new byte[5];
|
||||
Array.Copy(SCSIInquiryResponse, 42, decoded.KreonVersion, 0, 5);
|
||||
|
||||
if(decoded.KreonSpace == 0x20 && decoded.KreonIdentifier.SequenceEqual(new byte[] { 0x4B, 0x52, 0x45, 0x4F, 0x4E }))
|
||||
if(decoded.KreonSpace == 0x20 &&
|
||||
decoded.KreonIdentifier.SequenceEqual(new byte[] {0x4B, 0x52, 0x45, 0x4F, 0x4E}))
|
||||
decoded.KreonPresent = true;
|
||||
}
|
||||
if(SCSIInquiryResponse.Length >= 49)
|
||||
@@ -212,16 +214,13 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
decoded.QAS = Convert.ToBoolean((SCSIInquiryResponse[56] & 0x02));
|
||||
decoded.IUS = Convert.ToBoolean((SCSIInquiryResponse[56] & 0x01));
|
||||
}
|
||||
if(SCSIInquiryResponse.Length >= 58)
|
||||
decoded.Reserved4 = SCSIInquiryResponse[57];
|
||||
if(SCSIInquiryResponse.Length >= 58) decoded.Reserved4 = SCSIInquiryResponse[57];
|
||||
if(SCSIInquiryResponse.Length >= 60)
|
||||
{
|
||||
int descriptorsNo;
|
||||
|
||||
if(SCSIInquiryResponse.Length >= 74)
|
||||
descriptorsNo = 8;
|
||||
else
|
||||
descriptorsNo = (SCSIInquiryResponse.Length - 58) / 2;
|
||||
if(SCSIInquiryResponse.Length >= 74) descriptorsNo = 8;
|
||||
else descriptorsNo = (SCSIInquiryResponse.Length - 58) / 2;
|
||||
|
||||
decoded.VersionDescriptors = new ushort[descriptorsNo];
|
||||
for(int i = 0; i < descriptorsNo; i++)
|
||||
@@ -229,6 +228,7 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
decoded.VersionDescriptors[i] = BitConverter.ToUInt16(SCSIInquiryResponse, 58 + (i * 2));
|
||||
}
|
||||
}
|
||||
|
||||
if(SCSIInquiryResponse.Length >= 75 && SCSIInquiryResponse.Length < 96)
|
||||
{
|
||||
decoded.Reserved5 = new byte[SCSIInquiryResponse.Length - 74];
|
||||
@@ -264,16 +264,19 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
public static string Prettify(SCSIInquiry? SCSIInquiryResponse)
|
||||
{
|
||||
if(SCSIInquiryResponse == null)
|
||||
return null;
|
||||
if(SCSIInquiryResponse == null) return null;
|
||||
|
||||
SCSIInquiry response = SCSIInquiryResponse.Value;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendFormat("Device vendor: {0}", VendorString.Prettify(StringHandlers.CToString(response.VendorIdentification).Trim())).AppendLine();
|
||||
sb.AppendFormat("Device name: {0}", StringHandlers.CToString(response.ProductIdentification).Trim()).AppendLine();
|
||||
sb.AppendFormat("Device release level: {0}", StringHandlers.CToString(response.ProductRevisionLevel).Trim()).AppendLine();
|
||||
sb.AppendFormat("Device vendor: {0}",
|
||||
VendorString.Prettify(StringHandlers.CToString(response.VendorIdentification).Trim()))
|
||||
.AppendLine();
|
||||
sb.AppendFormat("Device name: {0}", StringHandlers.CToString(response.ProductIdentification).Trim())
|
||||
.AppendLine();
|
||||
sb.AppendFormat("Device release level: {0}", StringHandlers.CToString(response.ProductRevisionLevel).Trim())
|
||||
.AppendLine();
|
||||
switch((PeripheralQualifiers)response.PeripheralQualifier)
|
||||
{
|
||||
case PeripheralQualifiers.Supported:
|
||||
@@ -289,7 +292,8 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
sb.AppendLine("Device is connected but unsupported.");
|
||||
break;
|
||||
default:
|
||||
sb.AppendFormat("Vendor value {0} set in Peripheral Qualifier field.", response.PeripheralQualifier).AppendLine();
|
||||
sb.AppendFormat("Vendor value {0} set in Peripheral Qualifier field.", response.PeripheralQualifier)
|
||||
.AppendLine();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -365,7 +369,8 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
sb.AppendLine("Unknown or no device type");
|
||||
break;
|
||||
default:
|
||||
sb.AppendFormat("Unknown device type field value 0x{0:X2}", response.PeripheralDeviceType).AppendLine();
|
||||
sb.AppendFormat("Unknown device type field value 0x{0:X2}", response.PeripheralDeviceType)
|
||||
.AppendLine();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -393,7 +398,8 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
sb.AppendLine("Device claims to comply with ANSI X3.408:2005 (SPC-4)");
|
||||
break;
|
||||
default:
|
||||
sb.AppendFormat("Device claims to comply with unknown SCSI ANSI standard value 0x{0:X2})", response.ANSIVersion).AppendLine();
|
||||
sb.AppendFormat("Device claims to comply with unknown SCSI ANSI standard value 0x{0:X2})",
|
||||
response.ANSIVersion).AppendLine();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -406,7 +412,8 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
sb.AppendLine("Device claims to comply ECMA-111: Small Computer System Interface SCSI");
|
||||
break;
|
||||
default:
|
||||
sb.AppendFormat("Device claims to comply with unknown SCSI ECMA standard value 0x{0:X2})", response.ECMAVersion).AppendLine();
|
||||
sb.AppendFormat("Device claims to comply with unknown SCSI ECMA standard value 0x{0:X2})",
|
||||
response.ECMAVersion).AppendLine();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -419,65 +426,39 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
sb.AppendLine("Device claims to comply with ISO/IEC 9316:1995");
|
||||
break;
|
||||
default:
|
||||
sb.AppendFormat("Device claims to comply with unknown SCSI ISO/IEC standard value 0x{0:X2})", response.ISOVersion).AppendLine();
|
||||
sb.AppendFormat("Device claims to comply with unknown SCSI ISO/IEC standard value 0x{0:X2})",
|
||||
response.ISOVersion).AppendLine();
|
||||
break;
|
||||
}
|
||||
|
||||
if(response.RMB)
|
||||
sb.AppendLine("Device is removable");
|
||||
if(response.AERC)
|
||||
sb.AppendLine("Device supports Asynchronous Event Reporting Capability");
|
||||
if(response.TrmTsk)
|
||||
sb.AppendLine("Device supports TERMINATE TASK command");
|
||||
if(response.NormACA)
|
||||
sb.AppendLine("Device supports setting Normal ACA");
|
||||
if(response.HiSup)
|
||||
sb.AppendLine("Device supports LUN hierarchical addressing");
|
||||
if(response.SCCS)
|
||||
sb.AppendLine("Device contains an embedded storage array controller");
|
||||
if(response.ACC)
|
||||
sb.AppendLine("Device contains an Access Control Coordinator");
|
||||
if(response.ThreePC)
|
||||
sb.AppendLine("Device supports third-party copy commands");
|
||||
if(response.Protect)
|
||||
sb.AppendLine("Device supports protection information");
|
||||
if(response.BQue)
|
||||
sb.AppendLine("Device supports basic queueing");
|
||||
if(response.EncServ)
|
||||
sb.AppendLine("Device contains an embedded enclosure services component");
|
||||
if(response.MultiP)
|
||||
sb.AppendLine("Multi-port device");
|
||||
if(response.MChngr)
|
||||
sb.AppendLine("Device contains or is attached to a medium changer");
|
||||
if(response.ACKREQQ)
|
||||
sb.AppendLine("Device supports request and acknowledge handshakes");
|
||||
if(response.Addr32)
|
||||
sb.AppendLine("Device supports 32-bit wide SCSI addresses");
|
||||
if(response.Addr16)
|
||||
sb.AppendLine("Device supports 16-bit wide SCSI addresses");
|
||||
if(response.RelAddr)
|
||||
sb.AppendLine("Device supports relative addressing");
|
||||
if(response.WBus32)
|
||||
sb.AppendLine("Device supports 32-bit wide data transfers");
|
||||
if(response.WBus16)
|
||||
sb.AppendLine("Device supports 16-bit wide data transfers");
|
||||
if(response.Sync)
|
||||
sb.AppendLine("Device supports synchronous data transfer");
|
||||
if(response.Linked)
|
||||
sb.AppendLine("Device supports linked commands");
|
||||
if(response.TranDis)
|
||||
sb.AppendLine("Device supports CONTINUE TASK and TARGET TRANSFER DISABLE commands");
|
||||
if(response.QAS)
|
||||
sb.AppendLine("Device supports Quick Arbitration and Selection");
|
||||
if(response.CmdQue)
|
||||
sb.AppendLine("Device supports TCQ queue");
|
||||
if(response.IUS)
|
||||
sb.AppendLine("Device supports information unit transfers");
|
||||
if(response.SftRe)
|
||||
sb.AppendLine("Device implements RESET as a soft reset");
|
||||
if(response.RMB) sb.AppendLine("Device is removable");
|
||||
if(response.AERC) sb.AppendLine("Device supports Asynchronous Event Reporting Capability");
|
||||
if(response.TrmTsk) sb.AppendLine("Device supports TERMINATE TASK command");
|
||||
if(response.NormACA) sb.AppendLine("Device supports setting Normal ACA");
|
||||
if(response.HiSup) sb.AppendLine("Device supports LUN hierarchical addressing");
|
||||
if(response.SCCS) sb.AppendLine("Device contains an embedded storage array controller");
|
||||
if(response.ACC) sb.AppendLine("Device contains an Access Control Coordinator");
|
||||
if(response.ThreePC) sb.AppendLine("Device supports third-party copy commands");
|
||||
if(response.Protect) sb.AppendLine("Device supports protection information");
|
||||
if(response.BQue) sb.AppendLine("Device supports basic queueing");
|
||||
if(response.EncServ) sb.AppendLine("Device contains an embedded enclosure services component");
|
||||
if(response.MultiP) sb.AppendLine("Multi-port device");
|
||||
if(response.MChngr) sb.AppendLine("Device contains or is attached to a medium changer");
|
||||
if(response.ACKREQQ) sb.AppendLine("Device supports request and acknowledge handshakes");
|
||||
if(response.Addr32) sb.AppendLine("Device supports 32-bit wide SCSI addresses");
|
||||
if(response.Addr16) sb.AppendLine("Device supports 16-bit wide SCSI addresses");
|
||||
if(response.RelAddr) sb.AppendLine("Device supports relative addressing");
|
||||
if(response.WBus32) sb.AppendLine("Device supports 32-bit wide data transfers");
|
||||
if(response.WBus16) sb.AppendLine("Device supports 16-bit wide data transfers");
|
||||
if(response.Sync) sb.AppendLine("Device supports synchronous data transfer");
|
||||
if(response.Linked) sb.AppendLine("Device supports linked commands");
|
||||
if(response.TranDis) sb.AppendLine("Device supports CONTINUE TASK and TARGET TRANSFER DISABLE commands");
|
||||
if(response.QAS) sb.AppendLine("Device supports Quick Arbitration and Selection");
|
||||
if(response.CmdQue) sb.AppendLine("Device supports TCQ queue");
|
||||
if(response.IUS) sb.AppendLine("Device supports information unit transfers");
|
||||
if(response.SftRe) sb.AppendLine("Device implements RESET as a soft reset");
|
||||
#if DEBUG
|
||||
if(response.VS1)
|
||||
sb.AppendLine("Vendor specific bit 5 on byte 6 of INQUIRY response is set");
|
||||
if(response.VS1) sb.AppendLine("Vendor specific bit 5 on byte 6 of INQUIRY response is set");
|
||||
#endif
|
||||
|
||||
switch((TGPSValues)response.TPGS)
|
||||
@@ -525,8 +506,7 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
switch(VersionDescriptor)
|
||||
{
|
||||
case 0xFFFF:
|
||||
case 0x0000:
|
||||
break;
|
||||
case 0x0000: break;
|
||||
case 0x0020:
|
||||
sb.AppendLine("Device complies with SAM (no version claimed)");
|
||||
break;
|
||||
@@ -1185,7 +1165,8 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
case 0x097D:
|
||||
case 0x097E:
|
||||
case 0x097F:
|
||||
sb.AppendFormat("Device complies with iSCSI revision {0}", VersionDescriptor & 0x1F).AppendLine();
|
||||
sb.AppendFormat("Device complies with iSCSI revision {0}", VersionDescriptor & 0x1F)
|
||||
.AppendLine();
|
||||
break;
|
||||
case 0x0980:
|
||||
sb.AppendLine("Device complies with SBP-3 (no version claimed)");
|
||||
@@ -1932,14 +1913,16 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
sb.AppendLine("Device complies with IEEE 1667-2009");
|
||||
break;
|
||||
default:
|
||||
sb.AppendFormat("Device complies with unknown standard code 0x{0:X4}", VersionDescriptor).AppendLine();
|
||||
sb.AppendFormat("Device complies with unknown standard code 0x{0:X4}", VersionDescriptor)
|
||||
.AppendLine();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Quantum vendor prettifying
|
||||
if(response.QuantumPresent && StringHandlers.CToString(response.VendorIdentification).ToLowerInvariant().Trim() == "quantum")
|
||||
if(response.QuantumPresent &&
|
||||
StringHandlers.CToString(response.VendorIdentification).ToLowerInvariant().Trim() == "quantum")
|
||||
{
|
||||
sb.AppendLine("Quantum vendor-specific information:");
|
||||
switch(response.Qt_ProductFamily)
|
||||
@@ -1968,77 +1951,85 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
}
|
||||
|
||||
sb.AppendFormat("Release firmware: {0}", response.Qt_ReleasedFirmware).AppendLine();
|
||||
sb.AppendFormat("Firmware version: {0}.{1}", response.Qt_FirmwareMajorVersion, response.Qt_FirmwareMinorVersion).AppendLine();
|
||||
sb.AppendFormat("EEPROM format version: {0}.{1}", response.Qt_EEPROMFormatMajorVersion, response.Qt_EEPROMFormatMinorVersion).AppendLine();
|
||||
sb.AppendFormat("Firmware version: {0}.{1}", response.Qt_FirmwareMajorVersion,
|
||||
response.Qt_FirmwareMinorVersion).AppendLine();
|
||||
sb.AppendFormat("EEPROM format version: {0}.{1}", response.Qt_EEPROMFormatMajorVersion,
|
||||
response.Qt_EEPROMFormatMinorVersion).AppendLine();
|
||||
sb.AppendFormat("Firmware personality: {0}", response.Qt_FirmwarePersonality).AppendLine();
|
||||
sb.AppendFormat("Firmware subpersonality: {0}", response.Qt_FirmwareSubPersonality).AppendLine();
|
||||
sb.AppendFormat("Tape directory format version: {0}", response.Qt_TapeDirectoryFormatVersion).AppendLine();
|
||||
sb.AppendFormat("Tape directory format version: {0}", response.Qt_TapeDirectoryFormatVersion)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("Controller hardware version: {0}", response.Qt_ControllerHardwareVersion).AppendLine();
|
||||
sb.AppendFormat("Drive EEPROM version: {0}", response.Qt_DriveEEPROMVersion).AppendLine();
|
||||
sb.AppendFormat("Drive hardware version: {0}", response.Qt_DriveHardwareVersion).AppendLine();
|
||||
sb.AppendFormat("Media loader firmware version: {0}", response.Qt_MediaLoaderFirmwareVersion).AppendLine();
|
||||
sb.AppendFormat("Media loader hardware version: {0}", response.Qt_MediaLoaderHardwareVersion).AppendLine();
|
||||
sb.AppendFormat("Media loader mechanical version: {0}", response.Qt_MediaLoaderMechanicalVersion).AppendLine();
|
||||
if(response.Qt_LibraryPresent)
|
||||
sb.AppendLine("Library is present");
|
||||
if(response.Qt_MediaLoaderPresent)
|
||||
sb.AppendLine("Media loader is present");
|
||||
sb.AppendFormat("Module revision: {0}", StringHandlers.CToString(response.Qt_ModuleRevision)).AppendLine();
|
||||
sb.AppendFormat("Media loader firmware version: {0}", response.Qt_MediaLoaderFirmwareVersion)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("Media loader hardware version: {0}", response.Qt_MediaLoaderHardwareVersion)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("Media loader mechanical version: {0}", response.Qt_MediaLoaderMechanicalVersion)
|
||||
.AppendLine();
|
||||
if(response.Qt_LibraryPresent) sb.AppendLine("Library is present");
|
||||
if(response.Qt_MediaLoaderPresent) sb.AppendLine("Media loader is present");
|
||||
sb.AppendFormat("Module revision: {0}", StringHandlers.CToString(response.Qt_ModuleRevision))
|
||||
.AppendLine();
|
||||
}
|
||||
#endregion Quantum vendor prettifying
|
||||
|
||||
#region IBM vendor prettifying
|
||||
if(response.IBMPresent && StringHandlers.CToString(response.VendorIdentification).ToLowerInvariant().Trim() == "ibm")
|
||||
if(response.IBMPresent &&
|
||||
StringHandlers.CToString(response.VendorIdentification).ToLowerInvariant().Trim() == "ibm")
|
||||
{
|
||||
sb.AppendLine("IBM vendor-specific information:");
|
||||
|
||||
if(response.IBM_PerformanceLimit == 0)
|
||||
sb.AppendLine("Performance is not limited");
|
||||
else
|
||||
sb.AppendFormat("Performance is limited using factor {0}", response.IBM_PerformanceLimit);
|
||||
if(response.IBM_PerformanceLimit == 0) sb.AppendLine("Performance is not limited");
|
||||
else sb.AppendFormat("Performance is limited using factor {0}", response.IBM_PerformanceLimit);
|
||||
|
||||
if(response.IBM_AutDis)
|
||||
sb.AppendLine("Automation is disabled");
|
||||
if(response.IBM_AutDis) sb.AppendLine("Automation is disabled");
|
||||
|
||||
sb.AppendFormat("IBM OEM Specific Field: {0}", response.IBM_OEMSpecific).AppendLine();
|
||||
}
|
||||
#endregion IBM vendor prettifying
|
||||
|
||||
#region HP vendor prettifying
|
||||
if(response.HPPresent && StringHandlers.CToString(response.VendorIdentification).ToLowerInvariant().Trim() == "hp")
|
||||
if(response.HPPresent &&
|
||||
StringHandlers.CToString(response.VendorIdentification).ToLowerInvariant().Trim() == "hp")
|
||||
{
|
||||
sb.AppendLine("HP vendor-specific information:");
|
||||
|
||||
if(response.HP_WORM)
|
||||
sb.AppendFormat("Device supports WORM version {0}", response.HP_WORMVersion).AppendLine();
|
||||
|
||||
byte[] OBDRSign = { 0x24, 0x44, 0x52, 0x2D, 0x31, 0x30};
|
||||
if(OBDRSign.SequenceEqual(response.HP_OBDR))
|
||||
sb.AppendLine("Device supports Tape Disaster Recovery");
|
||||
byte[] OBDRSign = {0x24, 0x44, 0x52, 0x2D, 0x31, 0x30};
|
||||
if(OBDRSign.SequenceEqual(response.HP_OBDR)) sb.AppendLine("Device supports Tape Disaster Recovery");
|
||||
}
|
||||
#endregion HP vendor prettifying
|
||||
|
||||
#region Seagate vendor prettifying
|
||||
if((response.SeagatePresent || response.Seagate2Present || response.Seagate3Present)
|
||||
&& StringHandlers.CToString(response.VendorIdentification).ToLowerInvariant().Trim() == "seagate")
|
||||
if((response.SeagatePresent || response.Seagate2Present || response.Seagate3Present) &&
|
||||
StringHandlers.CToString(response.VendorIdentification).ToLowerInvariant().Trim() == "seagate")
|
||||
{
|
||||
sb.AppendLine("Seagate vendor-specific information:");
|
||||
|
||||
if(response.SeagatePresent)
|
||||
sb.AppendFormat("Drive serial number: {0}", StringHandlers.CToString(response.Seagate_DriveSerialNumber)).AppendLine();
|
||||
sb.AppendFormat("Drive serial number: {0}",
|
||||
StringHandlers.CToString(response.Seagate_DriveSerialNumber)).AppendLine();
|
||||
|
||||
if(response.Seagate2Present)
|
||||
sb.AppendFormat("Drive copyright: {0}", StringHandlers.CToString(response.Seagate_Copyright)).AppendLine();
|
||||
sb.AppendFormat("Drive copyright: {0}", StringHandlers.CToString(response.Seagate_Copyright))
|
||||
.AppendLine();
|
||||
|
||||
if(response.Seagate3Present)
|
||||
sb.AppendFormat("Drive servo part number: {0}", PrintHex.ByteArrayToHexArrayString(response.Seagate_ServoPROMPartNo, 40)).AppendLine();
|
||||
sb.AppendFormat("Drive servo part number: {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(response.Seagate_ServoPROMPartNo, 40))
|
||||
.AppendLine();
|
||||
}
|
||||
#endregion Seagate vendor prettifying
|
||||
|
||||
#region Kreon vendor prettifying
|
||||
if(response.KreonPresent)
|
||||
{
|
||||
sb.AppendFormat("Drive is flashed with Kreon firmware {0}.", StringHandlers.CToString(response.KreonVersion)).AppendLine();
|
||||
sb.AppendFormat("Drive is flashed with Kreon firmware {0}.",
|
||||
StringHandlers.CToString(response.KreonVersion)).AppendLine();
|
||||
}
|
||||
#endregion Kreon vendor prettifying
|
||||
|
||||
@@ -2049,8 +2040,7 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
sb.AppendFormat("Reserved byte 5, bits 2 to 1 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
if(response.Reserved3 != 0)
|
||||
sb.AppendFormat("Reserved byte 56, bits 7 to 4 = 0x{0:X2}", response.Reserved3).AppendLine();
|
||||
if(response.Reserved4 != 0)
|
||||
sb.AppendFormat("Reserved byte 57 = 0x{0:X2}", response.Reserved4).AppendLine();
|
||||
if(response.Reserved4 != 0) sb.AppendFormat("Reserved byte 57 = 0x{0:X2}", response.Reserved4).AppendLine();
|
||||
|
||||
if(response.Reserved5 != null)
|
||||
{
|
||||
@@ -2097,11 +2087,9 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
SCSIInquiry? decoded = Decode(SCSIInquiryResponse);
|
||||
return Prettify(decoded);
|
||||
}
|
||||
|
||||
#endregion Public methods
|
||||
|
||||
#region Public structures
|
||||
|
||||
// SCSI INQUIRY command response
|
||||
public struct SCSIInquiry
|
||||
{
|
||||
@@ -2341,6 +2329,7 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
public byte[] VendorSpecific2;
|
||||
|
||||
// Per DLT4000/DLT4500/DLT4700 Cartridge Tape Subsystem Product Manual
|
||||
|
||||
#region Quantum vendor unique inquiry data structure
|
||||
/// <summary>
|
||||
/// Means that the INQUIRY response contains 56 bytes or more, so this data has been filled
|
||||
@@ -2532,8 +2521,6 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
public byte[] KreonVersion;
|
||||
#endregion Kreon vendor unique inquiry data structure
|
||||
}
|
||||
|
||||
#endregion Public structures
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -218,8 +218,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static AACSVolumeIdentifier? DecodeAACSVolumeIdentifier(byte[] AACSVIResponse)
|
||||
{
|
||||
if(AACSVIResponse == null)
|
||||
return null;
|
||||
if(AACSVIResponse == null) return null;
|
||||
|
||||
AACSVolumeIdentifier decoded = new AACSVolumeIdentifier();
|
||||
|
||||
@@ -237,18 +236,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static string PrettifyAACSVolumeIdentifier(AACSVolumeIdentifier? AACSVIResponse)
|
||||
{
|
||||
if(AACSVIResponse == null)
|
||||
return null;
|
||||
if(AACSVIResponse == null) return null;
|
||||
|
||||
AACSVolumeIdentifier response = AACSVIResponse.Value;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
#endif
|
||||
sb.AppendFormat("AACS Volume Identifier in hex follows:");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.VolumeIdentifier, 80));
|
||||
@@ -264,8 +260,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static AACSMediaSerialNumber? DecodeAACSMediaSerialNumber(byte[] AACSMSNResponse)
|
||||
{
|
||||
if(AACSMSNResponse == null)
|
||||
return null;
|
||||
if(AACSMSNResponse == null) return null;
|
||||
|
||||
AACSMediaSerialNumber decoded = new AACSMediaSerialNumber();
|
||||
|
||||
@@ -283,18 +278,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static string PrettifyAACSMediaSerialNumber(AACSMediaSerialNumber? AACSMSNResponse)
|
||||
{
|
||||
if(AACSMSNResponse == null)
|
||||
return null;
|
||||
if(AACSMSNResponse == null) return null;
|
||||
|
||||
AACSMediaSerialNumber response = AACSMSNResponse.Value;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
#endif
|
||||
sb.AppendFormat("AACS Media Serial Number in hex follows:");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MediaSerialNumber, 80));
|
||||
@@ -310,8 +302,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static AACSMediaIdentifier? DecodeAACSMediaIdentifier(byte[] AACSMIResponse)
|
||||
{
|
||||
if(AACSMIResponse == null)
|
||||
return null;
|
||||
if(AACSMIResponse == null) return null;
|
||||
|
||||
AACSMediaIdentifier decoded = new AACSMediaIdentifier();
|
||||
|
||||
@@ -329,18 +320,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static string PrettifyAACSMediaIdentifier(AACSMediaIdentifier? AACSMIResponse)
|
||||
{
|
||||
if(AACSMIResponse == null)
|
||||
return null;
|
||||
if(AACSMIResponse == null) return null;
|
||||
|
||||
AACSMediaIdentifier response = AACSMIResponse.Value;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
#endif
|
||||
sb.AppendFormat("AACS Media Identifier in hex follows:");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MediaIdentifier, 80));
|
||||
@@ -356,8 +344,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static AACSMediaKeyBlock? DecodeAACSMediaKeyBlock(byte[] AACSMKBResponse)
|
||||
{
|
||||
if(AACSMKBResponse == null)
|
||||
return null;
|
||||
if(AACSMKBResponse == null) return null;
|
||||
|
||||
AACSMediaKeyBlock decoded = new AACSMediaKeyBlock();
|
||||
|
||||
@@ -375,18 +362,17 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static string PrettifyAACSMediaKeyBlock(AACSMediaKeyBlock? AACSMKBResponse)
|
||||
{
|
||||
if(AACSMKBResponse == null)
|
||||
return null;
|
||||
if(AACSMKBResponse == null) return null;
|
||||
|
||||
AACSMediaKeyBlock response = AACSMKBResponse.Value;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
#if DEBUG
|
||||
if(response.Reserved != 0)
|
||||
sb.AppendFormat("Reserved = 0x{0:X2}", response.Reserved).AppendLine();
|
||||
if(response.Reserved != 0) sb.AppendFormat("Reserved = 0x{0:X2}", response.Reserved).AppendLine();
|
||||
#endif
|
||||
sb.AppendFormat("Total number of media key blocks available to transfer {0}", response.TotalPacks).AppendLine();
|
||||
sb.AppendFormat("Total number of media key blocks available to transfer {0}", response.TotalPacks)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("AACS Media Key Blocks in hex follows:");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MediaKeyBlockPacks, 80));
|
||||
|
||||
@@ -401,8 +387,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static AACSDataKeys? DecodeAACSDataKeys(byte[] AACSDKResponse)
|
||||
{
|
||||
if(AACSDKResponse == null)
|
||||
return null;
|
||||
if(AACSDKResponse == null) return null;
|
||||
|
||||
AACSDataKeys decoded = new AACSDataKeys();
|
||||
|
||||
@@ -420,18 +405,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static string PrettifyAACSDataKeys(AACSDataKeys? AACSDKResponse)
|
||||
{
|
||||
if(AACSDKResponse == null)
|
||||
return null;
|
||||
if(AACSDKResponse == null) return null;
|
||||
|
||||
AACSDataKeys response = AACSDKResponse.Value;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
#endif
|
||||
sb.AppendFormat("AACS Data Keys in hex follows:");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.DataKeys, 80));
|
||||
@@ -447,8 +429,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static AACSLBAExtentsResponse? DecodeAACSLBAExtents(byte[] AACSLBAExtsResponse)
|
||||
{
|
||||
if(AACSLBAExtsResponse == null)
|
||||
return null;
|
||||
if(AACSLBAExtsResponse == null) return null;
|
||||
|
||||
AACSLBAExtentsResponse decoded = new AACSLBAExtentsResponse();
|
||||
|
||||
@@ -458,8 +439,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
decoded.Reserved = AACSLBAExtsResponse[2];
|
||||
decoded.MaxLBAExtents = AACSLBAExtsResponse[3];
|
||||
|
||||
if((AACSLBAExtsResponse.Length - 4) % 16 != 0)
|
||||
return decoded;
|
||||
if((AACSLBAExtsResponse.Length - 4) % 16 != 0) return decoded;
|
||||
|
||||
decoded.Extents = new AACSLBAExtent[(AACSLBAExtsResponse.Length - 4) / 16];
|
||||
|
||||
@@ -476,8 +456,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static string PrettifyAACSLBAExtents(AACSLBAExtentsResponse? AACSLBAExtsResponse)
|
||||
{
|
||||
if(AACSLBAExtsResponse == null)
|
||||
return null;
|
||||
if(AACSLBAExtsResponse == null) return null;
|
||||
|
||||
AACSLBAExtentsResponse response = AACSLBAExtsResponse.Value;
|
||||
|
||||
@@ -485,16 +464,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
if(response.MaxLBAExtents == 0)
|
||||
{
|
||||
if(response.DataLength > 2)
|
||||
sb.AppendLine("Drive can store 256 LBA Extents");
|
||||
else
|
||||
sb.AppendLine("Drive cannot store LBA Extents");
|
||||
if(response.DataLength > 2) sb.AppendLine("Drive can store 256 LBA Extents");
|
||||
else sb.AppendLine("Drive cannot store LBA Extents");
|
||||
}
|
||||
else
|
||||
sb.AppendFormat("Drive can store {0} LBA Extents", response.MaxLBAExtents).AppendLine();
|
||||
else sb.AppendFormat("Drive can store {0} LBA Extents", response.MaxLBAExtents).AppendLine();
|
||||
|
||||
for(int i = 0; i < response.Extents.Length; i++)
|
||||
sb.AppendFormat("LBA Extent {0} starts at LBA {1} and goes for {2} sectors", i, response.Extents[i].StartLBA, response.Extents[i].LBACount);
|
||||
sb.AppendFormat("LBA Extent {0} starts at LBA {1} and goes for {2} sectors", i,
|
||||
response.Extents[i].StartLBA, response.Extents[i].LBACount);
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
@@ -505,5 +482,4 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
return PrettifyAACSLBAExtents(decoded);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -78,8 +78,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static CPRMMediaKeyBlock? DecodeCPRMMediaKeyBlock(byte[] CPRMMKBResponse)
|
||||
{
|
||||
if(CPRMMKBResponse == null)
|
||||
return null;
|
||||
if(CPRMMKBResponse == null) return null;
|
||||
|
||||
CPRMMediaKeyBlock decoded = new CPRMMediaKeyBlock();
|
||||
|
||||
@@ -97,18 +96,17 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static string PrettifyCPRMMediaKeyBlock(CPRMMediaKeyBlock? CPRMMKBResponse)
|
||||
{
|
||||
if(CPRMMKBResponse == null)
|
||||
return null;
|
||||
if(CPRMMKBResponse == null) return null;
|
||||
|
||||
CPRMMediaKeyBlock response = CPRMMKBResponse.Value;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
#if DEBUG
|
||||
if(response.Reserved != 0)
|
||||
sb.AppendFormat("Reserved = 0x{0:X2}", response.Reserved).AppendLine();
|
||||
if(response.Reserved != 0) sb.AppendFormat("Reserved = 0x{0:X2}", response.Reserved).AppendLine();
|
||||
#endif
|
||||
sb.AppendFormat("Total number of CPRM Media Key Blocks available to transfer: {0}", response.TotalPacks).AppendLine();
|
||||
sb.AppendFormat("Total number of CPRM Media Key Blocks available to transfer: {0}", response.TotalPacks)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("CPRM Media Key Blocks in hex follows:");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MKBPackData, 80));
|
||||
|
||||
@@ -121,5 +119,4 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
return PrettifyCPRMMediaKeyBlock(decoded);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -275,17 +275,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static StandardDiscInformation? Decode000b(byte[] response)
|
||||
{
|
||||
if(response.Length < 34)
|
||||
return null;
|
||||
if(response.Length < 34) return null;
|
||||
|
||||
if((response[2] & 0xE0) != 0)
|
||||
return null;
|
||||
if((response[2] & 0xE0) != 0) return null;
|
||||
|
||||
StandardDiscInformation decoded = new StandardDiscInformation();
|
||||
decoded.DataLength = (ushort)((response[0] << 8) + response[1]);
|
||||
|
||||
if((decoded.DataLength + 2) != response.Length)
|
||||
return null;
|
||||
if((decoded.DataLength + 2) != response.Length) return null;
|
||||
|
||||
decoded.DataType = (byte)((response[2] & 0xE0) >> 5);
|
||||
decoded.Erasable |= (response[2] & 0x10) == 0x10;
|
||||
@@ -304,12 +301,12 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
decoded.Dbit |= (response[7] & 0x04) == 0x04;
|
||||
decoded.BGFormatStatus = (byte)(response[7] & 0x03);
|
||||
|
||||
decoded.DiscIdentification = (uint)((response[12] << 24) + (response[13] << 16) +
|
||||
(response[14] << 8) + response[15]);
|
||||
decoded.LastSessionLeadInStartLBA = (uint)((response[16] << 24) + (response[17] << 16) +
|
||||
(response[18] << 8) + response[19]);
|
||||
decoded.LastPossibleLeadOutStartLBA = (uint)((response[20] << 24) + (response[21] << 16) +
|
||||
(response[22] << 8) + response[23]);
|
||||
decoded.DiscIdentification =
|
||||
(uint)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]);
|
||||
decoded.LastSessionLeadInStartLBA =
|
||||
(uint)((response[16] << 24) + (response[17] << 16) + (response[18] << 8) + response[19]);
|
||||
decoded.LastPossibleLeadOutStartLBA =
|
||||
(uint)((response[20] << 24) + (response[21] << 16) + (response[22] << 8) + response[23]);
|
||||
|
||||
byte[] temp = new byte[8];
|
||||
Array.Copy(response, 24, temp, 0, 8);
|
||||
@@ -335,13 +332,11 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static string Prettify000b(StandardDiscInformation? information)
|
||||
{
|
||||
if(!information.HasValue)
|
||||
return null;
|
||||
if(!information.HasValue) return null;
|
||||
|
||||
StandardDiscInformation decoded = information.Value;
|
||||
|
||||
if(decoded.DataType != 0)
|
||||
return null;
|
||||
if(decoded.DataType != 0) return null;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
@@ -377,8 +372,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
break;
|
||||
}
|
||||
|
||||
if(decoded.Erasable)
|
||||
sb.AppendLine("Disc is erasable");
|
||||
if(decoded.Erasable) sb.AppendLine("Disc is erasable");
|
||||
|
||||
switch(decoded.LastSessionStatus)
|
||||
{
|
||||
@@ -409,41 +403,35 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
break;
|
||||
}
|
||||
|
||||
if(decoded.Dbit)
|
||||
sb.AppendLine("MRW is dirty");
|
||||
if(decoded.Dbit) sb.AppendLine("MRW is dirty");
|
||||
|
||||
sb.AppendFormat("First track on disc is track {0}", decoded.FirstTrackNumber).AppendLine();
|
||||
sb.AppendFormat("Disc has {0} sessions", decoded.Sessions).AppendLine();
|
||||
sb.AppendFormat("First track in last session is track {0}", decoded.FirstTrackLastSession).AppendLine();
|
||||
sb.AppendFormat("Last track in last session is track {0}", decoded.LastTrackLastSession).AppendLine();
|
||||
sb.AppendFormat("Last session Lead-In address is {0} (as LBA) or {1:X2}:{2:X2}:{3:X2}", decoded.LastSessionLeadInStartLBA,
|
||||
(decoded.LastSessionLeadInStartLBA & 0xFF0000) >> 16,
|
||||
(decoded.LastSessionLeadInStartLBA & 0xFF00) >> 8,
|
||||
(decoded.LastSessionLeadInStartLBA & 0xFF)).AppendLine();
|
||||
sb.AppendFormat("Last possible Lead-Out address is {0} (as LBA) or {1:X2}:{2:X2}:{3:X2}", decoded.LastPossibleLeadOutStartLBA,
|
||||
(decoded.LastPossibleLeadOutStartLBA & 0xFF0000) >> 16,
|
||||
(decoded.LastPossibleLeadOutStartLBA & 0xFF00) >> 8,
|
||||
(decoded.LastPossibleLeadOutStartLBA & 0xFF)).AppendLine();
|
||||
sb.AppendFormat("Last session Lead-In address is {0} (as LBA) or {1:X2}:{2:X2}:{3:X2}",
|
||||
decoded.LastSessionLeadInStartLBA, (decoded.LastSessionLeadInStartLBA & 0xFF0000) >> 16,
|
||||
(decoded.LastSessionLeadInStartLBA & 0xFF00) >> 8,
|
||||
(decoded.LastSessionLeadInStartLBA & 0xFF)).AppendLine();
|
||||
sb.AppendFormat("Last possible Lead-Out address is {0} (as LBA) or {1:X2}:{2:X2}:{3:X2}",
|
||||
decoded.LastPossibleLeadOutStartLBA, (decoded.LastPossibleLeadOutStartLBA & 0xFF0000) >> 16,
|
||||
(decoded.LastPossibleLeadOutStartLBA & 0xFF00) >> 8,
|
||||
(decoded.LastPossibleLeadOutStartLBA & 0xFF)).AppendLine();
|
||||
|
||||
if(decoded.URU)
|
||||
sb.AppendLine("Disc is defined for unrestricted use");
|
||||
else
|
||||
sb.AppendLine("Disc is defined for restricted use");
|
||||
if(decoded.URU) sb.AppendLine("Disc is defined for unrestricted use");
|
||||
else sb.AppendLine("Disc is defined for restricted use");
|
||||
|
||||
if(decoded.DID_V)
|
||||
sb.AppendFormat("Disc ID: {0:X6}", decoded.DiscIdentification & 0x00FFFFFF).AppendLine();
|
||||
if(decoded.DBC_V)
|
||||
sb.AppendFormat("Disc barcode: {0:X16}", decoded.DiscBarcode).AppendLine();
|
||||
if(decoded.DAC_V)
|
||||
sb.AppendFormat("Disc application code: {0}", decoded.DiscApplicationCode).AppendLine();
|
||||
if(decoded.DID_V) sb.AppendFormat("Disc ID: {0:X6}", decoded.DiscIdentification & 0x00FFFFFF).AppendLine();
|
||||
if(decoded.DBC_V) sb.AppendFormat("Disc barcode: {0:X16}", decoded.DiscBarcode).AppendLine();
|
||||
if(decoded.DAC_V) sb.AppendFormat("Disc application code: {0}", decoded.DiscApplicationCode).AppendLine();
|
||||
|
||||
if(decoded.OPCTables != null)
|
||||
{
|
||||
foreach(OPCTable table in decoded.OPCTables)
|
||||
{
|
||||
sb.AppendFormat("OPC values for {0}Kbit/sec.: {1}, {2}, {3}, {4}, {5}, {6}", table.Speed,
|
||||
table.OPCValues[0], table.OPCValues[1], table.OPCValues[2],
|
||||
table.OPCValues[3], table.OPCValues[4], table.OPCValues[5]).AppendLine();
|
||||
table.OPCValues[0], table.OPCValues[1], table.OPCValues[2], table.OPCValues[3],
|
||||
table.OPCValues[4], table.OPCValues[5]).AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,17 +440,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static TrackResourcesInformation? Decode001b(byte[] response)
|
||||
{
|
||||
if(response.Length != 12)
|
||||
return null;
|
||||
if(response.Length != 12) return null;
|
||||
|
||||
if((response[2] & 0xE0) != 0x20)
|
||||
return null;
|
||||
if((response[2] & 0xE0) != 0x20) return null;
|
||||
|
||||
TrackResourcesInformation decoded = new TrackResourcesInformation();
|
||||
decoded.DataLength = (ushort)((response[0] << 8) + response[1]);
|
||||
|
||||
if((decoded.DataLength + 2) != response.Length)
|
||||
return null;
|
||||
if((decoded.DataLength + 2) != response.Length) return null;
|
||||
|
||||
decoded.DataType = (byte)((response[2] & 0xE0) >> 5);
|
||||
decoded.MaxTracks = (ushort)((response[4] << 8) + response[5]);
|
||||
@@ -475,19 +460,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static string Prettify001b(TrackResourcesInformation? information)
|
||||
{
|
||||
if(!information.HasValue)
|
||||
return null;
|
||||
if(!information.HasValue) return null;
|
||||
|
||||
TrackResourcesInformation decoded = information.Value;
|
||||
|
||||
if(decoded.DataType != 1)
|
||||
return null;
|
||||
if(decoded.DataType != 1) return null;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendFormat("{0} maximum possible tracks on the disc", decoded.MaxTracks).AppendLine();
|
||||
sb.AppendFormat("{0} assigned tracks on the disc", decoded.AssignedTracks).AppendLine();
|
||||
sb.AppendFormat("{0} maximum possible appendable tracks on the disc", decoded.AppendableTracks).AppendLine();
|
||||
sb.AppendFormat("{0} maximum possible appendable tracks on the disc", decoded.AppendableTracks)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("{0} current appendable tracks on the disc", decoded.MaxAppendableTracks).AppendLine();
|
||||
|
||||
return sb.ToString();
|
||||
@@ -495,40 +479,39 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static POWResourcesInformation? Decode010b(byte[] response)
|
||||
{
|
||||
if(response.Length != 16)
|
||||
return null;
|
||||
if(response.Length != 16) return null;
|
||||
|
||||
if((response[2] & 0xE0) != 0x40)
|
||||
return null;
|
||||
if((response[2] & 0xE0) != 0x40) return null;
|
||||
|
||||
POWResourcesInformation decoded = new POWResourcesInformation();
|
||||
decoded.DataLength = (ushort)((response[0] << 8) + response[1]);
|
||||
|
||||
if((decoded.DataLength + 2) != response.Length)
|
||||
return null;
|
||||
if((decoded.DataLength + 2) != response.Length) return null;
|
||||
|
||||
decoded.DataType = (byte)((response[2] & 0xE0) >> 5);
|
||||
decoded.RemainingPOWReplacements = (ushort)((response[4] << 24) + (response[5] << 16) + (response[6] << 8) + response[7]);
|
||||
decoded.RemainingPOWReallocation = (ushort)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]);
|
||||
decoded.RemainingPOWUpdates = (ushort)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]);
|
||||
decoded.RemainingPOWReplacements =
|
||||
(ushort)((response[4] << 24) + (response[5] << 16) + (response[6] << 8) + response[7]);
|
||||
decoded.RemainingPOWReallocation =
|
||||
(ushort)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]);
|
||||
decoded.RemainingPOWUpdates =
|
||||
(ushort)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]);
|
||||
|
||||
return decoded;
|
||||
}
|
||||
|
||||
public static string Prettify010b(POWResourcesInformation? information)
|
||||
{
|
||||
if(!information.HasValue)
|
||||
return null;
|
||||
if(!information.HasValue) return null;
|
||||
|
||||
POWResourcesInformation decoded = information.Value;
|
||||
|
||||
if(decoded.DataType != 1)
|
||||
return null;
|
||||
if(decoded.DataType != 1) return null;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendFormat("{0} remaining POW replacements", decoded.RemainingPOWReplacements).AppendLine();
|
||||
sb.AppendFormat("{0} remaining POW reallocation map entries", decoded.RemainingPOWReallocation).AppendLine();
|
||||
sb.AppendFormat("{0} remaining POW reallocation map entries", decoded.RemainingPOWReallocation)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("{0} remaining POW updates", decoded.RemainingPOWUpdates).AppendLine();
|
||||
|
||||
return sb.ToString();
|
||||
@@ -536,24 +519,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static string Prettify(byte[] response)
|
||||
{
|
||||
if(response == null)
|
||||
return null;
|
||||
if(response == null) return null;
|
||||
|
||||
if(response.Length < 12)
|
||||
return null;
|
||||
if(response.Length < 12) return null;
|
||||
|
||||
switch(response[2] & 0xE0)
|
||||
{
|
||||
case 0x00:
|
||||
return Prettify000b(Decode000b(response));
|
||||
case 0x20:
|
||||
return Prettify001b(Decode001b(response));
|
||||
case 0x40:
|
||||
return Prettify010b(Decode010b(response));
|
||||
case 0x00: return Prettify000b(Decode000b(response));
|
||||
case 0x20: return Prettify001b(Decode001b(response));
|
||||
case 0x40: return Prettify010b(Decode010b(response));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -74,5 +74,4 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
CDROMXA = 0x20,
|
||||
Undefined = 0xFF
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -103,11 +103,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static RecognizedFormatLayers? DecodeFormatLayers(byte[] FormatLayersResponse)
|
||||
{
|
||||
if(FormatLayersResponse == null)
|
||||
return null;
|
||||
if(FormatLayersResponse == null) return null;
|
||||
|
||||
if(FormatLayersResponse.Length < 8)
|
||||
return null;
|
||||
if(FormatLayersResponse.Length < 8) return null;
|
||||
|
||||
RecognizedFormatLayers decoded = new RecognizedFormatLayers();
|
||||
|
||||
@@ -134,8 +132,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static string PrettifyFormatLayers(RecognizedFormatLayers? FormatLayersResponse)
|
||||
{
|
||||
if(FormatLayersResponse == null)
|
||||
return null;
|
||||
if(FormatLayersResponse == null) return null;
|
||||
|
||||
RecognizedFormatLayers response = FormatLayersResponse.Value;
|
||||
|
||||
@@ -148,50 +145,41 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
switch(response.FormatLayers[i])
|
||||
{
|
||||
case (ushort)FormatLayerTypeCodes.BDLayer:
|
||||
{
|
||||
sb.AppendFormat("Layer {0} is of type Blu-ray", i).AppendLine();
|
||||
if(response.DefaultFormatLayer == i)
|
||||
sb.AppendLine("This is the default layer.");
|
||||
if(response.OnlineFormatLayer == i)
|
||||
sb.AppendLine("This is the layer actually in use.");
|
||||
break;
|
||||
}
|
||||
{
|
||||
sb.AppendFormat("Layer {0} is of type Blu-ray", i).AppendLine();
|
||||
if(response.DefaultFormatLayer == i) sb.AppendLine("This is the default layer.");
|
||||
if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use.");
|
||||
break;
|
||||
}
|
||||
case (ushort)FormatLayerTypeCodes.CDLayer:
|
||||
{
|
||||
sb.AppendFormat("Layer {0} is of type CD", i).AppendLine();
|
||||
if(response.DefaultFormatLayer == i)
|
||||
sb.AppendLine("This is the default layer.");
|
||||
if(response.OnlineFormatLayer == i)
|
||||
sb.AppendLine("This is the layer actually in use.");
|
||||
break;
|
||||
}
|
||||
{
|
||||
sb.AppendFormat("Layer {0} is of type CD", i).AppendLine();
|
||||
if(response.DefaultFormatLayer == i) sb.AppendLine("This is the default layer.");
|
||||
if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use.");
|
||||
break;
|
||||
}
|
||||
case (ushort)FormatLayerTypeCodes.DVDLayer:
|
||||
{
|
||||
sb.AppendFormat("Layer {0} is of type DVD", i).AppendLine();
|
||||
if(response.DefaultFormatLayer == i)
|
||||
sb.AppendLine("This is the default layer.");
|
||||
if(response.OnlineFormatLayer == i)
|
||||
sb.AppendLine("This is the layer actually in use.");
|
||||
break;
|
||||
}
|
||||
{
|
||||
sb.AppendFormat("Layer {0} is of type DVD", i).AppendLine();
|
||||
if(response.DefaultFormatLayer == i) sb.AppendLine("This is the default layer.");
|
||||
if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use.");
|
||||
break;
|
||||
}
|
||||
case (ushort)FormatLayerTypeCodes.HDDVDLayer:
|
||||
{
|
||||
sb.AppendFormat("Layer {0} is of type HD DVD", i).AppendLine();
|
||||
if(response.DefaultFormatLayer == i)
|
||||
sb.AppendLine("This is the default layer.");
|
||||
if(response.OnlineFormatLayer == i)
|
||||
sb.AppendLine("This is the layer actually in use.");
|
||||
break;
|
||||
}
|
||||
{
|
||||
sb.AppendFormat("Layer {0} is of type HD DVD", i).AppendLine();
|
||||
if(response.DefaultFormatLayer == i) sb.AppendLine("This is the default layer.");
|
||||
if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use.");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
sb.AppendFormat("Layer {0} is of unknown type 0x{1:X4}", i, response.FormatLayers[i]).AppendLine();
|
||||
if(response.DefaultFormatLayer == i)
|
||||
sb.AppendLine("This is the default layer.");
|
||||
if(response.OnlineFormatLayer == i)
|
||||
sb.AppendLine("This is the layer actually in use.");
|
||||
break;
|
||||
}
|
||||
{
|
||||
sb.AppendFormat("Layer {0} is of unknown type 0x{1:X4}", i, response.FormatLayers[i])
|
||||
.AppendLine();
|
||||
if(response.DefaultFormatLayer == i) sb.AppendLine("This is the default layer.");
|
||||
if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,5 +192,4 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
return PrettifyFormatLayers(decoded);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -113,8 +113,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static WriteProtectionStatus? DecodeWriteProtectionStatus(byte[] WPSResponse)
|
||||
{
|
||||
if(WPSResponse == null)
|
||||
return null;
|
||||
if(WPSResponse == null) return null;
|
||||
|
||||
WriteProtectionStatus decoded = new WriteProtectionStatus();
|
||||
|
||||
@@ -137,35 +136,24 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
|
||||
public static string PrettifyWriteProtectionStatus(WriteProtectionStatus? WPSResponse)
|
||||
{
|
||||
if(WPSResponse == null)
|
||||
return null;
|
||||
if(WPSResponse == null) return null;
|
||||
|
||||
WriteProtectionStatus response = WPSResponse.Value;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if(response.MSWI)
|
||||
sb.AppendLine("Writing inhibited by media specific reason");
|
||||
if(response.CWP)
|
||||
sb.AppendLine("Cartridge sets write protection");
|
||||
if(response.PWP)
|
||||
sb.AppendLine("Media surface sets write protection");
|
||||
if(response.SWPP)
|
||||
sb.AppendLine("Software write protection is set until power down");
|
||||
if(response.MSWI) sb.AppendLine("Writing inhibited by media specific reason");
|
||||
if(response.CWP) sb.AppendLine("Cartridge sets write protection");
|
||||
if(response.PWP) sb.AppendLine("Media surface sets write protection");
|
||||
if(response.SWPP) sb.AppendLine("Software write protection is set until power down");
|
||||
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
if(response.Reserved3 != 0)
|
||||
sb.AppendFormat("Reserved3 = 0x{0:X2}", response.Reserved3).AppendLine();
|
||||
if(response.Reserved4 != 0)
|
||||
sb.AppendFormat("Reserved4 = 0x{0:X2}", response.Reserved4).AppendLine();
|
||||
if(response.Reserved5 != 0)
|
||||
sb.AppendFormat("Reserved5 = 0x{0:X2}", response.Reserved5).AppendLine();
|
||||
if(response.Reserved6 != 0)
|
||||
sb.AppendFormat("Reserved6 = 0x{0:X2}", response.Reserved6).AppendLine();
|
||||
if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
if(response.Reserved3 != 0) sb.AppendFormat("Reserved3 = 0x{0:X2}", response.Reserved3).AppendLine();
|
||||
if(response.Reserved4 != 0) sb.AppendFormat("Reserved4 = 0x{0:X2}", response.Reserved4).AppendLine();
|
||||
if(response.Reserved5 != 0) sb.AppendFormat("Reserved5 = 0x{0:X2}", response.Reserved5).AppendLine();
|
||||
if(response.Reserved6 != 0) sb.AppendFormat("Reserved6 = 0x{0:X2}", response.Reserved6).AppendLine();
|
||||
#endif
|
||||
|
||||
return sb.ToString();
|
||||
@@ -177,5 +165,4 @@ namespace DiscImageChef.Decoders.SCSI.MMC
|
||||
return PrettifyWriteProtectionStatus(decoded);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -40,40 +40,31 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
{
|
||||
byte[] hdr;
|
||||
|
||||
if(header.BlockDescriptors != null)
|
||||
hdr = new byte[4 + header.BlockDescriptors.Length * 8];
|
||||
else
|
||||
hdr = new byte[4];
|
||||
if(header.BlockDescriptors != null) hdr = new byte[4 + header.BlockDescriptors.Length * 8];
|
||||
else hdr = new byte[4];
|
||||
|
||||
hdr[1] = (byte)header.MediumType;
|
||||
|
||||
if(deviceType == PeripheralDeviceTypes.DirectAccess || deviceType == PeripheralDeviceTypes.MultiMediaDevice)
|
||||
{
|
||||
if(header.WriteProtected)
|
||||
hdr[2] += 0x80;
|
||||
if(header.DPOFUA)
|
||||
hdr[2] += 0x10;
|
||||
if(header.WriteProtected) hdr[2] += 0x80;
|
||||
if(header.DPOFUA) hdr[2] += 0x10;
|
||||
}
|
||||
|
||||
if(deviceType == PeripheralDeviceTypes.SequentialAccess)
|
||||
{
|
||||
if(header.WriteProtected)
|
||||
hdr[2] += 0x80;
|
||||
if(header.WriteProtected) hdr[2] += 0x80;
|
||||
hdr[2] += (byte)(header.Speed & 0x0F);
|
||||
hdr[2] += (byte)((header.BufferedMode << 4) & 0x70);
|
||||
}
|
||||
|
||||
if(deviceType == PeripheralDeviceTypes.PrinterDevice)
|
||||
hdr[2] += (byte)((header.BufferedMode << 4) & 0x70);
|
||||
if(deviceType == PeripheralDeviceTypes.PrinterDevice) hdr[2] += (byte)((header.BufferedMode << 4) & 0x70);
|
||||
|
||||
if(deviceType == PeripheralDeviceTypes.OpticalDevice)
|
||||
{
|
||||
if(header.WriteProtected)
|
||||
hdr[2] += 0x80;
|
||||
if(header.EBC)
|
||||
hdr[2] += 0x01;
|
||||
if(header.DPOFUA)
|
||||
hdr[2] += 0x10;
|
||||
if(header.WriteProtected) hdr[2] += 0x80;
|
||||
if(header.EBC) hdr[2] += 0x01;
|
||||
if(header.DPOFUA) hdr[2] += 0x10;
|
||||
}
|
||||
|
||||
if(header.BlockDescriptors != null)
|
||||
@@ -98,11 +89,7 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
public static byte[] EncodeMode6(DecodedMode mode, PeripheralDeviceTypes deviceType)
|
||||
{
|
||||
int modeSize = 0;
|
||||
if(mode.Pages != null)
|
||||
{
|
||||
foreach(ModePage page in mode.Pages)
|
||||
modeSize += page.PageResponse.Length;
|
||||
}
|
||||
if(mode.Pages != null) { foreach(ModePage page in mode.Pages) modeSize += page.PageResponse.Length; }
|
||||
|
||||
byte[] hdr = EncodeModeHeader6(mode.Header, deviceType);
|
||||
modeSize += hdr.Length;
|
||||
@@ -123,15 +110,10 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
return md;
|
||||
}
|
||||
|
||||
|
||||
public static byte[] EncodeMode10(DecodedMode mode, PeripheralDeviceTypes deviceType)
|
||||
{
|
||||
int modeSize = 0;
|
||||
if(mode.Pages != null)
|
||||
{
|
||||
foreach(ModePage page in mode.Pages)
|
||||
modeSize += page.PageResponse.Length;
|
||||
}
|
||||
if(mode.Pages != null) { foreach(ModePage page in mode.Pages) modeSize += page.PageResponse.Length; }
|
||||
|
||||
byte[] hdr = EncodeModeHeader10(mode.Header, deviceType);
|
||||
modeSize += hdr.Length;
|
||||
@@ -163,47 +145,36 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
if(header.BlockDescriptors != null)
|
||||
{
|
||||
if(longLBA)
|
||||
hdr = new byte[8 + header.BlockDescriptors.Length * 16];
|
||||
else
|
||||
hdr = new byte[8 + header.BlockDescriptors.Length * 8];
|
||||
if(longLBA) hdr = new byte[8 + header.BlockDescriptors.Length * 16];
|
||||
else hdr = new byte[8 + header.BlockDescriptors.Length * 8];
|
||||
}
|
||||
else
|
||||
hdr = new byte[8];
|
||||
else hdr = new byte[8];
|
||||
|
||||
hdr[2] = (byte)header.MediumType;
|
||||
|
||||
if(deviceType == PeripheralDeviceTypes.DirectAccess || deviceType == PeripheralDeviceTypes.MultiMediaDevice)
|
||||
{
|
||||
if(header.WriteProtected)
|
||||
hdr[3] += 0x80;
|
||||
if(header.DPOFUA)
|
||||
hdr[3] += 0x10;
|
||||
if(header.WriteProtected) hdr[3] += 0x80;
|
||||
if(header.DPOFUA) hdr[3] += 0x10;
|
||||
}
|
||||
|
||||
if(deviceType == PeripheralDeviceTypes.SequentialAccess)
|
||||
{
|
||||
if(header.WriteProtected)
|
||||
hdr[3] += 0x80;
|
||||
if(header.WriteProtected) hdr[3] += 0x80;
|
||||
hdr[3] += (byte)(header.Speed & 0x0F);
|
||||
hdr[3] += (byte)((header.BufferedMode << 4) & 0x70);
|
||||
}
|
||||
|
||||
if(deviceType == PeripheralDeviceTypes.PrinterDevice)
|
||||
hdr[3] += (byte)((header.BufferedMode << 4) & 0x70);
|
||||
if(deviceType == PeripheralDeviceTypes.PrinterDevice) hdr[3] += (byte)((header.BufferedMode << 4) & 0x70);
|
||||
|
||||
if(deviceType == PeripheralDeviceTypes.OpticalDevice)
|
||||
{
|
||||
if(header.WriteProtected)
|
||||
hdr[3] += 0x80;
|
||||
if(header.EBC)
|
||||
hdr[3] += 0x01;
|
||||
if(header.DPOFUA)
|
||||
hdr[3] += 0x10;
|
||||
if(header.WriteProtected) hdr[3] += 0x80;
|
||||
if(header.EBC) hdr[3] += 0x01;
|
||||
if(header.DPOFUA) hdr[3] += 0x10;
|
||||
}
|
||||
|
||||
if(longLBA)
|
||||
hdr[4] += 0x01;
|
||||
if(longLBA) hdr[4] += 0x01;
|
||||
|
||||
if(header.BlockDescriptors != null)
|
||||
{
|
||||
@@ -232,8 +203,7 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
{
|
||||
if(deviceType != PeripheralDeviceTypes.DirectAccess)
|
||||
hdr[0 + i * 8 + 8] = (byte)header.BlockDescriptors[i].Density;
|
||||
else
|
||||
hdr[0 + i * 8 + 8] = (byte)((header.BlockDescriptors[i].Blocks & 0xFF000000) >> 24);
|
||||
else hdr[0 + i * 8 + 8] = (byte)((header.BlockDescriptors[i].Blocks & 0xFF000000) >> 24);
|
||||
hdr[1 + i * 8 + 8] = (byte)((header.BlockDescriptors[i].Blocks & 0xFF0000) >> 16);
|
||||
hdr[2 + i * 8 + 8] = (byte)((header.BlockDescriptors[i].Blocks & 0xFF00) >> 8);
|
||||
hdr[3 + i * 8 + 8] = (byte)(header.BlockDescriptors[i].Blocks & 0xFF);
|
||||
@@ -254,24 +224,15 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
pg[0] = 0x01;
|
||||
pg[1] = 6;
|
||||
|
||||
if(page.PS)
|
||||
pg[0] += 0x80;
|
||||
if(page.AWRE)
|
||||
pg[2] += 0x80;
|
||||
if(page.ARRE)
|
||||
pg[2] += 0x40;
|
||||
if(page.TB)
|
||||
pg[2] += 0x20;
|
||||
if(page.RC)
|
||||
pg[2] += 0x10;
|
||||
if(page.EER)
|
||||
pg[2] += 0x08;
|
||||
if(page.PER)
|
||||
pg[2] += 0x04;
|
||||
if(page.DTE)
|
||||
pg[2] += 0x02;
|
||||
if(page.DCR)
|
||||
pg[2] += 0x01;
|
||||
if(page.PS) pg[0] += 0x80;
|
||||
if(page.AWRE) pg[2] += 0x80;
|
||||
if(page.ARRE) pg[2] += 0x40;
|
||||
if(page.TB) pg[2] += 0x20;
|
||||
if(page.RC) pg[2] += 0x10;
|
||||
if(page.EER) pg[2] += 0x08;
|
||||
if(page.PER) pg[2] += 0x04;
|
||||
if(page.DTE) pg[2] += 0x02;
|
||||
if(page.DCR) pg[2] += 0x01;
|
||||
|
||||
pg[3] = page.ReadRetryCount;
|
||||
pg[4] = page.CorrectionSpan;
|
||||
@@ -296,8 +257,7 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
pg[0] = 0x01;
|
||||
pg[1] = 10;
|
||||
|
||||
if(page.PS)
|
||||
pg[0] += 0x80;
|
||||
if(page.PS) pg[0] += 0x80;
|
||||
pg[2] = page.Parameter;
|
||||
pg[3] = page.ReadRetryCount;
|
||||
|
||||
@@ -310,5 +270,4 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
return pg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -55,11 +55,9 @@ namespace DiscImageChef.Decoders.SCSI.SSC
|
||||
|
||||
public static BlockLimitsData? Decode(byte[] response)
|
||||
{
|
||||
if(response == null)
|
||||
return null;
|
||||
if(response == null) return null;
|
||||
|
||||
if(response.Length != 6)
|
||||
return null;
|
||||
if(response.Length != 6) return null;
|
||||
|
||||
BlockLimitsData dec = new BlockLimitsData();
|
||||
|
||||
@@ -72,8 +70,7 @@ namespace DiscImageChef.Decoders.SCSI.SSC
|
||||
|
||||
public static string Prettify(BlockLimitsData? decoded)
|
||||
{
|
||||
if(decoded == null)
|
||||
return null;
|
||||
if(decoded == null) return null;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
@@ -83,13 +80,14 @@ namespace DiscImageChef.Decoders.SCSI.SSC
|
||||
{
|
||||
if(decoded.Value.maxBlockLen > 0)
|
||||
sb.AppendFormat("Device's maximum block size is {0} bytes", decoded.Value.maxBlockLen).AppendLine();
|
||||
else
|
||||
sb.AppendLine("Device does not specify a maximum block size");
|
||||
else sb.AppendLine("Device does not specify a maximum block size");
|
||||
sb.AppendFormat("Device's minimum block size is {0} bytes", decoded.Value.minBlockLen).AppendLine();
|
||||
|
||||
if(decoded.Value.granularity > 0)
|
||||
#pragma warning disable IDE0004 // Remove Unnecessary Cast
|
||||
sb.AppendFormat("Device's needs a block size granularity of 2^{0} ({1}) bytes", decoded.Value.granularity, Math.Pow(2, (double)decoded.Value.granularity)).AppendLine();
|
||||
sb.AppendFormat("Device's needs a block size granularity of 2^{0} ({1}) bytes",
|
||||
decoded.Value.granularity, Math.Pow(2, (double)decoded.Value.granularity))
|
||||
.AppendLine();
|
||||
#pragma warning restore IDE0004 // Remove Unnecessary Cast
|
||||
}
|
||||
|
||||
@@ -101,5 +99,4 @@ namespace DiscImageChef.Decoders.SCSI.SSC
|
||||
return Prettify(Decode(response));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -89,16 +89,13 @@ namespace DiscImageChef.Decoders.SCSI.SSC
|
||||
|
||||
public static DensitySupportHeader? DecodeDensity(byte[] response)
|
||||
{
|
||||
if(response == null)
|
||||
return null;
|
||||
if(response == null) return null;
|
||||
|
||||
if(response.Length <= 56)
|
||||
return null;
|
||||
if(response.Length <= 56) return null;
|
||||
|
||||
ushort responseLen = (ushort)((response[0] << 8) + response[1] + 2);
|
||||
|
||||
if(response.Length != responseLen)
|
||||
return null;
|
||||
if(response.Length != responseLen) return null;
|
||||
|
||||
List<DensitySupportDescriptor> descriptors = new List<DensitySupportDescriptor>();
|
||||
int offset = 4;
|
||||
@@ -115,10 +112,12 @@ namespace DiscImageChef.Decoders.SCSI.SSC
|
||||
descriptor.reserved = (byte)((response[offset + 2] & 0x1E) >> 1);
|
||||
descriptor.lenvalid |= (response[offset + 2] & 0x01) == 0x01;
|
||||
descriptor.len = (ushort)((response[offset + 3] << 8) + response[offset + 4]);
|
||||
descriptor.bpmm = (uint)((response[offset + 5] << 16) + (response[offset + 6] << 8) + response[offset + 7]);
|
||||
descriptor.bpmm =
|
||||
(uint)((response[offset + 5] << 16) + (response[offset + 6] << 8) + response[offset + 7]);
|
||||
descriptor.width = (ushort)((response[offset + 8] << 8) + response[offset + 9]);
|
||||
descriptor.tracks = (ushort)((response[offset + 10] << 8) + response[offset + 11]);
|
||||
descriptor.capacity = (uint)((response[offset + 12] << 24) + (response[offset + 13] << 16) + (response[offset + 14] << 8) + response[offset + 15]);
|
||||
descriptor.capacity = (uint)((response[offset + 12] << 24) + (response[offset + 13] << 16) +
|
||||
(response[offset + 14] << 8) + response[offset + 15]);
|
||||
tmp = new byte[8];
|
||||
Array.Copy(response, offset + 16, tmp, 0, 8);
|
||||
descriptor.organization = StringHandlers.CToString(tmp).Trim();
|
||||
@@ -129,10 +128,8 @@ namespace DiscImageChef.Decoders.SCSI.SSC
|
||||
Array.Copy(response, offset + 32, tmp, 0, 20);
|
||||
descriptor.description = StringHandlers.CToString(tmp).Trim();
|
||||
|
||||
if(descriptor.lenvalid)
|
||||
offset += descriptor.len + 5;
|
||||
else
|
||||
offset += 52;
|
||||
if(descriptor.lenvalid) offset += descriptor.len + 5;
|
||||
else offset += 52;
|
||||
|
||||
descriptors.Add(descriptor);
|
||||
}
|
||||
@@ -147,27 +144,25 @@ namespace DiscImageChef.Decoders.SCSI.SSC
|
||||
|
||||
public static string PrettifyDensity(DensitySupportHeader? density)
|
||||
{
|
||||
if(density == null)
|
||||
return null;
|
||||
if(density == null) return null;
|
||||
|
||||
DensitySupportHeader decoded = density.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
foreach(DensitySupportDescriptor descriptor in decoded.descriptors)
|
||||
{
|
||||
sb.AppendFormat("Density \"{0}\" defined by \"{1}\".", descriptor.name, descriptor.organization).AppendLine();
|
||||
sb.AppendFormat("Density \"{0}\" defined by \"{1}\".", descriptor.name, descriptor.organization)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("\tPrimary code: {0:X2}h", descriptor.primaryCode).AppendLine();
|
||||
if(descriptor.primaryCode != descriptor.secondaryCode)
|
||||
sb.AppendFormat("\tSecondary code: {0:X2}h", descriptor.secondaryCode).AppendLine();
|
||||
if(descriptor.writable)
|
||||
sb.AppendLine("\tDrive can write this density");
|
||||
if(descriptor.duplicate)
|
||||
sb.AppendLine("\tThis descriptor is duplicated");
|
||||
if(descriptor.defaultDensity)
|
||||
sb.AppendLine("\tThis is the default density on the drive");
|
||||
if(descriptor.writable) sb.AppendLine("\tDrive can write this density");
|
||||
if(descriptor.duplicate) sb.AppendLine("\tThis descriptor is duplicated");
|
||||
if(descriptor.defaultDensity) sb.AppendLine("\tThis is the default density on the drive");
|
||||
sb.AppendFormat("\tDensity has {0} bits per mm, with {1} tracks in a {2} mm width tape",
|
||||
#pragma warning disable IDE0004 // Remove Unnecessary Cast
|
||||
descriptor.bpmm, descriptor.tracks, (double)((double)descriptor.width / (double)10)).AppendLine();
|
||||
descriptor.bpmm, descriptor.tracks, (double)((double)descriptor.width / (double)10))
|
||||
.AppendLine();
|
||||
#pragma warning restore IDE0004 // Remove Unnecessary Cast
|
||||
sb.AppendFormat("\tDensity maximum capacity is {0} megabytes", descriptor.capacity).AppendLine();
|
||||
sb.AppendFormat("\tDensity description: {0}", descriptor.description).AppendLine();
|
||||
@@ -184,16 +179,13 @@ namespace DiscImageChef.Decoders.SCSI.SSC
|
||||
|
||||
public static MediaTypeSupportHeader? DecodeMediumType(byte[] response)
|
||||
{
|
||||
if(response == null)
|
||||
return null;
|
||||
if(response == null) return null;
|
||||
|
||||
if(response.Length <= 60)
|
||||
return null;
|
||||
if(response.Length <= 60) return null;
|
||||
|
||||
ushort responseLen = (ushort)((response[0] << 8) + response[1] + 2);
|
||||
|
||||
if(response.Length != responseLen)
|
||||
return null;
|
||||
if(response.Length != responseLen) return null;
|
||||
|
||||
List<MediaTypeSupportDescriptor> descriptors = new List<MediaTypeSupportDescriptor>();
|
||||
int offset = 4;
|
||||
@@ -205,8 +197,8 @@ namespace DiscImageChef.Decoders.SCSI.SSC
|
||||
descriptor.mediumType = response[offset + 0];
|
||||
descriptor.reserved1 = response[offset + 1];
|
||||
descriptor.len = (ushort)((response[offset + 2] << 8) + response[offset + 3]);
|
||||
if(descriptor.len != 52)
|
||||
return null;
|
||||
if(descriptor.len != 52) return null;
|
||||
|
||||
descriptor.numberOfCodes = response[offset + 4];
|
||||
descriptor.densityCodes = new byte[9];
|
||||
Array.Copy(response, offset + 5, descriptor.densityCodes, 0, 9);
|
||||
@@ -239,27 +231,28 @@ namespace DiscImageChef.Decoders.SCSI.SSC
|
||||
|
||||
public static string PrettifyMediumType(MediaTypeSupportHeader? mediumType)
|
||||
{
|
||||
if(mediumType == null)
|
||||
return null;
|
||||
if(mediumType == null) return null;
|
||||
|
||||
MediaTypeSupportHeader decoded = mediumType.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
foreach(MediaTypeSupportDescriptor descriptor in decoded.descriptors)
|
||||
{
|
||||
sb.AppendFormat("Medium type \"{0}\" defined by \"{1}\".", descriptor.name, descriptor.organization).AppendLine();
|
||||
sb.AppendFormat("Medium type \"{0}\" defined by \"{1}\".", descriptor.name, descriptor.organization)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("\tMedium type code: {0:X2}h", descriptor.mediumType).AppendLine();
|
||||
if(descriptor.numberOfCodes > 0)
|
||||
{
|
||||
sb.AppendFormat("\tMedium supports following density codes:");
|
||||
for(int i = 0; i < descriptor.numberOfCodes; i++)
|
||||
sb.AppendFormat(" {0:X2}h", descriptor.densityCodes[i]);
|
||||
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
sb.AppendFormat("\tMedium has a nominal length of {0} m in a {1} mm width tape",
|
||||
#pragma warning disable IDE0004 // Remove Unnecessary Cast
|
||||
descriptor.length, (double)((double)descriptor.width / (double)10)).AppendLine();
|
||||
descriptor.length, (double)((double)descriptor.width / (double)10)).AppendLine();
|
||||
#pragma warning restore IDE0004 // Remove Unnecessary Cast
|
||||
sb.AppendFormat("\tMedium description: {0}", descriptor.description).AppendLine();
|
||||
sb.AppendLine();
|
||||
@@ -273,5 +266,4 @@ namespace DiscImageChef.Decoders.SCSI.SSC
|
||||
return PrettifyMediumType(DecodeMediumType(response));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -35,8 +35,8 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
public enum MediumTypes : byte
|
||||
{
|
||||
Default = 0x00,
|
||||
#region Medium Types defined in ECMA-111 for Direct-Access devices
|
||||
|
||||
#region Medium Types defined in ECMA-111 for Direct-Access devices
|
||||
/// <summary>
|
||||
/// ECMA-54: 200 mm Flexible Disk Cartridge using Two-Frequency Recording at 13262 ftprad on One Side
|
||||
/// </summary>
|
||||
@@ -72,7 +72,6 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
#endregion Medium Types defined in ECMA-111 for Direct-Access devices
|
||||
|
||||
#region Medium Types defined in SCSI-2 for Direct-Access devices
|
||||
|
||||
/// <summary>
|
||||
/// Unspecified single sided flexible disk
|
||||
/// </summary>
|
||||
@@ -104,7 +103,6 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
#endregion Medium Types defined in SCSI-2 for Direct-Access devices
|
||||
|
||||
#region Medium Types defined in SCSI-3 SBC-1 for Optical devices
|
||||
|
||||
/// <summary>
|
||||
/// Read-only medium
|
||||
/// </summary>
|
||||
@@ -132,7 +130,6 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
#endregion Medium Types defined in SCSI-3 SBC-1 for Optical devices
|
||||
|
||||
#region Medium Types defined in SCSI-2 for MultiMedia devices
|
||||
|
||||
/// <summary>
|
||||
/// 120 mm CD-ROM
|
||||
/// </summary>
|
||||
@@ -157,11 +154,9 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
/// 80 mm Compact Disc with data and audio
|
||||
/// </summary>
|
||||
MixedCD_80 = 0x07,
|
||||
|
||||
#endregion Medium Types defined in SCSI-2 for MultiMedia devices
|
||||
|
||||
#region Medium Types defined in SFF-8020i
|
||||
|
||||
/// <summary>
|
||||
/// Unknown medium type
|
||||
/// </summary>
|
||||
@@ -269,7 +264,6 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
#endregion Medium Types defined in SFF-8020i
|
||||
|
||||
#region Medium Types defined in USB Mass Storage Class - UFI Command Specification
|
||||
|
||||
/// <summary>
|
||||
/// 3.5-inch, 135 tpi, 12362 bits/radian, double-sided MFM (aka 1.25Mb)
|
||||
/// </summary>
|
||||
@@ -281,7 +275,6 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
#endregion Medium Types defined in USB Mass Storage Class - UFI Command Specification
|
||||
|
||||
#region Medium Types defined in INF-8070
|
||||
|
||||
/// <summary>
|
||||
/// Unknown type block device
|
||||
/// </summary>
|
||||
@@ -294,7 +287,6 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
/// Read/Write block device
|
||||
/// </summary>
|
||||
ReadWriteBlockDevice = 0x42,
|
||||
|
||||
#endregion Medium Types defined in INF-8070
|
||||
|
||||
#region Medium Types found in vendor documents
|
||||
@@ -590,16 +582,14 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
/// Exatape 75m
|
||||
/// </summary>
|
||||
Exatape75m = 0xD7,
|
||||
|
||||
|
||||
#endregion Medium Types found in vendor documents
|
||||
}
|
||||
|
||||
public enum DensityType : byte
|
||||
{
|
||||
Default = 0x00,
|
||||
#region Density Types defined in ECMA-111 for Direct-Access devices
|
||||
|
||||
#region Density Types defined in ECMA-111 for Direct-Access devices
|
||||
/// <summary>
|
||||
/// 7958 flux transitions per radian
|
||||
/// </summary>
|
||||
@@ -615,7 +605,6 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
#endregion Density Types defined in ECMA-111 for Direct-Access devices
|
||||
|
||||
#region Density Types defined in ECMA-111 for Sequential-Access devices
|
||||
|
||||
/// <summary>
|
||||
/// ECMA-62 & ANSI X3.22-1983: 12,7 mm 9-Track Magnetic Tape, 32 ftpmm, NRZI, 32 cpmm
|
||||
/// </summary>
|
||||
@@ -647,7 +636,6 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
#endregion Density Types defined in ECMA-111 for Sequential-Access devices
|
||||
|
||||
#region Density Types defined in SCSI-2 for Sequential-Access devices
|
||||
|
||||
/// <summary>
|
||||
/// ANXI X3.136-1986: 6,35 mm 4 or 9-Track Magnetic Tape Cartridge, 315 bpmm, GCR (QIC-24)
|
||||
/// </summary>
|
||||
@@ -711,7 +699,6 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
#endregion Density Types defined in SCSI-2 for Sequential-Access devices
|
||||
|
||||
#region Density Types defined in SCSI-2 for MultiMedia devices
|
||||
|
||||
/// <summary>
|
||||
/// User data only
|
||||
/// </summary>
|
||||
@@ -731,7 +718,6 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
#endregion Density Types defined in SCSI-2 for MultiMedia devices
|
||||
|
||||
#region Density Types defined in SCSI-2 for Optical devices
|
||||
|
||||
/// <summary>
|
||||
/// ISO/IEC 10090: 86 mm Read/Write single-sided optical disc with 12500 tracks
|
||||
/// </summary>
|
||||
@@ -768,7 +754,6 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
/// ANSI X3.200: 356 mm double-sided optical disc with 56350 tracks
|
||||
/// </summary>
|
||||
X3_200 = 0x09,
|
||||
|
||||
#endregion Density Types defined in SCSI-2 for Optical devices
|
||||
|
||||
#region Density Types found in vendor documents
|
||||
@@ -1044,8 +1029,6 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
/// VStape I compressed
|
||||
/// </summary>
|
||||
VStape1c = 0x99,
|
||||
|
||||
#endregion Density Types found in vendor documents
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user