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> <ConsolePause>false</ConsolePause>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <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" />
<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>
<ItemGroup> <ItemGroup>
<Compile Include="SCSI\Inquiry.cs" /> <Compile Include="SCSI\Inquiry.cs" />

View File

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

View File

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