2017-05-28 21:01:17 +01:00
|
|
|
|
// /***************************************************************************
|
|
|
|
|
|
// The Disc Image Chef
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : ATA.cs
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
2017-05-28 21:01:17 +01:00
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Component : Core algorithms.
|
2017-05-28 21:01:17 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Creates reports from ATA devices.
|
2017-05-28 21:01:17 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
|
// it under the terms of the GNU General Public License as
|
|
|
|
|
|
// published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
|
//
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
//
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Copyright © 2011-2018 Natalia Portillo
|
2017-05-28 21:01:17 +01:00
|
|
|
|
// ****************************************************************************/
|
2017-12-19 03:50:57 +00:00
|
|
|
|
|
2017-05-28 21:01:17 +01:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using DiscImageChef.Console;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
using DiscImageChef.Decoders.ATA;
|
2017-05-28 21:01:17 +01:00
|
|
|
|
using DiscImageChef.Devices;
|
|
|
|
|
|
using DiscImageChef.Metadata;
|
|
|
|
|
|
|
|
|
|
|
|
namespace DiscImageChef.Core.Devices.Report
|
|
|
|
|
|
{
|
2017-12-23 01:46:08 +00:00
|
|
|
|
/// <summary>
|
2017-12-23 17:41:23 +00:00
|
|
|
|
/// Implements creating a report for an ATA device
|
2017-12-23 01:46:08 +00:00
|
|
|
|
/// </summary>
|
2017-12-20 17:15:26 +00:00
|
|
|
|
public static class Ata
|
2017-05-28 21:01:17 +01:00
|
|
|
|
{
|
2017-12-23 01:46:08 +00:00
|
|
|
|
/// <summary>
|
2017-12-23 17:41:23 +00:00
|
|
|
|
/// Creates a report of an ATA device
|
2017-12-23 01:46:08 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="dev">Device</param>
|
|
|
|
|
|
/// <param name="report">Device report</param>
|
|
|
|
|
|
/// <param name="debug">If debug is enabled</param>
|
|
|
|
|
|
/// <param name="removable">If device is removable</param>
|
2017-05-28 21:01:17 +01:00
|
|
|
|
public static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable)
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(report == null) return;
|
2017-05-28 21:01:17 +01:00
|
|
|
|
|
2017-12-21 23:00:30 +00:00
|
|
|
|
const uint TIMEOUT = 5;
|
2017-05-28 21:01:17 +01:00
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
if(dev.IsUsb) Usb.Report(dev, ref report, debug, ref removable);
|
2017-05-28 21:01:17 +01:00
|
|
|
|
|
2017-12-21 23:00:30 +00:00
|
|
|
|
if(dev.IsFireWire) FireWire.Report(dev, ref report, ref removable);
|
2017-05-28 21:01:17 +01:00
|
|
|
|
|
2017-12-21 23:00:30 +00:00
|
|
|
|
if(dev.IsPcmcia) Pcmcia.Report(dev, ref report);
|
2017-05-28 21:01:17 +01:00
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Querying ATA IDENTIFY...");
|
|
|
|
|
|
|
2017-12-21 23:00:30 +00:00
|
|
|
|
dev.AtaIdentify(out byte[] buffer, out _, TIMEOUT, out _);
|
2017-05-28 21:01:17 +01:00
|
|
|
|
|
2017-12-21 14:30:38 +00:00
|
|
|
|
if(!Identify.Decode(buffer).HasValue) return;
|
2017-12-21 06:06:19 +00:00
|
|
|
|
|
2017-12-21 17:10:37 +00:00
|
|
|
|
Identify.IdentifyDevice? ataIdNullable = Identify.Decode(buffer);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataIdNullable == null) return;
|
2017-05-28 21:01:17 +01:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
Identify.IdentifyDevice ataId = ataIdNullable.Value;
|
|
|
|
|
|
|
|
|
|
|
|
ConsoleKeyInfo pressedKey;
|
|
|
|
|
|
if((ushort)ataId.GeneralConfiguration == 0x848A)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.CompactFlash = true;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.CompactFlashSpecified = true;
|
2018-01-21 21:56:09 +00:00
|
|
|
|
removable = false;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
}
|
2017-12-23 17:41:23 +00:00
|
|
|
|
else if(!removable && ataId.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.Removable))
|
2017-12-23 01:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
|
pressedKey = new ConsoleKeyInfo();
|
|
|
|
|
|
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
2017-05-28 21:01:17 +01:00
|
|
|
|
{
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.Write("Is the media removable from the reading/writing elements? (Y/N): ");
|
|
|
|
|
|
pressedKey = System.Console.ReadKey();
|
|
|
|
|
|
DicConsole.WriteLine();
|
2017-05-28 21:01:17 +01:00
|
|
|
|
}
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
removable = pressedKey.Key == ConsoleKey.Y;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(removable)
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Please remove any media from the device and press any key when it is out.");
|
|
|
|
|
|
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))
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.AdditionalPID = ataId.AdditionalPID;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.AdditionalPIDSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.APIOSupported != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.APIOSupported = ataId.APIOSupported;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.APIOSupportedSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.BufferType != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.BufferType = ataId.BufferType;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.BufferTypeSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.BufferSize != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.BufferSize = ataId.BufferSize;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.BufferSizeSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.Capabilities != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.Capabilities = ataId.Capabilities;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.CapabilitiesSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.Capabilities2 != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.Capabilities2 = ataId.Capabilities2;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.Capabilities2Specified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.Capabilities3 != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.Capabilities3 = ataId.Capabilities3;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.Capabilities3Specified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.CFAPowerMode != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.CFAPowerMode = ataId.CFAPowerMode;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.CFAPowerModeSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.CommandSet != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.CommandSet = ataId.CommandSet;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.CommandSetSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.CommandSet2 != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.CommandSet2 = ataId.CommandSet2;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.CommandSet2Specified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.CommandSet3 != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.CommandSet3 = ataId.CommandSet3;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.CommandSet3Specified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.CommandSet4 != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.CommandSet4 = ataId.CommandSet4;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.CommandSet4Specified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.CommandSet5 != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.CommandSet5 = ataId.CommandSet5;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.CommandSet5Specified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.CurrentAAM != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.CurrentAAM = ataId.CurrentAAM;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.CurrentAAMSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.CurrentAPM != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.CurrentAPM = ataId.CurrentAPM;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.CurrentAPMSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.DataSetMgmt != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.DataSetMgmt = ataId.DataSetMgmt;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.DataSetMgmtSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.DataSetMgmtSize != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.DataSetMgmtSize = ataId.DataSetMgmtSize;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.DataSetMgmtSizeSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.DeviceFormFactor != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.DeviceFormFactor = ataId.DeviceFormFactor;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.DeviceFormFactorSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.DMAActive != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.DMAActive = ataId.DMAActive;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.DMAActiveSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.DMASupported != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.DMASupported = ataId.DMASupported;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.DMASupportedSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.DMATransferTimingMode != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.DMATransferTimingMode = ataId.DMATransferTimingMode;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.DMATransferTimingModeSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.EnhancedSecurityEraseTime != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.EnhancedSecurityEraseTime = ataId.EnhancedSecurityEraseTime;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.EnhancedSecurityEraseTimeSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.EnabledCommandSet != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.EnabledCommandSet = ataId.EnabledCommandSet;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.EnabledCommandSetSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.EnabledCommandSet2 != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.EnabledCommandSet2 = ataId.EnabledCommandSet2;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.EnabledCommandSet2Specified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.EnabledCommandSet3 != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.EnabledCommandSet3 = ataId.EnabledCommandSet3;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.EnabledCommandSet3Specified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.EnabledCommandSet4 != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.EnabledCommandSet4 = ataId.EnabledCommandSet4;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.EnabledCommandSet4Specified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.EnabledSATAFeatures != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.EnabledSATAFeatures = ataId.EnabledSATAFeatures;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.EnabledSATAFeaturesSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.ExtendedUserSectors != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ExtendedUserSectors = ataId.ExtendedUserSectors;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ExtendedUserSectorsSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.FreeFallSensitivity != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.FreeFallSensitivity = ataId.FreeFallSensitivity;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.FreeFallSensitivitySpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(!string.IsNullOrWhiteSpace(ataId.FirmwareRevision))
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.FirmwareRevision = ataId.FirmwareRevision;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.FirmwareRevisionSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.GeneralConfiguration != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.GeneralConfiguration = ataId.GeneralConfiguration;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.GeneralConfigurationSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.HardwareResetResult != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.HardwareResetResult = ataId.HardwareResetResult;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.HardwareResetResultSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.InterseekDelay != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.InterseekDelay = ataId.InterseekDelay;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.InterseekDelaySpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.MajorVersion != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.MajorVersion = ataId.MajorVersion;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.MajorVersionSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.MasterPasswordRevisionCode != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.MasterPasswordRevisionCode = ataId.MasterPasswordRevisionCode;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.MasterPasswordRevisionCodeSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.MaxDownloadMicroMode3 != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.MaxDownloadMicroMode3 = ataId.MaxDownloadMicroMode3;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.MaxDownloadMicroMode3Specified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.MaxQueueDepth != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.MaxQueueDepth = ataId.MaxQueueDepth;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.MaxQueueDepthSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.MDMAActive != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.MDMAActive = ataId.MDMAActive;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.MDMAActiveSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.MDMASupported != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.MDMASupported = ataId.MDMASupported;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.MDMASupportedSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.MinDownloadMicroMode3 != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.MinDownloadMicroMode3 = ataId.MinDownloadMicroMode3;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.MinDownloadMicroMode3Specified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.MinMDMACycleTime != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.MinMDMACycleTime = ataId.MinMDMACycleTime;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.MinMDMACycleTimeSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.MinorVersion != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.MinorVersion = ataId.MinorVersion;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.MinorVersionSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.MinPIOCycleTimeNoFlow != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.MinPIOCycleTimeNoFlow = ataId.MinPIOCycleTimeNoFlow;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.MinPIOCycleTimeNoFlowSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.MinPIOCycleTimeFlow != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.MinPIOCycleTimeFlow = ataId.MinPIOCycleTimeFlow;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.MinPIOCycleTimeFlowSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(!string.IsNullOrWhiteSpace(ataId.Model))
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.Model = ataId.Model;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ModelSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.MultipleMaxSectors != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.MultipleMaxSectors = ataId.MultipleMaxSectors;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.MultipleMaxSectorsSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.MultipleSectorNumber != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.MultipleSectorNumber = ataId.MultipleSectorNumber;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.MultipleSectorNumberSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.NVCacheCaps != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.NVCacheCaps = ataId.NVCacheCaps;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.NVCacheCapsSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.NVCacheSize != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.NVCacheSize = ataId.NVCacheSize;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.NVCacheSizeSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.NVCacheWriteSpeed != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.NVCacheWriteSpeed = ataId.NVCacheWriteSpeed;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.NVCacheWriteSpeedSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.NVEstimatedSpinUp != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.NVEstimatedSpinUp = ataId.NVEstimatedSpinUp;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.NVEstimatedSpinUpSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.PacketBusRelease != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.PacketBusRelease = ataId.PacketBusRelease;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.PacketBusReleaseSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.PIOTransferTimingMode != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.PIOTransferTimingMode = ataId.PIOTransferTimingMode;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.PIOTransferTimingModeSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.RecommendedAAM != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.RecommendedAAM = ataId.RecommendedAAM;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.RecommendedAAMSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.RecMDMACycleTime != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.RecommendedMDMACycleTime = ataId.RecMDMACycleTime;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.RecommendedMDMACycleTimeSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.RemovableStatusSet != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.RemovableStatusSet = ataId.RemovableStatusSet;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.RemovableStatusSetSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.SATACapabilities != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.SATACapabilities = ataId.SATACapabilities;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.SATACapabilitiesSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.SATACapabilities2 != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.SATACapabilities2 = ataId.SATACapabilities2;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.SATACapabilities2Specified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.SATAFeatures != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.SATAFeatures = ataId.SATAFeatures;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.SATAFeaturesSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.SCTCommandTransport != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.SCTCommandTransport = ataId.SCTCommandTransport;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.SCTCommandTransportSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.SectorsPerCard != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.SectorsPerCard = ataId.SectorsPerCard;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.SectorsPerCardSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.SecurityEraseTime != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.SecurityEraseTime = ataId.SecurityEraseTime;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.SecurityEraseTimeSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.SecurityStatus != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.SecurityStatus = ataId.SecurityStatus;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.SecurityStatusSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.ServiceBusyClear != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ServiceBusyClear = ataId.ServiceBusyClear;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ServiceBusyClearSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.SpecificConfiguration != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.SpecificConfiguration = ataId.SpecificConfiguration;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.SpecificConfigurationSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.StreamAccessLatency != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.StreamAccessLatency = ataId.StreamAccessLatency;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.StreamAccessLatencySpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.StreamMinReqSize != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.StreamMinReqSize = ataId.StreamMinReqSize;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.StreamMinReqSizeSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.StreamPerformanceGranularity != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.StreamPerformanceGranularity = ataId.StreamPerformanceGranularity;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.StreamPerformanceGranularitySpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.StreamTransferTimeDMA != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.StreamTransferTimeDMA = ataId.StreamTransferTimeDMA;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.StreamTransferTimeDMASpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.StreamTransferTimePIO != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.StreamTransferTimePIO = ataId.StreamTransferTimePIO;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.StreamTransferTimePIOSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.TransportMajorVersion != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.TransportMajorVersion = ataId.TransportMajorVersion;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.TransportMajorVersionSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.TransportMinorVersion != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.TransportMinorVersion = ataId.TransportMinorVersion;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.TransportMinorVersionSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.TrustedComputing != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.TrustedComputing = ataId.TrustedComputing;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.TrustedComputingSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.UDMAActive != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.UDMAActive = ataId.UDMAActive;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.UDMAActiveSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.UDMASupported != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.UDMASupported = ataId.UDMASupported;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.UDMASupportedSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.WRVMode != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.WRVMode = ataId.WRVMode;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.WRVModeSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.WRVSectorCountMode3 != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.WRVSectorCountMode3 = ataId.WRVSectorCountMode3;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.WRVSectorCountMode3Specified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.WRVSectorCountMode2 != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.WRVSectorCountMode2 = ataId.WRVSectorCountMode2;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.WRVSectorCountMode2Specified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(debug) report.ATA.Identify = buffer;
|
|
|
|
|
|
|
|
|
|
|
|
if(removable)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<testedMediaType> mediaTests = new List<testedMediaType>();
|
|
|
|
|
|
|
|
|
|
|
|
pressedKey = new ConsoleKeyInfo();
|
|
|
|
|
|
while(pressedKey.Key != ConsoleKey.N)
|
2017-05-28 21:01:17 +01:00
|
|
|
|
{
|
|
|
|
|
|
pressedKey = new ConsoleKeyInfo();
|
|
|
|
|
|
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
|
|
|
|
|
{
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.Write("Do you have media that you can insert in the drive? (Y/N): ");
|
2017-05-28 21:01:17 +01:00
|
|
|
|
pressedKey = System.Console.ReadKey();
|
|
|
|
|
|
DicConsole.WriteLine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(pressedKey.Key != ConsoleKey.Y) continue;
|
2017-05-28 21:01:17 +01:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.WriteLine("Please insert it in the drive and press any key when it is ready.");
|
2017-05-28 21:01:17 +01:00
|
|
|
|
System.Console.ReadKey(true);
|
2017-12-21 06:06:19 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
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 model and press enter: ");
|
|
|
|
|
|
mediaTest.Model = System.Console.ReadLine();
|
2017-12-21 06:06:19 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.ManufacturerSpecified = true;
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.ModelSpecified = true;
|
|
|
|
|
|
mediaTest.MediaIsRecognized = true;
|
2017-12-21 06:06:19 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.WriteLine("Querying ATA IDENTIFY...");
|
|
|
|
|
|
dev.AtaIdentify(out buffer, out _, TIMEOUT, out _);
|
2017-05-28 21:01:17 +01:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(Identify.Decode(buffer).HasValue)
|
2017-12-21 06:06:19 +00:00
|
|
|
|
{
|
2017-12-23 01:46:08 +00:00
|
|
|
|
ataId = Identify.Decode(buffer).Value;
|
|
|
|
|
|
|
|
|
|
|
|
if(ataId.UnformattedBPT != 0)
|
2017-12-21 06:06:19 +00:00
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.UnformattedBPT = ataId.UnformattedBPT;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.UnformattedBPTSpecified = true;
|
2017-12-21 06:06:19 +00:00
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.UnformattedBPS != 0)
|
2017-12-21 06:06:19 +00:00
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.UnformattedBPS = ataId.UnformattedBPS;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.UnformattedBPSSpecified = true;
|
|
|
|
|
|
}
|
2017-05-28 21:01:17 +01:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.Cylinders > 0 && ataId.Heads > 0 && ataId.SectorsPerTrack > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
mediaTest.CHS = new chsType
|
2017-12-21 17:10:37 +00:00
|
|
|
|
{
|
2017-12-23 01:46:08 +00:00
|
|
|
|
Cylinders = ataId.Cylinders,
|
2018-01-21 21:56:09 +00:00
|
|
|
|
Heads = ataId.Heads,
|
|
|
|
|
|
Sectors = ataId.SectorsPerTrack
|
2017-12-23 01:46:08 +00:00
|
|
|
|
};
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.Blocks = (ulong)(ataId.Cylinders * ataId.Heads * ataId.SectorsPerTrack);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.BlocksSpecified = true;
|
|
|
|
|
|
}
|
2017-05-28 21:01:17 +01:00
|
|
|
|
|
2017-12-23 17:41:23 +00:00
|
|
|
|
if(ataId.CurrentCylinders > 0 && ataId.CurrentHeads > 0 && ataId.CurrentSectorsPerTrack > 0)
|
2017-12-23 01:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
|
mediaTest.CurrentCHS = new chsType
|
2017-05-28 21:01:17 +01:00
|
|
|
|
{
|
2017-12-23 01:46:08 +00:00
|
|
|
|
Cylinders = ataId.CurrentCylinders,
|
2018-01-21 21:56:09 +00:00
|
|
|
|
Heads = ataId.CurrentHeads,
|
|
|
|
|
|
Sectors = ataId.CurrentSectorsPerTrack
|
2017-12-23 01:46:08 +00:00
|
|
|
|
};
|
|
|
|
|
|
if(mediaTest.Blocks == 0)
|
|
|
|
|
|
mediaTest.Blocks =
|
2017-12-23 17:41:23 +00:00
|
|
|
|
(ulong)(ataId.CurrentCylinders * ataId.CurrentHeads * ataId.CurrentSectorsPerTrack);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.BlocksSpecified = true;
|
|
|
|
|
|
}
|
2017-12-21 06:06:19 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.Capabilities.HasFlag(Identify.CapabilitiesBit.LBASupport))
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.LBASectors = ataId.LBASectors;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.LBASectorsSpecified = true;
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.Blocks = ataId.LBASectors;
|
|
|
|
|
|
mediaTest.BlocksSpecified = true;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
}
|
2017-12-21 06:06:19 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.CommandSet2.HasFlag(Identify.CommandSetBit2.LBA48))
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.LBA48Sectors = ataId.LBA48Sectors;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.LBA48SectorsSpecified = true;
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.Blocks = ataId.LBA48Sectors;
|
|
|
|
|
|
mediaTest.BlocksSpecified = true;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
}
|
2017-05-28 21:01:17 +01:00
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
if(ataId.NominalRotationRate != 0x0000 && ataId.NominalRotationRate != 0xFFFF)
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.NominalRotationRate == 0x0001)
|
2017-12-21 17:10:37 +00:00
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.SolidStateDevice = true;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.SolidStateDeviceSpecified = true;
|
2017-12-21 17:10:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.SolidStateDevice = false;
|
|
|
|
|
|
mediaTest.SolidStateDeviceSpecified = true;
|
|
|
|
|
|
mediaTest.NominalRotationRate = ataId.NominalRotationRate;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.NominalRotationRateSpecified = true;
|
2017-12-21 17:10:37 +00:00
|
|
|
|
}
|
2017-12-21 06:06:19 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
uint logicalsectorsize;
|
|
|
|
|
|
uint physicalsectorsize;
|
2017-12-23 17:41:23 +00:00
|
|
|
|
if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000)
|
2017-12-23 01:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
|
if((ataId.PhysLogSectorSize & 0x1000) == 0x1000)
|
2018-06-22 08:08:38 +01:00
|
|
|
|
if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF)
|
2017-12-23 01:46:08 +00:00
|
|
|
|
logicalsectorsize = 512;
|
2018-01-21 21:56:09 +00:00
|
|
|
|
else
|
|
|
|
|
|
logicalsectorsize = ataId.LogicalSectorWords * 2;
|
2018-06-22 08:08:38 +01:00
|
|
|
|
else logicalsectorsize = 512;
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
if((ataId.PhysLogSectorSize & 0x2000) == 0x2000)
|
2018-01-21 21:56:09 +00:00
|
|
|
|
physicalsectorsize =
|
|
|
|
|
|
(uint)(logicalsectorsize * ((1 << ataId.PhysLogSectorSize) & 0xF));
|
2017-12-23 01:46:08 +00:00
|
|
|
|
else physicalsectorsize = logicalsectorsize;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
logicalsectorsize = 512;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
physicalsectorsize = 512;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.BlockSize = logicalsectorsize;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.BlockSizeSpecified = true;
|
|
|
|
|
|
if(physicalsectorsize != logicalsectorsize)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.PhysicalBlockSize = physicalsectorsize;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.PhysicalBlockSizeSpecified = true;
|
2017-12-21 17:10:37 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if((ataId.LogicalAlignment & 0x8000) == 0x0000 &&
|
|
|
|
|
|
(ataId.LogicalAlignment & 0x4000) == 0x4000)
|
2017-12-21 17:10:37 +00:00
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.LogicalAlignment = (ushort)(ataId.LogicalAlignment & 0x3FFF);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.LogicalAlignmentSpecified = true;
|
2017-12-21 17:10:37 +00:00
|
|
|
|
}
|
2017-12-23 01:46:08 +00:00
|
|
|
|
}
|
2017-12-21 17:10:37 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.EccBytes != 0x0000 && ataId.EccBytes != 0xFFFF)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.LongBlockSize = logicalsectorsize + ataId.EccBytes;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.LongBlockSizeSpecified = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
if(ataId.UnformattedBPS > logicalsectorsize &&
|
2017-12-23 01:46:08 +00:00
|
|
|
|
(!mediaTest.LongBlockSizeSpecified || mediaTest.LongBlockSize == 516))
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.LongBlockSize = ataId.UnformattedBPS;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.LongBlockSizeSpecified = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-01-21 21:56:09 +00:00
|
|
|
|
if(ataId.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeSet) &&
|
2017-12-23 01:46:08 +00:00
|
|
|
|
!ataId.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeClear) &&
|
|
|
|
|
|
ataId.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.MediaSerial))
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.CanReadMediaSerial = true;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.CanReadMediaSerialSpecified = true;
|
|
|
|
|
|
if(!string.IsNullOrWhiteSpace(ataId.MediaManufacturer))
|
2017-12-21 17:10:37 +00:00
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.Manufacturer = ataId.MediaManufacturer;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.ManufacturerSpecified = true;
|
2017-12-21 17:10:37 +00:00
|
|
|
|
}
|
2017-12-21 06:06:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.SupportsReadLbaSpecified = true;
|
|
|
|
|
|
mediaTest.SupportsReadRetryLbaSpecified = true;
|
|
|
|
|
|
mediaTest.SupportsReadDmaLbaSpecified = true;
|
|
|
|
|
|
mediaTest.SupportsReadDmaRetryLbaSpecified = true;
|
|
|
|
|
|
mediaTest.SupportsReadLongLbaSpecified = true;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.SupportsReadLongRetryLbaSpecified = true;
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.SupportsSeekLbaSpecified = true;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.SupportsReadLba48Specified = true;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.SupportsReadDmaLba48Specified = true;
|
|
|
|
|
|
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.SupportsReadSpecified = true;
|
|
|
|
|
|
mediaTest.SupportsReadRetrySpecified = true;
|
|
|
|
|
|
mediaTest.SupportsReadDmaSpecified = true;
|
|
|
|
|
|
mediaTest.SupportsReadDmaRetrySpecified = true;
|
|
|
|
|
|
mediaTest.SupportsReadLongSpecified = true;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.SupportsReadLongRetrySpecified = true;
|
2018-01-21 21:56:09 +00:00
|
|
|
|
mediaTest.SupportsSeekSpecified = true;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
ulong checkCorrectRead = BitConverter.ToUInt64(buffer, 0);
|
2018-01-21 21:56:09 +00:00
|
|
|
|
bool sense;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ SECTOR(S) in CHS mode...");
|
2017-12-23 17:41:23 +00:00
|
|
|
|
sense = dev.Read(out byte[] readBuf, out AtaErrorRegistersChs errorChs, false, 0, 0, 1, 1,
|
|
|
|
|
|
TIMEOUT, out _);
|
|
|
|
|
|
mediaTest.SupportsRead = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 &&
|
2018-01-21 21:56:09 +00:00
|
|
|
|
readBuf.Length > 0;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ATA 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",
|
2017-12-23 17:41:23 +00:00
|
|
|
|
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in CHS mode...");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sense = dev.Read(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
|
2017-12-23 17:41:23 +00:00
|
|
|
|
mediaTest.SupportsReadRetry = !sense && (errorChs.Status & 0x01) != 0x01 &&
|
2018-01-21 21:56:09 +00:00
|
|
|
|
errorChs.Error == 0 && readBuf.Length > 0;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ATA 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",
|
2017-12-23 17:41:23 +00:00
|
|
|
|
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ DMA in CHS mode...");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sense = dev.ReadDma(out readBuf, out errorChs, false, 0, 0, 1, 1, TIMEOUT, out _);
|
2017-12-23 17:41:23 +00:00
|
|
|
|
mediaTest.SupportsReadDma = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 &&
|
2018-01-21 21:56:09 +00:00
|
|
|
|
readBuf.Length > 0;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ATA Report",
|
|
|
|
|
|
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
|
|
|
|
|
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
|
|
|
|
|
if(debug)
|
2017-12-23 17:41:23 +00:00
|
|
|
|
DataFile.WriteTo("ATA Report", "readdmachs", "_debug_" + mediaTest.MediumTypeName + ".bin",
|
|
|
|
|
|
"read results", readBuf);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ DMA RETRY in CHS mode...");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sense = dev.ReadDma(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
|
2017-12-23 17:41:23 +00:00
|
|
|
|
mediaTest.SupportsReadDmaRetry = !sense && (errorChs.Status & 0x01) != 0x01 &&
|
2018-01-21 21:56:09 +00:00
|
|
|
|
errorChs.Error == 0 &&
|
|
|
|
|
|
readBuf.Length > 0;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ATA 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",
|
2017-12-23 17:41:23 +00:00
|
|
|
|
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying SEEK in CHS mode...");
|
2018-01-21 21:56:09 +00:00
|
|
|
|
sense = dev.Seek(out errorChs, 0, 0, 1, TIMEOUT, out _);
|
2017-12-23 17:41:23 +00:00
|
|
|
|
mediaTest.SupportsSeek = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0;
|
|
|
|
|
|
DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}",
|
|
|
|
|
|
sense, errorChs.Status, errorChs.Error);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ SECTOR(S) in LBA mode...");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sense = dev.Read(out readBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, TIMEOUT, out _);
|
2017-12-23 17:41:23 +00:00
|
|
|
|
mediaTest.SupportsReadLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 &&
|
2018-01-21 21:56:09 +00:00
|
|
|
|
readBuf.Length > 0;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ATA Report",
|
|
|
|
|
|
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
|
|
|
|
|
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
|
|
|
|
|
if(debug)
|
2017-12-23 17:41:23 +00:00
|
|
|
|
DataFile.WriteTo("ATA Report", "readsectors", "_debug_" + mediaTest.MediumTypeName + ".bin",
|
|
|
|
|
|
"read results", readBuf);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in LBA mode...");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sense = dev.Read(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
|
2017-12-23 17:41:23 +00:00
|
|
|
|
mediaTest.SupportsReadRetryLba = !sense && (errorLba.Status & 0x01) != 0x01 &&
|
2018-01-21 21:56:09 +00:00
|
|
|
|
errorLba.Error == 0 &&
|
|
|
|
|
|
readBuf.Length > 0;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ATA 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", "readsectorsretry",
|
2017-12-23 17:41:23 +00:00
|
|
|
|
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ DMA in LBA mode...");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sense = dev.ReadDma(out readBuf, out errorLba, false, 0, 1, TIMEOUT, out _);
|
2017-12-23 17:41:23 +00:00
|
|
|
|
mediaTest.SupportsReadDmaLba = !sense && (errorLba.Status & 0x01) != 0x01 &&
|
2018-01-21 21:56:09 +00:00
|
|
|
|
errorLba.Error == 0 && readBuf.Length > 0;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ATA Report",
|
|
|
|
|
|
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
|
|
|
|
|
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
|
|
|
|
|
if(debug)
|
2017-12-23 17:41:23 +00:00
|
|
|
|
DataFile.WriteTo("ATA Report", "readdma", "_debug_" + mediaTest.MediumTypeName + ".bin",
|
|
|
|
|
|
"read results", readBuf);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ DMA RETRY in LBA mode...");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sense = dev.ReadDma(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.SupportsReadDmaRetryLba =
|
2017-12-23 17:41:23 +00:00
|
|
|
|
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ATA 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", "readdmaretry",
|
2017-12-23 17:41:23 +00:00
|
|
|
|
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying SEEK in LBA mode...");
|
2018-01-21 21:56:09 +00:00
|
|
|
|
sense = dev.Seek(out errorLba, 0, TIMEOUT, out _);
|
2017-12-23 17:41:23 +00:00
|
|
|
|
mediaTest.SupportsSeekLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0;
|
|
|
|
|
|
DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}",
|
|
|
|
|
|
sense, errorChs.Status, errorChs.Error);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ SECTOR(S) in LBA48 mode...");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sense = dev.Read(out readBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, TIMEOUT, out _);
|
2017-12-23 17:41:23 +00:00
|
|
|
|
mediaTest.SupportsReadLba48 = !sense && (errorLba48.Status & 0x01) != 0x01 &&
|
2018-01-21 21:56:09 +00:00
|
|
|
|
errorLba48.Error == 0 &&
|
|
|
|
|
|
readBuf.Length > 0;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ATA 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", "readsectors48",
|
2017-12-23 17:41:23 +00:00
|
|
|
|
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ DMA in LBA48 mode...");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sense = dev.ReadDma(out readBuf, out errorLba48, 0, 1, TIMEOUT, out _);
|
2017-12-23 17:41:23 +00:00
|
|
|
|
mediaTest.SupportsReadDmaLba48 = !sense && (errorLba48.Status & 0x01) != 0x01 &&
|
2018-01-21 21:56:09 +00:00
|
|
|
|
errorLba48.Error == 0 &&
|
|
|
|
|
|
readBuf.Length > 0;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ATA Report",
|
|
|
|
|
|
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
|
|
|
|
|
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
|
|
|
|
|
if(debug)
|
2017-12-23 17:41:23 +00:00
|
|
|
|
DataFile.WriteTo("ATA Report", "readdma48", "_debug_" + mediaTest.MediumTypeName + ".bin",
|
|
|
|
|
|
"read results", readBuf);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
2018-01-21 21:56:09 +00:00
|
|
|
|
// 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
|
|
|
|
|
|
// CORRECTABLE ERROR for this command.
|
|
|
|
|
|
dev.SetFeatures(out _, AtaFeatures.EnableReadLongVendorLength, 0, 0, 1, 0, TIMEOUT, out _);
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
if(ataId.UnformattedBPS > logicalsectorsize &&
|
2018-01-21 21:56:09 +00:00
|
|
|
|
(!mediaTest.LongBlockSizeSpecified || mediaTest.LongBlockSize == 516))
|
|
|
|
|
|
{
|
|
|
|
|
|
mediaTest.LongBlockSize = ataId.UnformattedBPS;
|
|
|
|
|
|
mediaTest.LongBlockSizeSpecified = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.WriteLine("Trying READ LONG in CHS mode...");
|
|
|
|
|
|
sense = dev.ReadLong(out readBuf, out errorChs, false, 0, 0, 1, mediaTest.LongBlockSize,
|
|
|
|
|
|
TIMEOUT, out _);
|
2017-12-23 17:41:23 +00:00
|
|
|
|
mediaTest.SupportsReadLong = !sense && (errorChs.Status & 0x01) != 0x01 &&
|
2018-01-21 21:56:09 +00:00
|
|
|
|
errorChs.Error == 0 && readBuf.Length > 0 &&
|
|
|
|
|
|
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ATA Report",
|
|
|
|
|
|
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
|
|
|
|
|
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
|
|
|
|
|
if(debug)
|
2017-12-23 17:41:23 +00:00
|
|
|
|
DataFile.WriteTo("ATA Report", "readlongchs", "_debug_" + mediaTest.MediumTypeName + ".bin",
|
|
|
|
|
|
"read results", readBuf);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ LONG RETRY in CHS mode...");
|
2017-12-23 17:41:23 +00:00
|
|
|
|
sense = dev.ReadLong(out readBuf, out errorChs, true, 0, 0, 1, mediaTest.LongBlockSize, TIMEOUT,
|
|
|
|
|
|
out _);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.SupportsReadLongRetry =
|
2017-12-23 17:41:23 +00:00
|
|
|
|
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0 &&
|
2018-01-21 21:56:09 +00:00
|
|
|
|
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ATA 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",
|
2017-12-23 17:41:23 +00:00
|
|
|
|
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ LONG in LBA mode...");
|
2017-12-23 17:41:23 +00:00
|
|
|
|
sense = dev.ReadLong(out readBuf, out errorLba, false, 0, mediaTest.LongBlockSize, TIMEOUT,
|
|
|
|
|
|
out _);
|
|
|
|
|
|
mediaTest.SupportsReadLongLba = !sense && (errorLba.Status & 0x01) != 0x01 &&
|
2018-01-21 21:56:09 +00:00
|
|
|
|
errorLba.Error == 0 &&
|
|
|
|
|
|
readBuf.Length > 0 &&
|
|
|
|
|
|
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ATA Report",
|
|
|
|
|
|
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
|
|
|
|
|
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
|
|
|
|
|
if(debug)
|
2017-12-23 17:41:23 +00:00
|
|
|
|
DataFile.WriteTo("ATA Report", "readlong", "_debug_" + mediaTest.MediumTypeName + ".bin",
|
|
|
|
|
|
"read results", readBuf);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ LONG RETRY in LBA mode...");
|
2017-12-23 17:41:23 +00:00
|
|
|
|
sense = dev.ReadLong(out readBuf, out errorLba, true, 0, mediaTest.LongBlockSize, TIMEOUT,
|
|
|
|
|
|
out _);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTest.SupportsReadLongRetryLba =
|
2017-12-23 17:41:23 +00:00
|
|
|
|
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0 &&
|
2018-01-21 21:56:09 +00:00
|
|
|
|
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ATA 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", "readlongretry",
|
2017-12-23 17:41:23 +00:00
|
|
|
|
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf);
|
2017-05-28 21:01:17 +01:00
|
|
|
|
}
|
2017-12-23 01:46:08 +00:00
|
|
|
|
else mediaTest.MediaIsRecognized = false;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
mediaTests.Add(mediaTest);
|
2017-05-28 21:01:17 +01:00
|
|
|
|
}
|
2017-12-21 06:06:19 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.RemovableMedias = mediaTests.ToArray();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
report.ATA.ReadCapabilities = new testedMediaType();
|
2017-12-21 06:06:19 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.UnformattedBPT != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ReadCapabilities.UnformattedBPT = ataId.UnformattedBPT;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.UnformattedBPTSpecified = true;
|
|
|
|
|
|
}
|
2018-01-21 21:56:09 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.UnformattedBPS != 0)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ReadCapabilities.UnformattedBPS = ataId.UnformattedBPS;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.UnformattedBPSSpecified = true;
|
|
|
|
|
|
}
|
2017-12-21 06:06:19 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.Cylinders > 0 && ataId.Heads > 0 && ataId.SectorsPerTrack > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
report.ATA.ReadCapabilities.CHS = new chsType
|
2017-12-21 17:10:37 +00:00
|
|
|
|
{
|
2017-12-23 01:46:08 +00:00
|
|
|
|
Cylinders = ataId.Cylinders,
|
2018-01-21 21:56:09 +00:00
|
|
|
|
Heads = ataId.Heads,
|
|
|
|
|
|
Sectors = ataId.SectorsPerTrack
|
2017-12-23 01:46:08 +00:00
|
|
|
|
};
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ReadCapabilities.Blocks =
|
|
|
|
|
|
(ulong)(ataId.Cylinders * ataId.Heads * ataId.SectorsPerTrack);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.BlocksSpecified = true;
|
|
|
|
|
|
}
|
2017-05-28 21:01:17 +01:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.CurrentCylinders > 0 && ataId.CurrentHeads > 0 && ataId.CurrentSectorsPerTrack > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
report.ATA.ReadCapabilities.CurrentCHS = new chsType
|
2017-12-21 17:10:37 +00:00
|
|
|
|
{
|
2017-12-23 01:46:08 +00:00
|
|
|
|
Cylinders = ataId.CurrentCylinders,
|
2018-01-21 21:56:09 +00:00
|
|
|
|
Heads = ataId.CurrentHeads,
|
|
|
|
|
|
Sectors = ataId.CurrentSectorsPerTrack
|
2017-12-23 01:46:08 +00:00
|
|
|
|
};
|
|
|
|
|
|
report.ATA.ReadCapabilities.Blocks =
|
|
|
|
|
|
(ulong)(ataId.CurrentCylinders * ataId.CurrentHeads * ataId.CurrentSectorsPerTrack);
|
|
|
|
|
|
report.ATA.ReadCapabilities.BlocksSpecified = true;
|
|
|
|
|
|
}
|
2017-05-28 21:01:17 +01:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.Capabilities.HasFlag(Identify.CapabilitiesBit.LBASupport))
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ReadCapabilities.LBASectors = ataId.LBASectors;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.LBASectorsSpecified = true;
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ReadCapabilities.Blocks = ataId.LBASectors;
|
|
|
|
|
|
report.ATA.ReadCapabilities.BlocksSpecified = true;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
}
|
2017-05-28 21:01:17 +01:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.CommandSet2.HasFlag(Identify.CommandSetBit2.LBA48))
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ReadCapabilities.LBA48Sectors = ataId.LBA48Sectors;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.LBA48SectorsSpecified = true;
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ReadCapabilities.Blocks = ataId.LBA48Sectors;
|
|
|
|
|
|
report.ATA.ReadCapabilities.BlocksSpecified = true;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
}
|
2017-05-28 21:01:17 +01:00
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
if(ataId.NominalRotationRate != 0x0000 && ataId.NominalRotationRate != 0xFFFF)
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.NominalRotationRate == 0x0001)
|
2017-05-28 21:01:17 +01:00
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SolidStateDevice = true;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SolidStateDeviceSpecified = true;
|
2017-05-28 21:01:17 +01:00
|
|
|
|
}
|
2017-12-21 06:06:19 +00:00
|
|
|
|
else
|
2017-05-28 21:01:17 +01:00
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SolidStateDevice = false;
|
|
|
|
|
|
report.ATA.ReadCapabilities.SolidStateDeviceSpecified = true;
|
|
|
|
|
|
report.ATA.ReadCapabilities.NominalRotationRate = ataId.NominalRotationRate;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.NominalRotationRateSpecified = true;
|
2017-05-28 21:01:17 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
uint logicalsectorsize;
|
|
|
|
|
|
uint physicalsectorsize;
|
|
|
|
|
|
if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000)
|
|
|
|
|
|
{
|
|
|
|
|
|
if((ataId.PhysLogSectorSize & 0x1000) == 0x1000)
|
2018-06-22 08:08:38 +01:00
|
|
|
|
if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF)
|
2018-01-21 21:56:09 +00:00
|
|
|
|
logicalsectorsize = 512;
|
|
|
|
|
|
else
|
|
|
|
|
|
logicalsectorsize = ataId.LogicalSectorWords * 2;
|
2018-06-22 08:08:38 +01:00
|
|
|
|
else logicalsectorsize = 512;
|
2017-05-28 21:01:17 +01:00
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
if((ataId.PhysLogSectorSize & 0x2000) == 0x2000)
|
2018-01-21 21:56:09 +00:00
|
|
|
|
physicalsectorsize = logicalsectorsize * (uint)Math.Pow(2, ataId.PhysLogSectorSize & 0xF);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
else physicalsectorsize = logicalsectorsize;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
logicalsectorsize = 512;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
physicalsectorsize = 512;
|
|
|
|
|
|
}
|
2017-06-04 05:06:49 +01:00
|
|
|
|
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ReadCapabilities.BlockSize = logicalsectorsize;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.BlockSizeSpecified = true;
|
|
|
|
|
|
if(physicalsectorsize != logicalsectorsize)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ReadCapabilities.PhysicalBlockSize = physicalsectorsize;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.PhysicalBlockSizeSpecified = true;
|
|
|
|
|
|
|
|
|
|
|
|
if((ataId.LogicalAlignment & 0x8000) == 0x0000 && (ataId.LogicalAlignment & 0x4000) == 0x4000)
|
2017-12-21 17:10:37 +00:00
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ReadCapabilities.LogicalAlignment =
|
|
|
|
|
|
(ushort)(ataId.LogicalAlignment & 0x3FFF);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.LogicalAlignmentSpecified = true;
|
2017-12-21 17:10:37 +00:00
|
|
|
|
}
|
2017-12-23 01:46:08 +00:00
|
|
|
|
}
|
2017-12-21 06:06:19 +00:00
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
if(ataId.EccBytes != 0x0000 && ataId.EccBytes != 0xFFFF)
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ReadCapabilities.LongBlockSize = logicalsectorsize + ataId.EccBytes;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.LongBlockSizeSpecified = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(ataId.UnformattedBPS > logicalsectorsize &&
|
|
|
|
|
|
(!report.ATA.ReadCapabilities.LongBlockSizeSpecified ||
|
|
|
|
|
|
report.ATA.ReadCapabilities.LongBlockSize == 516))
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ReadCapabilities.LongBlockSize = ataId.UnformattedBPS;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.LongBlockSizeSpecified = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-01-21 21:56:09 +00:00
|
|
|
|
if(ataId.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeSet) &&
|
2017-12-23 01:46:08 +00:00
|
|
|
|
!ataId.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeClear) &&
|
|
|
|
|
|
ataId.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.MediaSerial))
|
|
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ReadCapabilities.CanReadMediaSerial = true;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.CanReadMediaSerialSpecified = true;
|
|
|
|
|
|
if(!string.IsNullOrWhiteSpace(ataId.MediaManufacturer))
|
2017-05-28 21:01:17 +01:00
|
|
|
|
{
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ReadCapabilities.Manufacturer = ataId.MediaManufacturer;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.ManufacturerSpecified = true;
|
2017-05-28 21:01:17 +01:00
|
|
|
|
}
|
2017-12-21 17:10:37 +00:00
|
|
|
|
}
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
2018-01-21 21:56:09 +00:00
|
|
|
|
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;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SupportsReadLongRetryLbaSpecified = true;
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SupportsSeekLbaSpecified = true;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SupportsReadLba48Specified = true;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SupportsReadDmaLba48Specified = true;
|
|
|
|
|
|
|
2018-01-21 21:56:09 +00:00
|
|
|
|
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;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SupportsReadLongRetrySpecified = true;
|
2018-01-21 21:56:09 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SupportsSeekSpecified = true;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
ulong checkCorrectRead = BitConverter.ToUInt64(buffer, 0);
|
2018-01-21 21:56:09 +00:00
|
|
|
|
bool sense;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ SECTOR(S) in CHS mode...");
|
2017-12-23 17:41:23 +00:00
|
|
|
|
sense = dev.Read(out byte[] readBuf, out AtaErrorRegistersChs errorChs, false, 0, 0, 1, 1, TIMEOUT,
|
|
|
|
|
|
out _);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SupportsRead =
|
|
|
|
|
|
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
|
|
|
|
|
|
DicConsole.DebugWriteLine("ATA 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);
|
|
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in CHS mode...");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sense = dev.Read(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SupportsReadRetry =
|
|
|
|
|
|
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
|
|
|
|
|
|
DicConsole.DebugWriteLine("ATA 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);
|
|
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ DMA in CHS mode...");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sense = dev.ReadDma(out readBuf, out errorChs, false, 0, 0, 1, 1, TIMEOUT, out _);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SupportsReadDma =
|
|
|
|
|
|
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
|
|
|
|
|
|
DicConsole.DebugWriteLine("ATA Report",
|
|
|
|
|
|
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
|
|
|
|
|
errorChs.Status, errorChs.Error, readBuf.Length);
|
|
|
|
|
|
if(debug)
|
2017-12-23 17:41:23 +00:00
|
|
|
|
DataFile.WriteTo("ATA Report", "readdmachs", "_debug_" + report.ATA.Model + ".bin", "read results",
|
|
|
|
|
|
readBuf);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ DMA RETRY in CHS mode...");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sense = dev.ReadDma(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SupportsReadDmaRetry =
|
|
|
|
|
|
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
|
|
|
|
|
|
DicConsole.DebugWriteLine("ATA 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);
|
|
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying SEEK in CHS mode...");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sense = dev.Seek(out errorChs, 0, 0, 1, TIMEOUT, out _);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SupportsSeek =
|
|
|
|
|
|
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0;
|
|
|
|
|
|
DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", sense,
|
|
|
|
|
|
errorChs.Status, errorChs.Error);
|
|
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ SECTOR(S) in LBA mode...");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sense = dev.Read(out readBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, TIMEOUT, out _);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SupportsReadLba =
|
|
|
|
|
|
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
|
|
|
|
|
|
DicConsole.DebugWriteLine("ATA Report",
|
|
|
|
|
|
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
|
|
|
|
|
errorLba.Status, errorLba.Error, readBuf.Length);
|
|
|
|
|
|
if(debug)
|
2017-12-23 17:41:23 +00:00
|
|
|
|
DataFile.WriteTo("ATA Report", "readsectors", "_debug_" + report.ATA.Model + ".bin", "read results",
|
|
|
|
|
|
readBuf);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in LBA mode...");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sense = dev.Read(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SupportsReadRetryLba =
|
|
|
|
|
|
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
|
|
|
|
|
|
DicConsole.DebugWriteLine("ATA 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);
|
|
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ DMA in LBA mode...");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sense = dev.ReadDma(out readBuf, out errorLba, false, 0, 1, TIMEOUT, out _);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SupportsReadDmaLba =
|
|
|
|
|
|
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
|
|
|
|
|
|
DicConsole.DebugWriteLine("ATA 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);
|
|
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ DMA RETRY in LBA mode...");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sense = dev.ReadDma(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SupportsReadDmaRetryLba =
|
|
|
|
|
|
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
|
|
|
|
|
|
DicConsole.DebugWriteLine("ATA 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);
|
|
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying SEEK in LBA mode...");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sense = dev.Seek(out errorLba, 0, TIMEOUT, out _);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SupportsSeekLba =
|
|
|
|
|
|
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0;
|
|
|
|
|
|
DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", sense,
|
|
|
|
|
|
errorLba.Status, errorLba.Error);
|
|
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ SECTOR(S) in LBA48 mode...");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sense = dev.Read(out readBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, TIMEOUT, out _);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SupportsReadLba48 =
|
|
|
|
|
|
!sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && readBuf.Length > 0;
|
|
|
|
|
|
DicConsole.DebugWriteLine("ATA 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);
|
|
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ DMA in LBA48 mode...");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sense = dev.ReadDma(out readBuf, out errorLba48, 0, 1, TIMEOUT, out _);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
report.ATA.ReadCapabilities.SupportsReadDmaLba48 =
|
|
|
|
|
|
!sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && readBuf.Length > 0;
|
|
|
|
|
|
DicConsole.DebugWriteLine("ATA Report",
|
|
|
|
|
|
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
|
|
|
|
|
errorLba48.Status, errorLba48.Error, readBuf.Length);
|
|
|
|
|
|
if(debug)
|
2017-12-23 17:41:23 +00:00
|
|
|
|
DataFile.WriteTo("ATA Report", "readdma48", "_debug_" + report.ATA.Model + ".bin", "read results",
|
|
|
|
|
|
readBuf);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
2018-01-21 21:56:09 +00:00
|
|
|
|
// 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
|
|
|
|
|
|
// CORRECTABLE ERROR for this command.
|
|
|
|
|
|
dev.SetFeatures(out _, AtaFeatures.EnableReadLongVendorLength, 0, 0, 1, 0, TIMEOUT, out _);
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(ataId.UnformattedBPS > logicalsectorsize &&
|
|
|
|
|
|
(!report.ATA.ReadCapabilities.LongBlockSizeSpecified ||
|
|
|
|
|
|
report.ATA.ReadCapabilities.LongBlockSize == 516))
|
|
|
|
|
|
{
|
|
|
|
|
|
report.ATA.ReadCapabilities.LongBlockSize = ataId.UnformattedBPS;
|
|
|
|
|
|
report.ATA.ReadCapabilities.LongBlockSizeSpecified = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-23 01:46:08 +00:00
|
|
|
|
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.SupportsReadLong =
|
|
|
|
|
|
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0 &&
|
2018-01-21 21:56:09 +00:00
|
|
|
|
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ATA Report",
|
|
|
|
|
|
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
|
|
|
|
|
errorChs.Status, errorChs.Error, readBuf.Length);
|
|
|
|
|
|
if(debug)
|
2017-12-23 17:41:23 +00:00
|
|
|
|
DataFile.WriteTo("ATA Report", "readlongchs", "_debug_" + report.ATA.Model + ".bin", "read results",
|
|
|
|
|
|
readBuf);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
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.SupportsReadLongRetry =
|
|
|
|
|
|
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0 &&
|
2018-01-21 21:56:09 +00:00
|
|
|
|
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ATA 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);
|
|
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ LONG in LBA mode...");
|
|
|
|
|
|
sense = dev.ReadLong(out readBuf, out errorLba, false, 0, report.ATA.ReadCapabilities.LongBlockSize,
|
|
|
|
|
|
TIMEOUT, out _);
|
|
|
|
|
|
report.ATA.ReadCapabilities.SupportsReadLongLba =
|
|
|
|
|
|
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0 &&
|
2018-01-21 21:56:09 +00:00
|
|
|
|
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ATA Report",
|
|
|
|
|
|
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
|
|
|
|
|
errorLba.Status, errorLba.Error, readBuf.Length);
|
|
|
|
|
|
if(debug)
|
2017-12-23 17:41:23 +00:00
|
|
|
|
DataFile.WriteTo("ATA Report", "readlong", "_debug_" + report.ATA.Model + ".bin", "read results",
|
|
|
|
|
|
readBuf);
|
2017-12-23 01:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
DicConsole.WriteLine("Trying READ LONG RETRY in LBA mode...");
|
|
|
|
|
|
sense = dev.ReadLong(out readBuf, out errorLba, true, 0, report.ATA.ReadCapabilities.LongBlockSize,
|
|
|
|
|
|
TIMEOUT, out _);
|
|
|
|
|
|
report.ATA.ReadCapabilities.SupportsReadLongRetryLba =
|
|
|
|
|
|
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0 &&
|
2018-01-21 21:56:09 +00:00
|
|
|
|
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
2017-12-23 01:46:08 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ATA 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);
|
2017-05-28 21:01:17 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|