mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
REFACTOR: Invert 'if' statement to reduce nesting.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -51,409 +51,408 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
Decoders.ATA.AtaErrorRegistersCHS errorRegs;
|
||||
dev.AtapiIdentify(out buffer, out errorRegs, timeout, out duration);
|
||||
|
||||
if(Decoders.ATA.Identify.Decode(buffer).HasValue)
|
||||
if(!Decoders.ATA.Identify.Decode(buffer).HasValue) return;
|
||||
|
||||
Decoders.ATA.Identify.IdentifyDevice atapiId = Decoders.ATA.Identify.Decode(buffer).Value;
|
||||
|
||||
report.ATAPI = new ataType();
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(atapiId.AdditionalPID))
|
||||
{
|
||||
Decoders.ATA.Identify.IdentifyDevice atapiId = Decoders.ATA.Identify.Decode(buffer).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(debug) report.ATAPI.Identify = buffer;
|
||||
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(debug) report.ATAPI.Identify = buffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,25 +51,24 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
if(pressedKey.Key == ConsoleKey.Y)
|
||||
if(pressedKey.Key != ConsoleKey.Y) return;
|
||||
|
||||
report.FireWire = new firewireType();
|
||||
report.FireWire.Manufacturer = dev.FireWireVendorName;
|
||||
report.FireWire.Product = dev.FireWireModelName;
|
||||
report.FireWire.ProductID = dev.FireWireModel;
|
||||
report.FireWire.VendorID = dev.FireWireVendor;
|
||||
|
||||
pressedKey = new ConsoleKeyInfo();
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
report.FireWire = new firewireType();
|
||||
report.FireWire.Manufacturer = dev.FireWireVendorName;
|
||||
report.FireWire.Product = dev.FireWireModelName;
|
||||
report.FireWire.ProductID = dev.FireWireModel;
|
||||
report.FireWire.VendorID = dev.FireWireVendor;
|
||||
|
||||
pressedKey = new ConsoleKeyInfo();
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
DicConsole.Write("Is the media removable from the reading/writing elements? (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
report.FireWire.RemovableMedia = pressedKey.Key == ConsoleKey.Y;
|
||||
removable = report.FireWire.RemovableMedia;
|
||||
DicConsole.Write("Is the media removable from the reading/writing elements? (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
report.FireWire.RemovableMedia = pressedKey.Key == ConsoleKey.Y;
|
||||
removable = report.FireWire.RemovableMedia;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,32 +43,33 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
report.PCMCIA = new pcmciaType();
|
||||
report.PCMCIA.CIS = dev.Cis;
|
||||
Tuple[] tuples = CIS.GetTuples(dev.Cis);
|
||||
if(tuples != null)
|
||||
foreach(Tuple tuple in tuples)
|
||||
switch(tuple.Code) {
|
||||
case TupleCodes.CISTPL_MANFID:
|
||||
ManufacturerIdentificationTuple manfid = CIS.DecodeManufacturerIdentificationTuple(tuple);
|
||||
if(tuples == null) return;
|
||||
|
||||
if(manfid != null)
|
||||
{
|
||||
report.PCMCIA.ManufacturerCode = manfid.ManufacturerID;
|
||||
report.PCMCIA.CardCode = manfid.CardID;
|
||||
report.PCMCIA.ManufacturerCodeSpecified = true;
|
||||
report.PCMCIA.CardCodeSpecified = true;
|
||||
}
|
||||
break;
|
||||
case TupleCodes.CISTPL_VERS_1:
|
||||
Level1VersionTuple vers = CIS.DecodeLevel1VersionTuple(tuple);
|
||||
foreach(Tuple tuple in tuples)
|
||||
switch(tuple.Code) {
|
||||
case TupleCodes.CISTPL_MANFID:
|
||||
ManufacturerIdentificationTuple manfid = CIS.DecodeManufacturerIdentificationTuple(tuple);
|
||||
|
||||
if(vers != null)
|
||||
{
|
||||
report.PCMCIA.Manufacturer = vers.Manufacturer;
|
||||
report.PCMCIA.ProductName = vers.Product;
|
||||
report.PCMCIA.Compliance = string.Format("{0}.{1}", vers.MajorVersion, vers.MinorVersion);
|
||||
report.PCMCIA.AdditionalInformation = vers.AdditionalInformation;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(manfid != null)
|
||||
{
|
||||
report.PCMCIA.ManufacturerCode = manfid.ManufacturerID;
|
||||
report.PCMCIA.CardCode = manfid.CardID;
|
||||
report.PCMCIA.ManufacturerCodeSpecified = true;
|
||||
report.PCMCIA.CardCodeSpecified = true;
|
||||
}
|
||||
break;
|
||||
case TupleCodes.CISTPL_VERS_1:
|
||||
Level1VersionTuple vers = CIS.DecodeLevel1VersionTuple(tuple);
|
||||
|
||||
if(vers != null)
|
||||
{
|
||||
report.PCMCIA.Manufacturer = vers.Manufacturer;
|
||||
report.PCMCIA.ProductName = vers.Product;
|
||||
report.PCMCIA.Compliance = string.Format("{0}.{1}", vers.MajorVersion, vers.MinorVersion);
|
||||
report.PCMCIA.AdditionalInformation = vers.AdditionalInformation;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,13 +189,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
DicConsole.WriteLine("Querying SCSI EVPD {0:X2}h...", page);
|
||||
sense = dev.ScsiInquiry(out buffer, out senseBuffer, page);
|
||||
if(!sense)
|
||||
{
|
||||
pageType evpd = new pageType();
|
||||
evpd.page = page;
|
||||
evpd.value = buffer;
|
||||
evpds.Add(evpd);
|
||||
}
|
||||
if(sense) continue;
|
||||
|
||||
pageType evpd = new pageType();
|
||||
evpd.page = page;
|
||||
evpd.value = buffer;
|
||||
evpds.Add(evpd);
|
||||
}
|
||||
|
||||
if(evpds.Count > 0) report.SCSI.EVPDPages = evpds.ToArray();
|
||||
@@ -330,324 +329,321 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
if(pressedKey.Key == ConsoleKey.Y)
|
||||
if(pressedKey.Key != ConsoleKey.Y) continue;
|
||||
|
||||
DicConsole.WriteLine("Please insert it in the drive and press any key when it is ready.");
|
||||
System.Console.ReadKey(true);
|
||||
|
||||
testedMediaType mediaTest = new testedMediaType();
|
||||
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: ");
|
||||
mediaTest.Manufacturer = 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;
|
||||
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(sense)
|
||||
{
|
||||
DicConsole.WriteLine("Please insert it in the drive and press any key when it is ready.");
|
||||
System.Console.ReadKey(true);
|
||||
Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuffer);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.ASC == 0x3A)
|
||||
{
|
||||
int leftRetries = 20;
|
||||
while(leftRetries > 0)
|
||||
{
|
||||
DicConsole.Write("\rWaiting for drive to become ready");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(!sense) break;
|
||||
|
||||
testedMediaType mediaTest = new testedMediaType();
|
||||
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: ");
|
||||
mediaTest.Manufacturer = System.Console.ReadLine();
|
||||
DicConsole.Write("Please write the media model and press enter: ");
|
||||
mediaTest.Model = System.Console.ReadLine();
|
||||
leftRetries--;
|
||||
}
|
||||
|
||||
mediaTest.ManufacturerSpecified = true;
|
||||
mediaTest.ModelSpecified = true;
|
||||
mediaTest.MediaIsRecognized = true;
|
||||
mediaTest.MediaIsRecognized &= !sense;
|
||||
}
|
||||
else if(decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01)
|
||||
{
|
||||
int leftRetries = 20;
|
||||
while(leftRetries > 0)
|
||||
{
|
||||
DicConsole.Write("\rWaiting for drive to become ready");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(!sense) break;
|
||||
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(sense)
|
||||
leftRetries--;
|
||||
}
|
||||
|
||||
mediaTest.MediaIsRecognized &= !sense;
|
||||
}
|
||||
else mediaTest.MediaIsRecognized = false;
|
||||
else mediaTest.MediaIsRecognized = false;
|
||||
}
|
||||
|
||||
if(mediaTest.MediaIsRecognized)
|
||||
{
|
||||
mediaTest.SupportsReadCapacitySpecified = true;
|
||||
mediaTest.SupportsReadCapacity16Specified = true;
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI READ CAPACITY...");
|
||||
sense = dev.ReadCapacity(out buffer, out senseBuffer, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadCapacity = true;
|
||||
mediaTest.Blocks =
|
||||
(ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) +
|
||||
buffer[3]) + 1;
|
||||
mediaTest.BlockSize =
|
||||
(uint)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]);
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI READ CAPACITY (16)...");
|
||||
sense = dev.ReadCapacity16(out buffer, out buffer, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadCapacity16 = true;
|
||||
byte[] temp = new byte[8];
|
||||
Array.Copy(buffer, 0, temp, 0, 8);
|
||||
Array.Reverse(temp);
|
||||
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;
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE (10)...");
|
||||
sense = dev.ModeSense10(out buffer, out senseBuffer, false, true,
|
||||
ScsiModeSensePageControl.Current, 0x3F, 0x00, timeout,
|
||||
out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
if(debug) mediaTest.ModeSense10Data = buffer;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE...");
|
||||
sense = dev.ModeSense(out buffer, out senseBuffer, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense6 = true;
|
||||
if(!decMode.HasValue)
|
||||
decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(debug) mediaTest.ModeSense6Data = buffer;
|
||||
}
|
||||
|
||||
if(decMode.HasValue)
|
||||
{
|
||||
mediaTest.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
mediaTest.MediumTypeSpecified = true;
|
||||
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.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 duration);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read6",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
buffer);
|
||||
|
||||
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 duration);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead10);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read10",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
buffer);
|
||||
|
||||
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 duration);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead12);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read12",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
buffer);
|
||||
|
||||
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 duration);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead16);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read16",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
buffer);
|
||||
|
||||
mediaTest.LongBlockSize = mediaTest.BlockSize;
|
||||
DicConsole.WriteLine("Trying SCSI READ LONG (10)...");
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 0xFFFF, timeout,
|
||||
out duration);
|
||||
if(sense && !dev.Error)
|
||||
{
|
||||
Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuffer);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.ASC == 0x3A)
|
||||
if(decSense.Value.SenseKey == Decoders.SCSI.SenseKeys.IllegalRequest &&
|
||||
decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00)
|
||||
{
|
||||
int leftRetries = 20;
|
||||
while(leftRetries > 0)
|
||||
mediaTest.SupportsReadLong = true;
|
||||
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
||||
{
|
||||
DicConsole.Write("\rWaiting for drive to become ready");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(!sense) break;
|
||||
|
||||
leftRetries--;
|
||||
mediaTest.LongBlockSize =
|
||||
0xFFFF - (decSense.Value.Information & 0xFFFF);
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
mediaTest.MediaIsRecognized &= !sense;
|
||||
}
|
||||
else if(decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01)
|
||||
{
|
||||
int leftRetries = 20;
|
||||
while(leftRetries > 0)
|
||||
{
|
||||
DicConsole.Write("\rWaiting for drive to become ready");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(!sense) break;
|
||||
|
||||
leftRetries--;
|
||||
}
|
||||
|
||||
mediaTest.MediaIsRecognized &= !sense;
|
||||
}
|
||||
else mediaTest.MediaIsRecognized = false;
|
||||
else mediaTest.MediaIsRecognized = false;
|
||||
}
|
||||
|
||||
if(mediaTest.MediaIsRecognized)
|
||||
if(mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize)
|
||||
if(mediaTest.BlockSize == 512)
|
||||
foreach(ushort testSize in new[]
|
||||
{
|
||||
// Long sector sizes for floppies
|
||||
514,
|
||||
// Long sector sizes for SuperDisk
|
||||
536, 558,
|
||||
// Long sector sizes for 512-byte magneto-opticals
|
||||
600, 610, 630
|
||||
})
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0,
|
||||
testSize, timeout, out duration);
|
||||
if(sense || dev.Error) continue;
|
||||
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = testSize;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
else if(mediaTest.BlockSize == 1024)
|
||||
foreach(ushort testSize in new[]
|
||||
{
|
||||
// Long sector sizes for floppies
|
||||
1026,
|
||||
// Long sector sizes for 1024-byte magneto-opticals
|
||||
1200
|
||||
})
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0,
|
||||
testSize, timeout, out duration);
|
||||
if(sense || dev.Error) continue;
|
||||
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = testSize;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
else if(mediaTest.BlockSize == 2048)
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 2380,
|
||||
timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 2380;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
else if(mediaTest.BlockSize == 4096)
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 4760,
|
||||
timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 4760;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
else if(mediaTest.BlockSize == 8192)
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 9424,
|
||||
timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 9424;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize)
|
||||
{
|
||||
mediaTest.SupportsReadCapacitySpecified = true;
|
||||
mediaTest.SupportsReadCapacity16Specified = true;
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI READ CAPACITY...");
|
||||
sense = dev.ReadCapacity(out buffer, out senseBuffer, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
pressedKey = new ConsoleKeyInfo();
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
mediaTest.SupportsReadCapacity = true;
|
||||
mediaTest.Blocks =
|
||||
(ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) +
|
||||
buffer[3]) + 1;
|
||||
mediaTest.BlockSize =
|
||||
(uint)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]);
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlockSizeSpecified = true;
|
||||
DicConsole
|
||||
.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI READ CAPACITY (16)...");
|
||||
sense = dev.ReadCapacity16(out buffer, out buffer, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
if(pressedKey.Key == ConsoleKey.Y)
|
||||
{
|
||||
mediaTest.SupportsReadCapacity16 = true;
|
||||
byte[] temp = new byte[8];
|
||||
Array.Copy(buffer, 0, temp, 0, 8);
|
||||
Array.Reverse(temp);
|
||||
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;
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE (10)...");
|
||||
sense = dev.ModeSense10(out buffer, out senseBuffer, false, true,
|
||||
ScsiModeSensePageControl.Current, 0x3F, 0x00, timeout,
|
||||
out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
if(debug) mediaTest.ModeSense10Data = buffer;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE...");
|
||||
sense = dev.ModeSense(out buffer, out senseBuffer, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense6 = true;
|
||||
if(!decMode.HasValue)
|
||||
decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(debug) mediaTest.ModeSense6Data = buffer;
|
||||
}
|
||||
|
||||
if(decMode.HasValue)
|
||||
{
|
||||
mediaTest.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
mediaTest.MediumTypeSpecified = true;
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
decMode.Value.Header.BlockDescriptors.Length > 0)
|
||||
for(ushort i = (ushort)mediaTest.BlockSize; i <= ushort.MaxValue; i++)
|
||||
{
|
||||
mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
mediaTest.DensitySpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
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 duration);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read6",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
buffer);
|
||||
|
||||
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 duration);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead10);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read10",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
buffer);
|
||||
|
||||
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 duration);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead12);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read12",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
buffer);
|
||||
|
||||
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 duration);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead16);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read16",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
buffer);
|
||||
|
||||
mediaTest.LongBlockSize = mediaTest.BlockSize;
|
||||
DicConsole.WriteLine("Trying SCSI READ LONG (10)...");
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 0xFFFF, timeout,
|
||||
out duration);
|
||||
if(sense && !dev.Error)
|
||||
{
|
||||
Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuffer);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.SenseKey == Decoders.SCSI.SenseKeys.IllegalRequest &&
|
||||
decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00)
|
||||
{
|
||||
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.BlockSize == 512)
|
||||
foreach(ushort testSize in new[]
|
||||
{
|
||||
// Long sector sizes for floppies
|
||||
514,
|
||||
// Long sector sizes for SuperDisk
|
||||
536, 558,
|
||||
// Long sector sizes for 512-byte magneto-opticals
|
||||
600, 610, 630
|
||||
})
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0,
|
||||
testSize, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = testSize;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(mediaTest.BlockSize == 1024)
|
||||
foreach(ushort testSize in new[]
|
||||
{
|
||||
// Long sector sizes for floppies
|
||||
1026,
|
||||
// Long sector sizes for 1024-byte magneto-opticals
|
||||
1200
|
||||
})
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0,
|
||||
testSize, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = testSize;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(mediaTest.BlockSize == 2048)
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 2380,
|
||||
DicConsole.Write("\rTrying to READ LONG with a size of {0} bytes...", i);
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, i,
|
||||
timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
if(!sense)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 2380;
|
||||
mediaTest.LongBlockSize = i;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
else if(mediaTest.BlockSize == 4096)
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 4760,
|
||||
timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 4760;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
else if(mediaTest.BlockSize == 8192)
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 9424,
|
||||
timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 9424;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize)
|
||||
{
|
||||
pressedKey = new ConsoleKeyInfo();
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
DicConsole
|
||||
.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
if(pressedKey.Key == ConsoleKey.Y)
|
||||
{
|
||||
for(ushort i = (ushort)mediaTest.BlockSize; i <= ushort.MaxValue; i++)
|
||||
{
|
||||
DicConsole.Write("\rTrying to READ LONG with a size of {0} bytes...", i);
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, i,
|
||||
timeout, out duration);
|
||||
if(!sense)
|
||||
{
|
||||
mediaTest.LongBlockSize = i;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(i == ushort.MaxValue) break;
|
||||
break;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine();
|
||||
if(i == ushort.MaxValue) break;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
if(debug && mediaTest.SupportsReadLong && mediaTest.LongBlockSizeSpecified &&
|
||||
mediaTest.LongBlockSize != mediaTest.BlockSize)
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0,
|
||||
(ushort)mediaTest.LongBlockSize, timeout, out duration);
|
||||
if(!sense)
|
||||
DataFile.WriteTo("SCSI Report", "readlong10",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
buffer);
|
||||
}
|
||||
|
||||
mediaTest.CanReadMediaSerialSpecified = true;
|
||||
DicConsole.WriteLine("Trying SCSI READ MEDIA SERIAL NUMBER...");
|
||||
mediaTest.CanReadMediaSerial =
|
||||
!dev.ReadMediaSerialNumber(out buffer, out senseBuffer, timeout, out duration);
|
||||
}
|
||||
|
||||
mediaTests.Add(mediaTest);
|
||||
if(debug && mediaTest.SupportsReadLong && mediaTest.LongBlockSizeSpecified &&
|
||||
mediaTest.LongBlockSize != mediaTest.BlockSize)
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0,
|
||||
(ushort)mediaTest.LongBlockSize, timeout, out duration);
|
||||
if(!sense)
|
||||
DataFile.WriteTo("SCSI Report", "readlong10",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
buffer);
|
||||
}
|
||||
|
||||
mediaTest.CanReadMediaSerialSpecified = true;
|
||||
DicConsole.WriteLine("Trying SCSI READ MEDIA SERIAL NUMBER...");
|
||||
mediaTest.CanReadMediaSerial =
|
||||
!dev.ReadMediaSerialNumber(out buffer, out senseBuffer, timeout, out duration);
|
||||
}
|
||||
|
||||
mediaTests.Add(mediaTest);
|
||||
}
|
||||
|
||||
report.SCSI.RemovableMedias = mediaTests.ToArray();
|
||||
@@ -807,13 +803,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, timeout,
|
||||
out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = testSize;
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
if(sense || dev.Error) continue;
|
||||
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = testSize;
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
else if(report.SCSI.ReadCapabilities.BlockSize == 1024)
|
||||
foreach(ushort testSize in new[]
|
||||
@@ -826,13 +821,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, timeout,
|
||||
out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = testSize;
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
if(sense || dev.Error) continue;
|
||||
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = testSize;
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
else if(report.SCSI.ReadCapabilities.BlockSize == 2048)
|
||||
{
|
||||
|
||||
@@ -1333,11 +1333,10 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
DataFile.WriteTo("SCSI Report", "leadin",
|
||||
"_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" +
|
||||
mediaType + ".bin", "read results", buffer);
|
||||
if(!sense)
|
||||
{
|
||||
mediaTest.CanReadLeadIn = true;
|
||||
break;
|
||||
}
|
||||
if(sense) continue;
|
||||
|
||||
mediaTest.CanReadLeadIn = true;
|
||||
break;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Trying to read CD Lead-Out...");
|
||||
|
||||
@@ -133,14 +133,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.SequentialDevice.SupportedMediaTypes[i].Organization =
|
||||
mtsh.Value.descriptors[i].organization;
|
||||
report.SCSI.SequentialDevice.SupportedMediaTypes[i].Width = mtsh.Value.descriptors[i].width;
|
||||
if(mtsh.Value.descriptors[i].densityCodes != null)
|
||||
{
|
||||
report.SCSI.SequentialDevice.SupportedMediaTypes[i].DensityCodes =
|
||||
new int[mtsh.Value.descriptors[i].densityCodes.Length];
|
||||
for(int j = 0; j < mtsh.Value.descriptors.Length; j++)
|
||||
report.SCSI.SequentialDevice.SupportedMediaTypes[i].DensityCodes[j] =
|
||||
mtsh.Value.descriptors[i].densityCodes[j];
|
||||
}
|
||||
if(mtsh.Value.descriptors[i].densityCodes == null) continue;
|
||||
|
||||
report.SCSI.SequentialDevice.SupportedMediaTypes[i].DensityCodes =
|
||||
new int[mtsh.Value.descriptors[i].densityCodes.Length];
|
||||
for(int j = 0; j < mtsh.Value.descriptors.Length; j++)
|
||||
report.SCSI.SequentialDevice.SupportedMediaTypes[i].DensityCodes[j] =
|
||||
mtsh.Value.descriptors[i].densityCodes[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,159 +157,157 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
if(pressedKey.Key == ConsoleKey.Y)
|
||||
if(pressedKey.Key != ConsoleKey.Y) continue;
|
||||
|
||||
DicConsole.WriteLine("Please insert it in the drive and press any key when it is ready.");
|
||||
System.Console.ReadKey(true);
|
||||
|
||||
SequentialMedia seqTest = new SequentialMedia();
|
||||
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: ");
|
||||
seqTest.Manufacturer = System.Console.ReadLine();
|
||||
DicConsole.Write("Please write the media model and press enter: ");
|
||||
seqTest.Model = System.Console.ReadLine();
|
||||
|
||||
seqTest.MediaIsRecognized = true;
|
||||
|
||||
sense = dev.Load(out senseBuffer, timeout, out duration);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(sense)
|
||||
{
|
||||
DicConsole.WriteLine("Please insert it in the drive and press any key when it is ready.");
|
||||
System.Console.ReadKey(true);
|
||||
|
||||
SequentialMedia seqTest = new SequentialMedia();
|
||||
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: ");
|
||||
seqTest.Manufacturer = System.Console.ReadLine();
|
||||
DicConsole.Write("Please write the media model and press enter: ");
|
||||
seqTest.Model = System.Console.ReadLine();
|
||||
|
||||
seqTest.MediaIsRecognized = true;
|
||||
|
||||
sense = dev.Load(out senseBuffer, timeout, out duration);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(sense)
|
||||
{
|
||||
Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuffer);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.ASC == 0x3A)
|
||||
Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuffer);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.ASC == 0x3A)
|
||||
{
|
||||
int leftRetries = 20;
|
||||
while(leftRetries > 0)
|
||||
{
|
||||
int leftRetries = 20;
|
||||
while(leftRetries > 0)
|
||||
{
|
||||
DicConsole.Write("\rWaiting for drive to become ready");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(!sense) break;
|
||||
DicConsole.Write("\rWaiting for drive to become ready");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(!sense) break;
|
||||
|
||||
leftRetries--;
|
||||
}
|
||||
|
||||
seqTest.MediaIsRecognized &= !sense;
|
||||
leftRetries--;
|
||||
}
|
||||
else if(decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01)
|
||||
|
||||
seqTest.MediaIsRecognized &= !sense;
|
||||
}
|
||||
else if(decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01)
|
||||
{
|
||||
int leftRetries = 20;
|
||||
while(leftRetries > 0)
|
||||
{
|
||||
int leftRetries = 20;
|
||||
while(leftRetries > 0)
|
||||
{
|
||||
DicConsole.Write("\rWaiting for drive to become ready");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(!sense) break;
|
||||
DicConsole.Write("\rWaiting for drive to become ready");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(!sense) break;
|
||||
|
||||
leftRetries--;
|
||||
}
|
||||
|
||||
seqTest.MediaIsRecognized &= !sense;
|
||||
leftRetries--;
|
||||
}
|
||||
else seqTest.MediaIsRecognized = false;
|
||||
|
||||
seqTest.MediaIsRecognized &= !sense;
|
||||
}
|
||||
else seqTest.MediaIsRecognized = false;
|
||||
}
|
||||
|
||||
if(seqTest.MediaIsRecognized)
|
||||
{
|
||||
decMode = null;
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE (10)...");
|
||||
sense = dev.ModeSense10(out buffer, out senseBuffer, false, true,
|
||||
ScsiModeSensePageControl.Current, 0x3F, 0x00, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
if(debug) seqTest.ModeSense10Data = buffer;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE...");
|
||||
sense = dev.ModeSense(out buffer, out senseBuffer, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense6 = true;
|
||||
if(!decMode.HasValue) decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(debug) seqTest.ModeSense6Data = buffer;
|
||||
}
|
||||
|
||||
if(decMode.HasValue)
|
||||
{
|
||||
seqTest.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
seqTest.MediumTypeSpecified = true;
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
decMode.Value.Header.BlockDescriptors.Length > 0)
|
||||
{
|
||||
seqTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
seqTest.DensitySpecified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI REPORT DENSITY SUPPORT for current media...");
|
||||
sense = dev.ReportDensitySupport(out buffer, out senseBuffer, false, true, timeout, out duration);
|
||||
if(!sense)
|
||||
{
|
||||
Decoders.SCSI.SSC.DensitySupport.DensitySupportHeader? dsh =
|
||||
Decoders.SCSI.SSC.DensitySupport.DecodeDensity(buffer);
|
||||
if(dsh.HasValue)
|
||||
{
|
||||
seqTest.SupportedDensities = new SupportedDensity[dsh.Value.descriptors.Length];
|
||||
for(int i = 0; i < dsh.Value.descriptors.Length; i++)
|
||||
{
|
||||
seqTest.SupportedDensities[i].BitsPerMm = dsh.Value.descriptors[i].bpmm;
|
||||
seqTest.SupportedDensities[i].Capacity = dsh.Value.descriptors[i].capacity;
|
||||
seqTest.SupportedDensities[i].DefaultDensity = dsh.Value.descriptors[i].defaultDensity;
|
||||
seqTest.SupportedDensities[i].Description = dsh.Value.descriptors[i].description;
|
||||
seqTest.SupportedDensities[i].Duplicate = dsh.Value.descriptors[i].duplicate;
|
||||
seqTest.SupportedDensities[i].Name = dsh.Value.descriptors[i].name;
|
||||
seqTest.SupportedDensities[i].Organization = dsh.Value.descriptors[i].organization;
|
||||
seqTest.SupportedDensities[i].PrimaryCode = dsh.Value.descriptors[i].primaryCode;
|
||||
seqTest.SupportedDensities[i].SecondaryCode = dsh.Value.descriptors[i].secondaryCode;
|
||||
seqTest.SupportedDensities[i].Tracks = dsh.Value.descriptors[i].tracks;
|
||||
seqTest.SupportedDensities[i].Width = dsh.Value.descriptors[i].width;
|
||||
seqTest.SupportedDensities[i].Writable = dsh.Value.descriptors[i].writable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI REPORT DENSITY SUPPORT for medium types for current media...");
|
||||
sense = dev.ReportDensitySupport(out buffer, out senseBuffer, true, true, timeout, out duration);
|
||||
if(!sense)
|
||||
{
|
||||
Decoders.SCSI.SSC.DensitySupport.MediaTypeSupportHeader? mtsh =
|
||||
Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(buffer);
|
||||
if(mtsh.HasValue)
|
||||
{
|
||||
seqTest.SupportedMediaTypes = new SupportedMedia[mtsh.Value.descriptors.Length];
|
||||
for(int i = 0; i < mtsh.Value.descriptors.Length; i++)
|
||||
{
|
||||
seqTest.SupportedMediaTypes[i].Description = mtsh.Value.descriptors[i].description;
|
||||
seqTest.SupportedMediaTypes[i].Length = mtsh.Value.descriptors[i].length;
|
||||
seqTest.SupportedMediaTypes[i].MediumType = mtsh.Value.descriptors[i].mediumType;
|
||||
seqTest.SupportedMediaTypes[i].Name = mtsh.Value.descriptors[i].name;
|
||||
seqTest.SupportedMediaTypes[i].Organization = mtsh.Value.descriptors[i].organization;
|
||||
seqTest.SupportedMediaTypes[i].Width = mtsh.Value.descriptors[i].width;
|
||||
if(mtsh.Value.descriptors[i].densityCodes != null)
|
||||
{
|
||||
seqTest.SupportedMediaTypes[i].DensityCodes =
|
||||
new int[mtsh.Value.descriptors[i].densityCodes.Length];
|
||||
for(int j = 0; j < mtsh.Value.descriptors.Length; j++)
|
||||
seqTest.SupportedMediaTypes[i].DensityCodes[j] =
|
||||
mtsh.Value.descriptors[i].densityCodes[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
seqTest.CanReadMediaSerialSpecified = true;
|
||||
DicConsole.WriteLine("Trying SCSI READ MEDIA SERIAL NUMBER...");
|
||||
seqTest.CanReadMediaSerial =
|
||||
!dev.ReadMediaSerialNumber(out buffer, out senseBuffer, timeout, out duration);
|
||||
seqTests.Add(seqTest);
|
||||
else seqTest.MediaIsRecognized = false;
|
||||
}
|
||||
|
||||
if(seqTest.MediaIsRecognized)
|
||||
{
|
||||
decMode = null;
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE (10)...");
|
||||
sense = dev.ModeSense10(out buffer, out senseBuffer, false, true,
|
||||
ScsiModeSensePageControl.Current, 0x3F, 0x00, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
if(debug) seqTest.ModeSense10Data = buffer;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE...");
|
||||
sense = dev.ModeSense(out buffer, out senseBuffer, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense6 = true;
|
||||
if(!decMode.HasValue) decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(debug) seqTest.ModeSense6Data = buffer;
|
||||
}
|
||||
|
||||
if(decMode.HasValue)
|
||||
{
|
||||
seqTest.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
seqTest.MediumTypeSpecified = true;
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
decMode.Value.Header.BlockDescriptors.Length > 0)
|
||||
{
|
||||
seqTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
seqTest.DensitySpecified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI REPORT DENSITY SUPPORT for current media...");
|
||||
sense = dev.ReportDensitySupport(out buffer, out senseBuffer, false, true, timeout, out duration);
|
||||
if(!sense)
|
||||
{
|
||||
Decoders.SCSI.SSC.DensitySupport.DensitySupportHeader? dsh =
|
||||
Decoders.SCSI.SSC.DensitySupport.DecodeDensity(buffer);
|
||||
if(dsh.HasValue)
|
||||
{
|
||||
seqTest.SupportedDensities = new SupportedDensity[dsh.Value.descriptors.Length];
|
||||
for(int i = 0; i < dsh.Value.descriptors.Length; i++)
|
||||
{
|
||||
seqTest.SupportedDensities[i].BitsPerMm = dsh.Value.descriptors[i].bpmm;
|
||||
seqTest.SupportedDensities[i].Capacity = dsh.Value.descriptors[i].capacity;
|
||||
seqTest.SupportedDensities[i].DefaultDensity = dsh.Value.descriptors[i].defaultDensity;
|
||||
seqTest.SupportedDensities[i].Description = dsh.Value.descriptors[i].description;
|
||||
seqTest.SupportedDensities[i].Duplicate = dsh.Value.descriptors[i].duplicate;
|
||||
seqTest.SupportedDensities[i].Name = dsh.Value.descriptors[i].name;
|
||||
seqTest.SupportedDensities[i].Organization = dsh.Value.descriptors[i].organization;
|
||||
seqTest.SupportedDensities[i].PrimaryCode = dsh.Value.descriptors[i].primaryCode;
|
||||
seqTest.SupportedDensities[i].SecondaryCode = dsh.Value.descriptors[i].secondaryCode;
|
||||
seqTest.SupportedDensities[i].Tracks = dsh.Value.descriptors[i].tracks;
|
||||
seqTest.SupportedDensities[i].Width = dsh.Value.descriptors[i].width;
|
||||
seqTest.SupportedDensities[i].Writable = dsh.Value.descriptors[i].writable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI REPORT DENSITY SUPPORT for medium types for current media...");
|
||||
sense = dev.ReportDensitySupport(out buffer, out senseBuffer, true, true, timeout, out duration);
|
||||
if(!sense)
|
||||
{
|
||||
Decoders.SCSI.SSC.DensitySupport.MediaTypeSupportHeader? mtsh =
|
||||
Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(buffer);
|
||||
if(mtsh.HasValue)
|
||||
{
|
||||
seqTest.SupportedMediaTypes = new SupportedMedia[mtsh.Value.descriptors.Length];
|
||||
for(int i = 0; i < mtsh.Value.descriptors.Length; i++)
|
||||
{
|
||||
seqTest.SupportedMediaTypes[i].Description = mtsh.Value.descriptors[i].description;
|
||||
seqTest.SupportedMediaTypes[i].Length = mtsh.Value.descriptors[i].length;
|
||||
seqTest.SupportedMediaTypes[i].MediumType = mtsh.Value.descriptors[i].mediumType;
|
||||
seqTest.SupportedMediaTypes[i].Name = mtsh.Value.descriptors[i].name;
|
||||
seqTest.SupportedMediaTypes[i].Organization = mtsh.Value.descriptors[i].organization;
|
||||
seqTest.SupportedMediaTypes[i].Width = mtsh.Value.descriptors[i].width;
|
||||
if(mtsh.Value.descriptors[i].densityCodes == null) continue;
|
||||
|
||||
seqTest.SupportedMediaTypes[i].DensityCodes =
|
||||
new int[mtsh.Value.descriptors[i].densityCodes.Length];
|
||||
for(int j = 0; j < mtsh.Value.descriptors.Length; j++)
|
||||
seqTest.SupportedMediaTypes[i].DensityCodes[j] =
|
||||
mtsh.Value.descriptors[i].densityCodes[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
seqTest.CanReadMediaSerialSpecified = true;
|
||||
DicConsole.WriteLine("Trying SCSI READ MEDIA SERIAL NUMBER...");
|
||||
seqTest.CanReadMediaSerial =
|
||||
!dev.ReadMediaSerialNumber(out buffer, out senseBuffer, timeout, out duration);
|
||||
seqTests.Add(seqTest);
|
||||
}
|
||||
|
||||
report.SCSI.SequentialDevice.TestedMedia = seqTests.ToArray();
|
||||
|
||||
@@ -51,26 +51,25 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
if(pressedKey.Key == ConsoleKey.Y)
|
||||
if(pressedKey.Key != ConsoleKey.Y) return;
|
||||
|
||||
report.USB = new usbType();
|
||||
report.USB.Manufacturer = dev.UsbManufacturerString;
|
||||
report.USB.Product = dev.UsbProductString;
|
||||
report.USB.ProductID = dev.UsbProductId;
|
||||
report.USB.VendorID = dev.UsbVendorId;
|
||||
|
||||
pressedKey = new ConsoleKeyInfo();
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
report.USB = new usbType();
|
||||
report.USB.Manufacturer = dev.UsbManufacturerString;
|
||||
report.USB.Product = dev.UsbProductString;
|
||||
report.USB.ProductID = dev.UsbProductId;
|
||||
report.USB.VendorID = dev.UsbVendorId;
|
||||
|
||||
pressedKey = new ConsoleKeyInfo();
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
DicConsole.Write("Is the media removable from the reading/writing elements? (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
report.USB.RemovableMedia = pressedKey.Key == ConsoleKey.Y;
|
||||
removable = report.USB.RemovableMedia;
|
||||
if(debug) report.USB.Descriptors = dev.UsbDescriptors;
|
||||
DicConsole.Write("Is the media removable from the reading/writing elements? (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
report.USB.RemovableMedia = pressedKey.Key == ConsoleKey.Y;
|
||||
removable = report.USB.RemovableMedia;
|
||||
if(debug) report.USB.Descriptors = dev.UsbDescriptors;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user