diff --git a/.idea/.idea.DiscImageChef/.idea/contentModel.xml b/.idea/.idea.DiscImageChef/.idea/contentModel.xml index 98ad5fd9e..25a755c4f 100644 --- a/.idea/.idea.DiscImageChef/.idea/contentModel.xml +++ b/.idea/.idea.DiscImageChef/.idea/contentModel.xml @@ -134,6 +134,7 @@ + diff --git a/DiscImageChef.CommonTypes/DiscImageChef.CommonTypes.csproj b/DiscImageChef.CommonTypes/DiscImageChef.CommonTypes.csproj index cacec77fd..6032dc4dd 100644 --- a/DiscImageChef.CommonTypes/DiscImageChef.CommonTypes.csproj +++ b/DiscImageChef.CommonTypes/DiscImageChef.CommonTypes.csproj @@ -76,6 +76,7 @@ + diff --git a/DiscImageChef.CommonTypes/Metadata/DeviceReportV2.cs b/DiscImageChef.CommonTypes/Metadata/DeviceReportV2.cs new file mode 100644 index 000000000..0fd9cd653 --- /dev/null +++ b/DiscImageChef.CommonTypes/Metadata/DeviceReportV2.cs @@ -0,0 +1,422 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : DeviceReportV2.cs +// Author(s) : Natalia Portillo +// +// Component : JSON metadata. +// +// --[ Description ] ---------------------------------------------------------- +// +// Contains classes for a JSON device report. +// +// --[ License ] -------------------------------------------------------------- +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2018 Natalia Portillo +// ****************************************************************************/ + +using System; +using System.Xml.Serialization; +using DiscImageChef.Decoders.ATA; +using DiscImageChef.Decoders.SCSI; +using DiscImageChef.Decoders.SCSI.MMC; + +// ReSharper disable InconsistentNaming +// ReSharper disable UnusedAutoPropertyAccessor.Global + +namespace DiscImageChef.CommonTypes.Metadata +{ + public class DeviceReportV2 + { + public Usb USB { get; set; } + public FireWire FireWire { get; set; } + public Pcmcia PCMCIA { get; set; } + public bool CompactFlash { get; set; } + public Ata ATA { get; set; } + public Ata ATAPI { get; set; } + public Scsi SCSI { get; set; } + public MmcSd MultiMediaCard { get; set; } + public MmcSd SecureDigital { get; set; } + } + + public class Usb + { + public ushort VendorID { get; set; } + public ushort ProductID { get; set; } + public string Manufacturer { get; set; } + public string Product { get; set; } + public bool RemovableMedia { get; set; } + public byte[] Descriptors { get; set; } + } + + public class FireWire + { + public uint VendorID { get; set; } + public uint ProductID { get; set; } + public string Manufacturer { get; set; } + public string Product { get; set; } + public bool RemovableMedia { get; set; } + } + + public class Ata + { + public Identify.IdentifyDevice? IdentifyDevice { get; set; } + + public byte[] Identify { get; set; } + + public TestedMedia ReadCapabilities { get; set; } + public TestedMedia[] RemovableMedias { get; set; } + } + + public class Chs + { + public ushort Cylinders { get; set; } + public ushort Heads { get; set; } + public ushort Sectors { get; set; } + } + + public class Scsi + { + public Inquiry.SCSIInquiry? Inquiry { get; set; } + public byte[] InquiryData { get; set; } + public ScsiPage[] EVPDPages { get; set; } + public bool SupportsModeSense6 { get; set; } + public bool SupportsModeSense10 { get; set; } + public bool SupportsModeSubpages { get; set; } + public ScsiMode ModeSense { get; set; } + public Mmc MultiMediaDevice { get; set; } + public TestedMedia ReadCapabilities { get; set; } + public TestedMedia[] RemovableMedias { get; set; } + public Ssc SequentialDevice { get; set; } + public byte[] ModeSense6Data { get; set; } + public byte[] ModeSense10Data { get; set; } + } + + public class ScsiMode + { + public byte? MediumType { get; set; } + public bool WriteProtected { get; set; } + public BlockDescriptor[] BlockDescriptors { get; set; } + public byte? Speed { get; set; } + public byte? BufferedMode { get; set; } + public bool BlankCheckEnabled { get; set; } + public bool DPOandFUA { get; set; } + public ScsiPage[] ModePages { get; set; } + } + + public class BlockDescriptor + { + public byte Density { get; set; } + public ulong? Blocks { get; set; } + public uint? BlockLength { get; set; } + + [XmlIgnore] + public bool BlocksSpecified { get; set; } + [XmlIgnore] + public bool BlockLengthSpecified { get; set; } + } + + public class ScsiPage + { + public byte page { get; set; } + public byte subpage { get; set; } + public byte[] value { get; set; } + } + + public class Mmc + { + public Modes.ModePage_2A? ModeSense2A { get; set; } + public MmcFeatures Features { get; set; } + public TestedMedia[] TestedMedia { get; set; } + } + + public class MmcFeatures + { + public byte? AACSVersion { get; set; } + public byte? AGIDs { get; set; } + public byte? BindingNonceBlocks { get; set; } + public ushort? BlocksPerReadableUnit { get; set; } + public bool BufferUnderrunFreeInDVD { get; set; } + public bool BufferUnderrunFreeInSAO { get; set; } + public bool BufferUnderrunFreeInTAO { get; set; } + public bool CanAudioScan { get; set; } + public bool CanEject { get; set; } + public bool CanEraseSector { get; set; } + public bool CanExpandBDRESpareArea { get; set; } + public bool CanFormat { get; set; } + public bool CanFormatBDREWithoutSpare { get; set; } + public bool CanFormatCert { get; set; } + public bool CanFormatFRF { get; set; } + public bool CanFormatQCert { get; set; } + public bool CanFormatRRM { get; set; } + public bool CanGenerateBindingNonce { get; set; } + public bool CanLoad { get; set; } + public bool CanMuteSeparateChannels { get; set; } + public bool CanOverwriteSAOTrack { get; set; } + public bool CanOverwriteTAOTrack { get; set; } + public bool CanPlayCDAudio { get; set; } + public bool CanPseudoOverwriteBDR { get; set; } + public bool CanReadAllDualR { get; set; } + public bool CanReadAllDualRW { get; set; } + public bool CanReadBD { get; set; } + public bool CanReadBDR { get; set; } + public bool CanReadBDRE1 { get; set; } + public bool CanReadBDRE2 { get; set; } + public bool CanReadBDROM { get; set; } + public bool CanReadBluBCA { get; set; } + public bool CanReadCD { get; set; } + public bool CanReadCDMRW { get; set; } + public bool CanReadCPRM_MKB { get; set; } + public bool CanReadDDCD { get; set; } + public bool CanReadDVD { get; set; } + public bool CanReadDVDPlusMRW { get; set; } + public bool CanReadDVDPlusR { get; set; } + public bool CanReadDVDPlusRDL { get; set; } + public bool CanReadDVDPlusRW { get; set; } + public bool CanReadDVDPlusRWDL { get; set; } + public bool CanReadDriveAACSCertificate { get; set; } + public bool CanReadHDDVD { get; set; } + public bool CanReadHDDVDR { get; set; } + public bool CanReadHDDVDRAM { get; set; } + public bool CanReadLeadInCDText { get; set; } + public bool CanReadOldBDR { get; set; } + public bool CanReadOldBDRE { get; set; } + public bool CanReadOldBDROM { get; set; } + public bool CanReadSpareAreaInformation { get; set; } + public bool CanReportDriveSerial { get; set; } + public bool CanReportMediaSerial { get; set; } + public bool CanTestWriteDDCDR { get; set; } + public bool CanTestWriteDVD { get; set; } + public bool CanTestWriteInSAO { get; set; } + public bool CanTestWriteInTAO { get; set; } + public bool CanUpgradeFirmware { get; set; } + public bool CanWriteBD { get; set; } + public bool CanWriteBDR { get; set; } + public bool CanWriteBDRE1 { get; set; } + public bool CanWriteBDRE2 { get; set; } + public bool CanWriteBusEncryptedBlocks { get; set; } + public bool CanWriteCDMRW { get; set; } + public bool CanWriteCDRW { get; set; } + public bool CanWriteCDRWCAV { get; set; } + public bool CanWriteCDSAO { get; set; } + public bool CanWriteCDTAO { get; set; } + public bool CanWriteCSSManagedDVD { get; set; } + public bool CanWriteDDCDR { get; set; } + public bool CanWriteDDCDRW { get; set; } + public bool CanWriteDVDPlusMRW { get; set; } + public bool CanWriteDVDPlusR { get; set; } + public bool CanWriteDVDPlusRDL { get; set; } + public bool CanWriteDVDPlusRW { get; set; } + public bool CanWriteDVDPlusRWDL { get; set; } + public bool CanWriteDVDR { get; set; } + public bool CanWriteDVDRDL { get; set; } + public bool CanWriteDVDRW { get; set; } + public bool CanWriteHDDVDR { get; set; } + public bool CanWriteHDDVDRAM { get; set; } + public bool CanWriteOldBDR { get; set; } + public bool CanWriteOldBDRE { get; set; } + public bool CanWritePackedSubchannelInTAO { get; set; } + public bool CanWriteRWSubchannelInSAO { get; set; } + public bool CanWriteRWSubchannelInTAO { get; set; } + public bool CanWriteRaw { get; set; } + public bool CanWriteRawMultiSession { get; set; } + public bool CanWriteRawSubchannelInTAO { get; set; } + public bool ChangerIsSideChangeCapable { get; set; } + public byte ChangerSlots { get; set; } + public bool ChangerSupportsDiscPresent { get; set; } + public byte? CPRMVersion { get; set; } + public byte? CSSVersion { get; set; } + public bool DBML { get; set; } + public bool DVDMultiRead { get; set; } + public bool EmbeddedChanger { get; set; } + public bool ErrorRecoveryPage { get; set; } + public DateTime? FirmwareDate { get; set; } + public byte? LoadingMechanismType { get; set; } + public bool Locked { get; set; } + public uint? LogicalBlockSize { get; set; } + public bool MultiRead { get; set; } + public PhysicalInterfaces? PhysicalInterfaceStandard { get; set; } + public uint? PhysicalInterfaceStandardNumber { get; set; } + public bool PreventJumper { get; set; } + public bool SupportsAACS { get; set; } + public bool SupportsBusEncryption { get; set; } + public bool SupportsC2 { get; set; } + public bool SupportsCPRM { get; set; } + public bool SupportsCSS { get; set; } + public bool SupportsDAP { get; set; } + public bool SupportsDeviceBusyEvent { get; set; } + public bool SupportsHybridDiscs { get; set; } + public bool SupportsModePage1Ch { get; set; } + public bool SupportsOSSC { get; set; } + public bool SupportsPWP { get; set; } + public bool SupportsSWPP { get; set; } + public bool SupportsSecurDisc { get; set; } + public bool SupportsSeparateVolume { get; set; } + public bool SupportsVCPS { get; set; } + public bool SupportsWriteInhibitDCB { get; set; } + public bool SupportsWriteProtectPAC { get; set; } + public ushort? VolumeLevels { get; set; } + } + + public class TestedMedia + { + public Identify.IdentifyDevice? IdentifyDevice { get; set; } + public byte[] IdentifyData { get; set; } + public ulong? Blocks { get; set; } + public uint? BlockSize { get; set; } + public bool? CanReadAACS { get; set; } + public bool? CanReadADIP { get; set; } + public bool? CanReadATIP { get; set; } + public bool? CanReadBCA { get; set; } + public bool? CanReadC2Pointers { get; set; } + public bool? CanReadCMI { get; set; } + public bool? CanReadCorrectedSubchannel { get; set; } + public bool? CanReadCorrectedSubchannelWithC2 { get; set; } + public bool? CanReadDCB { get; set; } + public bool? CanReadDDS { get; set; } + public bool? CanReadDMI { get; set; } + public bool? CanReadDiscInformation { get; set; } + public bool? CanReadFullTOC { get; set; } + public bool? CanReadHDCMI { get; set; } + public bool? CanReadLayerCapacity { get; set; } + public bool? CanReadLeadIn { get; set; } + public bool? CanReadLeadOut { get; set; } + public bool? CanReadMediaID { get; set; } + public bool? CanReadMediaSerial { get; set; } + public bool? CanReadPAC { get; set; } + public bool? CanReadPFI { get; set; } + public bool? CanReadPMA { get; set; } + public bool? CanReadPQSubchannel { get; set; } + public bool? CanReadPQSubchannelWithC2 { get; set; } + public bool? CanReadPRI { get; set; } + public bool? CanReadRWSubchannel { get; set; } + public bool? CanReadRWSubchannelWithC2 { get; set; } + public bool? CanReadRecordablePFI { get; set; } + public bool? CanReadSpareAreaInformation { get; set; } + public bool? CanReadTOC { get; set; } + public byte? Density { get; set; } + public uint? LongBlockSize { get; set; } + public string Manufacturer { get; set; } + public bool MediaIsRecognized { get; set; } + public byte? MediumType { get; set; } + public string MediumTypeName { get; set; } + public string Model { get; set; } + public bool? SupportsHLDTSTReadRawDVD { get; set; } + public bool? SupportsNECReadCDDA { get; set; } + public bool? SupportsPioneerReadCDDA { get; set; } + public bool? SupportsPioneerReadCDDAMSF { get; set; } + public bool? SupportsPlextorReadCDDA { get; set; } + public bool? SupportsPlextorReadRawDVD { get; set; } + public bool? SupportsRead10 { get; set; } + public bool? SupportsRead12 { get; set; } + public bool? SupportsRead16 { get; set; } + public bool? SupportsRead { get; set; } + public bool? SupportsReadCapacity16 { get; set; } + public bool? SupportsReadCapacity { get; set; } + public bool? SupportsReadCd { get; set; } + public bool? SupportsReadCdMsf { get; set; } + public bool? SupportsReadCdRaw { get; set; } + public bool? SupportsReadCdMsfRaw { get; set; } + public bool? SupportsReadLong16 { get; set; } + public bool? SupportsReadLong { get; set; } + + public byte[] ModeSense6Data { get; set; } + public byte[] ModeSense10Data { get; set; } + + public Chs CHS { get; set; } + public Chs CurrentCHS { get; set; } + public uint? LBASectors { get; set; } + public ulong? LBA48Sectors { get; set; } + public ushort? LogicalAlignment { get; set; } + public ushort? NominalRotationRate { get; set; } + public uint? PhysicalBlockSize { get; set; } + public bool? SolidStateDevice { get; set; } + public ushort? UnformattedBPT { get; set; } + public ushort? UnformattedBPS { get; set; } + + public bool? SupportsReadDmaLba { get; set; } + public bool? SupportsReadDmaRetryLba { get; set; } + public bool? SupportsReadLba { get; set; } + public bool? SupportsReadRetryLba { get; set; } + public bool? SupportsReadLongLba { get; set; } + public bool? SupportsReadLongRetryLba { get; set; } + public bool? SupportsSeekLba { get; set; } + + public bool? SupportsReadDmaLba48 { get; set; } + public bool? SupportsReadLba48 { get; set; } + + public bool? SupportsReadDma { get; set; } + public bool? SupportsReadDmaRetry { get; set; } + public bool? SupportsReadRetry { get; set; } + public bool? SupportsReadLongRetry { get; set; } + public bool? SupportsSeek { get; set; } + } + + public class Ssc + { + public byte? BlockSizeGranularity { get; set; } + public uint? MaxBlockLength { get; set; } + public uint? MinBlockLength { get; set; } + + public SupportedDensity[] SupportedDensities { get; set; } + public SupportedMedia[] SupportedMediaTypes { get; set; } + public TestedSequentialMedia[] TestedMedia { get; set; } + } + + public struct TestedSequentialMedia + { + public bool? CanReadMediaSerial { get; set; } + public byte? Density { get; set; } + public string Manufacturer { get; set; } + public bool MediaIsRecognized { get; set; } + public byte? MediumType { get; set; } + public string MediumTypeName { get; set; } + public string Model { get; set; } + public SupportedDensity[] SupportedDensities { get; set; } + public SupportedMedia[] SupportedMediaTypes { get; set; } + + public byte[] ModeSense6Data { get; set; } + public byte[] ModeSense10Data { get; set; } + } + + public class Pcmcia + { + public byte[] CIS { get; set; } + public string Compliance { get; set; } + public ushort? ManufacturerCode { get; set; } + public ushort? CardCode { get; set; } + public string Manufacturer { get; set; } + public string ProductName { get; set; } + public string[] AdditionalInformation { get; set; } + } + + public class MmcSd + { + public byte[] CID { get; set; } + public byte[] CSD { get; set; } + public byte[] OCR { get; set; } + public byte[] SCR { get; set; } + public byte[] ExtendedCSD { get; set; } + } +} \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Report/ATA.cs b/DiscImageChef.Core/Devices/Report/ATA.cs index e662b861b..06efb4ed7 100644 --- a/DiscImageChef.Core/Devices/Report/ATA.cs +++ b/DiscImageChef.Core/Devices/Report/ATA.cs @@ -51,7 +51,8 @@ namespace DiscImageChef.Core.Devices.Report /// Device report /// If debug is enabled /// If device is removable - public static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable) + /// + public static void Report(Device dev, ref DeviceReportV2 report, bool debug, ref bool removable) { if(report == null) return; @@ -69,19 +70,21 @@ namespace DiscImageChef.Core.Devices.Report if(!Identify.Decode(buffer).HasValue) return; - Identify.IdentifyDevice? ataIdNullable = Identify.Decode(buffer); - if(ataIdNullable == null) return; + report.ATA = new CommonTypes.Metadata.Ata(); + report.ATA.IdentifyDevice = Identify.Decode(buffer); + ; - Identify.IdentifyDevice ataId = ataIdNullable.Value; + if(report.ATA.IdentifyDevice == null) return; ConsoleKeyInfo pressedKey; - if((ushort)ataId.GeneralConfiguration == 0x848A) + if((ushort)report.ATA.IdentifyDevice?.GeneralConfiguration == 0x848A) { - report.CompactFlash = true; - report.CompactFlashSpecified = true; - removable = false; + report.CompactFlash = true; + removable = false; } - else if(!removable && ataId.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.Removable)) + else if(!removable && + report.ATA.IdentifyDevice?.GeneralConfiguration + .HasFlag(Identify.GeneralConfigurationBit.Removable) == true) { pressedKey = new ConsoleKeyInfo(); while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) @@ -100,484 +103,14 @@ namespace DiscImageChef.Core.Devices.Report System.Console.ReadKey(true); DicConsole.WriteLine("Querying ATA IDENTIFY..."); dev.AtaIdentify(out buffer, out _, TIMEOUT, out _); - ataId = Identify.Decode(buffer).Value; - } - - report.ATA = new ataType(); - - if(!string.IsNullOrWhiteSpace(ataId.AdditionalPID)) - { - report.ATA.AdditionalPID = ataId.AdditionalPID; - report.ATA.AdditionalPIDSpecified = true; - } - - if(ataId.APIOSupported != 0) - { - report.ATA.APIOSupported = ataId.APIOSupported; - report.ATA.APIOSupportedSpecified = true; - } - - if(ataId.BufferType != 0) - { - report.ATA.BufferType = ataId.BufferType; - report.ATA.BufferTypeSpecified = true; - } - - if(ataId.BufferSize != 0) - { - report.ATA.BufferSize = ataId.BufferSize; - report.ATA.BufferSizeSpecified = true; - } - - if(ataId.Capabilities != 0) - { - report.ATA.Capabilities = ataId.Capabilities; - report.ATA.CapabilitiesSpecified = true; - } - - if(ataId.Capabilities2 != 0) - { - report.ATA.Capabilities2 = ataId.Capabilities2; - report.ATA.Capabilities2Specified = true; - } - - if(ataId.Capabilities3 != 0) - { - report.ATA.Capabilities3 = ataId.Capabilities3; - report.ATA.Capabilities3Specified = true; - } - - if(ataId.CFAPowerMode != 0) - { - report.ATA.CFAPowerMode = ataId.CFAPowerMode; - report.ATA.CFAPowerModeSpecified = true; - } - - if(ataId.CommandSet != 0) - { - report.ATA.CommandSet = ataId.CommandSet; - report.ATA.CommandSetSpecified = true; - } - - if(ataId.CommandSet2 != 0) - { - report.ATA.CommandSet2 = ataId.CommandSet2; - report.ATA.CommandSet2Specified = true; - } - - if(ataId.CommandSet3 != 0) - { - report.ATA.CommandSet3 = ataId.CommandSet3; - report.ATA.CommandSet3Specified = true; - } - - if(ataId.CommandSet4 != 0) - { - report.ATA.CommandSet4 = ataId.CommandSet4; - report.ATA.CommandSet4Specified = true; - } - - if(ataId.CommandSet5 != 0) - { - report.ATA.CommandSet5 = ataId.CommandSet5; - report.ATA.CommandSet5Specified = true; - } - - if(ataId.CurrentAAM != 0) - { - report.ATA.CurrentAAM = ataId.CurrentAAM; - report.ATA.CurrentAAMSpecified = true; - } - - if(ataId.CurrentAPM != 0) - { - report.ATA.CurrentAPM = ataId.CurrentAPM; - report.ATA.CurrentAPMSpecified = true; - } - - if(ataId.DataSetMgmt != 0) - { - report.ATA.DataSetMgmt = ataId.DataSetMgmt; - report.ATA.DataSetMgmtSpecified = true; - } - - if(ataId.DataSetMgmtSize != 0) - { - report.ATA.DataSetMgmtSize = ataId.DataSetMgmtSize; - report.ATA.DataSetMgmtSizeSpecified = true; - } - - if(ataId.DeviceFormFactor != 0) - { - report.ATA.DeviceFormFactor = ataId.DeviceFormFactor; - report.ATA.DeviceFormFactorSpecified = true; - } - - if(ataId.DMAActive != 0) - { - report.ATA.DMAActive = ataId.DMAActive; - report.ATA.DMAActiveSpecified = true; - } - - if(ataId.DMASupported != 0) - { - report.ATA.DMASupported = ataId.DMASupported; - report.ATA.DMASupportedSpecified = true; - } - - if(ataId.DMATransferTimingMode != 0) - { - report.ATA.DMATransferTimingMode = ataId.DMATransferTimingMode; - report.ATA.DMATransferTimingModeSpecified = true; - } - - if(ataId.EnhancedSecurityEraseTime != 0) - { - report.ATA.EnhancedSecurityEraseTime = ataId.EnhancedSecurityEraseTime; - report.ATA.EnhancedSecurityEraseTimeSpecified = true; - } - - if(ataId.EnabledCommandSet != 0) - { - report.ATA.EnabledCommandSet = ataId.EnabledCommandSet; - report.ATA.EnabledCommandSetSpecified = true; - } - - if(ataId.EnabledCommandSet2 != 0) - { - report.ATA.EnabledCommandSet2 = ataId.EnabledCommandSet2; - report.ATA.EnabledCommandSet2Specified = true; - } - - if(ataId.EnabledCommandSet3 != 0) - { - report.ATA.EnabledCommandSet3 = ataId.EnabledCommandSet3; - report.ATA.EnabledCommandSet3Specified = true; - } - - if(ataId.EnabledCommandSet4 != 0) - { - report.ATA.EnabledCommandSet4 = ataId.EnabledCommandSet4; - report.ATA.EnabledCommandSet4Specified = true; - } - - if(ataId.EnabledSATAFeatures != 0) - { - report.ATA.EnabledSATAFeatures = ataId.EnabledSATAFeatures; - report.ATA.EnabledSATAFeaturesSpecified = true; - } - - if(ataId.ExtendedUserSectors != 0) - { - report.ATA.ExtendedUserSectors = ataId.ExtendedUserSectors; - report.ATA.ExtendedUserSectorsSpecified = true; - } - - if(ataId.FreeFallSensitivity != 0) - { - report.ATA.FreeFallSensitivity = ataId.FreeFallSensitivity; - report.ATA.FreeFallSensitivitySpecified = true; - } - - if(!string.IsNullOrWhiteSpace(ataId.FirmwareRevision)) - { - report.ATA.FirmwareRevision = ataId.FirmwareRevision; - report.ATA.FirmwareRevisionSpecified = true; - } - - if(ataId.GeneralConfiguration != 0) - { - report.ATA.GeneralConfiguration = ataId.GeneralConfiguration; - report.ATA.GeneralConfigurationSpecified = true; - } - - if(ataId.HardwareResetResult != 0) - { - report.ATA.HardwareResetResult = ataId.HardwareResetResult; - report.ATA.HardwareResetResultSpecified = true; - } - - if(ataId.InterseekDelay != 0) - { - report.ATA.InterseekDelay = ataId.InterseekDelay; - report.ATA.InterseekDelaySpecified = true; - } - - if(ataId.MajorVersion != 0) - { - report.ATA.MajorVersion = ataId.MajorVersion; - report.ATA.MajorVersionSpecified = true; - } - - if(ataId.MasterPasswordRevisionCode != 0) - { - report.ATA.MasterPasswordRevisionCode = ataId.MasterPasswordRevisionCode; - report.ATA.MasterPasswordRevisionCodeSpecified = true; - } - - if(ataId.MaxDownloadMicroMode3 != 0) - { - report.ATA.MaxDownloadMicroMode3 = ataId.MaxDownloadMicroMode3; - report.ATA.MaxDownloadMicroMode3Specified = true; - } - - if(ataId.MaxQueueDepth != 0) - { - report.ATA.MaxQueueDepth = ataId.MaxQueueDepth; - report.ATA.MaxQueueDepthSpecified = true; - } - - if(ataId.MDMAActive != 0) - { - report.ATA.MDMAActive = ataId.MDMAActive; - report.ATA.MDMAActiveSpecified = true; - } - - if(ataId.MDMASupported != 0) - { - report.ATA.MDMASupported = ataId.MDMASupported; - report.ATA.MDMASupportedSpecified = true; - } - - if(ataId.MinDownloadMicroMode3 != 0) - { - report.ATA.MinDownloadMicroMode3 = ataId.MinDownloadMicroMode3; - report.ATA.MinDownloadMicroMode3Specified = true; - } - - if(ataId.MinMDMACycleTime != 0) - { - report.ATA.MinMDMACycleTime = ataId.MinMDMACycleTime; - report.ATA.MinMDMACycleTimeSpecified = true; - } - - if(ataId.MinorVersion != 0) - { - report.ATA.MinorVersion = ataId.MinorVersion; - report.ATA.MinorVersionSpecified = true; - } - - if(ataId.MinPIOCycleTimeNoFlow != 0) - { - report.ATA.MinPIOCycleTimeNoFlow = ataId.MinPIOCycleTimeNoFlow; - report.ATA.MinPIOCycleTimeNoFlowSpecified = true; - } - - if(ataId.MinPIOCycleTimeFlow != 0) - { - report.ATA.MinPIOCycleTimeFlow = ataId.MinPIOCycleTimeFlow; - report.ATA.MinPIOCycleTimeFlowSpecified = true; - } - - if(!string.IsNullOrWhiteSpace(ataId.Model)) - { - report.ATA.Model = ataId.Model; - report.ATA.ModelSpecified = true; - } - - if(ataId.MultipleMaxSectors != 0) - { - report.ATA.MultipleMaxSectors = ataId.MultipleMaxSectors; - report.ATA.MultipleMaxSectorsSpecified = true; - } - - if(ataId.MultipleSectorNumber != 0) - { - report.ATA.MultipleSectorNumber = ataId.MultipleSectorNumber; - report.ATA.MultipleSectorNumberSpecified = true; - } - - if(ataId.NVCacheCaps != 0) - { - report.ATA.NVCacheCaps = ataId.NVCacheCaps; - report.ATA.NVCacheCapsSpecified = true; - } - - if(ataId.NVCacheSize != 0) - { - report.ATA.NVCacheSize = ataId.NVCacheSize; - report.ATA.NVCacheSizeSpecified = true; - } - - if(ataId.NVCacheWriteSpeed != 0) - { - report.ATA.NVCacheWriteSpeed = ataId.NVCacheWriteSpeed; - report.ATA.NVCacheWriteSpeedSpecified = true; - } - - if(ataId.NVEstimatedSpinUp != 0) - { - report.ATA.NVEstimatedSpinUp = ataId.NVEstimatedSpinUp; - report.ATA.NVEstimatedSpinUpSpecified = true; - } - - if(ataId.PacketBusRelease != 0) - { - report.ATA.PacketBusRelease = ataId.PacketBusRelease; - report.ATA.PacketBusReleaseSpecified = true; - } - - if(ataId.PIOTransferTimingMode != 0) - { - report.ATA.PIOTransferTimingMode = ataId.PIOTransferTimingMode; - report.ATA.PIOTransferTimingModeSpecified = true; - } - - if(ataId.RecommendedAAM != 0) - { - report.ATA.RecommendedAAM = ataId.RecommendedAAM; - report.ATA.RecommendedAAMSpecified = true; - } - - if(ataId.RecMDMACycleTime != 0) - { - report.ATA.RecommendedMDMACycleTime = ataId.RecMDMACycleTime; - report.ATA.RecommendedMDMACycleTimeSpecified = true; - } - - if(ataId.RemovableStatusSet != 0) - { - report.ATA.RemovableStatusSet = ataId.RemovableStatusSet; - report.ATA.RemovableStatusSetSpecified = true; - } - - if(ataId.SATACapabilities != 0) - { - report.ATA.SATACapabilities = ataId.SATACapabilities; - report.ATA.SATACapabilitiesSpecified = true; - } - - if(ataId.SATACapabilities2 != 0) - { - report.ATA.SATACapabilities2 = ataId.SATACapabilities2; - report.ATA.SATACapabilities2Specified = true; - } - - if(ataId.SATAFeatures != 0) - { - report.ATA.SATAFeatures = ataId.SATAFeatures; - report.ATA.SATAFeaturesSpecified = true; - } - - if(ataId.SCTCommandTransport != 0) - { - report.ATA.SCTCommandTransport = ataId.SCTCommandTransport; - report.ATA.SCTCommandTransportSpecified = true; - } - - if(ataId.SectorsPerCard != 0) - { - report.ATA.SectorsPerCard = ataId.SectorsPerCard; - report.ATA.SectorsPerCardSpecified = true; - } - - if(ataId.SecurityEraseTime != 0) - { - report.ATA.SecurityEraseTime = ataId.SecurityEraseTime; - report.ATA.SecurityEraseTimeSpecified = true; - } - - if(ataId.SecurityStatus != 0) - { - report.ATA.SecurityStatus = ataId.SecurityStatus; - report.ATA.SecurityStatusSpecified = true; - } - - if(ataId.ServiceBusyClear != 0) - { - report.ATA.ServiceBusyClear = ataId.ServiceBusyClear; - report.ATA.ServiceBusyClearSpecified = true; - } - - if(ataId.SpecificConfiguration != 0) - { - report.ATA.SpecificConfiguration = ataId.SpecificConfiguration; - report.ATA.SpecificConfigurationSpecified = true; - } - - if(ataId.StreamAccessLatency != 0) - { - report.ATA.StreamAccessLatency = ataId.StreamAccessLatency; - report.ATA.StreamAccessLatencySpecified = true; - } - - if(ataId.StreamMinReqSize != 0) - { - report.ATA.StreamMinReqSize = ataId.StreamMinReqSize; - report.ATA.StreamMinReqSizeSpecified = true; - } - - if(ataId.StreamPerformanceGranularity != 0) - { - report.ATA.StreamPerformanceGranularity = ataId.StreamPerformanceGranularity; - report.ATA.StreamPerformanceGranularitySpecified = true; - } - - if(ataId.StreamTransferTimeDMA != 0) - { - report.ATA.StreamTransferTimeDMA = ataId.StreamTransferTimeDMA; - report.ATA.StreamTransferTimeDMASpecified = true; - } - - if(ataId.StreamTransferTimePIO != 0) - { - report.ATA.StreamTransferTimePIO = ataId.StreamTransferTimePIO; - report.ATA.StreamTransferTimePIOSpecified = true; - } - - if(ataId.TransportMajorVersion != 0) - { - report.ATA.TransportMajorVersion = ataId.TransportMajorVersion; - report.ATA.TransportMajorVersionSpecified = true; - } - - if(ataId.TransportMinorVersion != 0) - { - report.ATA.TransportMinorVersion = ataId.TransportMinorVersion; - report.ATA.TransportMinorVersionSpecified = true; - } - - if(ataId.TrustedComputing != 0) - { - report.ATA.TrustedComputing = ataId.TrustedComputing; - report.ATA.TrustedComputingSpecified = true; - } - - if(ataId.UDMAActive != 0) - { - report.ATA.UDMAActive = ataId.UDMAActive; - report.ATA.UDMAActiveSpecified = true; - } - - if(ataId.UDMASupported != 0) - { - report.ATA.UDMASupported = ataId.UDMASupported; - report.ATA.UDMASupportedSpecified = true; - } - - if(ataId.WRVMode != 0) - { - report.ATA.WRVMode = ataId.WRVMode; - report.ATA.WRVModeSpecified = true; - } - - if(ataId.WRVSectorCountMode3 != 0) - { - report.ATA.WRVSectorCountMode3 = ataId.WRVSectorCountMode3; - report.ATA.WRVSectorCountMode3Specified = true; - } - - if(ataId.WRVSectorCountMode2 != 0) - { - report.ATA.WRVSectorCountMode2 = ataId.WRVSectorCountMode2; - report.ATA.WRVSectorCountMode2Specified = true; + report.ATA.IdentifyDevice = Identify.Decode(buffer).Value; } if(debug) report.ATA.Identify = buffer; if(removable) { - List mediaTests = new List(); + List mediaTests = new List(); pressedKey = new ConsoleKeyInfo(); while(pressedKey.Key != ConsoleKey.N) @@ -595,50 +128,40 @@ namespace DiscImageChef.Core.Devices.Report DicConsole.WriteLine("Please insert it in the drive and press any key when it is ready."); System.Console.ReadKey(true); - testedMediaType mediaTest = new testedMediaType(); + TestedMedia mediaTest = new TestedMedia(); DicConsole.Write("Please write a description of the media type and press enter: "); mediaTest.MediumTypeName = System.Console.ReadLine(); DicConsole.Write("Please write the media model and press enter: "); mediaTest.Model = System.Console.ReadLine(); - mediaTest.ManufacturerSpecified = true; - mediaTest.ModelSpecified = true; - mediaTest.MediaIsRecognized = true; + mediaTest.MediaIsRecognized = true; DicConsole.WriteLine("Querying ATA IDENTIFY..."); dev.AtaIdentify(out buffer, out _, TIMEOUT, out _); - if(Identify.Decode(buffer).HasValue) + mediaTest.IdentifyData = buffer; + mediaTest.IdentifyDevice = Identify.Decode(buffer); + + if(mediaTest.IdentifyDevice.HasValue) { - ataId = Identify.Decode(buffer).Value; + Identify.IdentifyDevice ataId = mediaTest.IdentifyDevice.Value; - if(ataId.UnformattedBPT != 0) - { - mediaTest.UnformattedBPT = ataId.UnformattedBPT; - mediaTest.UnformattedBPTSpecified = true; - } + if(ataId.UnformattedBPT != 0) mediaTest.UnformattedBPT = ataId.UnformattedBPT; - if(ataId.UnformattedBPS != 0) - { - mediaTest.UnformattedBPS = ataId.UnformattedBPS; - mediaTest.UnformattedBPSSpecified = true; - } + if(ataId.UnformattedBPS != 0) mediaTest.UnformattedBPS = ataId.UnformattedBPS; if(ataId.Cylinders > 0 && ataId.Heads > 0 && ataId.SectorsPerTrack > 0) { - mediaTest.CHS = new chsType + mediaTest.CHS = new Chs { - Cylinders = ataId.Cylinders, - Heads = ataId.Heads, - Sectors = ataId.SectorsPerTrack + Cylinders = ataId.Cylinders, Heads = ataId.Heads, Sectors = ataId.SectorsPerTrack }; - mediaTest.Blocks = (ulong)(ataId.Cylinders * ataId.Heads * ataId.SectorsPerTrack); - mediaTest.BlocksSpecified = true; + mediaTest.Blocks = (ulong)(ataId.Cylinders * ataId.Heads * ataId.SectorsPerTrack); } if(ataId.CurrentCylinders > 0 && ataId.CurrentHeads > 0 && ataId.CurrentSectorsPerTrack > 0) { - mediaTest.CurrentCHS = new chsType + mediaTest.CurrentCHS = new Chs { Cylinders = ataId.CurrentCylinders, Heads = ataId.CurrentHeads, @@ -647,37 +170,27 @@ namespace DiscImageChef.Core.Devices.Report if(mediaTest.Blocks == 0) mediaTest.Blocks = (ulong)(ataId.CurrentCylinders * ataId.CurrentHeads * ataId.CurrentSectorsPerTrack); - mediaTest.BlocksSpecified = true; } if(ataId.Capabilities.HasFlag(Identify.CapabilitiesBit.LBASupport)) { - mediaTest.LBASectors = ataId.LBASectors; - mediaTest.LBASectorsSpecified = true; - mediaTest.Blocks = ataId.LBASectors; - mediaTest.BlocksSpecified = true; + mediaTest.LBASectors = ataId.LBASectors; + mediaTest.Blocks = ataId.LBASectors; } if(ataId.CommandSet2.HasFlag(Identify.CommandSetBit2.LBA48)) { - mediaTest.LBA48Sectors = ataId.LBA48Sectors; - mediaTest.LBA48SectorsSpecified = true; - mediaTest.Blocks = ataId.LBA48Sectors; - mediaTest.BlocksSpecified = true; + mediaTest.LBA48Sectors = ataId.LBA48Sectors; + mediaTest.Blocks = ataId.LBA48Sectors; } if(ataId.NominalRotationRate != 0x0000 && ataId.NominalRotationRate != 0xFFFF) if(ataId.NominalRotationRate == 0x0001) - { - mediaTest.SolidStateDevice = true; - mediaTest.SolidStateDeviceSpecified = true; - } + mediaTest.SolidStateDevice = true; else { - mediaTest.SolidStateDevice = false; - mediaTest.SolidStateDeviceSpecified = true; - mediaTest.NominalRotationRate = ataId.NominalRotationRate; - mediaTest.NominalRotationRateSpecified = true; + mediaTest.SolidStateDevice = false; + mediaTest.NominalRotationRate = ataId.NominalRotationRate; } uint logicalsectorsize; @@ -702,66 +215,32 @@ namespace DiscImageChef.Core.Devices.Report physicalsectorsize = 512; } - mediaTest.BlockSize = logicalsectorsize; - mediaTest.BlockSizeSpecified = true; + mediaTest.BlockSize = logicalsectorsize; if(physicalsectorsize != logicalsectorsize) { - mediaTest.PhysicalBlockSize = physicalsectorsize; - mediaTest.PhysicalBlockSizeSpecified = true; + mediaTest.PhysicalBlockSize = physicalsectorsize; if((ataId.LogicalAlignment & 0x8000) == 0x0000 && (ataId.LogicalAlignment & 0x4000) == 0x4000) - { - mediaTest.LogicalAlignment = (ushort)(ataId.LogicalAlignment & 0x3FFF); - mediaTest.LogicalAlignmentSpecified = true; - } + mediaTest.LogicalAlignment = (ushort)(ataId.LogicalAlignment & 0x3FFF); } if(ataId.EccBytes != 0x0000 && ataId.EccBytes != 0xFFFF) - { - mediaTest.LongBlockSize = logicalsectorsize + ataId.EccBytes; - mediaTest.LongBlockSizeSpecified = true; - } + mediaTest.LongBlockSize = logicalsectorsize + ataId.EccBytes; if(ataId.UnformattedBPS > logicalsectorsize && - (!mediaTest.LongBlockSizeSpecified || mediaTest.LongBlockSize == 516)) - { - mediaTest.LongBlockSize = ataId.UnformattedBPS; - mediaTest.LongBlockSizeSpecified = true; - } + (!(ataId.EccBytes != 0x0000 && ataId.EccBytes != 0xFFFF) || mediaTest.LongBlockSize == 516)) + mediaTest.LongBlockSize = ataId.UnformattedBPS; if(ataId.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeSet) && !ataId.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeClear) && ataId.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.MediaSerial)) { - mediaTest.CanReadMediaSerial = true; - mediaTest.CanReadMediaSerialSpecified = true; + mediaTest.CanReadMediaSerial = true; if(!string.IsNullOrWhiteSpace(ataId.MediaManufacturer)) - { - mediaTest.Manufacturer = ataId.MediaManufacturer; - mediaTest.ManufacturerSpecified = true; - } + mediaTest.Manufacturer = ataId.MediaManufacturer; } - mediaTest.SupportsReadLbaSpecified = true; - mediaTest.SupportsReadRetryLbaSpecified = true; - mediaTest.SupportsReadDmaLbaSpecified = true; - mediaTest.SupportsReadDmaRetryLbaSpecified = true; - mediaTest.SupportsReadLongLbaSpecified = true; - mediaTest.SupportsReadLongRetryLbaSpecified = true; - mediaTest.SupportsSeekLbaSpecified = true; - - mediaTest.SupportsReadLba48Specified = true; - mediaTest.SupportsReadDmaLba48Specified = true; - - mediaTest.SupportsReadSpecified = true; - mediaTest.SupportsReadRetrySpecified = true; - mediaTest.SupportsReadDmaSpecified = true; - mediaTest.SupportsReadDmaRetrySpecified = true; - mediaTest.SupportsReadLongSpecified = true; - mediaTest.SupportsReadLongRetrySpecified = true; - mediaTest.SupportsSeekSpecified = true; - ulong checkCorrectRead = BitConverter.ToUInt64(buffer, 0); bool sense; @@ -900,25 +379,17 @@ namespace DiscImageChef.Core.Devices.Report dev.AtaIdentify(out buffer, out _, TIMEOUT, out _); if(Identify.Decode(buffer).HasValue) { - mediaTest.LongBlockSizeSpecified = false; - ataId = Identify.Decode(buffer).Value; if(ataId.EccBytes != 0x0000 && ataId.EccBytes != 0xFFFF) - { - mediaTest.LongBlockSize = logicalsectorsize + ataId.EccBytes; - mediaTest.LongBlockSizeSpecified = true; - } + mediaTest.LongBlockSize = logicalsectorsize + ataId.EccBytes; if(ataId.UnformattedBPS > logicalsectorsize && - (!mediaTest.LongBlockSizeSpecified || mediaTest.LongBlockSize == 516)) - { - mediaTest.LongBlockSize = ataId.UnformattedBPS; - mediaTest.LongBlockSizeSpecified = true; - } + (!(ataId.EccBytes != 0x0000 && ataId.EccBytes != 0xFFFF) || + mediaTest.LongBlockSize == 516)) mediaTest.LongBlockSize = ataId.UnformattedBPS; } DicConsole.WriteLine("Trying READ LONG in CHS mode..."); - sense = dev.ReadLong(out readBuf, out errorChs, false, 0, 0, 1, mediaTest.LongBlockSize, + sense = dev.ReadLong(out readBuf, out errorChs, false, 0, 0, 1, mediaTest.LongBlockSize ?? 0, TIMEOUT, out _); mediaTest.SupportsReadLong = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0 && @@ -931,8 +402,8 @@ namespace DiscImageChef.Core.Devices.Report "read results", readBuf); DicConsole.WriteLine("Trying READ LONG RETRY in CHS mode..."); - sense = dev.ReadLong(out readBuf, out errorChs, true, 0, 0, 1, mediaTest.LongBlockSize, TIMEOUT, - out _); + sense = dev.ReadLong(out readBuf, out errorChs, true, 0, 0, 1, mediaTest.LongBlockSize ?? 0, + TIMEOUT, out _); mediaTest.SupportsReadLongRetry = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead; @@ -944,7 +415,7 @@ namespace DiscImageChef.Core.Devices.Report "_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf); DicConsole.WriteLine("Trying READ LONG in LBA mode..."); - sense = dev.ReadLong(out readBuf, out errorLba, false, 0, mediaTest.LongBlockSize, TIMEOUT, + sense = dev.ReadLong(out readBuf, out errorLba, false, 0, mediaTest.LongBlockSize ?? 0, TIMEOUT, out _); mediaTest.SupportsReadLongLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && @@ -958,7 +429,7 @@ namespace DiscImageChef.Core.Devices.Report "read results", readBuf); DicConsole.WriteLine("Trying READ LONG RETRY in LBA mode..."); - sense = dev.ReadLong(out readBuf, out errorLba, true, 0, mediaTest.LongBlockSize, TIMEOUT, + sense = dev.ReadLong(out readBuf, out errorLba, true, 0, mediaTest.LongBlockSize ?? 0, TIMEOUT, out _); mediaTest.SupportsReadLongRetryLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0 && @@ -979,36 +450,26 @@ namespace DiscImageChef.Core.Devices.Report } else { - report.ATA.ReadCapabilities = new testedMediaType(); + Identify.IdentifyDevice ataId = report.ATA.IdentifyDevice.Value; - if(ataId.UnformattedBPT != 0) - { - report.ATA.ReadCapabilities.UnformattedBPT = ataId.UnformattedBPT; - report.ATA.ReadCapabilities.UnformattedBPTSpecified = true; - } + report.ATA.ReadCapabilities = new TestedMedia(); - if(ataId.UnformattedBPS != 0) - { - report.ATA.ReadCapabilities.UnformattedBPS = ataId.UnformattedBPS; - report.ATA.ReadCapabilities.UnformattedBPSSpecified = true; - } + if(ataId.UnformattedBPT != 0) report.ATA.ReadCapabilities.UnformattedBPT = ataId.UnformattedBPT; + + if(ataId.UnformattedBPS != 0) report.ATA.ReadCapabilities.UnformattedBPS = ataId.UnformattedBPS; if(ataId.Cylinders > 0 && ataId.Heads > 0 && ataId.SectorsPerTrack > 0) { - report.ATA.ReadCapabilities.CHS = new chsType + report.ATA.ReadCapabilities.CHS = new Chs { - Cylinders = ataId.Cylinders, - Heads = ataId.Heads, - Sectors = ataId.SectorsPerTrack + Cylinders = ataId.Cylinders, Heads = ataId.Heads, Sectors = ataId.SectorsPerTrack }; - report.ATA.ReadCapabilities.Blocks = - (ulong)(ataId.Cylinders * ataId.Heads * ataId.SectorsPerTrack); - report.ATA.ReadCapabilities.BlocksSpecified = true; + report.ATA.ReadCapabilities.Blocks = (ulong)(ataId.Cylinders * ataId.Heads * ataId.SectorsPerTrack); } if(ataId.CurrentCylinders > 0 && ataId.CurrentHeads > 0 && ataId.CurrentSectorsPerTrack > 0) { - report.ATA.ReadCapabilities.CurrentCHS = new chsType + report.ATA.ReadCapabilities.CurrentCHS = new Chs { Cylinders = ataId.CurrentCylinders, Heads = ataId.CurrentHeads, @@ -1016,37 +477,27 @@ namespace DiscImageChef.Core.Devices.Report }; report.ATA.ReadCapabilities.Blocks = (ulong)(ataId.CurrentCylinders * ataId.CurrentHeads * ataId.CurrentSectorsPerTrack); - report.ATA.ReadCapabilities.BlocksSpecified = true; } if(ataId.Capabilities.HasFlag(Identify.CapabilitiesBit.LBASupport)) { - report.ATA.ReadCapabilities.LBASectors = ataId.LBASectors; - report.ATA.ReadCapabilities.LBASectorsSpecified = true; - report.ATA.ReadCapabilities.Blocks = ataId.LBASectors; - report.ATA.ReadCapabilities.BlocksSpecified = true; + report.ATA.ReadCapabilities.LBASectors = ataId.LBASectors; + report.ATA.ReadCapabilities.Blocks = ataId.LBASectors; } if(ataId.CommandSet2.HasFlag(Identify.CommandSetBit2.LBA48)) { - report.ATA.ReadCapabilities.LBA48Sectors = ataId.LBA48Sectors; - report.ATA.ReadCapabilities.LBA48SectorsSpecified = true; - report.ATA.ReadCapabilities.Blocks = ataId.LBA48Sectors; - report.ATA.ReadCapabilities.BlocksSpecified = true; + report.ATA.ReadCapabilities.LBA48Sectors = ataId.LBA48Sectors; + report.ATA.ReadCapabilities.Blocks = ataId.LBA48Sectors; } if(ataId.NominalRotationRate != 0x0000 && ataId.NominalRotationRate != 0xFFFF) if(ataId.NominalRotationRate == 0x0001) - { - report.ATA.ReadCapabilities.SolidStateDevice = true; - report.ATA.ReadCapabilities.SolidStateDeviceSpecified = true; - } + report.ATA.ReadCapabilities.SolidStateDevice = true; else { - report.ATA.ReadCapabilities.SolidStateDevice = false; - report.ATA.ReadCapabilities.SolidStateDeviceSpecified = true; - report.ATA.ReadCapabilities.NominalRotationRate = ataId.NominalRotationRate; - report.ATA.ReadCapabilities.NominalRotationRateSpecified = true; + report.ATA.ReadCapabilities.SolidStateDevice = false; + report.ATA.ReadCapabilities.NominalRotationRate = ataId.NominalRotationRate; } uint logicalsectorsize; @@ -1070,67 +521,32 @@ namespace DiscImageChef.Core.Devices.Report physicalsectorsize = 512; } - report.ATA.ReadCapabilities.BlockSize = logicalsectorsize; - report.ATA.ReadCapabilities.BlockSizeSpecified = true; + report.ATA.ReadCapabilities.BlockSize = logicalsectorsize; if(physicalsectorsize != logicalsectorsize) { - report.ATA.ReadCapabilities.PhysicalBlockSize = physicalsectorsize; - report.ATA.ReadCapabilities.PhysicalBlockSizeSpecified = true; + report.ATA.ReadCapabilities.PhysicalBlockSize = physicalsectorsize; if((ataId.LogicalAlignment & 0x8000) == 0x0000 && (ataId.LogicalAlignment & 0x4000) == 0x4000) - { - report.ATA.ReadCapabilities.LogicalAlignment = - (ushort)(ataId.LogicalAlignment & 0x3FFF); - report.ATA.ReadCapabilities.LogicalAlignmentSpecified = true; - } + report.ATA.ReadCapabilities.LogicalAlignment = (ushort)(ataId.LogicalAlignment & 0x3FFF); } if(ataId.EccBytes != 0x0000 && ataId.EccBytes != 0xFFFF) - { - report.ATA.ReadCapabilities.LongBlockSize = logicalsectorsize + ataId.EccBytes; - report.ATA.ReadCapabilities.LongBlockSizeSpecified = true; - } + report.ATA.ReadCapabilities.LongBlockSize = logicalsectorsize + ataId.EccBytes; if(ataId.UnformattedBPS > logicalsectorsize && - (!report.ATA.ReadCapabilities.LongBlockSizeSpecified || + (!(ataId.EccBytes != 0x0000 && ataId.EccBytes != 0xFFFF) || report.ATA.ReadCapabilities.LongBlockSize == 516)) - { - report.ATA.ReadCapabilities.LongBlockSize = ataId.UnformattedBPS; - report.ATA.ReadCapabilities.LongBlockSizeSpecified = true; - } + report.ATA.ReadCapabilities.LongBlockSize = ataId.UnformattedBPS; if(ataId.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeSet) && !ataId.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeClear) && ataId.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.MediaSerial)) { - report.ATA.ReadCapabilities.CanReadMediaSerial = true; - report.ATA.ReadCapabilities.CanReadMediaSerialSpecified = true; + report.ATA.ReadCapabilities.CanReadMediaSerial = true; if(!string.IsNullOrWhiteSpace(ataId.MediaManufacturer)) - { - report.ATA.ReadCapabilities.Manufacturer = ataId.MediaManufacturer; - report.ATA.ReadCapabilities.ManufacturerSpecified = true; - } + report.ATA.ReadCapabilities.Manufacturer = ataId.MediaManufacturer; } - report.ATA.ReadCapabilities.SupportsReadLbaSpecified = true; - report.ATA.ReadCapabilities.SupportsReadRetryLbaSpecified = true; - report.ATA.ReadCapabilities.SupportsReadDmaLbaSpecified = true; - report.ATA.ReadCapabilities.SupportsReadDmaRetryLbaSpecified = true; - report.ATA.ReadCapabilities.SupportsReadLongLbaSpecified = true; - report.ATA.ReadCapabilities.SupportsReadLongRetryLbaSpecified = true; - report.ATA.ReadCapabilities.SupportsSeekLbaSpecified = true; - - report.ATA.ReadCapabilities.SupportsReadLba48Specified = true; - report.ATA.ReadCapabilities.SupportsReadDmaLba48Specified = true; - - report.ATA.ReadCapabilities.SupportsReadSpecified = true; - report.ATA.ReadCapabilities.SupportsReadRetrySpecified = true; - report.ATA.ReadCapabilities.SupportsReadDmaSpecified = true; - report.ATA.ReadCapabilities.SupportsReadDmaRetrySpecified = true; - report.ATA.ReadCapabilities.SupportsReadLongSpecified = true; - report.ATA.ReadCapabilities.SupportsReadLongRetrySpecified = true; - report.ATA.ReadCapabilities.SupportsSeekSpecified = true; - ulong checkCorrectRead = BitConverter.ToUInt64(buffer, 0); bool sense; @@ -1143,8 +559,8 @@ namespace DiscImageChef.Core.Devices.Report "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorChs.Status, errorChs.Error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readsectorschs", "_debug_" + report.ATA.Model + ".bin", - "read results", readBuf); + DataFile.WriteTo("ATA Report", "readsectorschs", + "_debug_" + report.ATA.IdentifyDevice?.Model + ".bin", "read results", readBuf); DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in CHS mode..."); sense = dev.Read(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _); @@ -1154,8 +570,8 @@ namespace DiscImageChef.Core.Devices.Report "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorChs.Status, errorChs.Error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readsectorsretrychs", "_debug_" + report.ATA.Model + ".bin", - "read results", readBuf); + DataFile.WriteTo("ATA Report", "readsectorsretrychs", + "_debug_" + report.ATA.IdentifyDevice?.Model + ".bin", "read results", readBuf); DicConsole.WriteLine("Trying READ DMA in CHS mode..."); sense = dev.ReadDma(out readBuf, out errorChs, false, 0, 0, 1, 1, TIMEOUT, out _); @@ -1165,8 +581,8 @@ namespace DiscImageChef.Core.Devices.Report "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorChs.Status, errorChs.Error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readdmachs", "_debug_" + report.ATA.Model + ".bin", "read results", - readBuf); + DataFile.WriteTo("ATA Report", "readdmachs", "_debug_" + report.ATA.IdentifyDevice?.Model + ".bin", + "read results", readBuf); DicConsole.WriteLine("Trying READ DMA RETRY in CHS mode..."); sense = dev.ReadDma(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _); @@ -1176,8 +592,8 @@ namespace DiscImageChef.Core.Devices.Report "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorChs.Status, errorChs.Error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readdmaretrychs", "_debug_" + report.ATA.Model + ".bin", - "read results", readBuf); + DataFile.WriteTo("ATA Report", "readdmaretrychs", + "_debug_" + report.ATA.IdentifyDevice?.Model + ".bin", "read results", readBuf); DicConsole.WriteLine("Trying SEEK in CHS mode..."); sense = dev.Seek(out errorChs, 0, 0, 1, TIMEOUT, out _); @@ -1194,8 +610,8 @@ namespace DiscImageChef.Core.Devices.Report "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorLba.Status, errorLba.Error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readsectors", "_debug_" + report.ATA.Model + ".bin", "read results", - readBuf); + DataFile.WriteTo("ATA Report", "readsectors", "_debug_" + report.ATA.IdentifyDevice?.Model + ".bin", + "read results", readBuf); DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in LBA mode..."); sense = dev.Read(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _); @@ -1205,8 +621,8 @@ namespace DiscImageChef.Core.Devices.Report "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorLba.Status, errorLba.Error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readsectorsretry", "_debug_" + report.ATA.Model + ".bin", - "read results", readBuf); + DataFile.WriteTo("ATA Report", "readsectorsretry", + "_debug_" + report.ATA.IdentifyDevice?.Model + ".bin", "read results", readBuf); DicConsole.WriteLine("Trying READ DMA in LBA mode..."); sense = dev.ReadDma(out readBuf, out errorLba, false, 0, 1, TIMEOUT, out _); @@ -1216,8 +632,8 @@ namespace DiscImageChef.Core.Devices.Report "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorLba.Status, errorLba.Error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readdma", "_debug_" + report.ATA.Model + ".bin", "read results", - readBuf); + DataFile.WriteTo("ATA Report", "readdma", "_debug_" + report.ATA.IdentifyDevice?.Model + ".bin", + "read results", readBuf); DicConsole.WriteLine("Trying READ DMA RETRY in LBA mode..."); sense = dev.ReadDma(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _); @@ -1227,8 +643,8 @@ namespace DiscImageChef.Core.Devices.Report "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorLba.Status, errorLba.Error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readdmaretry", "_debug_" + report.ATA.Model + ".bin", - "read results", readBuf); + DataFile.WriteTo("ATA Report", "readdmaretry", + "_debug_" + report.ATA.IdentifyDevice?.Model + ".bin", "read results", readBuf); DicConsole.WriteLine("Trying SEEK in LBA mode..."); sense = dev.Seek(out errorLba, 0, TIMEOUT, out _); @@ -1245,8 +661,8 @@ namespace DiscImageChef.Core.Devices.Report "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorLba48.Status, errorLba48.Error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readsectors48", "_debug_" + report.ATA.Model + ".bin", - "read results", readBuf); + DataFile.WriteTo("ATA Report", "readsectors48", + "_debug_" + report.ATA.IdentifyDevice?.Model + ".bin", "read results", readBuf); DicConsole.WriteLine("Trying READ DMA in LBA48 mode..."); sense = dev.ReadDma(out readBuf, out errorLba48, 0, 1, TIMEOUT, out _); @@ -1256,8 +672,8 @@ namespace DiscImageChef.Core.Devices.Report "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorLba48.Status, errorLba48.Error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readdma48", "_debug_" + report.ATA.Model + ".bin", "read results", - readBuf); + DataFile.WriteTo("ATA Report", "readdma48", "_debug_" + report.ATA.IdentifyDevice?.Model + ".bin", + "read results", readBuf); // Send SET FEATURES before sending READ LONG commands, retrieve IDENTIFY again and // check if ECC size changed. Sector is set to 1 because without it most drives just return @@ -1267,27 +683,19 @@ namespace DiscImageChef.Core.Devices.Report dev.AtaIdentify(out buffer, out _, TIMEOUT, out _); if(Identify.Decode(buffer).HasValue) { - report.ATA.ReadCapabilities.LongBlockSizeSpecified = false; - ataId = Identify.Decode(buffer).Value; if(ataId.EccBytes != 0x0000 && ataId.EccBytes != 0xFFFF) - { - report.ATA.ReadCapabilities.LongBlockSize = logicalsectorsize + ataId.EccBytes; - report.ATA.ReadCapabilities.LongBlockSizeSpecified = true; - } + report.ATA.ReadCapabilities.LongBlockSize = logicalsectorsize + ataId.EccBytes; if(ataId.UnformattedBPS > logicalsectorsize && - (!report.ATA.ReadCapabilities.LongBlockSizeSpecified || + (!(ataId.EccBytes != 0x0000 && ataId.EccBytes != 0xFFFF) || report.ATA.ReadCapabilities.LongBlockSize == 516)) - { - report.ATA.ReadCapabilities.LongBlockSize = ataId.UnformattedBPS; - report.ATA.ReadCapabilities.LongBlockSizeSpecified = true; - } + report.ATA.ReadCapabilities.LongBlockSize = ataId.UnformattedBPS; } DicConsole.WriteLine("Trying READ LONG in CHS mode..."); sense = dev.ReadLong(out readBuf, out errorChs, false, 0, 0, 1, - report.ATA.ReadCapabilities.LongBlockSize, TIMEOUT, out _); + report.ATA.ReadCapabilities.LongBlockSize ?? 0, TIMEOUT, out _); report.ATA.ReadCapabilities.SupportsReadLong = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead; @@ -1295,12 +703,12 @@ namespace DiscImageChef.Core.Devices.Report "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorChs.Status, errorChs.Error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readlongchs", "_debug_" + report.ATA.Model + ".bin", "read results", - readBuf); + DataFile.WriteTo("ATA Report", "readlongchs", "_debug_" + report.ATA.IdentifyDevice?.Model + ".bin", + "read results", readBuf); DicConsole.WriteLine("Trying READ LONG RETRY in CHS mode..."); sense = dev.ReadLong(out readBuf, out errorChs, true, 0, 0, 1, - report.ATA.ReadCapabilities.LongBlockSize, TIMEOUT, out _); + report.ATA.ReadCapabilities.LongBlockSize ?? 0, TIMEOUT, out _); report.ATA.ReadCapabilities.SupportsReadLongRetry = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead; @@ -1308,12 +716,12 @@ namespace DiscImageChef.Core.Devices.Report "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorChs.Status, errorChs.Error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readlongretrychs", "_debug_" + report.ATA.Model + ".bin", - "read results", readBuf); + DataFile.WriteTo("ATA Report", "readlongretrychs", + "_debug_" + report.ATA.IdentifyDevice?.Model + ".bin", "read results", readBuf); DicConsole.WriteLine("Trying READ LONG in LBA mode..."); - sense = dev.ReadLong(out readBuf, out errorLba, false, 0, report.ATA.ReadCapabilities.LongBlockSize, - TIMEOUT, out _); + sense = dev.ReadLong(out readBuf, out errorLba, false, 0, + report.ATA.ReadCapabilities.LongBlockSize ?? 0, TIMEOUT, out _); report.ATA.ReadCapabilities.SupportsReadLongLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead; @@ -1321,11 +729,11 @@ namespace DiscImageChef.Core.Devices.Report "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorLba.Status, errorLba.Error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readlong", "_debug_" + report.ATA.Model + ".bin", "read results", - readBuf); + DataFile.WriteTo("ATA Report", "readlong", "_debug_" + report.ATA.IdentifyDevice?.Model + ".bin", + "read results", readBuf); DicConsole.WriteLine("Trying READ LONG RETRY in LBA mode..."); - sense = dev.ReadLong(out readBuf, out errorLba, true, 0, report.ATA.ReadCapabilities.LongBlockSize, + sense = dev.ReadLong(out readBuf, out errorLba, true, 0, report.ATA.ReadCapabilities.LongBlockSize ?? 0, TIMEOUT, out _); report.ATA.ReadCapabilities.SupportsReadLongRetryLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0 && @@ -1334,8 +742,8 @@ namespace DiscImageChef.Core.Devices.Report "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense, errorLba.Status, errorLba.Error, readBuf.Length); if(debug) - DataFile.WriteTo("ATA Report", "readlongretry", "_debug_" + report.ATA.Model + ".bin", - "read results", readBuf); + DataFile.WriteTo("ATA Report", "readlongretry", + "_debug_" + report.ATA.IdentifyDevice?.Model + ".bin", "read results", readBuf); } } } diff --git a/DiscImageChef.Core/Devices/Report/ATAPI.cs b/DiscImageChef.Core/Devices/Report/ATAPI.cs index 788fbde14..9c0fa3f34 100644 --- a/DiscImageChef.Core/Devices/Report/ATAPI.cs +++ b/DiscImageChef.Core/Devices/Report/ATAPI.cs @@ -48,7 +48,7 @@ namespace DiscImageChef.Core.Devices.Report /// Device /// Device report /// If debug is enabled - internal static void Report(Device dev, ref DeviceReport report, bool debug) + internal static void Report(Device dev, ref DeviceReportV2 report, bool debug) { if(report == null) return; @@ -61,486 +61,7 @@ namespace DiscImageChef.Core.Devices.Report if(!Identify.Decode(buffer).HasValue) return; Identify.IdentifyDevice? atapiIdNullable = Identify.Decode(buffer); - if(atapiIdNullable != null) - { - Identify.IdentifyDevice atapiId = atapiIdNullable.Value; - - report.ATAPI = new ataType(); - - if(!string.IsNullOrWhiteSpace(atapiId.AdditionalPID)) - { - report.ATAPI.AdditionalPID = atapiId.AdditionalPID; - report.ATAPI.AdditionalPIDSpecified = true; - } - - if(atapiId.APIOSupported != 0) - { - report.ATAPI.APIOSupported = atapiId.APIOSupported; - report.ATAPI.APIOSupportedSpecified = true; - } - - if(atapiId.ATAPIByteCount != 0) - { - report.ATAPI.ATAPIByteCount = atapiId.ATAPIByteCount; - report.ATAPI.ATAPIByteCountSpecified = true; - } - - if(atapiId.BufferType != 0) - { - report.ATAPI.BufferType = atapiId.BufferType; - report.ATAPI.BufferTypeSpecified = true; - } - - if(atapiId.BufferSize != 0) - { - report.ATAPI.BufferSize = atapiId.BufferSize; - report.ATAPI.BufferSizeSpecified = true; - } - - if(atapiId.Capabilities != 0) - { - report.ATAPI.Capabilities = atapiId.Capabilities; - report.ATAPI.CapabilitiesSpecified = true; - } - - if(atapiId.Capabilities2 != 0) - { - report.ATAPI.Capabilities2 = atapiId.Capabilities2; - report.ATAPI.Capabilities2Specified = true; - } - - if(atapiId.Capabilities3 != 0) - { - report.ATAPI.Capabilities3 = atapiId.Capabilities3; - report.ATAPI.Capabilities3Specified = true; - } - - if(atapiId.CFAPowerMode != 0) - { - report.ATAPI.CFAPowerMode = atapiId.CFAPowerMode; - report.ATAPI.CFAPowerModeSpecified = true; - } - - if(atapiId.CommandSet != 0) - { - report.ATAPI.CommandSet = atapiId.CommandSet; - report.ATAPI.CommandSetSpecified = true; - } - - if(atapiId.CommandSet2 != 0) - { - report.ATAPI.CommandSet2 = atapiId.CommandSet2; - report.ATAPI.CommandSet2Specified = true; - } - - if(atapiId.CommandSet3 != 0) - { - report.ATAPI.CommandSet3 = atapiId.CommandSet3; - report.ATAPI.CommandSet3Specified = true; - } - - if(atapiId.CommandSet4 != 0) - { - report.ATAPI.CommandSet4 = atapiId.CommandSet4; - report.ATAPI.CommandSet4Specified = true; - } - - if(atapiId.CommandSet5 != 0) - { - report.ATAPI.CommandSet5 = atapiId.CommandSet5; - report.ATAPI.CommandSet5Specified = true; - } - - if(atapiId.CurrentAAM != 0) - { - report.ATAPI.CurrentAAM = atapiId.CurrentAAM; - report.ATAPI.CurrentAAMSpecified = true; - } - - if(atapiId.CurrentAPM != 0) - { - report.ATAPI.CurrentAPM = atapiId.CurrentAPM; - report.ATAPI.CurrentAPMSpecified = true; - } - - if(atapiId.DataSetMgmt != 0) - { - report.ATAPI.DataSetMgmt = atapiId.DataSetMgmt; - report.ATAPI.DataSetMgmtSpecified = true; - } - - if(atapiId.DataSetMgmtSize != 0) - { - report.ATAPI.DataSetMgmtSize = atapiId.DataSetMgmtSize; - report.ATAPI.DataSetMgmtSizeSpecified = true; - } - - if(atapiId.DeviceFormFactor != 0) - { - report.ATAPI.DeviceFormFactor = atapiId.DeviceFormFactor; - report.ATAPI.DeviceFormFactorSpecified = true; - } - - if(atapiId.DMAActive != 0) - { - report.ATAPI.DMAActive = atapiId.DMAActive; - report.ATAPI.DMAActiveSpecified = true; - } - - if(atapiId.DMASupported != 0) - { - report.ATAPI.DMASupported = atapiId.DMASupported; - report.ATAPI.DMASupportedSpecified = true; - } - - if(atapiId.DMATransferTimingMode != 0) - { - report.ATAPI.DMATransferTimingMode = atapiId.DMATransferTimingMode; - report.ATAPI.DMATransferTimingModeSpecified = true; - } - - if(atapiId.EnhancedSecurityEraseTime != 0) - { - report.ATAPI.EnhancedSecurityEraseTime = atapiId.EnhancedSecurityEraseTime; - report.ATAPI.EnhancedSecurityEraseTimeSpecified = true; - } - - if(atapiId.EnabledCommandSet != 0) - { - report.ATAPI.EnabledCommandSet = atapiId.EnabledCommandSet; - report.ATAPI.EnabledCommandSetSpecified = true; - } - - if(atapiId.EnabledCommandSet2 != 0) - { - report.ATAPI.EnabledCommandSet2 = atapiId.EnabledCommandSet2; - report.ATAPI.EnabledCommandSet2Specified = true; - } - - if(atapiId.EnabledCommandSet3 != 0) - { - report.ATAPI.EnabledCommandSet3 = atapiId.EnabledCommandSet3; - report.ATAPI.EnabledCommandSet3Specified = true; - } - - if(atapiId.EnabledCommandSet4 != 0) - { - report.ATAPI.EnabledCommandSet4 = atapiId.EnabledCommandSet4; - report.ATAPI.EnabledCommandSet4Specified = true; - } - - if(atapiId.EnabledSATAFeatures != 0) - { - report.ATAPI.EnabledSATAFeatures = atapiId.EnabledSATAFeatures; - report.ATAPI.EnabledSATAFeaturesSpecified = true; - } - - if(atapiId.ExtendedUserSectors != 0) - { - report.ATAPI.ExtendedUserSectors = atapiId.ExtendedUserSectors; - report.ATAPI.ExtendedUserSectorsSpecified = true; - } - - if(atapiId.FreeFallSensitivity != 0) - { - report.ATAPI.FreeFallSensitivity = atapiId.FreeFallSensitivity; - report.ATAPI.FreeFallSensitivitySpecified = true; - } - - if(!string.IsNullOrWhiteSpace(atapiId.FirmwareRevision)) - { - report.ATAPI.FirmwareRevision = atapiId.FirmwareRevision; - report.ATAPI.FirmwareRevisionSpecified = true; - } - - if(atapiId.GeneralConfiguration != 0) - { - report.ATAPI.GeneralConfiguration = atapiId.GeneralConfiguration; - report.ATAPI.GeneralConfigurationSpecified = true; - } - - if(atapiId.HardwareResetResult != 0) - { - report.ATAPI.HardwareResetResult = atapiId.HardwareResetResult; - report.ATAPI.HardwareResetResultSpecified = true; - } - - if(atapiId.InterseekDelay != 0) - { - report.ATAPI.InterseekDelay = atapiId.InterseekDelay; - report.ATAPI.InterseekDelaySpecified = true; - } - - if(atapiId.MajorVersion != 0) - { - report.ATAPI.MajorVersion = atapiId.MajorVersion; - report.ATAPI.MajorVersionSpecified = true; - } - - if(atapiId.MasterPasswordRevisionCode != 0) - { - report.ATAPI.MasterPasswordRevisionCode = atapiId.MasterPasswordRevisionCode; - report.ATAPI.MasterPasswordRevisionCodeSpecified = true; - } - - if(atapiId.MaxDownloadMicroMode3 != 0) - { - report.ATAPI.MaxDownloadMicroMode3 = atapiId.MaxDownloadMicroMode3; - report.ATAPI.MaxDownloadMicroMode3Specified = true; - } - - if(atapiId.MaxQueueDepth != 0) - { - report.ATAPI.MaxQueueDepth = atapiId.MaxQueueDepth; - report.ATAPI.MaxQueueDepthSpecified = true; - } - - if(atapiId.MDMAActive != 0) - { - report.ATAPI.MDMAActive = atapiId.MDMAActive; - report.ATAPI.MDMAActiveSpecified = true; - } - - if(atapiId.MDMASupported != 0) - { - report.ATAPI.MDMASupported = atapiId.MDMASupported; - report.ATAPI.MDMASupportedSpecified = true; - } - - if(atapiId.MinDownloadMicroMode3 != 0) - { - report.ATAPI.MinDownloadMicroMode3 = atapiId.MinDownloadMicroMode3; - report.ATAPI.MinDownloadMicroMode3Specified = true; - } - - if(atapiId.MinMDMACycleTime != 0) - { - report.ATAPI.MinMDMACycleTime = atapiId.MinMDMACycleTime; - report.ATAPI.MinMDMACycleTimeSpecified = true; - } - - if(atapiId.MinorVersion != 0) - { - report.ATAPI.MinorVersion = atapiId.MinorVersion; - report.ATAPI.MinorVersionSpecified = true; - } - - if(atapiId.MinPIOCycleTimeNoFlow != 0) - { - report.ATAPI.MinPIOCycleTimeNoFlow = atapiId.MinPIOCycleTimeNoFlow; - report.ATAPI.MinPIOCycleTimeNoFlowSpecified = true; - } - - if(atapiId.MinPIOCycleTimeFlow != 0) - { - report.ATAPI.MinPIOCycleTimeFlow = atapiId.MinPIOCycleTimeFlow; - report.ATAPI.MinPIOCycleTimeFlowSpecified = true; - } - - if(!string.IsNullOrWhiteSpace(atapiId.Model)) - { - report.ATAPI.Model = atapiId.Model; - report.ATAPI.ModelSpecified = true; - } - - if(atapiId.MultipleMaxSectors != 0) - { - report.ATAPI.MultipleMaxSectors = atapiId.MultipleMaxSectors; - report.ATAPI.MultipleMaxSectorsSpecified = true; - } - - if(atapiId.MultipleSectorNumber != 0) - { - report.ATAPI.MultipleSectorNumber = atapiId.MultipleSectorNumber; - report.ATAPI.MultipleSectorNumberSpecified = true; - } - - if(atapiId.NVCacheCaps != 0) - { - report.ATAPI.NVCacheCaps = atapiId.NVCacheCaps; - report.ATAPI.NVCacheCapsSpecified = true; - } - - if(atapiId.NVCacheSize != 0) - { - report.ATAPI.NVCacheSize = atapiId.NVCacheSize; - report.ATAPI.NVCacheSizeSpecified = true; - } - - if(atapiId.NVCacheWriteSpeed != 0) - { - report.ATAPI.NVCacheWriteSpeed = atapiId.NVCacheWriteSpeed; - report.ATAPI.NVCacheWriteSpeedSpecified = true; - } - - if(atapiId.NVEstimatedSpinUp != 0) - { - report.ATAPI.NVEstimatedSpinUp = atapiId.NVEstimatedSpinUp; - report.ATAPI.NVEstimatedSpinUpSpecified = true; - } - - if(atapiId.PacketBusRelease != 0) - { - report.ATAPI.PacketBusRelease = atapiId.PacketBusRelease; - report.ATAPI.PacketBusReleaseSpecified = true; - } - - if(atapiId.PIOTransferTimingMode != 0) - { - report.ATAPI.PIOTransferTimingMode = atapiId.PIOTransferTimingMode; - report.ATAPI.PIOTransferTimingModeSpecified = true; - } - - if(atapiId.RecommendedAAM != 0) - { - report.ATAPI.RecommendedAAM = atapiId.RecommendedAAM; - report.ATAPI.RecommendedAAMSpecified = true; - } - - if(atapiId.RecMDMACycleTime != 0) - { - report.ATAPI.RecommendedMDMACycleTime = atapiId.RecMDMACycleTime; - report.ATAPI.RecommendedMDMACycleTimeSpecified = true; - } - - if(atapiId.RemovableStatusSet != 0) - { - report.ATAPI.RemovableStatusSet = atapiId.RemovableStatusSet; - report.ATAPI.RemovableStatusSetSpecified = true; - } - - if(atapiId.SATACapabilities != 0) - { - report.ATAPI.SATACapabilities = atapiId.SATACapabilities; - report.ATAPI.SATACapabilitiesSpecified = true; - } - - if(atapiId.SATACapabilities2 != 0) - { - report.ATAPI.SATACapabilities2 = atapiId.SATACapabilities2; - report.ATAPI.SATACapabilities2Specified = true; - } - - if(atapiId.SATAFeatures != 0) - { - report.ATAPI.SATAFeatures = atapiId.SATAFeatures; - report.ATAPI.SATAFeaturesSpecified = true; - } - - if(atapiId.SCTCommandTransport != 0) - { - report.ATAPI.SCTCommandTransport = atapiId.SCTCommandTransport; - report.ATAPI.SCTCommandTransportSpecified = true; - } - - if(atapiId.SectorsPerCard != 0) - { - report.ATAPI.SectorsPerCard = atapiId.SectorsPerCard; - report.ATAPI.SectorsPerCardSpecified = true; - } - - if(atapiId.SecurityEraseTime != 0) - { - report.ATAPI.SecurityEraseTime = atapiId.SecurityEraseTime; - report.ATAPI.SecurityEraseTimeSpecified = true; - } - - if(atapiId.SecurityStatus != 0) - { - report.ATAPI.SecurityStatus = atapiId.SecurityStatus; - report.ATAPI.SecurityStatusSpecified = true; - } - - if(atapiId.ServiceBusyClear != 0) - { - report.ATAPI.ServiceBusyClear = atapiId.ServiceBusyClear; - report.ATAPI.ServiceBusyClearSpecified = true; - } - - if(atapiId.SpecificConfiguration != 0) - { - report.ATAPI.SpecificConfiguration = atapiId.SpecificConfiguration; - report.ATAPI.SpecificConfigurationSpecified = true; - } - - if(atapiId.StreamAccessLatency != 0) - { - report.ATAPI.StreamAccessLatency = atapiId.StreamAccessLatency; - report.ATAPI.StreamAccessLatencySpecified = true; - } - - if(atapiId.StreamMinReqSize != 0) - { - report.ATAPI.StreamMinReqSize = atapiId.StreamMinReqSize; - report.ATAPI.StreamMinReqSizeSpecified = true; - } - - if(atapiId.StreamPerformanceGranularity != 0) - { - report.ATAPI.StreamPerformanceGranularity = atapiId.StreamPerformanceGranularity; - report.ATAPI.StreamPerformanceGranularitySpecified = true; - } - - if(atapiId.StreamTransferTimeDMA != 0) - { - report.ATAPI.StreamTransferTimeDMA = atapiId.StreamTransferTimeDMA; - report.ATAPI.StreamTransferTimeDMASpecified = true; - } - - if(atapiId.StreamTransferTimePIO != 0) - { - report.ATAPI.StreamTransferTimePIO = atapiId.StreamTransferTimePIO; - report.ATAPI.StreamTransferTimePIOSpecified = true; - } - - if(atapiId.TransportMajorVersion != 0) - { - report.ATAPI.TransportMajorVersion = atapiId.TransportMajorVersion; - report.ATAPI.TransportMajorVersionSpecified = true; - } - - if(atapiId.TransportMinorVersion != 0) - { - report.ATAPI.TransportMinorVersion = atapiId.TransportMinorVersion; - report.ATAPI.TransportMinorVersionSpecified = true; - } - - if(atapiId.TrustedComputing != 0) - { - report.ATAPI.TrustedComputing = atapiId.TrustedComputing; - report.ATAPI.TrustedComputingSpecified = true; - } - - if(atapiId.UDMAActive != 0) - { - report.ATAPI.UDMAActive = atapiId.UDMAActive; - report.ATAPI.UDMAActiveSpecified = true; - } - - if(atapiId.UDMASupported != 0) - { - report.ATAPI.UDMASupported = atapiId.UDMASupported; - report.ATAPI.UDMASupportedSpecified = true; - } - - if(atapiId.WRVMode != 0) - { - report.ATAPI.WRVMode = atapiId.WRVMode; - report.ATAPI.WRVModeSpecified = true; - } - - if(atapiId.WRVSectorCountMode3 != 0) - { - report.ATAPI.WRVSectorCountMode3 = atapiId.WRVSectorCountMode3; - report.ATAPI.WRVSectorCountMode3Specified = true; - } - - if(atapiId.WRVSectorCountMode2 != 0) - { - report.ATAPI.WRVSectorCountMode2 = atapiId.WRVSectorCountMode2; - report.ATAPI.WRVSectorCountMode2Specified = true; - } - } + if(atapiIdNullable != null) report.ATAPI = new CommonTypes.Metadata.Ata {IdentifyDevice = atapiIdNullable}; if(debug) report.ATAPI.Identify = buffer; } diff --git a/DiscImageChef.Core/Devices/Report/FireWire.cs b/DiscImageChef.Core/Devices/Report/FireWire.cs index 95995a9f5..a241a463d 100644 --- a/DiscImageChef.Core/Devices/Report/FireWire.cs +++ b/DiscImageChef.Core/Devices/Report/FireWire.cs @@ -48,7 +48,7 @@ namespace DiscImageChef.Core.Devices.Report /// Device /// Device report /// If device is removable - internal static void Report(Device dev, ref DeviceReport report, ref bool removable) + internal static void Report(Device dev, ref DeviceReportV2 report, ref bool removable) { if(report == null) return; @@ -62,7 +62,7 @@ namespace DiscImageChef.Core.Devices.Report if(pressedKey.Key != ConsoleKey.Y) return; - report.FireWire = new firewireType + report.FireWire = new CommonTypes.Metadata.FireWire { Manufacturer = dev.FireWireVendorName, Product = dev.FireWireModelName, diff --git a/DiscImageChef.Core/Devices/Report/NVMe.cs b/DiscImageChef.Core/Devices/Report/NVMe.cs index 64513a501..3d190c109 100644 --- a/DiscImageChef.Core/Devices/Report/NVMe.cs +++ b/DiscImageChef.Core/Devices/Report/NVMe.cs @@ -38,7 +38,7 @@ namespace DiscImageChef.Core.Devices.Report { public static class Nvme { - public static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable) + public static void Report(Device dev, ref DeviceReportV2 report, bool debug, ref bool removable) { if(report == null) return; diff --git a/DiscImageChef.Core/Devices/Report/PCMCIA.cs b/DiscImageChef.Core/Devices/Report/PCMCIA.cs index e8f220898..1df5e3392 100644 --- a/DiscImageChef.Core/Devices/Report/PCMCIA.cs +++ b/DiscImageChef.Core/Devices/Report/PCMCIA.cs @@ -46,9 +46,9 @@ namespace DiscImageChef.Core.Devices.Report /// /// Device /// Device report - internal static void Report(Device dev, ref DeviceReport report) + internal static void Report(Device dev, ref DeviceReportV2 report) { - report.PCMCIA = new pcmciaType {CIS = dev.Cis}; + report.PCMCIA = new CommonTypes.Metadata.Pcmcia {CIS = dev.Cis}; Tuple[] tuples = CIS.GetTuples(dev.Cis); if(tuples == null) return; @@ -60,10 +60,8 @@ namespace DiscImageChef.Core.Devices.Report if(manfid != null) { - report.PCMCIA.ManufacturerCode = manfid.ManufacturerID; - report.PCMCIA.CardCode = manfid.CardID; - report.PCMCIA.ManufacturerCodeSpecified = true; - report.PCMCIA.CardCodeSpecified = true; + report.PCMCIA.ManufacturerCode = manfid.ManufacturerID; + report.PCMCIA.CardCode = manfid.CardID; } break; diff --git a/DiscImageChef.Core/Devices/Report/SCSI/General.cs b/DiscImageChef.Core/Devices/Report/SCSI/General.cs index 50adf9b22..273df108d 100644 --- a/DiscImageChef.Core/Devices/Report/SCSI/General.cs +++ b/DiscImageChef.Core/Devices/Report/SCSI/General.cs @@ -55,7 +55,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI /// Device report /// If debug is enabled /// If device is removable - public static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable) + public static void Report(Device dev, ref DeviceReportV2 report, bool debug, ref bool removable) { if(report == null) return; @@ -87,110 +87,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.WriteLine("Querying SCSI INQUIRY..."); sense = dev.ScsiInquiry(out byte[] buffer, out byte[] senseBuffer); - report.SCSI = new scsiType(); + report.SCSI = new Scsi(); if(!sense && Inquiry.Decode(buffer).HasValue) { - Inquiry.SCSIInquiry inq = Inquiry.Decode(buffer).Value; + report.SCSI.Inquiry = Inquiry.Decode(buffer); - List versionDescriptors = new List(); - report.SCSI.Inquiry = new scsiInquiryType(); - - if(inq.DeviceTypeModifier != 0) - { - report.SCSI.Inquiry.DeviceTypeModifier = inq.DeviceTypeModifier; - report.SCSI.Inquiry.DeviceTypeModifierSpecified = true; - } - - if(inq.ISOVersion != 0) - { - report.SCSI.Inquiry.ISOVersion = inq.ISOVersion; - report.SCSI.Inquiry.ISOVersionSpecified = true; - } - - if(inq.ECMAVersion != 0) - { - report.SCSI.Inquiry.ECMAVersion = inq.ECMAVersion; - report.SCSI.Inquiry.ECMAVersionSpecified = true; - } - - if(inq.ANSIVersion != 0) - { - report.SCSI.Inquiry.ANSIVersion = inq.ANSIVersion; - report.SCSI.Inquiry.ANSIVersionSpecified = true; - } - - if(inq.ResponseDataFormat != 0) - { - report.SCSI.Inquiry.ResponseDataFormat = inq.ResponseDataFormat; - report.SCSI.Inquiry.ResponseDataFormatSpecified = true; - } - - if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.VendorIdentification))) - { - report.SCSI.Inquiry.VendorIdentification = - StringHandlers.CToString(inq.VendorIdentification).Trim(); - if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.VendorIdentification)) - report.SCSI.Inquiry.VendorIdentificationSpecified = true; - } - - if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.ProductIdentification))) - { - report.SCSI.Inquiry.ProductIdentification = - StringHandlers.CToString(inq.ProductIdentification).Trim(); - if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.ProductIdentification)) - report.SCSI.Inquiry.ProductIdentificationSpecified = true; - } - - if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.ProductRevisionLevel))) - { - report.SCSI.Inquiry.ProductRevisionLevel = - StringHandlers.CToString(inq.ProductRevisionLevel).Trim(); - if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.ProductRevisionLevel)) - report.SCSI.Inquiry.ProductRevisionLevelSpecified = true; - } - - if(inq.VersionDescriptors != null) - { - versionDescriptors.AddRange(inq.VersionDescriptors.Where(descriptor => descriptor != 0)); - - if(versionDescriptors.Count > 0) - report.SCSI.Inquiry.VersionDescriptors = versionDescriptors.ToArray(); - } - - report.SCSI.Inquiry.PeripheralQualifier = (PeripheralQualifiers)inq.PeripheralQualifier; - report.SCSI.Inquiry.PeripheralDeviceType = (PeripheralDeviceTypes)inq.PeripheralDeviceType; - report.SCSI.Inquiry.AsymmetricalLUNAccess = (TGPSValues)inq.TPGS; - report.SCSI.Inquiry.SPIClocking = (SPIClocking)inq.Clocking; - - report.SCSI.Inquiry.AccessControlCoordinator = inq.ACC; - report.SCSI.Inquiry.ACKRequests = inq.ACKREQQ; - report.SCSI.Inquiry.AERCSupported = inq.AERC; - report.SCSI.Inquiry.Address16 = inq.Addr16; - report.SCSI.Inquiry.Address32 = inq.Addr32; - report.SCSI.Inquiry.BasicQueueing = inq.BQue; - report.SCSI.Inquiry.EnclosureServices = inq.EncServ; - report.SCSI.Inquiry.HierarchicalLUN = inq.HiSup; - report.SCSI.Inquiry.IUS = inq.IUS; - report.SCSI.Inquiry.LinkedCommands = inq.Linked; - report.SCSI.Inquiry.MediumChanger = inq.MChngr; - report.SCSI.Inquiry.MultiPortDevice = inq.MultiP; - report.SCSI.Inquiry.NormalACA = inq.NormACA; - report.SCSI.Inquiry.Protection = inq.Protect; - report.SCSI.Inquiry.QAS = inq.QAS; - report.SCSI.Inquiry.RelativeAddressing = inq.RelAddr; - report.SCSI.Inquiry.Removable = inq.RMB; - report.SCSI.Inquiry.TaggedCommandQueue = inq.CmdQue; - report.SCSI.Inquiry.TerminateTaskSupported = inq.TrmTsk; - report.SCSI.Inquiry.ThirdPartyCopy = inq.ThreePC; - report.SCSI.Inquiry.TranferDisable = inq.TranDis; - report.SCSI.Inquiry.SoftReset = inq.SftRe; - report.SCSI.Inquiry.StorageArrayController = inq.SCCS; - report.SCSI.Inquiry.SyncTransfer = inq.Sync; - report.SCSI.Inquiry.WideBus16 = inq.WBus16; - report.SCSI.Inquiry.WideBus32 = inq.WBus32; - - if(debug) report.SCSI.Inquiry.Data = buffer; + if(debug) report.SCSI.InquiryData = buffer; } DicConsole.WriteLine("Querying list of SCSI EVPDs..."); @@ -201,14 +104,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI byte[] evpdPages = EVPD.DecodePage00(buffer); if(evpdPages != null && evpdPages.Length > 0) { - List evpds = new List(); + List evpds = new List(); foreach(byte page in evpdPages.Where(page => page != 0x80)) { DicConsole.WriteLine("Querying SCSI EVPD {0:X2}h...", page); sense = dev.ScsiInquiry(out buffer, out senseBuffer, page); if(sense) continue; - pageType evpd = new pageType {page = page, value = buffer}; + ScsiPage evpd = new ScsiPage {page = page, value = buffer}; evpds.Add(evpd); } @@ -287,7 +190,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(decMode.HasValue) { - report.SCSI.ModeSense = new modeType + report.SCSI.ModeSense = new ScsiMode { BlankCheckEnabled = decMode.Value.Header.EBC, DPOandFUA = decMode.Value.Header.DPOFUA, @@ -295,27 +198,18 @@ namespace DiscImageChef.Core.Devices.Report.SCSI }; if(decMode.Value.Header.BufferedMode > 0) - { - report.SCSI.ModeSense.BufferedMode = decMode.Value.Header.BufferedMode; - report.SCSI.ModeSense.BufferedModeSpecified = true; - } + report.SCSI.ModeSense.BufferedMode = decMode.Value.Header.BufferedMode; - if(decMode.Value.Header.Speed > 0) - { - report.SCSI.ModeSense.Speed = decMode.Value.Header.Speed; - report.SCSI.ModeSense.SpeedSpecified = true; - } + if(decMode.Value.Header.Speed > 0) report.SCSI.ModeSense.Speed = decMode.Value.Header.Speed; if(decMode.Value.Pages != null) { - List modePages = new List(); + List modePages = new List(); foreach(Modes.ModePage page in decMode.Value.Pages) { - modePageType modePage = new modePageType + ScsiPage modePage = new ScsiPage { - page = page.Page, - subpage = page.Subpage, - value = page.PageResponse + page = page.Page, subpage = page.Subpage, value = page.PageResponse }; modePages.Add(modePage); @@ -327,10 +221,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } } + string productIdentification = null; + if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(report.SCSI.Inquiry?.ProductIdentification))) + productIdentification = StringHandlers.CToString(report.SCSI.Inquiry?.ProductIdentification).Trim(); + switch(dev.ScsiType) { case PeripheralDeviceTypes.MultiMediaDevice: - Mmc.Report(dev, ref report, debug, ref cdromMode); + Mmc.Report(dev, ref report, debug, ref cdromMode, productIdentification); break; case PeripheralDeviceTypes.SequentialAccess: Ssc.Report(dev, ref report, debug); @@ -338,7 +236,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI default: if(removable) { - List mediaTests = new List(); + List mediaTests = new List(); pressedKey = new ConsoleKeyInfo(); while(pressedKey.Key != ConsoleKey.N) @@ -356,7 +254,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.WriteLine("Please insert it in the drive and press any key when it is ready."); System.Console.ReadKey(true); - testedMediaType mediaTest = new testedMediaType(); + TestedMedia mediaTest = new TestedMedia(); DicConsole.Write("Please write a description of the media type and press enter: "); mediaTest.MediumTypeName = System.Console.ReadLine(); DicConsole.Write("Please write the media manufacturer and press enter: "); @@ -364,9 +262,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.Write("Please write the media model and press enter: "); mediaTest.Model = System.Console.ReadLine(); - mediaTest.ManufacturerSpecified = true; - mediaTest.ModelSpecified = true; - mediaTest.MediaIsRecognized = true; + mediaTest.MediaIsRecognized = true; sense = dev.ScsiTestUnitReady(out senseBuffer, TIMEOUT, out _); if(sense) @@ -409,9 +305,6 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(mediaTest.MediaIsRecognized) { - mediaTest.SupportsReadCapacitySpecified = true; - mediaTest.SupportsReadCapacity16Specified = true; - DicConsole.WriteLine("Querying SCSI READ CAPACITY..."); sense = dev.ReadCapacity(out buffer, out senseBuffer, TIMEOUT, out _); if(!sense && !dev.Error) @@ -422,8 +315,6 @@ namespace DiscImageChef.Core.Devices.Report.SCSI 1; mediaTest.BlockSize = (uint)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]); - mediaTest.BlocksSpecified = true; - mediaTest.BlockSizeSpecified = true; } DicConsole.WriteLine("Querying SCSI READ CAPACITY (16)..."); @@ -437,8 +328,6 @@ namespace DiscImageChef.Core.Devices.Report.SCSI mediaTest.Blocks = BitConverter.ToUInt64(temp, 0) + 1; mediaTest.BlockSize = (uint)((buffer[8] << 24) + (buffer[9] << 16) + (buffer[10] << 8) + buffer[11]); - mediaTest.BlocksSpecified = true; - mediaTest.BlockSizeSpecified = true; } decMode = null; @@ -464,26 +353,15 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(decMode.HasValue) { - mediaTest.MediumType = (byte)decMode.Value.Header.MediumType; - mediaTest.MediumTypeSpecified = true; + mediaTest.MediumType = (byte)decMode.Value.Header.MediumType; if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length > 0) - { - mediaTest.Density = - (byte)decMode.Value.Header.BlockDescriptors[0].Density; - mediaTest.DensitySpecified = true; - } + mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density; } - mediaTest.SupportsReadSpecified = true; - mediaTest.SupportsRead10Specified = true; - mediaTest.SupportsRead12Specified = true; - mediaTest.SupportsRead16Specified = true; - mediaTest.SupportsReadLongSpecified = true; - DicConsole.WriteLine("Trying SCSI READ (6)..."); - mediaTest.SupportsRead = - !dev.Read6(out buffer, out senseBuffer, 0, mediaTest.BlockSize, TIMEOUT, out _); + mediaTest.SupportsRead = !dev.Read6(out buffer, out senseBuffer, 0, + mediaTest.BlockSize ?? 512, TIMEOUT, out _); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead); if(debug) DataFile.WriteTo("SCSI Report", "read6", @@ -493,7 +371,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.WriteLine("Trying SCSI READ (10)..."); mediaTest.SupportsRead10 = !dev.Read10(out buffer, out senseBuffer, 0, false, true, false, false, 0, - mediaTest.BlockSize, 0, 1, TIMEOUT, out _); + mediaTest.BlockSize ?? 512, 0, 1, TIMEOUT, out _); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead10); if(debug) DataFile.WriteTo("SCSI Report", "read10", @@ -503,7 +381,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.WriteLine("Trying SCSI READ (12)..."); mediaTest.SupportsRead12 = !dev.Read12(out buffer, out senseBuffer, 0, false, true, false, false, 0, - mediaTest.BlockSize, 0, 1, false, TIMEOUT, out _); + mediaTest.BlockSize ?? 512, 0, 1, false, TIMEOUT, out _); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead12); if(debug) DataFile.WriteTo("SCSI Report", "read12", @@ -513,7 +391,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.WriteLine("Trying SCSI READ (16)..."); mediaTest.SupportsRead16 = !dev.Read16(out buffer, out senseBuffer, 0, false, true, false, 0, - mediaTest.BlockSize, 0, 1, false, TIMEOUT, out _); + mediaTest.BlockSize ?? 512, 0, 1, false, TIMEOUT, out _); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead16); if(debug) DataFile.WriteTo("SCSI Report", "read16", @@ -534,15 +412,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI { mediaTest.SupportsReadLong = true; if(decSense.Value.InformationValid && decSense.Value.ILI) - { mediaTest.LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); - mediaTest.LongBlockSizeSpecified = true; - } } } - if(mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize) + if(mediaTest.SupportsReadLong == true && mediaTest.LongBlockSize == mediaTest.BlockSize) if(mediaTest.BlockSize == 512) foreach(int i in new[] { @@ -559,9 +434,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI testSize, TIMEOUT, out _); if(sense || dev.Error) continue; - mediaTest.SupportsReadLong = true; - mediaTest.LongBlockSize = testSize; - mediaTest.LongBlockSizeSpecified = true; + mediaTest.SupportsReadLong = true; + mediaTest.LongBlockSize = testSize; break; } else if(mediaTest.BlockSize == 1024) @@ -578,9 +452,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI (ushort)i, TIMEOUT, out _); if(sense || dev.Error) continue; - mediaTest.SupportsReadLong = true; - mediaTest.LongBlockSize = testSize; - mediaTest.LongBlockSizeSpecified = true; + mediaTest.SupportsReadLong = true; + mediaTest.LongBlockSize = testSize; break; } else if(mediaTest.BlockSize == 2048) @@ -589,9 +462,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI TIMEOUT, out _); if(!sense && !dev.Error) { - mediaTest.SupportsReadLong = true; - mediaTest.LongBlockSize = 2380; - mediaTest.LongBlockSizeSpecified = true; + mediaTest.SupportsReadLong = true; + mediaTest.LongBlockSize = 2380; } } else if(mediaTest.BlockSize == 4096) @@ -600,9 +472,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI TIMEOUT, out _); if(!sense && !dev.Error) { - mediaTest.SupportsReadLong = true; - mediaTest.LongBlockSize = 4760; - mediaTest.LongBlockSizeSpecified = true; + mediaTest.SupportsReadLong = true; + mediaTest.LongBlockSize = 4760; } } else if(mediaTest.BlockSize == 8192) @@ -611,13 +482,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI TIMEOUT, out _); if(!sense && !dev.Error) { - mediaTest.SupportsReadLong = true; - mediaTest.LongBlockSize = 9424; - mediaTest.LongBlockSizeSpecified = true; + mediaTest.SupportsReadLong = true; + mediaTest.LongBlockSize = 9424; } } - if(mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize) + if(mediaTest.SupportsReadLong == true && mediaTest.LongBlockSize == mediaTest.BlockSize) { pressedKey = new ConsoleKeyInfo(); while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) @@ -637,8 +507,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI TIMEOUT, out _); if(!sense) { - mediaTest.LongBlockSize = i; - mediaTest.LongBlockSizeSpecified = true; + mediaTest.LongBlockSize = i; break; } @@ -649,8 +518,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } } - if(debug && mediaTest.SupportsReadLong && mediaTest.LongBlockSizeSpecified && - mediaTest.LongBlockSize != mediaTest.BlockSize) + if(debug && mediaTest.SupportsReadLong == true && + mediaTest.LongBlockSize != mediaTest.BlockSize) { sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, (ushort)mediaTest.LongBlockSize, TIMEOUT, out _); @@ -660,7 +529,6 @@ namespace DiscImageChef.Core.Devices.Report.SCSI buffer); } - mediaTest.CanReadMediaSerialSpecified = true; DicConsole.WriteLine("Trying SCSI READ MEDIA SERIAL NUMBER..."); mediaTest.CanReadMediaSerial = !dev.ReadMediaSerialNumber(out buffer, out senseBuffer, TIMEOUT, out _); @@ -673,13 +541,9 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } else { - report.SCSI.ReadCapabilities = new testedMediaType(); - report.SCSI.ReadCapabilitiesSpecified = true; + report.SCSI.ReadCapabilities = new TestedMedia(); report.SCSI.ReadCapabilities.MediaIsRecognized = true; - report.SCSI.ReadCapabilities.SupportsReadCapacitySpecified = true; - report.SCSI.ReadCapabilities.SupportsReadCapacity16Specified = true; - DicConsole.WriteLine("Querying SCSI READ CAPACITY..."); sense = dev.ReadCapacity(out buffer, out senseBuffer, TIMEOUT, out _); if(!sense && !dev.Error) @@ -689,8 +553,6 @@ namespace DiscImageChef.Core.Devices.Report.SCSI (ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3]) + 1; report.SCSI.ReadCapabilities.BlockSize = (uint)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]); - report.SCSI.ReadCapabilities.BlocksSpecified = true; - report.SCSI.ReadCapabilities.BlockSizeSpecified = true; } DicConsole.WriteLine("Querying SCSI READ CAPACITY (16)..."); @@ -704,8 +566,6 @@ namespace DiscImageChef.Core.Devices.Report.SCSI report.SCSI.ReadCapabilities.Blocks = BitConverter.ToUInt64(temp, 0) + 1; report.SCSI.ReadCapabilities.BlockSize = (uint)((buffer[8] << 24) + (buffer[9] << 16) + (buffer[10] << 8) + buffer[11]); - report.SCSI.ReadCapabilities.BlocksSpecified = true; - report.SCSI.ReadCapabilities.BlockSizeSpecified = true; } decMode = null; @@ -732,65 +592,51 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(decMode.HasValue) { - report.SCSI.ReadCapabilities.MediumType = (byte)decMode.Value.Header.MediumType; - report.SCSI.ReadCapabilities.MediumTypeSpecified = true; + report.SCSI.ReadCapabilities.MediumType = (byte)decMode.Value.Header.MediumType; if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length > 0) - { report.SCSI.ReadCapabilities.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density; - report.SCSI.ReadCapabilities.DensitySpecified = true; - } } - report.SCSI.ReadCapabilities.SupportsReadSpecified = true; - report.SCSI.ReadCapabilities.SupportsRead10Specified = true; - report.SCSI.ReadCapabilities.SupportsRead12Specified = true; - report.SCSI.ReadCapabilities.SupportsRead16Specified = true; - report.SCSI.ReadCapabilities.SupportsReadLongSpecified = true; - DicConsole.WriteLine("Trying SCSI READ (6)..."); report.SCSI.ReadCapabilities.SupportsRead = - !dev.Read6(out buffer, out senseBuffer, 0, report.SCSI.ReadCapabilities.BlockSize, TIMEOUT, - out _); + !dev.Read6(out buffer, out senseBuffer, 0, report.SCSI.ReadCapabilities.BlockSize ?? 512, + TIMEOUT, out _); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !report.SCSI.ReadCapabilities.SupportsRead); if(debug) - DataFile.WriteTo("SCSI Report", "read6", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin", + DataFile.WriteTo("SCSI Report", "read6", "_debug_" + productIdentification + ".bin", "read results", buffer); DicConsole.WriteLine("Trying SCSI READ (10)..."); report.SCSI.ReadCapabilities.SupportsRead10 = !dev.Read10(out buffer, out senseBuffer, 0, false, true, false, false, 0, - report.SCSI.ReadCapabilities.BlockSize, 0, 1, TIMEOUT, out _); + report.SCSI.ReadCapabilities.BlockSize ?? 512, 0, 1, TIMEOUT, out _); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !report.SCSI.ReadCapabilities.SupportsRead10); if(debug) - DataFile.WriteTo("SCSI Report", "read10", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin", + DataFile.WriteTo("SCSI Report", "read10", "_debug_" + productIdentification + ".bin", "read results", buffer); DicConsole.WriteLine("Trying SCSI READ (12)..."); report.SCSI.ReadCapabilities.SupportsRead12 = !dev.Read12(out buffer, out senseBuffer, 0, false, true, false, false, 0, - report.SCSI.ReadCapabilities.BlockSize, 0, 1, false, TIMEOUT, out _); + report.SCSI.ReadCapabilities.BlockSize ?? 512, 0, 1, false, TIMEOUT, out _); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !report.SCSI.ReadCapabilities.SupportsRead12); if(debug) - DataFile.WriteTo("SCSI Report", "read12", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin", + DataFile.WriteTo("SCSI Report", "read12", "_debug_" + productIdentification + ".bin", "read results", buffer); DicConsole.WriteLine("Trying SCSI READ (16)..."); report.SCSI.ReadCapabilities.SupportsRead16 = !dev.Read16(out buffer, out senseBuffer, 0, false, true, false, 0, - report.SCSI.ReadCapabilities.BlockSize, 0, 1, false, TIMEOUT, out _); + report.SCSI.ReadCapabilities.BlockSize ?? 512, 0, 1, false, TIMEOUT, out _); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !report.SCSI.ReadCapabilities.SupportsRead16); if(debug) - DataFile.WriteTo("SCSI Report", "read16", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin", + DataFile.WriteTo("SCSI Report", "read16", "_debug_" + productIdentification + ".bin", "read results", buffer); report.SCSI.ReadCapabilities.LongBlockSize = report.SCSI.ReadCapabilities.BlockSize; @@ -805,16 +651,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI { report.SCSI.ReadCapabilities.SupportsReadLong = true; if(decSense.Value.InformationValid && decSense.Value.ILI) - { report.SCSI.ReadCapabilities.LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); - report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true; - } } } - if(report.SCSI.ReadCapabilities.SupportsReadLong && - report.SCSI.ReadCapabilities.LongBlockSize == report.SCSI.ReadCapabilities.BlockSize) + if(report.SCSI.ReadCapabilities.SupportsReadLong == true && + report.SCSI.ReadCapabilities.LongBlockSize == report.SCSI.ReadCapabilities.BlockSize) if(report.SCSI.ReadCapabilities.BlockSize == 512) foreach(int i in new[] { @@ -831,9 +674,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI TIMEOUT, out _); if(sense || dev.Error) continue; - report.SCSI.ReadCapabilities.SupportsReadLong = true; - report.SCSI.ReadCapabilities.LongBlockSize = testSize; - report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true; + report.SCSI.ReadCapabilities.SupportsReadLong = true; + report.SCSI.ReadCapabilities.LongBlockSize = testSize; break; } else if(report.SCSI.ReadCapabilities.BlockSize == 1024) @@ -850,9 +692,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI TIMEOUT, out _); if(sense || dev.Error) continue; - report.SCSI.ReadCapabilities.SupportsReadLong = true; - report.SCSI.ReadCapabilities.LongBlockSize = testSize; - report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true; + report.SCSI.ReadCapabilities.SupportsReadLong = true; + report.SCSI.ReadCapabilities.LongBlockSize = testSize; break; } else if(report.SCSI.ReadCapabilities.BlockSize == 2048) @@ -861,9 +702,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI out _); if(!sense && !dev.Error) { - report.SCSI.ReadCapabilities.SupportsReadLong = true; - report.SCSI.ReadCapabilities.LongBlockSize = 2380; - report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true; + report.SCSI.ReadCapabilities.SupportsReadLong = true; + report.SCSI.ReadCapabilities.LongBlockSize = 2380; } } else if(report.SCSI.ReadCapabilities.BlockSize == 4096) @@ -872,9 +712,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI out _); if(!sense && !dev.Error) { - report.SCSI.ReadCapabilities.SupportsReadLong = true; - report.SCSI.ReadCapabilities.LongBlockSize = 4760; - report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true; + report.SCSI.ReadCapabilities.SupportsReadLong = true; + report.SCSI.ReadCapabilities.LongBlockSize = 4760; } } else if(report.SCSI.ReadCapabilities.BlockSize == 8192) @@ -883,14 +722,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI out _); if(!sense && !dev.Error) { - report.SCSI.ReadCapabilities.SupportsReadLong = true; - report.SCSI.ReadCapabilities.LongBlockSize = 9424; - report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true; + report.SCSI.ReadCapabilities.SupportsReadLong = true; + report.SCSI.ReadCapabilities.LongBlockSize = 9424; } } - if(report.SCSI.ReadCapabilities.SupportsReadLong && - report.SCSI.ReadCapabilities.LongBlockSize == report.SCSI.ReadCapabilities.BlockSize) + if(report.SCSI.ReadCapabilities.SupportsReadLong == true && + report.SCSI.ReadCapabilities.LongBlockSize == report.SCSI.ReadCapabilities.BlockSize) { pressedKey = new ConsoleKeyInfo(); while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) @@ -918,8 +756,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI bingo.Close(); } - report.SCSI.ReadCapabilities.LongBlockSize = i; - report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true; + report.SCSI.ReadCapabilities.LongBlockSize = i; break; } @@ -930,17 +767,15 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } } - if(debug && - report.SCSI.ReadCapabilities.SupportsReadLong && - report.SCSI.ReadCapabilities.LongBlockSizeSpecified && - report.SCSI.ReadCapabilities.LongBlockSize != report.SCSI.ReadCapabilities.BlockSize) + if(debug && report.SCSI.ReadCapabilities.SupportsReadLong == true && + report.SCSI.ReadCapabilities.LongBlockSize != + report.SCSI.ReadCapabilities.BlockSize) { sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, (ushort)report.SCSI.ReadCapabilities.LongBlockSize, TIMEOUT, out _); if(!sense) DataFile.WriteTo("SCSI Report", "readlong10", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin", - "read results", buffer); + "_debug_" + productIdentification + ".bin", "read results", buffer); } } diff --git a/DiscImageChef.Core/Devices/Report/SCSI/MMC.cs b/DiscImageChef.Core/Devices/Report/SCSI/MMC.cs index c09d303ce..020ff51f7 100644 --- a/DiscImageChef.Core/Devices/Report/SCSI/MMC.cs +++ b/DiscImageChef.Core/Devices/Report/SCSI/MMC.cs @@ -55,7 +55,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI /// Device report /// If debug is enabled /// Decoded MODE PAGE 2Ah - internal static void Report(Device dev, ref DeviceReport report, bool debug, ref Modes.ModePage_2A? cdromMode) + internal static void Report(Device dev, ref DeviceReportV2 report, bool debug, ref Modes.ModePage_2A? cdromMode, + string productIdentification) { if(report == null) return; @@ -63,109 +64,11 @@ namespace DiscImageChef.Core.Devices.Report.SCSI const uint TIMEOUT = 5; List mediaTypes = new List(); - report.SCSI.MultiMediaDevice = new mmcType(); + report.SCSI.MultiMediaDevice = new CommonTypes.Metadata.Mmc(); + report.SCSI.MultiMediaDevice.ModeSense2A = cdromMode; if(cdromMode.HasValue) { - report.SCSI.MultiMediaDevice.ModeSense2A = new mmcModeType(); - if(cdromMode.Value.BufferSize != 0) - { - report.SCSI.MultiMediaDevice.ModeSense2A.BufferSize = cdromMode.Value.BufferSize; - report.SCSI.MultiMediaDevice.ModeSense2A.BufferSizeSpecified = true; - } - - if(cdromMode.Value.CurrentSpeed != 0) - { - report.SCSI.MultiMediaDevice.ModeSense2A.CurrentSpeed = cdromMode.Value.CurrentSpeed; - report.SCSI.MultiMediaDevice.ModeSense2A.CurrentSpeedSpecified = true; - } - - if(cdromMode.Value.CurrentWriteSpeed != 0) - { - report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeed = - cdromMode.Value.CurrentWriteSpeed; - report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeedSpecified = true; - } - - if(cdromMode.Value.CurrentWriteSpeedSelected != 0) - { - report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeedSelected = - cdromMode.Value.CurrentWriteSpeedSelected; - report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeedSelectedSpecified = true; - } - - if(cdromMode.Value.MaximumSpeed != 0) - { - report.SCSI.MultiMediaDevice.ModeSense2A.MaximumSpeed = cdromMode.Value.MaximumSpeed; - report.SCSI.MultiMediaDevice.ModeSense2A.MaximumSpeedSpecified = true; - } - - if(cdromMode.Value.MaxWriteSpeed != 0) - { - report.SCSI.MultiMediaDevice.ModeSense2A.MaximumWriteSpeed = cdromMode.Value.MaxWriteSpeed; - report.SCSI.MultiMediaDevice.ModeSense2A.MaximumWriteSpeedSpecified = true; - } - - if(cdromMode.Value.RotationControlSelected != 0) - { - report.SCSI.MultiMediaDevice.ModeSense2A.RotationControlSelected = - cdromMode.Value.RotationControlSelected; - report.SCSI.MultiMediaDevice.ModeSense2A.RotationControlSelectedSpecified = true; - } - - if(cdromMode.Value.SupportedVolumeLevels != 0) - { - report.SCSI.MultiMediaDevice.ModeSense2A.SupportedVolumeLevels = - cdromMode.Value.SupportedVolumeLevels; - report.SCSI.MultiMediaDevice.ModeSense2A.SupportedVolumeLevelsSpecified = true; - } - - report.SCSI.MultiMediaDevice.ModeSense2A.AccurateCDDA = cdromMode.Value.AccurateCDDA; - report.SCSI.MultiMediaDevice.ModeSense2A.BCK = cdromMode.Value.BCK; - report.SCSI.MultiMediaDevice.ModeSense2A.BufferUnderRunProtection = cdromMode.Value.BUF; - report.SCSI.MultiMediaDevice.ModeSense2A.CanEject = cdromMode.Value.Eject; - report.SCSI.MultiMediaDevice.ModeSense2A.CanLockMedia = cdromMode.Value.Lock; - report.SCSI.MultiMediaDevice.ModeSense2A.CDDACommand = cdromMode.Value.CDDACommand; - report.SCSI.MultiMediaDevice.ModeSense2A.CompositeAudioVideo = cdromMode.Value.Composite; - report.SCSI.MultiMediaDevice.ModeSense2A.CSSandCPPMSupported = cdromMode.Value.CMRSupported == 1; - report.SCSI.MultiMediaDevice.ModeSense2A.DeterministicSlotChanger = cdromMode.Value.SDP; - report.SCSI.MultiMediaDevice.ModeSense2A.DigitalPort1 = cdromMode.Value.DigitalPort1; - report.SCSI.MultiMediaDevice.ModeSense2A.DigitalPort2 = cdromMode.Value.DigitalPort2; - report.SCSI.MultiMediaDevice.ModeSense2A.LeadInPW = cdromMode.Value.LeadInPW; - report.SCSI.MultiMediaDevice.ModeSense2A.LoadingMechanismType = cdromMode.Value.LoadingMechanism; - report.SCSI.MultiMediaDevice.ModeSense2A.LockStatus = cdromMode.Value.LockState; - report.SCSI.MultiMediaDevice.ModeSense2A.LSBF = cdromMode.Value.LSBF; - report.SCSI.MultiMediaDevice.ModeSense2A.PlaysAudio = cdromMode.Value.AudioPlay; - report.SCSI.MultiMediaDevice.ModeSense2A.PreventJumperStatus = cdromMode.Value.PreventJumper; - report.SCSI.MultiMediaDevice.ModeSense2A.RCK = cdromMode.Value.RCK; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsBarcode = cdromMode.Value.ReadBarcode; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsBothSides = cdromMode.Value.SCC; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsCDR = cdromMode.Value.ReadCDR; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsCDRW = cdromMode.Value.ReadCDRW; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDeinterlavedSubchannel = - cdromMode.Value.DeinterlaveSubchannel; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDR = cdromMode.Value.ReadDVDR; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDRAM = cdromMode.Value.ReadDVDRAM; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDROM = cdromMode.Value.ReadDVDROM; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsISRC = cdromMode.Value.ISRC; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsMode2Form2 = cdromMode.Value.Mode2Form2; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsMode2Form1 = cdromMode.Value.Mode2Form1; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsPacketCDR = cdromMode.Value.Method2; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsSubchannel = cdromMode.Value.Subchannel; - report.SCSI.MultiMediaDevice.ModeSense2A.ReadsUPC = cdromMode.Value.UPC; - report.SCSI.MultiMediaDevice.ModeSense2A.ReturnsC2Pointers = cdromMode.Value.C2Pointer; - report.SCSI.MultiMediaDevice.ModeSense2A.SeparateChannelMute = cdromMode.Value.SeparateChannelMute; - report.SCSI.MultiMediaDevice.ModeSense2A.SeparateChannelVolume = cdromMode.Value.SeparateChannelVolume; - report.SCSI.MultiMediaDevice.ModeSense2A.SSS = cdromMode.Value.SSS; - report.SCSI.MultiMediaDevice.ModeSense2A.SupportsMultiSession = cdromMode.Value.MultiSession; - report.SCSI.MultiMediaDevice.ModeSense2A.TestWrite = cdromMode.Value.TestWrite; - report.SCSI.MultiMediaDevice.ModeSense2A.WritesCDR = cdromMode.Value.WriteCDR; - report.SCSI.MultiMediaDevice.ModeSense2A.WritesCDRW = cdromMode.Value.WriteCDRW; - report.SCSI.MultiMediaDevice.ModeSense2A.WritesDVDR = cdromMode.Value.WriteDVDR; - report.SCSI.MultiMediaDevice.ModeSense2A.WritesDVDRAM = cdromMode.Value.WriteDVDRAM; - report.SCSI.MultiMediaDevice.ModeSense2A.WriteSpeedPerformanceDescriptors = - cdromMode.Value.WriteSpeedPerformanceDescriptors; - mediaTypes.Add("CD-ROM"); mediaTypes.Add("Audio CD"); if(cdromMode.Value.ReadCDR) mediaTypes.Add("CD-R"); @@ -183,7 +86,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI Features.SeparatedFeatures ftr = Features.Separate(buffer); if(ftr.Descriptors != null && ftr.Descriptors.Length > 0) { - report.SCSI.MultiMediaDevice.Features = new mmcFeaturesType(); + report.SCSI.MultiMediaDevice.Features = new MmcFeatures(); foreach(Features.FeatureDescriptor desc in ftr.Descriptors) switch(desc.Code) { @@ -194,13 +97,10 @@ namespace DiscImageChef.Core.Devices.Report.SCSI { report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandard = ftr0001.Value.PhysicalInterfaceStandard; - report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandardSpecified = true; if((uint)ftr0001.Value.PhysicalInterfaceStandard > 0x8) { report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandardNumber = (uint)ftr0001.Value.PhysicalInterfaceStandard; - report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandardNumberSpecified = - true; report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandard = PhysicalInterfaces.Unspecified; } @@ -216,17 +116,11 @@ namespace DiscImageChef.Core.Devices.Report.SCSI { report.SCSI.MultiMediaDevice.Features.LoadingMechanismType = ftr0003.Value.LoadingMechanismType; - report.SCSI.MultiMediaDevice.Features.LoadingMechanismTypeSpecified = true; - report.SCSI.MultiMediaDevice.Features.CanLoad = - ftr0003.Value.Load; - report.SCSI.MultiMediaDevice.Features.CanEject = - ftr0003.Value.Eject; - report.SCSI.MultiMediaDevice.Features.PreventJumper = - ftr0003.Value.PreventJumper; - report.SCSI.MultiMediaDevice.Features.DBML = - ftr0003.Value.DBML; - report.SCSI.MultiMediaDevice.Features.Locked = - ftr0003.Value.Lock; + report.SCSI.MultiMediaDevice.Features.CanLoad = ftr0003.Value.Load; + report.SCSI.MultiMediaDevice.Features.CanEject = ftr0003.Value.Eject; + report.SCSI.MultiMediaDevice.Features.PreventJumper = ftr0003.Value.PreventJumper; + report.SCSI.MultiMediaDevice.Features.DBML = ftr0003.Value.DBML; + report.SCSI.MultiMediaDevice.Features.Locked = ftr0003.Value.Lock; } } break; @@ -248,18 +142,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(ftr0010.HasValue) { if(ftr0010.Value.LogicalBlockSize > 0) - { report.SCSI.MultiMediaDevice.Features.LogicalBlockSize = ftr0010.Value.LogicalBlockSize; - report.SCSI.MultiMediaDevice.Features.LogicalBlockSizeSpecified = true; - } if(ftr0010.Value.Blocking > 0) - { report.SCSI.MultiMediaDevice.Features.BlocksPerReadableUnit = ftr0010.Value.Blocking; - report.SCSI.MultiMediaDevice.Features.BlocksPerReadableUnitSpecified = true; - } report.SCSI.MultiMediaDevice.Features.ErrorRecoveryPage = ftr0010.Value.PP; } @@ -516,11 +404,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI report.SCSI.MultiMediaDevice.Features.CanMuteSeparateChannels = ftr0103.Value.SCM; report.SCSI.MultiMediaDevice.Features.SupportsSeparateVolume = ftr0103.Value.SV; if(ftr0103.Value.VolumeLevels > 0) - { - report.SCSI.MultiMediaDevice.Features.VolumeLevelsSpecified = true; - report.SCSI.MultiMediaDevice.Features.VolumeLevels = - ftr0103.Value.VolumeLevels; - } + report.SCSI.MultiMediaDevice.Features.VolumeLevels = ftr0103.Value.VolumeLevels; } } break; @@ -533,11 +417,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI Feature_0106? ftr0106 = Features.Decode_0106(desc.Data); if(ftr0106.HasValue) if(ftr0106.Value.CSSVersion > 0) - { - report.SCSI.MultiMediaDevice.Features.CSSVersionSpecified = true; - report.SCSI.MultiMediaDevice.Features.CSSVersion = - ftr0106.Value.CSSVersion; - } + report.SCSI.MultiMediaDevice.Features.CSSVersion = ftr0106.Value.CSSVersion; } break; case 0x0108: @@ -552,11 +432,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI Feature_010B? ftr010B = Features.Decode_010B(desc.Data); if(ftr010B.HasValue) if(ftr010B.Value.CPRMVersion > 0) - { - report.SCSI.MultiMediaDevice.Features.CPRMVersionSpecified = true; - report.SCSI.MultiMediaDevice.Features.CPRMVersion = - ftr010B.Value.CPRMVersion; - } + report.SCSI.MultiMediaDevice.Features.CPRMVersion = ftr010B.Value.CPRMVersion; } break; case 0x010C: @@ -597,8 +473,6 @@ namespace DiscImageChef.Core.Devices.Report.SCSI new DateTime(int.Parse(syear), int.Parse(smonth), int.Parse(sday), int.Parse(shour), int.Parse(sminute), int.Parse(ssecond), DateTimeKind.Utc); - - report.SCSI.MultiMediaDevice.Features.FirmwareDateSpecified = true; } #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch @@ -624,24 +498,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI report.SCSI.MultiMediaDevice.Features.CanGenerateBindingNonce = ftr010D.Value.BNG; if(ftr010D.Value.BindNonceBlocks > 0) - { - report.SCSI.MultiMediaDevice.Features.BindingNonceBlocksSpecified = true; report.SCSI.MultiMediaDevice.Features.BindingNonceBlocks = ftr010D.Value.BindNonceBlocks; - } if(ftr010D.Value.AGIDs > 0) - { - report.SCSI.MultiMediaDevice.Features.AGIDsSpecified = true; - report.SCSI.MultiMediaDevice.Features.AGIDs = ftr010D.Value.AGIDs; - } + report.SCSI.MultiMediaDevice.Features.AGIDs = ftr010D.Value.AGIDs; if(ftr010D.Value.AACSVersion > 0) - { - report.SCSI.MultiMediaDevice.Features.AACSVersionSpecified = true; - report.SCSI.MultiMediaDevice.Features.AACSVersion = - ftr010D.Value.AACSVersion; - } + report.SCSI.MultiMediaDevice.Features.AACSVersion = ftr010D.Value.AACSVersion; } } break; @@ -746,7 +610,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } mediaTypes.Sort(); - List mediaTests = new List(); + List mediaTests = new List(); foreach(string mediaType in mediaTypes) { ConsoleKeyInfo pressedKey = new ConsoleKeyInfo(); @@ -764,8 +628,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.WriteLine("Please insert it in the drive and press any key when it is ready."); System.Console.ReadKey(true); - testedMediaType mediaTest = - new testedMediaType {MediumTypeName = mediaType, MediaIsRecognized = true}; + TestedMedia mediaTest = new TestedMedia {MediumTypeName = mediaType, MediaIsRecognized = true}; sense = dev.ScsiTestUnitReady(out senseBuffer, TIMEOUT, out _); if(sense) @@ -824,9 +687,6 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(mediaTest.MediaIsRecognized) { - mediaTest.SupportsReadCapacitySpecified = true; - mediaTest.SupportsReadCapacity16Specified = true; - DicConsole.WriteLine("Querying SCSI READ CAPACITY..."); sense = dev.ReadCapacity(out buffer, out senseBuffer, TIMEOUT, out _); if(!sense && !dev.Error) @@ -836,8 +696,6 @@ namespace DiscImageChef.Core.Devices.Report.SCSI (ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3]) + 1; mediaTest.BlockSize = (uint)((buffer[5] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]); - mediaTest.BlocksSpecified = true; - mediaTest.BlockSizeSpecified = true; } DicConsole.WriteLine("Querying SCSI READ CAPACITY (16)..."); @@ -851,8 +709,6 @@ namespace DiscImageChef.Core.Devices.Report.SCSI mediaTest.Blocks = BitConverter.ToUInt64(temp, 0) + 1; mediaTest.BlockSize = (uint)((buffer[5] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]); - mediaTest.BlocksSpecified = true; - mediaTest.BlockSizeSpecified = true; } Modes.DecodedMode? decMode = null; @@ -878,65 +734,55 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(decMode.HasValue) { - mediaTest.MediumType = (byte)decMode.Value.Header.MediumType; - mediaTest.MediumTypeSpecified = true; + mediaTest.MediumType = (byte)decMode.Value.Header.MediumType; if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length > 0) - { - mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density; - mediaTest.DensitySpecified = true; - } + mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density; } if(mediaType.StartsWith("CD-", StringComparison.Ordinal) || mediaType.StartsWith("DDCD-", StringComparison.Ordinal) || mediaType == "Audio CD") { - mediaTest.CanReadTOCSpecified = true; - mediaTest.CanReadFullTOCSpecified = true; DicConsole.WriteLine("Querying CD TOC..."); mediaTest.CanReadTOC = !dev.ReadTocPmaAtip(out buffer, out senseBuffer, false, 0, 0, TIMEOUT, out _); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadTOC); if(debug) DataFile.WriteTo("SCSI Report", "readtoc", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Querying CD Full TOC..."); mediaTest.CanReadFullTOC = !dev.ReadRawToc(out buffer, out senseBuffer, 1, TIMEOUT, out _); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadFullTOC); if(debug) DataFile.WriteTo("SCSI Report", "readfulltoc", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } if(mediaType.StartsWith("CD-R", StringComparison.Ordinal) || mediaType.StartsWith("DDCD-R", StringComparison.Ordinal)) { - mediaTest.CanReadATIPSpecified = true; - mediaTest.CanReadPMASpecified = true; DicConsole.WriteLine("Querying CD ATIP..."); mediaTest.CanReadATIP = !dev.ReadAtip(out buffer, out senseBuffer, TIMEOUT, out _); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadATIP); if(debug) DataFile.WriteTo("SCSI Report", "atip", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Querying CD PMA..."); mediaTest.CanReadPMA = !dev.ReadPma(out buffer, out senseBuffer, TIMEOUT, out _); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPMA); if(debug) DataFile.WriteTo("SCSI Report", "pma", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } if(mediaType.StartsWith("DVD-", StringComparison.Ordinal) || mediaType.StartsWith("HD DVD-", StringComparison.Ordinal)) { - mediaTest.CanReadPFISpecified = true; - mediaTest.CanReadDMISpecified = true; DicConsole.WriteLine("Querying DVD PFI..."); mediaTest.CanReadPFI = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0, @@ -944,8 +790,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPFI); if(debug) DataFile.WriteTo("SCSI Report", "pfi", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Querying DVD DMI..."); mediaTest.CanReadDMI = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0, @@ -954,13 +800,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadDMI); if(debug) DataFile.WriteTo("SCSI Report", "dmi", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } if(mediaType == "DVD-ROM") { - mediaTest.CanReadCMISpecified = true; DicConsole.WriteLine("Querying DVD CMI..."); mediaTest.CanReadCMI = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0, @@ -968,15 +813,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadCMI); if(debug) DataFile.WriteTo("SCSI Report", "cmi", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } switch(mediaType) { case "DVD-ROM": case "HD DVD-ROM": - mediaTest.CanReadBCASpecified = true; DicConsole.WriteLine("Querying DVD BCA..."); mediaTest.CanReadBCA = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, @@ -985,9 +829,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadBCA); if(debug) DataFile.WriteTo("SCSI Report", "bca", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); - mediaTest.CanReadAACSSpecified = true; + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Querying DVD AACS..."); mediaTest.CanReadAACS = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, @@ -995,11 +838,10 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadAACS); if(debug) DataFile.WriteTo("SCSI Report", "aacs", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); break; case "BD-ROM": - mediaTest.CanReadBCASpecified = true; DicConsole.WriteLine("Querying BD BCA..."); mediaTest.CanReadBCA = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Bd, 0, @@ -1008,21 +850,19 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadBCA); if(debug) DataFile.WriteTo("SCSI Report", "bdbca", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); break; case "DVD-RAM": case "HD DVD-RAM": - mediaTest.CanReadDDSSpecified = true; - mediaTest.CanReadSpareAreaInformationSpecified = true; mediaTest.CanReadDDS = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0, MmcDiscStructureFormat.DvdramDds, 0, TIMEOUT, out _); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadDDS); if(debug) DataFile.WriteTo("SCSI Report", "dds", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); mediaTest.CanReadSpareAreaInformation = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0, MmcDiscStructureFormat.DvdramSpareAreaInformation, 0, @@ -1031,15 +871,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI !mediaTest.CanReadSpareAreaInformation); if(debug) DataFile.WriteTo("SCSI Report", "sai", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); break; } if(mediaType.StartsWith("BD-R", StringComparison.Ordinal) && mediaType != "BD-ROM") { - mediaTest.CanReadDDSSpecified = true; - mediaTest.CanReadSpareAreaInformationSpecified = true; DicConsole.WriteLine("Querying BD DDS..."); mediaTest.CanReadDDS = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Bd, 0, 0, @@ -1047,8 +885,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadDDS); if(debug) DataFile.WriteTo("SCSI Report", "bddds", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Querying BD SAI..."); mediaTest.CanReadSpareAreaInformation = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Bd, 0, 0, @@ -1058,13 +896,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI !mediaTest.CanReadSpareAreaInformation); if(debug) DataFile.WriteTo("SCSI Report", "bdsai", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } if(mediaType == "DVD-R" || mediaType == "DVD-RW") { - mediaTest.CanReadPRISpecified = true; DicConsole.WriteLine("Querying DVD PRI..."); mediaTest.CanReadPRI = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0, @@ -1072,14 +909,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPRI); if(debug) DataFile.WriteTo("SCSI Report", "pri", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } if(mediaType == "DVD-R" || mediaType == "DVD-RW" || mediaType == "HD DVD-R") { - mediaTest.CanReadMediaIDSpecified = true; - mediaTest.CanReadRecordablePFISpecified = true; DicConsole.WriteLine("Querying DVD Media ID..."); mediaTest.CanReadMediaID = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0, @@ -1087,8 +922,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadMediaID); if(debug) DataFile.WriteTo("SCSI Report", "mediaid", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Querying DVD Embossed PFI..."); mediaTest.CanReadRecordablePFI = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0, @@ -1097,14 +932,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadRecordablePFI); if(debug) DataFile.WriteTo("SCSI Report", "epfi", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } if(mediaType.StartsWith("DVD+R", StringComparison.Ordinal) || mediaType == "DVD+MRW") { - mediaTest.CanReadADIPSpecified = true; - mediaTest.CanReadDCBSpecified = true; DicConsole.WriteLine("Querying DVD ADIP..."); mediaTest.CanReadADIP = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0, @@ -1112,8 +945,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadADIP); if(debug) DataFile.WriteTo("SCSI Report", "adip", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Querying DVD DCB..."); mediaTest.CanReadDCB = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0, @@ -1121,13 +954,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadDCB); if(debug) DataFile.WriteTo("SCSI Report", "dcb", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } if(mediaType == "HD DVD-ROM") { - mediaTest.CanReadHDCMISpecified = true; DicConsole.WriteLine("Querying HD DVD CMI..."); mediaTest.CanReadHDCMI = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0, @@ -1136,13 +968,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadHDCMI); if(debug) DataFile.WriteTo("SCSI Report", "hdcmi", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } if(mediaType.EndsWith(" DL", StringComparison.Ordinal)) { - mediaTest.CanReadLayerCapacitySpecified = true; DicConsole.WriteLine("Querying DVD Layer Capacity..."); mediaTest.CanReadLayerCapacity = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0, @@ -1150,14 +981,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadLayerCapacity); if(debug) DataFile.WriteTo("SCSI Report", "layer", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } if(mediaType.StartsWith("BD-R", StringComparison.Ordinal)) { - mediaTest.CanReadDiscInformationSpecified = true; - mediaTest.CanReadPACSpecified = true; DicConsole.WriteLine("Querying BD Disc Information..."); mediaTest.CanReadDiscInformation = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Bd, 0, 0, @@ -1165,8 +994,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadDiscInformation); if(debug) DataFile.WriteTo("SCSI Report", "di", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Querying BD PAC..."); mediaTest.CanReadPAC = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Bd, 0, 0, @@ -1174,46 +1003,41 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPAC); if(debug) DataFile.WriteTo("SCSI Report", "pac", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } - mediaTest.SupportsReadSpecified = true; - mediaTest.SupportsRead10Specified = true; - mediaTest.SupportsRead12Specified = true; - mediaTest.SupportsRead16Specified = true; - DicConsole.WriteLine("Trying SCSI READ (6)..."); mediaTest.SupportsRead = !dev.Read6(out buffer, out senseBuffer, 0, 2048, TIMEOUT, out _); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead); if(debug) DataFile.WriteTo("SCSI Report", "read6", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + - ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Trying SCSI READ (10)..."); mediaTest.SupportsRead10 = !dev.Read10(out buffer, out senseBuffer, 0, false, true, false, false, 0, 2048, 0, 1, TIMEOUT, out _); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead10); if(debug) DataFile.WriteTo("SCSI Report", "read10", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + - ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Trying SCSI READ (12)..."); mediaTest.SupportsRead12 = !dev.Read12(out buffer, out senseBuffer, 0, false, true, false, false, 0, 2048, 0, 1, false, TIMEOUT, out _); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead12); if(debug) DataFile.WriteTo("SCSI Report", "read12", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + - ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Trying SCSI READ (16)..."); mediaTest.SupportsRead16 = !dev.Read16(out buffer, out senseBuffer, 0, false, true, false, 0, 2048, 0, 1, false, TIMEOUT, out _); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead16); if(debug) DataFile.WriteTo("SCSI Report", "read16", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + mediaType + - ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); if(debug) if(!tryPlextor) @@ -1233,20 +1057,6 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(mediaType.StartsWith("CD-", StringComparison.Ordinal) || mediaType.StartsWith("DDCD-", StringComparison.Ordinal) || mediaType == "Audio CD") { - mediaTest.CanReadC2PointersSpecified = true; - mediaTest.CanReadCorrectedSubchannelSpecified = true; - mediaTest.CanReadCorrectedSubchannelWithC2Specified = true; - mediaTest.CanReadLeadInSpecified = true; - mediaTest.CanReadLeadOutSpecified = true; - mediaTest.CanReadPQSubchannelSpecified = true; - mediaTest.CanReadPQSubchannelWithC2Specified = true; - mediaTest.CanReadRWSubchannelSpecified = true; - mediaTest.CanReadRWSubchannelWithC2Specified = true; - mediaTest.SupportsReadCdMsfSpecified = true; - mediaTest.SupportsReadCdSpecified = true; - mediaTest.SupportsReadCdMsfRawSpecified = true; - mediaTest.SupportsReadCdRawSpecified = true; - if(mediaType == "Audio CD") { DicConsole.WriteLine("Trying SCSI READ CD..."); @@ -1258,8 +1068,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsReadCd); if(debug) DataFile.WriteTo("SCSI Report", "readcd", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Trying SCSI READ CD MSF..."); mediaTest.SupportsReadCdMsf = !dev.ReadCdMsf(out buffer, out senseBuffer, 0x00000200, 0x00000201, 2352, MmcSectorTypes.Cdda, @@ -1269,8 +1079,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsReadCdMsf); if(debug) DataFile.WriteTo("SCSI Report", "readcdmsf", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } else { @@ -1283,8 +1093,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsReadCd); if(debug) DataFile.WriteTo("SCSI Report", "readcd", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Trying SCSI READ CD MSF..."); mediaTest.SupportsReadCdMsf = !dev.ReadCdMsf(out buffer, out senseBuffer, 0x00000200, 0x00000201, 2048, MmcSectorTypes.AllTypes, @@ -1294,8 +1104,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsReadCdMsf); if(debug) DataFile.WriteTo("SCSI Report", "readcdmsf", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Trying SCSI READ CD full sector..."); mediaTest.SupportsReadCdRaw = !dev.ReadCd(out buffer, out senseBuffer, 0, 2352, 1, MmcSectorTypes.AllTypes, false, false, true, @@ -1305,8 +1115,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsReadCdRaw); if(debug) DataFile.WriteTo("SCSI Report", "readcdraw", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Trying SCSI READ CD MSF full sector..."); mediaTest.SupportsReadCdMsfRaw = !dev.ReadCdMsf(out buffer, out senseBuffer, 0x00000200, 0x00000201, 2352, @@ -1318,11 +1128,11 @@ namespace DiscImageChef.Core.Devices.Report.SCSI !mediaTest.SupportsReadCdMsfRaw); if(debug) DataFile.WriteTo("SCSI Report", "readcdmsfraw", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } - if(mediaTest.SupportsReadCdRaw || mediaType == "Audio CD") + if(mediaTest.SupportsReadCdRaw == true || mediaType == "Audio CD") { DicConsole.WriteLine("Trying to read CD Lead-In..."); for(int i = -150; i < 0; i++) @@ -1340,8 +1150,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", sense); if(debug) DataFile.WriteTo("SCSI Report", "leadin", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); if(sense) continue; mediaTest.CanReadLeadIn = true; @@ -1366,8 +1176,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadLeadOut); if(debug) DataFile.WriteTo("SCSI Report", "leadout", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } if(mediaType == "Audio CD") @@ -1378,7 +1188,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.None, TIMEOUT, out _); - if(!mediaTest.CanReadC2Pointers) + if(!mediaTest.CanReadC2Pointers == true) mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2648, 1, MmcSectorTypes.Cdda, false, false, false, MmcHeaderCodes.None, true, false, @@ -1387,8 +1197,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadC2Pointers); if(debug) DataFile.WriteTo("SCSI Report", "readcdc2", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Trying to read subchannels..."); mediaTest.CanReadPQSubchannel = @@ -1398,8 +1208,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPQSubchannel); if(debug) DataFile.WriteTo("SCSI Report", "readcdpq", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); mediaTest.CanReadRWSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2448, 1, MmcSectorTypes.Cdda, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, @@ -1407,8 +1217,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadRWSubchannel); if(debug) DataFile.WriteTo("SCSI Report", "readcdrw", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); mediaTest.CanReadCorrectedSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2448, 1, MmcSectorTypes.Cdda, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, @@ -1417,8 +1227,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI !mediaTest.CanReadCorrectedSubchannel); if(debug) DataFile.WriteTo("SCSI Report", "readcdsub", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Trying to read subchannels with C2 Pointers..."); mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2662, @@ -1426,7 +1236,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.Q16, TIMEOUT, out _); - if(!mediaTest.CanReadPQSubchannelWithC2) + if(mediaTest.CanReadPQSubchannelWithC2 == false) mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2664, 1, MmcSectorTypes.Cdda, false, false, false, @@ -1438,15 +1248,15 @@ namespace DiscImageChef.Core.Devices.Report.SCSI !mediaTest.CanReadPQSubchannelWithC2); if(debug) DataFile.WriteTo("SCSI Report", "readcdpqc2", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2712, 1, MmcSectorTypes.Cdda, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.Raw, TIMEOUT, out _); - if(!mediaTest.CanReadRWSubchannelWithC2) + if(mediaTest.CanReadRWSubchannelWithC2 == false) mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2714, 1, MmcSectorTypes.Cdda, false, false, false, @@ -1458,14 +1268,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI !mediaTest.CanReadRWSubchannelWithC2); if(debug) DataFile.WriteTo("SCSI Report", "readcdrwc2", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2712, 1, MmcSectorTypes.Cdda, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.Rw, TIMEOUT, out _); - if(!mediaTest.CanReadCorrectedSubchannelWithC2) + if(mediaTest.CanReadCorrectedSubchannelWithC2 == false) mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2714, 1, MmcSectorTypes.Cdda, false, false, false, MmcHeaderCodes.None, true, false, @@ -1474,10 +1284,10 @@ namespace DiscImageChef.Core.Devices.Report.SCSI !mediaTest.CanReadCorrectedSubchannelWithC2); if(debug) DataFile.WriteTo("SCSI Report", "readcdsubc2", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } - else if(mediaTest.SupportsReadCdRaw) + else if(mediaTest.SupportsReadCdRaw == true) { DicConsole.WriteLine("Trying to read C2 Pointers..."); mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2646, 1, @@ -1485,7 +1295,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.C2Pointers, MmcSubchannel.None, TIMEOUT, out _); - if(!mediaTest.CanReadC2Pointers) + if(mediaTest.CanReadC2Pointers == false) mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2648, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, @@ -1494,8 +1304,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadC2Pointers); if(debug) DataFile.WriteTo("SCSI Report", "readcdc2", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Trying to read subchannels..."); mediaTest.CanReadPQSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2368, 1, @@ -1506,8 +1316,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPQSubchannel); if(debug) DataFile.WriteTo("SCSI Report", "readcdpq", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); mediaTest.CanReadRWSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2448, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, @@ -1516,8 +1326,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadRWSubchannel); if(debug) DataFile.WriteTo("SCSI Report", "readcdrw", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); mediaTest.CanReadCorrectedSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2448, 1, MmcSectorTypes.AllTypes, false, false, true, @@ -1528,8 +1338,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI !mediaTest.CanReadCorrectedSubchannel); if(debug) DataFile.WriteTo("SCSI Report", "readcdsub", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Trying to read subchannels with C2 Pointers..."); mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2662, @@ -1538,7 +1348,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.C2Pointers, MmcSubchannel.Q16, TIMEOUT, out _); - if(!mediaTest.CanReadPQSubchannelWithC2) + if(mediaTest.CanReadPQSubchannelWithC2 == false) mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2664, 1, MmcSectorTypes.AllTypes, false, false, true, @@ -1551,8 +1361,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI !mediaTest.CanReadPQSubchannelWithC2); if(debug) DataFile.WriteTo("SCSI Report", "readcdpqc2", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2712, 1, MmcSectorTypes.AllTypes, false, @@ -1560,7 +1370,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.C2Pointers, MmcSubchannel.Raw, TIMEOUT, out _); - if(!mediaTest.CanReadRWSubchannelWithC2) + if(mediaTest.CanReadRWSubchannelWithC2 == false) mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2714, 1, MmcSectorTypes.AllTypes, false, false, true, @@ -1573,8 +1383,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI !mediaTest.CanReadRWSubchannelWithC2); if(debug) DataFile.WriteTo("SCSI Report", "readcdrwc2", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2712, 1, @@ -1585,7 +1395,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI MmcErrorField.C2Pointers, MmcSubchannel.Rw, TIMEOUT, out _); - if(!mediaTest.CanReadCorrectedSubchannelWithC2) + if(mediaTest.CanReadCorrectedSubchannelWithC2 == false) mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2714, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, @@ -1594,8 +1404,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI !mediaTest.CanReadCorrectedSubchannelWithC2); if(debug) DataFile.WriteTo("SCSI Report", "readcdsubc2", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } else { @@ -1605,7 +1415,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.None, TIMEOUT, out _); - if(!mediaTest.CanReadC2Pointers) + if(mediaTest.CanReadC2Pointers == false) mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2344, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, @@ -1614,8 +1424,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadC2Pointers); if(debug) DataFile.WriteTo("SCSI Report", "readcdc2", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Trying to read subchannels..."); mediaTest.CanReadPQSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2064, 1, @@ -1626,8 +1436,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPQSubchannel); if(debug) DataFile.WriteTo("SCSI Report", "readcdpq", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); mediaTest.CanReadRWSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2144, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, @@ -1636,8 +1446,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadRWSubchannel); if(debug) DataFile.WriteTo("SCSI Report", "readcdrw", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); mediaTest.CanReadCorrectedSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2144, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, @@ -1647,8 +1457,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI !mediaTest.CanReadCorrectedSubchannel); if(debug) DataFile.WriteTo("SCSI Report", "readcdsub", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Trying to read subchannels with C2 Pointers..."); mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2358, @@ -1656,7 +1466,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.Q16, TIMEOUT, out _); - if(!mediaTest.CanReadPQSubchannelWithC2) + if(mediaTest.CanReadPQSubchannelWithC2 == false) mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2360, 1, MmcSectorTypes.AllTypes, false, false, false, @@ -1668,15 +1478,15 @@ namespace DiscImageChef.Core.Devices.Report.SCSI !mediaTest.CanReadPQSubchannelWithC2); if(debug) DataFile.WriteTo("SCSI Report", "readcdpqc2", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2438, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.Raw, TIMEOUT, out _); - if(!mediaTest.CanReadRWSubchannelWithC2) + if(mediaTest.CanReadRWSubchannelWithC2 == false) mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2440, 1, MmcSectorTypes.AllTypes, false, false, false, @@ -1688,14 +1498,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI !mediaTest.CanReadRWSubchannelWithC2); if(debug) DataFile.WriteTo("SCSI Report", "readcdrwc2", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2438, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.Rw, TIMEOUT, out _); - if(!mediaTest.CanReadCorrectedSubchannelWithC2) + if(mediaTest.CanReadCorrectedSubchannelWithC2 == false) mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2440, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, @@ -1704,8 +1514,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI !mediaTest.CanReadCorrectedSubchannelWithC2); if(debug) DataFile.WriteTo("SCSI Report", "readcdsubc2", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } if(debug) @@ -1741,7 +1551,6 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(tryPlextor) { - mediaTest.SupportsPlextorReadCDDASpecified = true; DicConsole.WriteLine("Trying Plextor READ CD-DA..."); mediaTest.SupportsPlextorReadCDDA = !dev.PlextorReadCdDa(out buffer, out senseBuffer, 0, 2352, 1, @@ -1750,14 +1559,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI !mediaTest.SupportsPlextorReadCDDA); if(debug) DataFile.WriteTo("SCSI Report", "plextorreadcdda", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } if(tryPioneer) { - mediaTest.SupportsPioneerReadCDDASpecified = true; - mediaTest.SupportsPioneerReadCDDAMSFSpecified = true; DicConsole.WriteLine("Trying Pioneer READ CD-DA..."); mediaTest.SupportsPioneerReadCDDA = !dev.PioneerReadCdDa(out buffer, out senseBuffer, 0, 2352, 1, @@ -1766,8 +1573,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI !mediaTest.SupportsPioneerReadCDDA); if(debug) DataFile.WriteTo("SCSI Report", "pioneerreadcdda", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); DicConsole.WriteLine("Trying Pioneer READ CD-DA MSF..."); mediaTest.SupportsPioneerReadCDDAMSF = !dev.PioneerReadCdDaMsf(out buffer, out senseBuffer, 0x00000200, 0x00000201, 2352, @@ -1776,21 +1583,20 @@ namespace DiscImageChef.Core.Devices.Report.SCSI !mediaTest.SupportsPioneerReadCDDAMSF); if(debug) DataFile.WriteTo("SCSI Report", "pioneerreadcddamsf", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } if(tryNec) { - mediaTest.SupportsNECReadCDDASpecified = true; DicConsole.WriteLine("Trying NEC READ CD-DA..."); mediaTest.SupportsNECReadCDDA = !dev.NecReadCdDa(out buffer, out senseBuffer, 0, 1, TIMEOUT, out _); DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsNECReadCDDA); if(debug) DataFile.WriteTo("SCSI Report", "necreadcdda", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } } @@ -1806,11 +1612,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI { mediaTest.SupportsReadLong = true; if(decSense.Value.InformationValid && decSense.Value.ILI) - { - mediaTest.LongBlockSize = - 0xFFFF - (decSense.Value.Information & 0xFFFF); - mediaTest.LongBlockSizeSpecified = true; - } + mediaTest.LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); } } @@ -1829,21 +1631,19 @@ namespace DiscImageChef.Core.Devices.Report.SCSI tryHldtst |= pressedKey.Key == ConsoleKey.Y; } - if(mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize) + if(mediaTest.SupportsReadLong == true && mediaTest.LongBlockSize == mediaTest.BlockSize) { // DVDs sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 37856, TIMEOUT, out _); if(!sense && !dev.Error) { - mediaTest.SupportsReadLong = true; - mediaTest.LongBlockSize = 37856; - mediaTest.LongBlockSizeSpecified = true; + mediaTest.SupportsReadLong = true; + mediaTest.LongBlockSize = 37856; } } if(tryPlextor) { - mediaTest.SupportsPlextorReadRawDVDSpecified = true; DicConsole.WriteLine("Trying Plextor trick to raw read DVDs..."); mediaTest.SupportsPlextorReadRawDVD = !dev.PlextorReadRawDvd(out buffer, out senseBuffer, 0, 1, TIMEOUT, out _); @@ -1851,15 +1651,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI !mediaTest.SupportsPlextorReadRawDVD); if(debug) DataFile.WriteTo("SCSI Report", "plextorrawdvd", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); - if(mediaTest.SupportsPlextorReadRawDVD) + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); + if(mediaTest.SupportsPlextorReadRawDVD == true) mediaTest.SupportsPlextorReadRawDVD = !ArrayHelpers.ArrayIsNullOrEmpty(buffer); } if(tryHldtst) { - mediaTest.SupportsHLDTSTReadRawDVDSpecified = true; DicConsole.WriteLine("Trying HL-DT-ST (aka LG) trick to raw read DVDs..."); mediaTest.SupportsHLDTSTReadRawDVD = !dev.HlDtStReadRawDvd(out buffer, out senseBuffer, 0, 1, TIMEOUT, out _); @@ -1867,11 +1666,11 @@ namespace DiscImageChef.Core.Devices.Report.SCSI !mediaTest.SupportsHLDTSTReadRawDVD); if(debug) DataFile.WriteTo("SCSI Report", "hldtstrawdvd", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } - if(mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize) + if(mediaTest.SupportsReadLong == true && mediaTest.LongBlockSize == mediaTest.BlockSize) { pressedKey = new ConsoleKeyInfo(); while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) @@ -1899,8 +1698,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI bingo.Close(); } - mediaTest.LongBlockSize = i; - mediaTest.LongBlockSizeSpecified = true; + mediaTest.LongBlockSize = i; break; } @@ -1911,15 +1709,15 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } } - if(debug && mediaTest.SupportsReadLong && mediaTest.LongBlockSizeSpecified && - mediaTest.LongBlockSize != mediaTest.BlockSize) + if(debug && mediaTest.SupportsReadLong == true && + mediaTest.LongBlockSize != mediaTest.BlockSize) { sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, (ushort)mediaTest.LongBlockSize, TIMEOUT, out _); if(!sense) DataFile.WriteTo("SCSI Report", "readlong10", - "_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" + - mediaType + ".bin", "read results", buffer); + "_debug_" + productIdentification + "_" + mediaType + ".bin", + "read results", buffer); } } diff --git a/DiscImageChef.Core/Devices/Report/SCSI/SSC.cs b/DiscImageChef.Core/Devices/Report/SCSI/SSC.cs index 4655a6fa1..ba23b2434 100644 --- a/DiscImageChef.Core/Devices/Report/SCSI/SSC.cs +++ b/DiscImageChef.Core/Devices/Report/SCSI/SSC.cs @@ -52,7 +52,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI /// Device /// Device report /// If debug is enabled - internal static void Report(Device dev, ref DeviceReport report, bool debug) + internal static void Report(Device dev, ref DeviceReportV2 report, bool debug) { if(report == null) return; @@ -60,7 +60,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI const uint TIMEOUT = 5; ConsoleKeyInfo pressedKey; - report.SCSI.SequentialDevice = new sscType(); + report.SCSI.SequentialDevice = new CommonTypes.Metadata.Ssc(); DicConsole.WriteLine("Querying SCSI READ BLOCK LIMITS..."); sense = dev.ReadBlockLimits(out byte[] buffer, out byte[] senseBuffer, TIMEOUT, out _); if(!sense) @@ -69,22 +69,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(decBl.HasValue) { if(decBl.Value.granularity > 0) - { - report.SCSI.SequentialDevice.BlockSizeGranularitySpecified = true; - report.SCSI.SequentialDevice.BlockSizeGranularity = decBl.Value.granularity; - } + report.SCSI.SequentialDevice.BlockSizeGranularity = decBl.Value.granularity; if(decBl.Value.maxBlockLen > 0) - { - report.SCSI.SequentialDevice.MaxBlockLengthSpecified = true; - report.SCSI.SequentialDevice.MaxBlockLength = decBl.Value.maxBlockLen; - } + report.SCSI.SequentialDevice.MaxBlockLength = decBl.Value.maxBlockLen; if(decBl.Value.minBlockLen > 0) - { - report.SCSI.SequentialDevice.MinBlockLengthSpecified = true; - report.SCSI.SequentialDevice.MinBlockLength = decBl.Value.minBlockLen; - } + report.SCSI.SequentialDevice.MinBlockLength = decBl.Value.minBlockLen; } } @@ -153,7 +144,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } } - List seqTests = new List(); + List seqTests = new List(); pressedKey = new ConsoleKeyInfo(); while(pressedKey.Key != ConsoleKey.N) @@ -171,7 +162,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI DicConsole.WriteLine("Please insert it in the drive and press any key when it is ready."); System.Console.ReadKey(true); - SequentialMedia seqTest = new SequentialMedia(); + TestedSequentialMedia seqTest = new TestedSequentialMedia(); DicConsole.Write("Please write a description of the media type and press enter: "); seqTest.MediumTypeName = System.Console.ReadLine(); DicConsole.Write("Please write the media manufacturer and press enter: "); @@ -246,14 +237,10 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(decMode.HasValue) { - seqTest.MediumType = (byte)decMode.Value.Header.MediumType; - seqTest.MediumTypeSpecified = true; + seqTest.MediumType = (byte)decMode.Value.Header.MediumType; if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length > 0) - { - seqTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density; - seqTest.DensitySpecified = true; - } + seqTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density; } } @@ -310,7 +297,6 @@ namespace DiscImageChef.Core.Devices.Report.SCSI } } - seqTest.CanReadMediaSerialSpecified = true; DicConsole.WriteLine("Trying SCSI READ MEDIA SERIAL NUMBER..."); seqTest.CanReadMediaSerial = !dev.ReadMediaSerialNumber(out buffer, out senseBuffer, TIMEOUT, out _); seqTests.Add(seqTest); diff --git a/DiscImageChef.Core/Devices/Report/SecureDigital.cs b/DiscImageChef.Core/Devices/Report/SecureDigital.cs index 3096ded2b..012bf4658 100644 --- a/DiscImageChef.Core/Devices/Report/SecureDigital.cs +++ b/DiscImageChef.Core/Devices/Report/SecureDigital.cs @@ -46,17 +46,17 @@ namespace DiscImageChef.Core.Devices.Report /// /// Device /// Device report - public static void Report(Device dev, ref DeviceReport report) + public static void Report(Device dev, ref DeviceReportV2 report) { if(report == null) return; switch(dev.Type) { case DeviceType.MMC: - report.MultiMediaCard = new mmcsdType(); + report.MultiMediaCard = new MmcSd(); break; case DeviceType.SecureDigital: - report.SecureDigital = new mmcsdType(); + report.SecureDigital = new MmcSd(); break; } diff --git a/DiscImageChef.Core/Devices/Report/USB.cs b/DiscImageChef.Core/Devices/Report/USB.cs index 8e9957c72..b42b1ec78 100644 --- a/DiscImageChef.Core/Devices/Report/USB.cs +++ b/DiscImageChef.Core/Devices/Report/USB.cs @@ -49,7 +49,7 @@ namespace DiscImageChef.Core.Devices.Report /// Device report /// If device is removable /// If debug is enabled - internal static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable) + internal static void Report(Device dev, ref DeviceReportV2 report, bool debug, ref bool removable) { if(report == null) return; @@ -63,7 +63,7 @@ namespace DiscImageChef.Core.Devices.Report if(pressedKey.Key != ConsoleKey.Y) return; - report.USB = new usbType + report.USB = new CommonTypes.Metadata.Usb { Manufacturer = dev.UsbManufacturerString, Product = dev.UsbProductString, diff --git a/DiscImageChef.Gui/Forms/frmDump.xeto.cs b/DiscImageChef.Gui/Forms/frmDump.xeto.cs index 6a54782f5..84b3b120b 100644 --- a/DiscImageChef.Gui/Forms/frmDump.xeto.cs +++ b/DiscImageChef.Gui/Forms/frmDump.xeto.cs @@ -49,8 +49,10 @@ using DiscImageChef.Devices; using Eto.Forms; using Eto.Serialization.Xaml; using Schemas; +using Ata = DiscImageChef.Core.Devices.Dumping.Ata; using DeviceInfo = DiscImageChef.Core.Devices.Info.DeviceInfo; using MediaType = DiscImageChef.CommonTypes.MediaType; +using Scsi = DiscImageChef.Core.Devices.Dumping.Scsi; namespace DiscImageChef.Gui.Forms { diff --git a/DiscImageChef.Server/ViewReport.aspx.cs b/DiscImageChef.Server/ViewReport.aspx.cs index 727d7c55b..217d47c50 100644 --- a/DiscImageChef.Server/ViewReport.aspx.cs +++ b/DiscImageChef.Server/ViewReport.aspx.cs @@ -42,6 +42,8 @@ using DiscImageChef.CommonTypes.Metadata; using DiscImageChef.Decoders.PCMCIA; using DiscImageChef.Decoders.SCSI; using DiscImageChef.Server.App_Start; +using Ata = DiscImageChef.Server.App_Start.Ata; +using TestedMedia = DiscImageChef.Server.App_Start.TestedMedia; using Tuple = DiscImageChef.Decoders.PCMCIA.Tuple; namespace DiscImageChef.Server diff --git a/DiscImageChef/Commands/DeviceReport.cs b/DiscImageChef/Commands/DeviceReport.cs index 1c9ceb0f1..fac999d59 100644 --- a/DiscImageChef/Commands/DeviceReport.cs +++ b/DiscImageChef/Commands/DeviceReport.cs @@ -32,12 +32,13 @@ using System; using System.IO; -using System.Xml.Serialization; +using DiscImageChef.CommonTypes.Metadata; using DiscImageChef.Console; -using DiscImageChef.Core; using DiscImageChef.Core.Devices.Report; using DiscImageChef.Core.Devices.Report.SCSI; using DiscImageChef.Devices; +using Newtonsoft.Json; +using Ata = DiscImageChef.Core.Devices.Report.Ata; namespace DiscImageChef.Commands { @@ -63,21 +64,18 @@ namespace DiscImageChef.Commands Core.Statistics.AddDevice(dev); - CommonTypes.Metadata.DeviceReport report = new CommonTypes.Metadata.DeviceReport(); - bool removable = false; - string xmlFile; - if(!string.IsNullOrWhiteSpace(dev.Manufacturer) && !string.IsNullOrWhiteSpace(dev.Revision)) - xmlFile = - dev.Manufacturer + "_" + dev.Model + "_" + dev.Revision + ".xml"; - else if(!string.IsNullOrWhiteSpace(dev.Manufacturer)) - xmlFile = dev.Manufacturer + "_" + dev.Model + ".xml"; - else if(!string.IsNullOrWhiteSpace(dev.Revision)) - xmlFile = dev.Model + "_" + dev.Revision + ".xml"; - else - xmlFile = - dev.Model + ".xml"; + DeviceReportV2 report = new DeviceReportV2(); + bool removable = false; + string jsonFile; - xmlFile = xmlFile.Replace('\\', '_').Replace('/', '_').Replace('?', '_'); + if(!string.IsNullOrWhiteSpace(dev.Manufacturer) && !string.IsNullOrWhiteSpace(dev.Revision)) + jsonFile = dev.Manufacturer + "_" + dev.Model + "_" + dev.Revision + ".json"; + else if(!string.IsNullOrWhiteSpace(dev.Manufacturer)) + jsonFile = dev.Manufacturer + "_" + dev.Model + ".json"; + else if(!string.IsNullOrWhiteSpace(dev.Revision)) jsonFile = dev.Model + "_" + dev.Revision + ".json"; + else jsonFile = dev.Model + ".json"; + + jsonFile = jsonFile.Replace('\\', '_').Replace('/', '_').Replace('?', '_'); switch(dev.Type) { @@ -98,14 +96,20 @@ namespace DiscImageChef.Commands default: throw new NotSupportedException("Unknown device type."); } - FileStream xmlFs = new FileStream(xmlFile, FileMode.Create); + FileStream jsonFs = new FileStream(jsonFile, FileMode.Create); + StreamWriter jsonSw = new StreamWriter(jsonFs); + jsonSw.Write(JsonConvert.SerializeObject(report, Formatting.Indented, + new JsonSerializerSettings + { + NullValueHandling = NullValueHandling.Ignore + })); + jsonSw.Close(); + jsonFs.Close(); - XmlSerializer xmlSer = new XmlSerializer(typeof(CommonTypes.Metadata.DeviceReport)); - xmlSer.Serialize(xmlFs, report); - xmlFs.Close(); Core.Statistics.AddCommand("device-report"); - if(Settings.Settings.Current.ShareReports) Remote.SubmitReport(report); + // TODO: + //if(Settings.Settings.Current.ShareReports) Remote.SubmitReport(report); } } } \ No newline at end of file diff --git a/DiscImageChef/Commands/DumpMedia.cs b/DiscImageChef/Commands/DumpMedia.cs index bde4b7aeb..1062a9fe1 100644 --- a/DiscImageChef/Commands/DumpMedia.cs +++ b/DiscImageChef/Commands/DumpMedia.cs @@ -45,6 +45,8 @@ using DiscImageChef.Core.Devices.Dumping; using DiscImageChef.Core.Logging; using DiscImageChef.Devices; using Schemas; +using Ata = DiscImageChef.Core.Devices.Dumping.Ata; +using Scsi = DiscImageChef.Core.Devices.Dumping.Scsi; namespace DiscImageChef.Commands { diff --git a/DiscImageChef/DiscImageChef.csproj b/DiscImageChef/DiscImageChef.csproj index a0c713b1a..6ad4815b9 100644 --- a/DiscImageChef/DiscImageChef.csproj +++ b/DiscImageChef/DiscImageChef.csproj @@ -265,6 +265,7 @@ +