Use device report version 2 for the database.

This commit is contained in:
2018-11-26 23:16:54 +00:00
parent 27d8b07ddd
commit e974d43805
3 changed files with 96 additions and 123 deletions

View File

@@ -43,7 +43,13 @@
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
<HintPath>..\..\..\.nuget\packages\newtonsoft.json\11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\..\..\.nuget\packages\system.componentmodel.annotations\4.5.0\ref\netstandard2.0\System.ComponentModel.Annotations.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="SCSI\Inquiry.cs" />

View File

@@ -172,10 +172,7 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
public static string PrettifyPage_81(byte[] pageResponse)
{
return PrettifyPage_81(DecodePage_81(pageResponse));
}
public static string PrettifyPage_81(byte[] pageResponse) => PrettifyPage_81(DecodePage_81(pageResponse));
public static string DefinitionToString(ScsiDefinitions definition)
{
@@ -430,10 +427,7 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
public static string PrettifyPage_83(byte[] pageResponse)
{
return PrettifyPage_83(DecodePage_83(pageResponse));
}
public static string PrettifyPage_83(byte[] pageResponse) => PrettifyPage_83(DecodePage_83(pageResponse));
public static string PrettifyPage_83(Page_83? modePage)
{
@@ -823,10 +817,7 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
public static string PrettifyPage_84(byte[] pageResponse)
{
return PrettifyPage_84(DecodePage_84(pageResponse));
}
public static string PrettifyPage_84(byte[] pageResponse) => PrettifyPage_84(DecodePage_84(pageResponse));
public static string PrettifyPage_84(Page_84? modePage)
{
@@ -955,10 +946,7 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
public static string PrettifyPage_85(byte[] pageResponse)
{
return PrettifyPage_85(DecodePage_85(pageResponse));
}
public static string PrettifyPage_85(byte[] pageResponse) => PrettifyPage_85(DecodePage_85(pageResponse));
public static string PrettifyPage_85(Page_85? modePage)
{
@@ -1216,10 +1204,7 @@ namespace DiscImageChef.Decoders.SCSI
};
}
public static string PrettifyPage_86(byte[] pageResponse)
{
return PrettifyPage_86(DecodePage_86(pageResponse));
}
public static string PrettifyPage_86(byte[] pageResponse) => PrettifyPage_86(DecodePage_86(pageResponse));
public static string PrettifyPage_86(Page_86? modePage)
{
@@ -1384,10 +1369,7 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
public static string PrettifyPage_89(byte[] pageResponse)
{
return PrettifyPage_89(DecodePage_89(pageResponse));
}
public static string PrettifyPage_89(byte[] pageResponse) => PrettifyPage_89(DecodePage_89(pageResponse));
// TODO: Decode ATA signature?
public static string PrettifyPage_89(Page_89? modePage)
@@ -1433,7 +1415,7 @@ namespace DiscImageChef.Decoders.SCSI
}
Identify.IdentifyDevice? id = Identify.Decode(page.IdentifyData);
if(id.HasValue)
if(id != null)
{
sb.AppendLine("\tATA IDENTIFY information follows:");
sb.AppendFormat("{0}", Identify.Prettify(id)).AppendLine();
@@ -1511,10 +1493,8 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
public static string PrettifyPage_C0_Quantum(byte[] pageResponse)
{
return PrettifyPage_C0_Quantum(DecodePage_C0_Quantum(pageResponse));
}
public static string PrettifyPage_C0_Quantum(byte[] pageResponse) =>
PrettifyPage_C0_Quantum(DecodePage_C0_Quantum(pageResponse));
public static string PrettifyPage_C0_Quantum(Page_C0_Quantum? modePage)
{
@@ -1593,10 +1573,8 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
public static string PrettifyPage_C0_C1_Certance(byte[] pageResponse)
{
return PrettifyPage_C0_C1_Certance(DecodePage_C0_C1_Certance(pageResponse));
}
public static string PrettifyPage_C0_C1_Certance(byte[] pageResponse) =>
PrettifyPage_C0_C1_Certance(DecodePage_C0_C1_Certance(pageResponse));
public static string PrettifyPage_C0_C1_Certance(Page_C0_C1_Certance? modePage)
{
@@ -1666,10 +1644,8 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
public static string PrettifyPage_C2_C3_C4_C5_C6_Certance(byte[] pageResponse)
{
return PrettifyPage_C2_C3_C4_C5_C6_Certance(DecodePage_C2_C3_C4_C5_C6_Certance(pageResponse));
}
public static string PrettifyPage_C2_C3_C4_C5_C6_Certance(byte[] pageResponse) =>
PrettifyPage_C2_C3_C4_C5_C6_Certance(DecodePage_C2_C3_C4_C5_C6_Certance(pageResponse));
public static string PrettifyPage_C2_C3_C4_C5_C6_Certance(Page_C2_C3_C4_C5_C6_Certance? modePage)
{
@@ -1837,10 +1813,8 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
public static string PrettifyPage_DF_Certance(byte[] pageResponse)
{
return PrettifyPage_DF_Certance(DecodePage_DF_Certance(pageResponse));
}
public static string PrettifyPage_DF_Certance(byte[] pageResponse) =>
PrettifyPage_DF_Certance(DecodePage_DF_Certance(pageResponse));
public static string PrettifyPage_DF_Certance(Page_DF_Certance? modePage)
{
@@ -2013,10 +1987,8 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
public static string PrettifyPage_C0_IBM(byte[] pageResponse)
{
return PrettifyPage_C0_IBM(DecodePage_C0_IBM(pageResponse));
}
public static string PrettifyPage_C0_IBM(byte[] pageResponse) =>
PrettifyPage_C0_IBM(DecodePage_C0_IBM(pageResponse));
public static string PrettifyPage_C0_IBM(Page_C0_IBM? modePage)
{
@@ -2084,10 +2056,8 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
public static string PrettifyPage_C1_IBM(byte[] pageResponse)
{
return PrettifyPage_C1_IBM(DecodePage_C1_IBM(pageResponse));
}
public static string PrettifyPage_C1_IBM(byte[] pageResponse) =>
PrettifyPage_C1_IBM(DecodePage_C1_IBM(pageResponse));
public static string PrettifyPage_C1_IBM(Page_C1_IBM? modePage)
{
@@ -2154,10 +2124,7 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
public static string PrettifyPage_B0(byte[] pageResponse)
{
return PrettifyPage_B0(DecodePage_B0(pageResponse));
}
public static string PrettifyPage_B0(byte[] pageResponse) => PrettifyPage_B0(DecodePage_B0(pageResponse));
public static string PrettifyPage_B0(Page_B0? modePage)
{
@@ -2339,10 +2306,8 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
public static string PrettifyPage_C0_to_C5_HP(byte[] pageResponse)
{
return PrettifyPage_C0_to_C5_HP(DecodePage_C0_to_C5_HP(pageResponse));
}
public static string PrettifyPage_C0_to_C5_HP(byte[] pageResponse) =>
PrettifyPage_C0_to_C5_HP(DecodePage_C0_to_C5_HP(pageResponse));
public static string PrettifyPage_C0_to_C5_HP(Page_C0_to_C5_HP? modePage)
{
@@ -2442,10 +2407,8 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
public static string PrettifyPage_C0_Seagate(byte[] pageResponse)
{
return PrettifyPage_C0_Seagate(DecodePage_C0_Seagate(pageResponse));
}
public static string PrettifyPage_C0_Seagate(byte[] pageResponse) =>
PrettifyPage_C0_Seagate(DecodePage_C0_Seagate(pageResponse));
public static string PrettifyPage_C0_Seagate(Page_C0_Seagate? modePage)
{

View File

@@ -30,9 +30,11 @@
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
namespace DiscImageChef.Decoders.SCSI
{
@@ -52,135 +54,139 @@ namespace DiscImageChef.Decoders.SCSI
/// 26 bytes in MMC-2
/// Variable bytes in MMC-3
/// </summary>
public struct ModePage_2A
public class ModePage_2A
{
public ModePage_2A_WriteDescriptor[] WriteSpeedPerformanceDescriptors;
/// <summary>
/// Parameters can be saved
/// </summary>
public bool PS;
public bool PS { get; set; }
/// <summary>
/// Drive supports multi-session and/or Photo-CD
/// </summary>
public bool MultiSession;
public bool MultiSession { get; set; }
/// <summary>
/// Drive is capable of reading sectors in Mode 2 Form 2 format
/// </summary>
public bool Mode2Form2;
public bool Mode2Form2 { get; set; }
/// <summary>
/// Drive is capable of reading sectors in Mode 2 Form 1 format
/// </summary>
public bool Mode2Form1;
public bool Mode2Form1 { get; set; }
/// <summary>
/// Drive is capable of playing audio
/// </summary>
public bool AudioPlay;
public bool AudioPlay { get; set; }
/// <summary>
/// Drive can return the ISRC
/// </summary>
public bool ISRC;
public bool ISRC { get; set; }
/// <summary>
/// Drive can return the media catalogue number
/// </summary>
public bool UPC;
public bool UPC { get; set; }
/// <summary>
/// Drive can return C2 pointers
/// </summary>
public bool C2Pointer;
public bool C2Pointer { get; set; }
/// <summary>
/// Drive can read, deinterlave and correct R-W subchannels
/// </summary>
public bool DeinterlaveSubchannel;
public bool DeinterlaveSubchannel { get; set; }
/// <summary>
/// Drive can read interleaved and uncorrected R-W subchannels
/// </summary>
public bool Subchannel;
public bool Subchannel { get; set; }
/// <summary>
/// Drive can continue from a loss of streaming on audio reading
/// </summary>
public bool AccurateCDDA;
public bool AccurateCDDA { get; set; }
/// <summary>
/// Audio can be read as digital data
/// </summary>
public bool CDDACommand;
public bool CDDACommand { get; set; }
/// <summary>
/// Loading Mechanism Type
/// </summary>
public byte LoadingMechanism;
public byte LoadingMechanism { get; set; }
/// <summary>
/// Drive can eject discs
/// </summary>
public bool Eject;
public bool Eject { get; set; }
/// <summary>
/// Drive's optional prevent jumper status
/// </summary>
public bool PreventJumper;
public bool PreventJumper { get; set; }
/// <summary>
/// Current lock status
/// </summary>
public bool LockState;
public bool LockState { get; set; }
/// <summary>
/// Drive can lock media
/// </summary>
public bool Lock;
public bool Lock { get; set; }
/// <summary>
/// Each channel can be muted independently
/// </summary>
public bool SeparateChannelMute;
public bool SeparateChannelMute { get; set; }
/// <summary>
/// Each channel's volume can be controlled independently
/// </summary>
public bool SeparateChannelVolume;
public bool SeparateChannelVolume { get; set; }
/// <summary>
/// Maximum drive speed in Kbytes/second
/// </summary>
public ushort MaximumSpeed;
public ushort MaximumSpeed { get; set; }
/// <summary>
/// Supported volume levels
/// </summary>
public ushort SupportedVolumeLevels;
public ushort SupportedVolumeLevels { get; set; }
/// <summary>
/// Buffer size in Kbytes
/// </summary>
public ushort BufferSize;
public ushort BufferSize { get; set; }
/// <summary>
/// Current drive speed in Kbytes/second
/// </summary>
public ushort CurrentSpeed;
public ushort CurrentSpeed { get; set; }
public bool Method2;
public bool ReadCDRW;
public bool ReadCDR;
public bool WriteCDRW;
public bool WriteCDR;
public bool DigitalPort2;
public bool DigitalPort1;
public bool Composite;
public bool SSS;
public bool SDP;
public byte Length;
public bool LSBF;
public bool RCK;
public bool BCK;
public bool Method2 { get; set; }
public bool ReadCDRW { get; set; }
public bool ReadCDR { get; set; }
public bool WriteCDRW { get; set; }
public bool WriteCDR { get; set; }
public bool DigitalPort2 { get; set; }
public bool DigitalPort1 { get; set; }
public bool Composite { get; set; }
public bool SSS { get; set; }
public bool SDP { get; set; }
public byte Length { get; set; }
public bool LSBF { get; set; }
public bool RCK { get; set; }
public bool BCK { get; set; }
public bool TestWrite;
public ushort MaxWriteSpeed;
public ushort CurrentWriteSpeed;
public bool TestWrite { get; set; }
public ushort MaxWriteSpeed { get; set; }
public ushort CurrentWriteSpeed { get; set; }
public bool ReadBarcode;
public bool ReadBarcode { get; set; }
public bool ReadDVDRAM;
public bool ReadDVDR;
public bool ReadDVDROM;
public bool WriteDVDRAM;
public bool WriteDVDR;
public bool LeadInPW;
public bool SCC;
public ushort CMRSupported;
public bool ReadDVDRAM { get; set; }
public bool ReadDVDR { get; set; }
public bool ReadDVDROM { get; set; }
public bool WriteDVDRAM { get; set; }
public bool WriteDVDR { get; set; }
public bool LeadInPW { get; set; }
public bool SCC { get; set; }
public ushort CMRSupported { get; set; }
public bool BUF;
public byte RotationControlSelected;
public ushort CurrentWriteSpeedSelected;
public ModePage_2A_WriteDescriptor[] WriteSpeedPerformanceDescriptors;
public bool BUF { get; set; }
public byte RotationControlSelected { get; set; }
public ushort CurrentWriteSpeedSelected { get; set; }
[JsonIgnore]
[Key]
public int Id { get; set; }
}
public struct ModePage_2A_WriteDescriptor
@@ -189,7 +195,7 @@ namespace DiscImageChef.Decoders.SCSI
public ushort WriteSpeed;
}
public static ModePage_2A? DecodeModePage_2A(byte[] pageResponse)
public static ModePage_2A DecodeModePage_2A(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40) return null;
@@ -293,16 +299,14 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
public static string PrettifyModePage_2A(byte[] pageResponse)
{
return PrettifyModePage_2A(DecodeModePage_2A(pageResponse));
}
public static string PrettifyModePage_2A(byte[] pageResponse) =>
PrettifyModePage_2A(DecodeModePage_2A(pageResponse));
public static string PrettifyModePage_2A(ModePage_2A? modePage)
public static string PrettifyModePage_2A(ModePage_2A modePage)
{
if(!modePage.HasValue) return null;
if(modePage is null) return null;
ModePage_2A page = modePage.Value;
ModePage_2A page = modePage;
StringBuilder sb = new StringBuilder();
sb.AppendLine("SCSI CD-ROM capabilities page:");