mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
🐛Fix sending READ LONG commands to ATA devices, thanks to supporting SET FEATURES command.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -83,11 +83,12 @@ namespace DiscImageChef.Devices
|
||||
public bool AtaIdentify(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
buffer = new byte[512];
|
||||
buffer = new byte[512];
|
||||
AtaRegistersChs registers = new AtaRegistersChs {Command = (byte)AtaCommands.IdentifyDevice};
|
||||
|
||||
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false,
|
||||
out duration,
|
||||
out bool sense);
|
||||
Error = LastError != 0;
|
||||
|
||||
@@ -96,27 +97,31 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool ReadDma(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, ushort cylinder, byte head,
|
||||
byte sector, byte count, uint timeout, out double duration)
|
||||
public bool ReadDma(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, ushort cylinder,
|
||||
byte head,
|
||||
byte sector, byte count, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return ReadDma(out buffer, out statusRegisters, true, cylinder, head, sector, count, timeout, out duration);
|
||||
}
|
||||
|
||||
public bool ReadDma(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, bool retry, ushort cylinder,
|
||||
byte head, byte sector, byte count, uint timeout, out double duration)
|
||||
byte head, byte sector, byte count, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count];
|
||||
buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count];
|
||||
AtaRegistersChs registers = new AtaRegistersChs
|
||||
{
|
||||
SectorCount = count,
|
||||
SectorCount = count,
|
||||
CylinderHigh = (byte)((cylinder & 0xFF00) / 0x100),
|
||||
CylinderLow = (byte)((cylinder & 0xFF) / 0x1),
|
||||
DeviceHead = (byte)(head & 0x0F),
|
||||
Sector = sector,
|
||||
Command = retry ? (byte)AtaCommands.ReadDmaRetry : (byte)AtaCommands.ReadDma
|
||||
CylinderLow = (byte)((cylinder & 0xFF) / 0x1),
|
||||
DeviceHead = (byte)(head & 0x0F),
|
||||
Sector = sector,
|
||||
Command = retry ? (byte)AtaCommands.ReadDmaRetry : (byte)AtaCommands.ReadDma
|
||||
};
|
||||
|
||||
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount,
|
||||
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma,
|
||||
AtaTransferRegister.SectorCount,
|
||||
ref buffer, timeout, true, out duration, out bool sense);
|
||||
Error = LastError != 0;
|
||||
|
||||
@@ -126,21 +131,23 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
|
||||
public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, ushort cylinder,
|
||||
byte head, byte sector, byte count, uint timeout, out double duration)
|
||||
byte head, byte sector, byte count,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count];
|
||||
buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count];
|
||||
AtaRegistersChs registers = new AtaRegistersChs
|
||||
{
|
||||
Command = (byte)AtaCommands.ReadMultiple,
|
||||
SectorCount = count,
|
||||
Command = (byte)AtaCommands.ReadMultiple,
|
||||
SectorCount = count,
|
||||
CylinderHigh = (byte)((cylinder & 0xFF00) / 0x100),
|
||||
CylinderLow = (byte)((cylinder & 0xFF) / 0x1),
|
||||
DeviceHead = (byte)(head & 0x0F),
|
||||
Sector = sector
|
||||
CylinderLow = (byte)((cylinder & 0xFF) / 0x1),
|
||||
DeviceHead = (byte)(head & 0x0F),
|
||||
Sector = sector
|
||||
};
|
||||
|
||||
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true,
|
||||
out duration,
|
||||
out bool sense);
|
||||
Error = LastError != 0;
|
||||
|
||||
@@ -150,27 +157,30 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
|
||||
public bool Read(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, ushort cylinder, byte head,
|
||||
byte sector, byte count, uint timeout, out double duration)
|
||||
byte sector, byte count, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return Read(out buffer, out statusRegisters, true, cylinder, head, sector, count, timeout, out duration);
|
||||
}
|
||||
|
||||
public bool Read(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, bool retry, ushort cylinder,
|
||||
byte head, byte sector, byte count, uint timeout, out double duration)
|
||||
byte head, byte sector, byte count, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count];
|
||||
buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count];
|
||||
AtaRegistersChs registers = new AtaRegistersChs
|
||||
{
|
||||
Command = retry ? (byte)AtaCommands.ReadRetry : (byte)AtaCommands.Read,
|
||||
SectorCount = count,
|
||||
Command = retry ? (byte)AtaCommands.ReadRetry : (byte)AtaCommands.Read,
|
||||
SectorCount = count,
|
||||
CylinderHigh = (byte)((cylinder & 0xFF00) / 0x100),
|
||||
CylinderLow = (byte)((cylinder & 0xFF) / 0x1),
|
||||
DeviceHead = (byte)(head & 0x0F),
|
||||
Sector = sector
|
||||
CylinderLow = (byte)((cylinder & 0xFF) / 0x1),
|
||||
DeviceHead = (byte)(head & 0x0F),
|
||||
Sector = sector
|
||||
};
|
||||
|
||||
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true,
|
||||
out duration,
|
||||
out bool sense);
|
||||
Error = LastError != 0;
|
||||
|
||||
@@ -179,29 +189,33 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool ReadLong(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, ushort cylinder, byte head,
|
||||
byte sector, uint blockSize, uint timeout, out double duration)
|
||||
public bool ReadLong(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, ushort cylinder,
|
||||
byte head,
|
||||
byte sector, uint blockSize, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return ReadLong(out buffer, out statusRegisters, true, cylinder, head, sector, blockSize, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
public bool ReadLong(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, bool retry, ushort cylinder,
|
||||
byte head, byte sector, uint blockSize, uint timeout, out double duration)
|
||||
public bool ReadLong(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, bool retry, ushort cylinder,
|
||||
byte head, byte sector, uint blockSize, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
buffer = new byte[blockSize];
|
||||
buffer = new byte[blockSize];
|
||||
AtaRegistersChs registers = new AtaRegistersChs
|
||||
{
|
||||
Command = retry ? (byte)AtaCommands.ReadLongRetry : (byte)AtaCommands.ReadLong,
|
||||
SectorCount = 1,
|
||||
Command = retry ? (byte)AtaCommands.ReadLongRetry : (byte)AtaCommands.ReadLong,
|
||||
SectorCount = 1,
|
||||
CylinderHigh = (byte)((cylinder & 0xFF00) / 0x100),
|
||||
CylinderLow = (byte)((cylinder & 0xFF) / 0x1),
|
||||
DeviceHead = (byte)(head & 0x0F),
|
||||
Sector = sector
|
||||
CylinderLow = (byte)((cylinder & 0xFF) / 0x1),
|
||||
DeviceHead = (byte)(head & 0x0F),
|
||||
Sector = sector
|
||||
};
|
||||
|
||||
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true,
|
||||
out duration,
|
||||
out bool sense);
|
||||
Error = LastError != 0;
|
||||
|
||||
@@ -211,20 +225,20 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
|
||||
public bool Seek(out AtaErrorRegistersChs statusRegisters, ushort cylinder, byte head, byte sector,
|
||||
uint timeout, out double duration)
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
byte[] buffer = new byte[0];
|
||||
byte[] buffer = new byte[0];
|
||||
AtaRegistersChs registers = new AtaRegistersChs
|
||||
{
|
||||
Command = (byte)AtaCommands.Seek,
|
||||
Command = (byte)AtaCommands.Seek,
|
||||
CylinderHigh = (byte)((cylinder & 0xFF00) / 0x100),
|
||||
CylinderLow = (byte)((cylinder & 0xFF) / 0x1),
|
||||
DeviceHead = (byte)(head & 0x0F),
|
||||
Sector = sector
|
||||
CylinderLow = (byte)((cylinder & 0xFF) / 0x1),
|
||||
DeviceHead = (byte)(head & 0x0F),
|
||||
Sector = sector
|
||||
};
|
||||
|
||||
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, true, out duration,
|
||||
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, true, out duration,
|
||||
out bool sense);
|
||||
Error = LastError != 0;
|
||||
|
||||
@@ -232,5 +246,37 @@ namespace DiscImageChef.Devices
|
||||
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool SetFeatures(out AtaErrorRegistersChs statusRegisters, AtaFeatures feature, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return SetFeatures(out statusRegisters, feature, 0, 0, 0, 0, timeout, out duration);
|
||||
}
|
||||
|
||||
public bool SetFeatures(out AtaErrorRegistersChs statusRegisters, AtaFeatures feature, ushort cylinder,
|
||||
byte head, byte sector, byte sectorCount,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
byte[] buffer = new byte[0];
|
||||
AtaRegistersChs registers = new AtaRegistersChs
|
||||
{
|
||||
Command = (byte)AtaCommands.SetFeatures,
|
||||
CylinderHigh = (byte)((cylinder & 0xFF00) / 0x100),
|
||||
CylinderLow = (byte)((cylinder & 0xFF) / 0x1),
|
||||
DeviceHead = (byte)(head & 0x0F),
|
||||
Sector = sector,
|
||||
SectorCount = sectorCount,
|
||||
Feature = (byte)feature
|
||||
};
|
||||
|
||||
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, true, out duration,
|
||||
out bool sense);
|
||||
Error = LastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "SET FEATURES took {0} ms.", duration);
|
||||
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -640,7 +640,7 @@ namespace DiscImageChef.Devices
|
||||
/// Requests SPC-4 style error data
|
||||
/// </summary>
|
||||
RequestSenseDataExt = 0x0B,
|
||||
SanitizeCommands = 0xB4,
|
||||
SanitizeCommands = 0xB4,
|
||||
/// <summary>
|
||||
/// Executes a Security Protocol command that does not require a transfer of data
|
||||
/// </summary>
|
||||
@@ -2394,7 +2394,7 @@ namespace DiscImageChef.Devices
|
||||
/// Sets the spindle speed to be used while reading/writing data to a CD
|
||||
/// </summary>
|
||||
SetCdSpeed = 0xDA,
|
||||
WriteCdp = 0xE3,
|
||||
WriteCdp = 0xE3,
|
||||
#endregion
|
||||
|
||||
#region ATA Command Pass-Through
|
||||
@@ -2413,10 +2413,10 @@ namespace DiscImageChef.Devices
|
||||
|
||||
#region 6-byte CDB aliases
|
||||
ModeSelect6 = ModeSelect,
|
||||
ModeSense6 = ModeSense,
|
||||
Read6 = Read,
|
||||
Seek6 = Seek,
|
||||
Write6 = Write,
|
||||
ModeSense6 = ModeSense,
|
||||
Read6 = Read,
|
||||
Seek6 = Seek,
|
||||
Write6 = Write,
|
||||
#endregion 6-byte CDB aliases
|
||||
|
||||
#region SCSI Zoned Block Commands
|
||||
@@ -2431,19 +2431,19 @@ namespace DiscImageChef.Devices
|
||||
#endregion
|
||||
|
||||
#region SCSI Commands with unknown meaning, mostly vendor specific
|
||||
SetCdSpeedUnk = 0xB8,
|
||||
WriteCdMsf = 0xA2,
|
||||
WriteCd = 0xAA,
|
||||
ReadDefectTag = 0xB7,
|
||||
PlayCd = 0xBC,
|
||||
SpareIn = 0xBC,
|
||||
SpareOut = 0xBD,
|
||||
WriteStream16 = 0x9A,
|
||||
WriteAtomic = 0x9C,
|
||||
SetCdSpeedUnk = 0xB8,
|
||||
WriteCdMsf = 0xA2,
|
||||
WriteCd = 0xAA,
|
||||
ReadDefectTag = 0xB7,
|
||||
PlayCd = 0xBC,
|
||||
SpareIn = 0xBC,
|
||||
SpareOut = 0xBD,
|
||||
WriteStream16 = 0x9A,
|
||||
WriteAtomic = 0x9C,
|
||||
ServiceActionBidirectional = 0x9D,
|
||||
WriteLong2 = 0xEA,
|
||||
UnknownCdCommand = 0xD4,
|
||||
UnknownCdCommand2 = 0xD5,
|
||||
WriteLong2 = 0xEA,
|
||||
UnknownCdCommand = 0xD4,
|
||||
UnknownCdCommand2 = 0xD5,
|
||||
#endregion SCSI Commands with unknown meaning, mostly vendor specific
|
||||
|
||||
#region SEGA Packet Interface (all are 12-byte CDB)
|
||||
@@ -2841,7 +2841,7 @@ namespace DiscImageChef.Devices
|
||||
/// <summary>
|
||||
/// Drive shall return only the Feature Header with the chosen Feature Descriptor
|
||||
/// </summary>
|
||||
Single = 0x02,
|
||||
Single = 0x02,
|
||||
Reserved = 0x03
|
||||
}
|
||||
|
||||
@@ -3505,8 +3505,8 @@ namespace DiscImageChef.Devices
|
||||
/// The host sends the bus testing data pattern to a device (ADTC, R1)
|
||||
/// </summary>
|
||||
BusTestWrite = 19,
|
||||
SpiReadOcr = 58,
|
||||
SpicrcOnOff = 59,
|
||||
SpiReadOcr = 58,
|
||||
SpicrcOnOff = 59,
|
||||
#endregion Class 1 MMC Commands (Basic and read-stream)
|
||||
|
||||
#region Class 2 MMC Commands (Block-oriented read)
|
||||
@@ -3742,35 +3742,35 @@ namespace DiscImageChef.Devices
|
||||
public enum MmcFlags : uint
|
||||
{
|
||||
ResponsePresent = 1 << 0,
|
||||
Response136 = 1 << 1,
|
||||
ResponseCrc = 1 << 2,
|
||||
ResponseBusy = 1 << 3,
|
||||
ResponseOpcode = 1 << 4,
|
||||
CommandMask = 3 << 5,
|
||||
CommandAc = 0 << 5,
|
||||
CommandAdtc = 1 << 5,
|
||||
CommandBc = 2 << 5,
|
||||
CommandBcr = 3 << 5,
|
||||
ResponseSpiS1 = 1 << 7,
|
||||
ResponseSpiS2 = 1 << 8,
|
||||
ResponseSpiB4 = 1 << 9,
|
||||
Response136 = 1 << 1,
|
||||
ResponseCrc = 1 << 2,
|
||||
ResponseBusy = 1 << 3,
|
||||
ResponseOpcode = 1 << 4,
|
||||
CommandMask = 3 << 5,
|
||||
CommandAc = 0 << 5,
|
||||
CommandAdtc = 1 << 5,
|
||||
CommandBc = 2 << 5,
|
||||
CommandBcr = 3 << 5,
|
||||
ResponseSpiS1 = 1 << 7,
|
||||
ResponseSpiS2 = 1 << 8,
|
||||
ResponseSpiB4 = 1 << 9,
|
||||
ResponseSpiBusy = 1 << 10,
|
||||
ResponseNone = 0,
|
||||
ResponseR1 = ResponsePresent | ResponseCrc | ResponseOpcode,
|
||||
ResponseR1B = ResponsePresent | ResponseCrc | ResponseOpcode | ResponseBusy,
|
||||
ResponseR2 = ResponsePresent | Response136 | ResponseCrc,
|
||||
ResponseR3 = ResponsePresent,
|
||||
ResponseR4 = ResponsePresent,
|
||||
ResponseR5 = ResponsePresent | ResponseCrc | ResponseOpcode,
|
||||
ResponseR6 = ResponsePresent | ResponseCrc | ResponseOpcode,
|
||||
ResponseR7 = ResponsePresent | ResponseCrc | ResponseOpcode,
|
||||
ResponseSpiR1 = ResponseSpiS1,
|
||||
ResponseSpiR1B = ResponseSpiS1 | ResponseSpiBusy,
|
||||
ResponseSpiR2 = ResponseSpiS1 | ResponseSpiS2,
|
||||
ResponseSpiR3 = ResponseSpiS1 | ResponseSpiB4,
|
||||
ResponseSpiR4 = ResponseSpiS1 | ResponseSpiB4,
|
||||
ResponseSpiR5 = ResponseSpiS1 | ResponseSpiS2,
|
||||
ResponseSpiR7 = ResponseSpiS1 | ResponseSpiB4
|
||||
ResponseNone = 0,
|
||||
ResponseR1 = ResponsePresent | ResponseCrc | ResponseOpcode,
|
||||
ResponseR1B = ResponsePresent | ResponseCrc | ResponseOpcode | ResponseBusy,
|
||||
ResponseR2 = ResponsePresent | Response136 | ResponseCrc,
|
||||
ResponseR3 = ResponsePresent,
|
||||
ResponseR4 = ResponsePresent,
|
||||
ResponseR5 = ResponsePresent | ResponseCrc | ResponseOpcode,
|
||||
ResponseR6 = ResponsePresent | ResponseCrc | ResponseOpcode,
|
||||
ResponseR7 = ResponsePresent | ResponseCrc | ResponseOpcode,
|
||||
ResponseSpiR1 = ResponseSpiS1,
|
||||
ResponseSpiR1B = ResponseSpiS1 | ResponseSpiBusy,
|
||||
ResponseSpiR2 = ResponseSpiS1 | ResponseSpiS2,
|
||||
ResponseSpiR3 = ResponseSpiS1 | ResponseSpiB4,
|
||||
ResponseSpiR4 = ResponseSpiS1 | ResponseSpiB4,
|
||||
ResponseSpiR5 = ResponseSpiS1 | ResponseSpiS2,
|
||||
ResponseSpiR7 = ResponseSpiS1 | ResponseSpiB4
|
||||
}
|
||||
|
||||
[Flags]
|
||||
@@ -3818,10 +3818,111 @@ namespace DiscImageChef.Devices
|
||||
ErrorSkipping
|
||||
}
|
||||
|
||||
public enum AtaFeatures : byte
|
||||
{
|
||||
/// <summary>Enable 8-bit data transfers</summary>
|
||||
Enable8Bit = 0x01,
|
||||
/// <summary>Enable write cache</summary>
|
||||
EnableWriteCache = 0x02,
|
||||
/// <summary>Set transfer mode based on value in sector count register</summary>
|
||||
SetTransferMode = 0x03,
|
||||
/// <summary>Enable all automatic defect reassignment</summary>
|
||||
EnableDefectReassignment = 0x04,
|
||||
/// <summary>Enable advanced power management</summary>
|
||||
EnableApm = 0x05,
|
||||
/// <summary>Enable Power-Up In Standby feature set</summary>
|
||||
EnablePowerUpInStandby = 0x06,
|
||||
/// <summary>Power-Up In Standby feature set device spin-up</summary>
|
||||
PowerUpInStandByFeature = 0x07,
|
||||
/// <summary>Reserved for Address offset reserved area boot method technical report</summary>
|
||||
AddressOffsetReserved = 0x09,
|
||||
/// <summary>Enable CFA power mode 1</summary>
|
||||
EnableCfaPowerMode1 = 0x0A,
|
||||
/// <summary>Enable Write-Read-Verify feature set</summary>
|
||||
EnableWriteReadVerify = 0x0B,
|
||||
/// <summary>Enable use of SATA feature</summary>
|
||||
EnableSataFeature = 0x10,
|
||||
/// <summary>Disable Media Status Notification</summary>
|
||||
DisableMediaStatusNotification = 0x31,
|
||||
/// <summary>Disable retry</summary>
|
||||
DisableRetry = 0x33,
|
||||
/// <summary>Enable Free-fall Control</summary>
|
||||
EnableFreeFall = 0x41,
|
||||
/// <summary>Enable Automatic Acoustic Management feature set</summary>
|
||||
EnableAam = 0x42,
|
||||
/// <summary>Set Maximum Host Interface Sector Times</summary>
|
||||
SetMaximumHostInterfaceSectorTimes = 0x43,
|
||||
/// <summary>Vendor unique length of ECC on read long/write long commands</summary>
|
||||
EnableReadLongVendorLength = 0x44,
|
||||
/// <summary>Extended Power conditions</summary>
|
||||
ExtendedPowerConditions = 0x4A,
|
||||
/// <summary>Set cache segments to sector count register value</summary>
|
||||
SetCacheSegments = 0x54,
|
||||
/// <summary>Disable read look-ahead feature</summary>
|
||||
DisableReadLookAhead = 0x55,
|
||||
/// <summary>Enable release interrupt</summary>
|
||||
EnableReleaseInterrupt = 0x5D,
|
||||
/// <summary>Enable SERVICE interrupt</summary>
|
||||
EnableServiceInterrupt = 0x5E,
|
||||
/// <summary>Long Physical Sector Alignment Error Reporting Control</summary>
|
||||
LongPhysicalSectorErrorControl = 0x62,
|
||||
/// <summary>Enable/Disable the DSN feature set</summary>
|
||||
DsnFeature = 0x63,
|
||||
/// <summary>Disable reverting to power on defaults</summary>
|
||||
DisableRevertToDefaults = 0x66,
|
||||
/// <summary>Disable ECC</summary>
|
||||
DisableEcc = 0x77,
|
||||
/// <summary>Disable 8-bit data transfers</summary>
|
||||
Disable8Bit = 0x81,
|
||||
/// <summary>Disable write cache</summary>
|
||||
DisableWriteCache = 0x82,
|
||||
/// <summary>Disable all automatic defect reassignment</summary>
|
||||
DisableDefectReassignment = 0x84,
|
||||
/// <summary>Disable advanced power management</summary>
|
||||
DisableApm = 0x85,
|
||||
/// <summary>Disable Power-Up In Standby feature set</summary>
|
||||
DisablePowerUpInStandby = 0x86,
|
||||
/// <summary>Enable ECC</summary>
|
||||
EnableEcc = 0x88,
|
||||
/// <summary>Reserved for Address offset reserved area boot method technical report</summary>
|
||||
AddressOffsetReserved2 = 0x89,
|
||||
/// <summary>Disable CFA power mode 1</summary>
|
||||
DisableCfaPowerMode1 = 0x8A,
|
||||
/// <summary>Disable Write-Read-Verify feature set</summary>
|
||||
DisableWriteReadVerify = 0x8B,
|
||||
/// <summary>Disable use of SATA feature</summary>
|
||||
DisableSataFeature = 0x90,
|
||||
/// <summary>Enable Media Status Notification</summary>
|
||||
EnableMediaStatusNotification = 0x95,
|
||||
/// <summary>Enable retries</summary>
|
||||
EnableRetries = 0x99,
|
||||
/// <summary>Set device maximum average current</summary>
|
||||
SetMaximumAverageCurrent = 0x9A,
|
||||
/// <summary>Enable read look-ahead feature</summary>
|
||||
EnableReadLookAhead = 0xAA,
|
||||
/// <summary>Set maximum prefetch using sector count register value</summary>
|
||||
SetMaximumPrefetch = 0xAB,
|
||||
/// <summary>4 bytes of ECC apply on read long/write long commands</summary>
|
||||
DisableReadLongVendorLength = 0xBB,
|
||||
/// <summary>Disable Free-fall Control</summary>
|
||||
DisableFreeFall = 0xC1,
|
||||
/// <summary>Disable Automatic Acoustic Management feature set</summary>
|
||||
DisableAam = 0xC2,
|
||||
/// <summary>Enable/Disable the Sense Data Reporting feature set</summary>
|
||||
SenseDataReporting = 0xC3,
|
||||
/// <summary>Enable reverting to power on defaults</summary>
|
||||
EnableRevertToDefaults = 0xCC,
|
||||
/// <summary>Disable release interrupt</summary>
|
||||
DisableReleaseInterrupt = 0xDD,
|
||||
/// <summary>Disable SERVICE interrupt</summary>
|
||||
DisableServiceInterrupt = 0xDE,
|
||||
VendorSpecific = 0xE0
|
||||
}
|
||||
|
||||
public enum KreonLockStates : byte
|
||||
{
|
||||
Locked = 0,
|
||||
Xtreme = 1,
|
||||
Locked = 0,
|
||||
Xtreme = 1,
|
||||
Wxripper = 2
|
||||
}
|
||||
}
|
||||
@@ -119,9 +119,9 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
menu:
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Sending READ BUFFER to the device:");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
@@ -184,9 +184,9 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
menu:
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Sending READ BUFFER DMA to the device:");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
@@ -241,19 +241,19 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
|
||||
static void ReadDma(string devPath, Device dev, bool retries)
|
||||
{
|
||||
uint lba = 0;
|
||||
byte count = 1;
|
||||
uint lba = 0;
|
||||
byte count = 1;
|
||||
string strDev;
|
||||
int item;
|
||||
int item;
|
||||
|
||||
parameters:
|
||||
while(true)
|
||||
{
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Parameters for READ DMA {0}command:", retries ? "WITH RETRIES " : "");
|
||||
DicConsole.WriteLine("LBA: {0}", lba);
|
||||
DicConsole.WriteLine("Count: {0}", count);
|
||||
DicConsole.WriteLine("LBA: {0}", lba);
|
||||
DicConsole.WriteLine("Count: {0}", count);
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
DicConsole.WriteLine("1.- Change parameters.");
|
||||
@@ -287,10 +287,11 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
if(lba > 0xFFFFFFF)
|
||||
{
|
||||
DicConsole
|
||||
.WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...",
|
||||
0xFFFFFFF);
|
||||
.WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...",
|
||||
0xFFFFFFF);
|
||||
lba = 0xFFFFFFF;
|
||||
}
|
||||
|
||||
DicConsole.Write("How many sectors?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!byte.TryParse(strDev, out count))
|
||||
@@ -311,12 +312,12 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
dev.Timeout, out double duration);
|
||||
|
||||
menu:
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Sending READ DMA {0}to the device:", retries ? "WITH RETRIES " : "");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
DicConsole.WriteLine("1.- Print buffer.");
|
||||
@@ -342,7 +343,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
return;
|
||||
case 1:
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("READ DMA {0}response:", retries ? "WITH RETRIES " : "");
|
||||
if(buffer != null) PrintHex.PrintHexArray(buffer, 64);
|
||||
DicConsole.WriteLine("Press any key to continue...");
|
||||
@@ -352,7 +353,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
goto menu;
|
||||
case 2:
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("READ DMA {0}status registers:", retries ? "WITH RETRIES " : "");
|
||||
DicConsole.Write("{0}", MainClass.DecodeAtaRegisters(errorRegisters));
|
||||
DicConsole.WriteLine("Press any key to continue...");
|
||||
@@ -372,19 +373,19 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
|
||||
static void ReadLong(string devPath, Device dev, bool retries)
|
||||
{
|
||||
uint lba = 0;
|
||||
uint blockSize = 1;
|
||||
uint lba = 0;
|
||||
uint blockSize = 1;
|
||||
string strDev;
|
||||
int item;
|
||||
int item;
|
||||
|
||||
parameters:
|
||||
while(true)
|
||||
{
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Parameters for READ LONG {0}command:", retries ? "WITH RETRIES " : "");
|
||||
DicConsole.WriteLine("LBA: {0}", lba);
|
||||
DicConsole.WriteLine("Block size: {0}", blockSize);
|
||||
DicConsole.WriteLine("LBA: {0}", lba);
|
||||
DicConsole.WriteLine("Block size: {0}", blockSize);
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
DicConsole.WriteLine("1.- Change parameters.");
|
||||
@@ -418,10 +419,20 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
if(lba > 0xFFFFFFF)
|
||||
{
|
||||
DicConsole
|
||||
.WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...",
|
||||
0xFFFFFFF);
|
||||
.WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...",
|
||||
0xFFFFFFF);
|
||||
lba = 0xFFFFFFF;
|
||||
}
|
||||
|
||||
DicConsole.Write("How many bytes to expect?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!uint.TryParse(strDev, out blockSize))
|
||||
{
|
||||
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
||||
blockSize = 0;
|
||||
System.Console.ReadKey();
|
||||
}
|
||||
|
||||
break;
|
||||
case 2: goto start;
|
||||
}
|
||||
@@ -433,12 +444,12 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
blockSize, dev.Timeout, out double duration);
|
||||
|
||||
menu:
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Sending READ LONG {0}to the device:", retries ? "WITH RETRIES " : "");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
DicConsole.WriteLine("1.- Print buffer.");
|
||||
@@ -464,7 +475,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
return;
|
||||
case 1:
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("READ LONG {0}response:", retries ? "WITH RETRIES " : "");
|
||||
if(buffer != null) PrintHex.PrintHexArray(buffer, 64);
|
||||
DicConsole.WriteLine("Press any key to continue...");
|
||||
@@ -474,7 +485,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
goto menu;
|
||||
case 2:
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("READ LONG {0}status registers:", retries ? "WITH RETRIES " : "");
|
||||
DicConsole.Write("{0}", MainClass.DecodeAtaRegisters(errorRegisters));
|
||||
DicConsole.WriteLine("Press any key to continue...");
|
||||
@@ -494,10 +505,10 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
|
||||
static void ReadMultiple(string devPath, Device dev)
|
||||
{
|
||||
uint lba = 0;
|
||||
byte count = 1;
|
||||
uint lba = 0;
|
||||
byte count = 1;
|
||||
string strDev;
|
||||
int item;
|
||||
int item;
|
||||
|
||||
parameters:
|
||||
while(true)
|
||||
@@ -505,7 +516,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Parameters for READ MULTIPLE command:");
|
||||
DicConsole.WriteLine("LBA: {0}", lba);
|
||||
DicConsole.WriteLine("LBA: {0}", lba);
|
||||
DicConsole.WriteLine("Count: {0}", count);
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
@@ -540,10 +551,11 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
if(lba > 0xFFFFFFF)
|
||||
{
|
||||
DicConsole
|
||||
.WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...",
|
||||
0xFFFFFFF);
|
||||
.WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...",
|
||||
0xFFFFFFF);
|
||||
lba = 0xFFFFFFF;
|
||||
}
|
||||
|
||||
DicConsole.Write("How many sectors?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!byte.TryParse(strDev, out count))
|
||||
@@ -566,9 +578,9 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
menu:
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Sending READ MULTIPLE to the device:");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
@@ -634,8 +646,8 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Sending READ NATIVE MAX ADDRESS to the device:");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Max LBA is {0}.", lba);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Max LBA is {0}.", lba);
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
DicConsole.WriteLine("1.- Decode error registers.");
|
||||
@@ -678,19 +690,19 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
|
||||
static void ReadSectors(string devPath, Device dev, bool retries)
|
||||
{
|
||||
uint lba = 0;
|
||||
byte count = 1;
|
||||
uint lba = 0;
|
||||
byte count = 1;
|
||||
string strDev;
|
||||
int item;
|
||||
int item;
|
||||
|
||||
parameters:
|
||||
while(true)
|
||||
{
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Parameters for READ SECTORS {0}command:", retries ? "WITH RETRIES " : "");
|
||||
DicConsole.WriteLine("LBA: {0}", lba);
|
||||
DicConsole.WriteLine("Count: {0}", count);
|
||||
DicConsole.WriteLine("LBA: {0}", lba);
|
||||
DicConsole.WriteLine("Count: {0}", count);
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
DicConsole.WriteLine("1.- Change parameters.");
|
||||
@@ -724,10 +736,11 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
if(lba > 0xFFFFFFF)
|
||||
{
|
||||
DicConsole
|
||||
.WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...",
|
||||
0xFFFFFFF);
|
||||
.WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...",
|
||||
0xFFFFFFF);
|
||||
lba = 0xFFFFFFF;
|
||||
}
|
||||
|
||||
DicConsole.Write("How many sectors?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!byte.TryParse(strDev, out count))
|
||||
@@ -748,12 +761,12 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
dev.Timeout, out double duration);
|
||||
|
||||
menu:
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Sending READ SECTORS {0}to the device:", retries ? "WITH RETRIES " : "");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
DicConsole.WriteLine("1.- Print buffer.");
|
||||
@@ -779,7 +792,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
return;
|
||||
case 1:
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("READ SECTORS {0}response:", retries ? "WITH RETRIES " : "");
|
||||
if(buffer != null) PrintHex.PrintHexArray(buffer, 64);
|
||||
DicConsole.WriteLine("Press any key to continue...");
|
||||
@@ -789,7 +802,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
goto menu;
|
||||
case 2:
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("READ SECTORS {0}status registers:", retries ? "WITH RETRIES " : "");
|
||||
DicConsole.Write("{0}", MainClass.DecodeAtaRegisters(errorRegisters));
|
||||
DicConsole.WriteLine("Press any key to continue...");
|
||||
@@ -809,9 +822,9 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
|
||||
static void Seek(string devPath, Device dev)
|
||||
{
|
||||
uint lba = 0;
|
||||
uint lba = 0;
|
||||
string strDev;
|
||||
int item;
|
||||
int item;
|
||||
|
||||
parameters:
|
||||
while(true)
|
||||
@@ -853,10 +866,11 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
if(lba > 0xFFFFFFF)
|
||||
{
|
||||
DicConsole
|
||||
.WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...",
|
||||
0xFFFFFFF);
|
||||
.WriteLine("Logical block address cannot be bigger than {0}. Setting it to {0}...",
|
||||
0xFFFFFFF);
|
||||
lba = 0xFFFFFFF;
|
||||
}
|
||||
|
||||
break;
|
||||
case 2: goto start;
|
||||
}
|
||||
@@ -870,7 +884,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Sending SEEK to the device:");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
DicConsole.WriteLine("1.- Decode error registers.");
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
DicConsole.WriteLine("7.- Send READ SECTORS command.");
|
||||
DicConsole.WriteLine("8.- Send READ SECTORS WITH RETRIES command.");
|
||||
DicConsole.WriteLine("9.- Send SEEK command.");
|
||||
DicConsole.WriteLine("10.- Send SET FEATURES command.");
|
||||
DicConsole.WriteLine("0.- Return to ATA commands menu.");
|
||||
DicConsole.Write("Choose: ");
|
||||
|
||||
@@ -93,6 +94,9 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
case 9:
|
||||
Seek(devPath, dev);
|
||||
continue;
|
||||
case 10:
|
||||
SetFeatures(devPath, dev);
|
||||
continue;
|
||||
default:
|
||||
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
|
||||
System.Console.ReadKey();
|
||||
@@ -111,9 +115,9 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
menu:
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Sending IDENTIFY DEVICE to the device:");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
@@ -180,22 +184,22 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
static void ReadDma(string devPath, Device dev, bool retries)
|
||||
{
|
||||
ushort cylinder = 0;
|
||||
byte head = 0;
|
||||
byte sector = 1;
|
||||
byte count = 1;
|
||||
byte head = 0;
|
||||
byte sector = 1;
|
||||
byte count = 1;
|
||||
string strDev;
|
||||
int item;
|
||||
int item;
|
||||
|
||||
parameters:
|
||||
while(true)
|
||||
{
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Parameters for READ DMA {0}command:", retries ? "WITH RETRIES " : "");
|
||||
DicConsole.WriteLine("Cylinder: {0}", cylinder);
|
||||
DicConsole.WriteLine("Head: {0}", head);
|
||||
DicConsole.WriteLine("Sector: {0}", sector);
|
||||
DicConsole.WriteLine("Count: {0}", count);
|
||||
DicConsole.WriteLine("Cylinder: {0}", cylinder);
|
||||
DicConsole.WriteLine("Head: {0}", head);
|
||||
DicConsole.WriteLine("Sector: {0}", sector);
|
||||
DicConsole.WriteLine("Count: {0}", count);
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
DicConsole.WriteLine("1.- Change parameters.");
|
||||
@@ -241,6 +245,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
DicConsole.WriteLine("Head cannot be bigger than 15. Setting it to 15...");
|
||||
head = 15;
|
||||
}
|
||||
|
||||
DicConsole.Write("What sector?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!byte.TryParse(strDev, out sector))
|
||||
@@ -271,12 +276,12 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
head, sector, count, dev.Timeout, out double duration);
|
||||
|
||||
menu:
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Sending READ DMA {0}to the device:", retries ? "WITH RETRIES " : "");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
DicConsole.WriteLine("1.- Print buffer.");
|
||||
@@ -302,7 +307,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
return;
|
||||
case 1:
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("READ DMA {0}response:", retries ? "WITH RETRIES " : "");
|
||||
if(buffer != null) PrintHex.PrintHexArray(buffer, 64);
|
||||
DicConsole.WriteLine("Press any key to continue...");
|
||||
@@ -312,7 +317,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
goto menu;
|
||||
case 2:
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("READ DMA {0}status registers:", retries ? "WITH RETRIES " : "");
|
||||
DicConsole.Write("{0}", MainClass.DecodeAtaRegisters(errorRegisters));
|
||||
DicConsole.WriteLine("Press any key to continue...");
|
||||
@@ -332,23 +337,23 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
|
||||
static void ReadLong(string devPath, Device dev, bool retries)
|
||||
{
|
||||
ushort cylinder = 0;
|
||||
byte head = 0;
|
||||
byte sector = 1;
|
||||
uint blockSize = 1;
|
||||
ushort cylinder = 0;
|
||||
byte head = 0;
|
||||
byte sector = 1;
|
||||
uint blockSize = 1;
|
||||
string strDev;
|
||||
int item;
|
||||
int item;
|
||||
|
||||
parameters:
|
||||
while(true)
|
||||
{
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Parameters for READ LONG {0}command:", retries ? "WITH RETRIES " : "");
|
||||
DicConsole.WriteLine("Cylinder: {0}", cylinder);
|
||||
DicConsole.WriteLine("Head: {0}", head);
|
||||
DicConsole.WriteLine("Sector: {0}", sector);
|
||||
DicConsole.WriteLine("Block size: {0}", blockSize);
|
||||
DicConsole.WriteLine("Cylinder: {0}", cylinder);
|
||||
DicConsole.WriteLine("Head: {0}", head);
|
||||
DicConsole.WriteLine("Sector: {0}", sector);
|
||||
DicConsole.WriteLine("Block size: {0}", blockSize);
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
DicConsole.WriteLine("1.- Change parameters.");
|
||||
@@ -394,6 +399,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
DicConsole.WriteLine("Head cannot be bigger than 15. Setting it to 15...");
|
||||
head = 15;
|
||||
}
|
||||
|
||||
DicConsole.Write("What sector?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!byte.TryParse(strDev, out sector))
|
||||
@@ -424,12 +430,12 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
head, sector, blockSize, dev.Timeout, out double duration);
|
||||
|
||||
menu:
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Sending READ LONG {0}to the device:", retries ? "WITH RETRIES " : "");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
DicConsole.WriteLine("1.- Print buffer.");
|
||||
@@ -455,7 +461,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
return;
|
||||
case 1:
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("READ LONG {0}response:", retries ? "WITH RETRIES " : "");
|
||||
if(buffer != null) PrintHex.PrintHexArray(buffer, 64);
|
||||
DicConsole.WriteLine("Press any key to continue...");
|
||||
@@ -465,7 +471,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
goto menu;
|
||||
case 2:
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("READ LONG {0}status registers:", retries ? "WITH RETRIES " : "");
|
||||
DicConsole.Write("{0}", MainClass.DecodeAtaRegisters(errorRegisters));
|
||||
DicConsole.WriteLine("Press any key to continue...");
|
||||
@@ -486,11 +492,11 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
static void ReadMultiple(string devPath, Device dev)
|
||||
{
|
||||
ushort cylinder = 0;
|
||||
byte head = 0;
|
||||
byte sector = 1;
|
||||
byte count = 1;
|
||||
byte head = 0;
|
||||
byte sector = 1;
|
||||
byte count = 1;
|
||||
string strDev;
|
||||
int item;
|
||||
int item;
|
||||
|
||||
parameters:
|
||||
while(true)
|
||||
@@ -499,9 +505,9 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Parameters for READ MULTIPLE command:");
|
||||
DicConsole.WriteLine("Cylinder: {0}", cylinder);
|
||||
DicConsole.WriteLine("Head: {0}", head);
|
||||
DicConsole.WriteLine("Sector: {0}", sector);
|
||||
DicConsole.WriteLine("Count: {0}", count);
|
||||
DicConsole.WriteLine("Head: {0}", head);
|
||||
DicConsole.WriteLine("Sector: {0}", sector);
|
||||
DicConsole.WriteLine("Count: {0}", count);
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
DicConsole.WriteLine("1.- Change parameters.");
|
||||
@@ -547,6 +553,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
DicConsole.WriteLine("Head cannot be bigger than 15. Setting it to 15...");
|
||||
head = 15;
|
||||
}
|
||||
|
||||
DicConsole.Write("What sector?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!byte.TryParse(strDev, out sector))
|
||||
@@ -579,9 +586,9 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
menu:
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Sending READ MULTIPLE to the device:");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
@@ -639,22 +646,22 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
static void ReadSectors(string devPath, Device dev, bool retries)
|
||||
{
|
||||
ushort cylinder = 0;
|
||||
byte head = 0;
|
||||
byte sector = 1;
|
||||
byte count = 1;
|
||||
byte head = 0;
|
||||
byte sector = 1;
|
||||
byte count = 1;
|
||||
string strDev;
|
||||
int item;
|
||||
int item;
|
||||
|
||||
parameters:
|
||||
while(true)
|
||||
{
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Parameters for READ SECTORS {0}command:", retries ? "WITH RETRIES " : "");
|
||||
DicConsole.WriteLine("Cylinder: {0}", cylinder);
|
||||
DicConsole.WriteLine("Head: {0}", head);
|
||||
DicConsole.WriteLine("Sector: {0}", sector);
|
||||
DicConsole.WriteLine("Count: {0}", count);
|
||||
DicConsole.WriteLine("Cylinder: {0}", cylinder);
|
||||
DicConsole.WriteLine("Head: {0}", head);
|
||||
DicConsole.WriteLine("Sector: {0}", sector);
|
||||
DicConsole.WriteLine("Count: {0}", count);
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
DicConsole.WriteLine("1.- Change parameters.");
|
||||
@@ -700,6 +707,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
DicConsole.WriteLine("Head cannot be bigger than 15. Setting it to 15...");
|
||||
head = 15;
|
||||
}
|
||||
|
||||
DicConsole.Write("What sector?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!byte.TryParse(strDev, out sector))
|
||||
@@ -730,12 +738,12 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
sector, count, dev.Timeout, out double duration);
|
||||
|
||||
menu:
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Sending READ SECTORS {0}to the device:", retries ? "WITH RETRIES " : "");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
||||
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
DicConsole.WriteLine("1.- Print buffer.");
|
||||
@@ -761,7 +769,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
return;
|
||||
case 1:
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("READ SECTORS {0}response:", retries ? "WITH RETRIES " : "");
|
||||
if(buffer != null) PrintHex.PrintHexArray(buffer, 64);
|
||||
DicConsole.WriteLine("Press any key to continue...");
|
||||
@@ -771,7 +779,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
goto menu;
|
||||
case 2:
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("READ SECTORS {0}status registers:", retries ? "WITH RETRIES " : "");
|
||||
DicConsole.Write("{0}", MainClass.DecodeAtaRegisters(errorRegisters));
|
||||
DicConsole.WriteLine("Press any key to continue...");
|
||||
@@ -792,10 +800,10 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
static void Seek(string devPath, Device dev)
|
||||
{
|
||||
ushort cylinder = 0;
|
||||
byte head = 0;
|
||||
byte sector = 1;
|
||||
byte head = 0;
|
||||
byte sector = 1;
|
||||
string strDev;
|
||||
int item;
|
||||
int item;
|
||||
|
||||
parameters:
|
||||
while(true)
|
||||
@@ -804,8 +812,8 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Parameters for SEEK command:");
|
||||
DicConsole.WriteLine("Cylinder: {0}", cylinder);
|
||||
DicConsole.WriteLine("Head: {0}", head);
|
||||
DicConsole.WriteLine("Sector: {0}", sector);
|
||||
DicConsole.WriteLine("Head: {0}", head);
|
||||
DicConsole.WriteLine("Sector: {0}", sector);
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
DicConsole.WriteLine("1.- Change parameters.");
|
||||
@@ -851,6 +859,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
DicConsole.WriteLine("Head cannot be bigger than 15. Setting it to 15...");
|
||||
head = 15;
|
||||
}
|
||||
|
||||
DicConsole.Write("What sector?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!byte.TryParse(strDev, out sector))
|
||||
@@ -874,7 +883,7 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Sending SEEK to the device:");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
DicConsole.WriteLine("1.- Decode error registers.");
|
||||
@@ -916,5 +925,156 @@ namespace DiscImageChef.Tests.Devices.ATA
|
||||
goto menu;
|
||||
}
|
||||
}
|
||||
|
||||
static void SetFeatures(string devPath, Device dev)
|
||||
{
|
||||
ushort cylinder = 0;
|
||||
byte head = 0;
|
||||
byte sector = 0;
|
||||
byte feature = 0;
|
||||
byte sectorCount = 0;
|
||||
string strDev;
|
||||
int item;
|
||||
|
||||
parameters:
|
||||
while(true)
|
||||
{
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Parameters for SET FEATURES command:");
|
||||
DicConsole.WriteLine("Cylinder: {0}", cylinder);
|
||||
DicConsole.WriteLine("Head: {0}", head);
|
||||
DicConsole.WriteLine("Sector: {0}", sector);
|
||||
DicConsole.WriteLine("Sector count: {0}", sectorCount);
|
||||
DicConsole.WriteLine("Feature: 0x{0:X2}", feature);
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
DicConsole.WriteLine("1.- Change parameters.");
|
||||
DicConsole.WriteLine("2.- Send command with these parameters.");
|
||||
DicConsole.WriteLine("0.- Return to CHS ATA commands menu.");
|
||||
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!int.TryParse(strDev, out item))
|
||||
{
|
||||
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
||||
System.Console.ReadKey();
|
||||
continue;
|
||||
}
|
||||
|
||||
switch(item)
|
||||
{
|
||||
case 0:
|
||||
DicConsole.WriteLine("Returning to CHS ATA commands menu...");
|
||||
return;
|
||||
case 1:
|
||||
DicConsole.Write("What cylinder?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!ushort.TryParse(strDev, out cylinder))
|
||||
{
|
||||
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
||||
cylinder = 0;
|
||||
System.Console.ReadKey();
|
||||
continue;
|
||||
}
|
||||
|
||||
DicConsole.Write("What head?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!byte.TryParse(strDev, out head))
|
||||
{
|
||||
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
||||
head = 0;
|
||||
System.Console.ReadKey();
|
||||
continue;
|
||||
}
|
||||
|
||||
if(head > 15)
|
||||
{
|
||||
DicConsole.WriteLine("Head cannot be bigger than 15. Setting it to 15...");
|
||||
head = 15;
|
||||
}
|
||||
|
||||
DicConsole.Write("What sector?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!byte.TryParse(strDev, out sector))
|
||||
{
|
||||
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
||||
sector = 0;
|
||||
System.Console.ReadKey();
|
||||
}
|
||||
|
||||
DicConsole.Write("What sector count?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!byte.TryParse(strDev, out sectorCount))
|
||||
{
|
||||
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
||||
sectorCount = 0;
|
||||
System.Console.ReadKey();
|
||||
}
|
||||
|
||||
DicConsole.Write("What feature?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!byte.TryParse(strDev, out feature))
|
||||
{
|
||||
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
||||
feature = 0;
|
||||
System.Console.ReadKey();
|
||||
}
|
||||
|
||||
break;
|
||||
case 2: goto start;
|
||||
}
|
||||
}
|
||||
|
||||
start:
|
||||
System.Console.Clear();
|
||||
bool sense = dev.Seek(out AtaErrorRegistersChs errorRegisters, cylinder, head, sector, dev.Timeout,
|
||||
out double duration);
|
||||
|
||||
menu:
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Sending SET FEATURES to the device:");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
DicConsole.WriteLine("1.- Decode error registers.");
|
||||
DicConsole.WriteLine("2.- Send command again.");
|
||||
DicConsole.WriteLine("3.- Change parameters.");
|
||||
DicConsole.WriteLine("0.- Return to CHS ATA commands menu.");
|
||||
DicConsole.Write("Choose: ");
|
||||
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!int.TryParse(strDev, out item))
|
||||
{
|
||||
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
||||
System.Console.ReadKey();
|
||||
System.Console.Clear();
|
||||
goto menu;
|
||||
}
|
||||
|
||||
switch(item)
|
||||
{
|
||||
case 0:
|
||||
DicConsole.WriteLine("Returning to CHS ATA commands menu...");
|
||||
return;
|
||||
case 1:
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("SET FEATURES status registers:");
|
||||
DicConsole.Write("{0}", MainClass.DecodeAtaRegisters(errorRegisters));
|
||||
DicConsole.WriteLine("Press any key to continue...");
|
||||
System.Console.ReadKey();
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
goto menu;
|
||||
case 2: goto start;
|
||||
case 3: goto parameters;
|
||||
default:
|
||||
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
|
||||
System.Console.ReadKey();
|
||||
System.Console.Clear();
|
||||
goto menu;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user