mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
REFACTOR: Reformat code.
This commit is contained in:
@@ -37,7 +37,8 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
public partial class Device
|
||||
{
|
||||
public bool ReadBuffer(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint timeout, out double duration)
|
||||
public bool ReadBuffer(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
buffer = new byte[512];
|
||||
AtaRegistersLBA28 registers = new AtaRegistersLBA28();
|
||||
@@ -45,8 +46,9 @@ namespace DiscImageChef.Devices
|
||||
|
||||
registers.command = (byte)AtaCommands.ReadBuffer;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer,
|
||||
ref buffer, timeout, false, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "READ BUFFER took {0} ms.", duration);
|
||||
@@ -54,7 +56,8 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool ReadBufferDma(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint timeout, out double duration)
|
||||
public bool ReadBufferDma(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
buffer = new byte[512];
|
||||
AtaRegistersLBA28 registers = new AtaRegistersLBA28();
|
||||
@@ -71,24 +74,22 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba, byte count, uint timeout, out double duration)
|
||||
public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba, byte count,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
return ReadDma(out buffer, out statusRegisters, true, lba, count, timeout, out duration);
|
||||
}
|
||||
|
||||
public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, bool retry, uint lba, byte count, uint timeout, out double duration)
|
||||
public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, bool retry, uint lba,
|
||||
byte count, uint timeout, out double duration)
|
||||
{
|
||||
if(count == 0)
|
||||
buffer = new byte[512 * 256];
|
||||
else
|
||||
buffer = new byte[512 * count];
|
||||
if(count == 0) buffer = new byte[512 * 256];
|
||||
else buffer = new byte[512 * count];
|
||||
AtaRegistersLBA28 registers = new AtaRegistersLBA28();
|
||||
bool sense;
|
||||
|
||||
if(retry)
|
||||
registers.command = (byte)AtaCommands.ReadDmaRetry;
|
||||
else
|
||||
registers.command = (byte)AtaCommands.ReadDma;
|
||||
if(retry) registers.command = (byte)AtaCommands.ReadDmaRetry;
|
||||
else registers.command = (byte)AtaCommands.ReadDma;
|
||||
registers.sectorCount = count;
|
||||
registers.deviceHead = (byte)((lba & 0xF000000) / 0x1000000);
|
||||
registers.lbaHigh = (byte)((lba & 0xFF0000) / 0x10000);
|
||||
@@ -105,12 +106,11 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba, byte count, uint timeout, out double duration)
|
||||
public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba, byte count,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
if(count == 0)
|
||||
buffer = new byte[512 * 256];
|
||||
else
|
||||
buffer = new byte[512 * count];
|
||||
if(count == 0) buffer = new byte[512 * 256];
|
||||
else buffer = new byte[512 * count];
|
||||
AtaRegistersLBA28 registers = new AtaRegistersLBA28();
|
||||
bool sense;
|
||||
|
||||
@@ -122,8 +122,9 @@ namespace DiscImageChef.Devices
|
||||
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
|
||||
registers.deviceHead += 0x40;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount,
|
||||
ref buffer, timeout, true, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "READ MULTIPLE took {0} ms.", duration);
|
||||
@@ -131,7 +132,8 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool ReadNativeMaxAddress(out uint lba, out AtaErrorRegistersLBA28 statusRegisters, uint timeout, out double duration)
|
||||
public bool ReadNativeMaxAddress(out uint lba, out AtaErrorRegistersLBA28 statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
lba = 0;
|
||||
byte[] buffer = new byte[0];
|
||||
@@ -141,8 +143,9 @@ namespace DiscImageChef.Devices
|
||||
registers.command = (byte)AtaCommands.ReadNativeMaxAddress;
|
||||
registers.deviceHead += 0x40;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer,
|
||||
ref buffer, timeout, false, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if((statusRegisters.status & 0x23) == 0)
|
||||
@@ -159,24 +162,22 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool Read(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba, byte count, uint timeout, out double duration)
|
||||
public bool Read(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba, byte count,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
return Read(out buffer, out statusRegisters, true, lba, count, timeout, out duration);
|
||||
}
|
||||
|
||||
public bool Read(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, bool retry, uint lba, byte count, uint timeout, out double duration)
|
||||
public bool Read(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, bool retry, uint lba,
|
||||
byte count, uint timeout, out double duration)
|
||||
{
|
||||
if(count == 0)
|
||||
buffer = new byte[512 * 256];
|
||||
else
|
||||
buffer = new byte[512 * count];
|
||||
if(count == 0) buffer = new byte[512 * 256];
|
||||
else buffer = new byte[512 * count];
|
||||
AtaRegistersLBA28 registers = new AtaRegistersLBA28();
|
||||
bool sense;
|
||||
|
||||
if(retry)
|
||||
registers.command = (byte)AtaCommands.ReadRetry;
|
||||
else
|
||||
registers.command = (byte)AtaCommands.Read;
|
||||
if(retry) registers.command = (byte)AtaCommands.ReadRetry;
|
||||
else registers.command = (byte)AtaCommands.Read;
|
||||
registers.sectorCount = count;
|
||||
registers.deviceHead = (byte)((lba & 0xF000000) / 0x1000000);
|
||||
registers.lbaHigh = (byte)((lba & 0xFF0000) / 0x10000);
|
||||
@@ -184,8 +185,9 @@ namespace DiscImageChef.Devices
|
||||
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
|
||||
registers.deviceHead += 0x40;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount,
|
||||
ref buffer, timeout, true, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "READ SECTORS took {0} ms.", duration);
|
||||
@@ -193,22 +195,21 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
|
||||
public bool ReadLong(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba, uint blockSize, uint timeout, out double duration)
|
||||
public bool ReadLong(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba, uint blockSize,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
return ReadLong(out buffer, out statusRegisters, true, lba, blockSize, timeout, out duration);
|
||||
}
|
||||
|
||||
public bool ReadLong(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, bool retry, uint lba, uint blockSize, uint timeout, out double duration)
|
||||
public bool ReadLong(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, bool retry, uint lba,
|
||||
uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[blockSize];
|
||||
AtaRegistersLBA28 registers = new AtaRegistersLBA28();
|
||||
bool sense;
|
||||
|
||||
if(retry)
|
||||
registers.command = (byte)AtaCommands.ReadLongRetry;
|
||||
else
|
||||
registers.command = (byte)AtaCommands.ReadLong;
|
||||
if(retry) registers.command = (byte)AtaCommands.ReadLongRetry;
|
||||
else registers.command = (byte)AtaCommands.ReadLong;
|
||||
registers.sectorCount = 1;
|
||||
registers.deviceHead = (byte)((lba & 0xF000000) / 0x1000000);
|
||||
registers.lbaHigh = (byte)((lba & 0xFF0000) / 0x10000);
|
||||
@@ -216,8 +217,9 @@ namespace DiscImageChef.Devices
|
||||
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
|
||||
registers.deviceHead += 0x40;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount,
|
||||
ref buffer, timeout, true, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "READ LONG took {0} ms.", duration);
|
||||
@@ -238,8 +240,9 @@ namespace DiscImageChef.Devices
|
||||
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
|
||||
registers.deviceHead += 0x40;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer,
|
||||
ref buffer, timeout, false, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "SEEK took {0} ms.", duration);
|
||||
@@ -247,5 +250,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,7 +37,8 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
public partial class Device
|
||||
{
|
||||
public bool GetNativeMaxAddressExt(out ulong lba, out AtaErrorRegistersLBA48 statusRegisters, uint timeout, out double duration)
|
||||
public bool GetNativeMaxAddressExt(out ulong lba, out AtaErrorRegistersLBA48 statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
lba = 0;
|
||||
AtaRegistersLBA48 registers = new AtaRegistersLBA48();
|
||||
@@ -47,8 +48,9 @@ namespace DiscImageChef.Devices
|
||||
registers.command = (byte)AtaCommands.NativeMaxAddress;
|
||||
registers.feature = 0x0000;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer,
|
||||
ref buffer, timeout, false, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if((statusRegisters.status & 0x23) == 0)
|
||||
@@ -64,12 +66,11 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, ulong lba, ushort count, uint timeout, out double duration)
|
||||
public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, ulong lba, ushort count,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
if(count == 0)
|
||||
buffer = new byte[512 * 65536];
|
||||
else
|
||||
buffer = new byte[512 * count];
|
||||
if(count == 0) buffer = new byte[512 * 65536];
|
||||
else buffer = new byte[512 * count];
|
||||
AtaRegistersLBA48 registers = new AtaRegistersLBA48();
|
||||
bool sense;
|
||||
|
||||
@@ -89,7 +90,8 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool ReadLog(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, byte logAddress, ushort pageNumber, ushort count, uint timeout, out double duration)
|
||||
public bool ReadLog(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, byte logAddress,
|
||||
ushort pageNumber, ushort count, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[512 * count];
|
||||
AtaRegistersLBA48 registers = new AtaRegistersLBA48();
|
||||
@@ -101,8 +103,9 @@ namespace DiscImageChef.Devices
|
||||
registers.lbaLow += logAddress;
|
||||
registers.lbaHigh = (ushort)((pageNumber & 0xFF00) / 0x100);
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount,
|
||||
ref buffer, timeout, true, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "READ LOG EXT took {0} ms.", duration);
|
||||
@@ -110,7 +113,8 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool ReadLogDma(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, byte logAddress, ushort pageNumber, ushort count, uint timeout, out double duration)
|
||||
public bool ReadLogDma(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, byte logAddress,
|
||||
ushort pageNumber, ushort count, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[512 * count];
|
||||
AtaRegistersLBA48 registers = new AtaRegistersLBA48();
|
||||
@@ -131,12 +135,11 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, ulong lba, ushort count, uint timeout, out double duration)
|
||||
public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, ulong lba, ushort count,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
if(count == 0)
|
||||
buffer = new byte[512 * 65536];
|
||||
else
|
||||
buffer = new byte[512 * count];
|
||||
if(count == 0) buffer = new byte[512 * 65536];
|
||||
else buffer = new byte[512 * count];
|
||||
AtaRegistersLBA48 registers = new AtaRegistersLBA48();
|
||||
bool sense;
|
||||
|
||||
@@ -147,8 +150,9 @@ namespace DiscImageChef.Devices
|
||||
registers.lbaLow = (ushort)((lba & 0xFFFF) / 0x1);
|
||||
registers.deviceHead += 0x40;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount,
|
||||
ref buffer, timeout, true, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "READ MULTIPLE EXT took {0} ms.", duration);
|
||||
@@ -156,7 +160,8 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool ReadNativeMaxAddress(out ulong lba, out AtaErrorRegistersLBA48 statusRegisters, uint timeout, out double duration)
|
||||
public bool ReadNativeMaxAddress(out ulong lba, out AtaErrorRegistersLBA48 statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
lba = 0;
|
||||
byte[] buffer = new byte[0];
|
||||
@@ -166,8 +171,9 @@ namespace DiscImageChef.Devices
|
||||
registers.command = (byte)AtaCommands.ReadNativeMaxAddressExt;
|
||||
registers.deviceHead += 0x40;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer,
|
||||
ref buffer, timeout, false, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if((statusRegisters.status & 0x23) == 0)
|
||||
@@ -183,12 +189,11 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool Read(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, ulong lba, ushort count, uint timeout, out double duration)
|
||||
public bool Read(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, ulong lba, ushort count,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
if(count == 0)
|
||||
buffer = new byte[512 * 65536];
|
||||
else
|
||||
buffer = new byte[512 * count];
|
||||
if(count == 0) buffer = new byte[512 * 65536];
|
||||
else buffer = new byte[512 * count];
|
||||
AtaRegistersLBA48 registers = new AtaRegistersLBA48();
|
||||
bool sense;
|
||||
|
||||
@@ -199,8 +204,9 @@ namespace DiscImageChef.Devices
|
||||
registers.lbaLow = (ushort)((lba & 0xFFFF) / 0x1);
|
||||
registers.deviceHead += 0x40;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount,
|
||||
ref buffer, timeout, true, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "READ SECTORS EXT took {0} ms.", duration);
|
||||
|
||||
@@ -81,7 +81,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="statusRegisters">Status registers.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool AtaIdentify(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, uint timeout, out double duration)
|
||||
public bool AtaIdentify(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
buffer = new byte[512];
|
||||
AtaRegistersCHS registers = new AtaRegistersCHS();
|
||||
@@ -89,8 +90,9 @@ namespace DiscImageChef.Devices
|
||||
|
||||
registers.command = (byte)AtaCommands.IdentifyDevice;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer,
|
||||
ref buffer, timeout, false, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "IDENTIFY DEVICE took {0} ms.", duration);
|
||||
@@ -98,24 +100,22 @@ 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)
|
||||
public bool ReadDma(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, bool retry, ushort cylinder,
|
||||
byte head, byte sector, byte count, uint timeout, out double duration)
|
||||
{
|
||||
if(count == 0)
|
||||
buffer = new byte[512 * 256];
|
||||
else
|
||||
buffer = new byte[512 * count];
|
||||
if(count == 0) buffer = new byte[512 * 256];
|
||||
else buffer = new byte[512 * count];
|
||||
AtaRegistersCHS registers = new AtaRegistersCHS();
|
||||
bool sense;
|
||||
|
||||
if(retry)
|
||||
registers.command = (byte)AtaCommands.ReadDmaRetry;
|
||||
else
|
||||
registers.command = (byte)AtaCommands.ReadDma;
|
||||
if(retry) registers.command = (byte)AtaCommands.ReadDmaRetry;
|
||||
else registers.command = (byte)AtaCommands.ReadDma;
|
||||
registers.sectorCount = count;
|
||||
registers.cylinderHigh = (byte)((cylinder & 0xFF00) / 0x100);
|
||||
registers.cylinderLow = (byte)((cylinder & 0xFF) / 0x1);
|
||||
@@ -131,12 +131,11 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, ushort cylinder, byte head, byte sector, byte count, uint timeout, out double duration)
|
||||
public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, ushort cylinder,
|
||||
byte head, byte sector, byte count, uint timeout, out double duration)
|
||||
{
|
||||
if(count == 0)
|
||||
buffer = new byte[512 * 256];
|
||||
else
|
||||
buffer = new byte[512 * count];
|
||||
if(count == 0) buffer = new byte[512 * 256];
|
||||
else buffer = new byte[512 * count];
|
||||
AtaRegistersCHS registers = new AtaRegistersCHS();
|
||||
bool sense;
|
||||
|
||||
@@ -147,8 +146,9 @@ namespace DiscImageChef.Devices
|
||||
registers.deviceHead = (byte)(head & 0x0F);
|
||||
registers.sector = sector;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount,
|
||||
ref buffer, timeout, true, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "READ MULTIPLE took {0} ms.", duration);
|
||||
@@ -156,33 +156,31 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
|
||||
public bool Read(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, ushort cylinder, byte head, byte sector, byte count, uint timeout, out double duration)
|
||||
public bool Read(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, ushort cylinder, byte head,
|
||||
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)
|
||||
public bool Read(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, bool retry, ushort cylinder,
|
||||
byte head, byte sector, byte count, uint timeout, out double duration)
|
||||
{
|
||||
if(count == 0)
|
||||
buffer = new byte[512 * 256];
|
||||
else
|
||||
buffer = new byte[512 * count];
|
||||
if(count == 0) buffer = new byte[512 * 256];
|
||||
else buffer = new byte[512 * count];
|
||||
AtaRegistersCHS registers = new AtaRegistersCHS();
|
||||
bool sense;
|
||||
|
||||
if(retry)
|
||||
registers.command = (byte)AtaCommands.ReadRetry;
|
||||
else
|
||||
registers.command = (byte)AtaCommands.Read;
|
||||
if(retry) registers.command = (byte)AtaCommands.ReadRetry;
|
||||
else registers.command = (byte)AtaCommands.Read;
|
||||
registers.sectorCount = count;
|
||||
registers.cylinderHigh = (byte)((cylinder & 0xFF00) / 0x100);
|
||||
registers.cylinderLow = (byte)((cylinder & 0xFF) / 0x1);
|
||||
registers.deviceHead = (byte)(head & 0x0F);
|
||||
registers.sector = sector;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount,
|
||||
ref buffer, timeout, true, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "READ SECTORS took {0} ms.", duration);
|
||||
@@ -190,29 +188,31 @@ 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);
|
||||
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];
|
||||
AtaRegistersCHS registers = new AtaRegistersCHS();
|
||||
bool sense;
|
||||
|
||||
if(retry)
|
||||
registers.command = (byte)AtaCommands.ReadLongRetry;
|
||||
else
|
||||
registers.command = (byte)AtaCommands.ReadLong;
|
||||
if(retry) registers.command = (byte)AtaCommands.ReadLongRetry;
|
||||
else registers.command = (byte)AtaCommands.ReadLong;
|
||||
registers.sectorCount = 1;
|
||||
registers.cylinderHigh = (byte)((cylinder & 0xFF00) / 0x100);
|
||||
registers.cylinderLow = (byte)((cylinder & 0xFF) / 0x1);
|
||||
registers.deviceHead = (byte)(head & 0x0F);
|
||||
registers.sector = sector;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount,
|
||||
ref buffer, timeout, true, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "READ LONG took {0} ms.", duration);
|
||||
@@ -220,7 +220,8 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool Seek(out AtaErrorRegistersCHS statusRegisters, ushort cylinder, byte head, byte sector, uint timeout, out double duration)
|
||||
public bool Seek(out AtaErrorRegistersCHS statusRegisters, ushort cylinder, byte head, byte sector,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
byte[] buffer = new byte[0];
|
||||
AtaRegistersCHS registers = new AtaRegistersCHS();
|
||||
@@ -232,8 +233,9 @@ namespace DiscImageChef.Devices
|
||||
registers.deviceHead = (byte)(head & 0x0F);
|
||||
registers.sector = sector;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer,
|
||||
ref buffer, timeout, true, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, true, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "SEEK took {0} ms.", duration);
|
||||
@@ -241,5 +243,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -81,7 +81,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="statusRegisters">Status registers.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool AtapiIdentify(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, uint timeout, out double duration)
|
||||
public bool AtapiIdentify(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
buffer = new byte[512];
|
||||
AtaRegistersCHS registers = new AtaRegistersCHS();
|
||||
@@ -89,8 +90,9 @@ namespace DiscImageChef.Devices
|
||||
|
||||
registers.command = (byte)AtaCommands.IdentifyPacketDevice;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer,
|
||||
ref buffer, timeout, false, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "IDENTIFY PACKET DEVICE took {0} ms.", duration);
|
||||
@@ -98,5 +100,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,7 +37,8 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
public partial class Device
|
||||
{
|
||||
public bool TranslateSector(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba, uint timeout, out double duration)
|
||||
public bool TranslateSector(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[512];
|
||||
AtaRegistersLBA28 registers = new AtaRegistersLBA28();
|
||||
@@ -50,8 +51,9 @@ namespace DiscImageChef.Devices
|
||||
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
|
||||
registers.deviceHead += 0x40;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer,
|
||||
ref buffer, timeout, false, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "CFA TRANSLATE SECTOR took {0} ms.", duration);
|
||||
@@ -59,7 +61,8 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool TranslateSector(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, ushort cylinder, byte head, byte sector, uint timeout, out double duration)
|
||||
public bool TranslateSector(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, ushort cylinder,
|
||||
byte head, byte sector, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[512];
|
||||
AtaRegistersCHS registers = new AtaRegistersCHS();
|
||||
@@ -71,8 +74,9 @@ namespace DiscImageChef.Devices
|
||||
registers.sector = sector;
|
||||
registers.deviceHead = (byte)(head & 0x0F);
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer,
|
||||
ref buffer, timeout, false, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "CFA TRANSLATE SECTOR took {0} ms.", duration);
|
||||
@@ -80,7 +84,8 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool RequestExtendedErrorCode(out byte errorCode, out AtaErrorRegistersLBA28 statusRegisters, uint timeout, out double duration)
|
||||
public bool RequestExtendedErrorCode(out byte errorCode, out AtaErrorRegistersLBA28 statusRegisters,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
byte[] buffer = new byte[0];
|
||||
AtaRegistersLBA28 registers = new AtaRegistersLBA28();
|
||||
@@ -88,8 +93,9 @@ namespace DiscImageChef.Devices
|
||||
|
||||
registers.command = (byte)AtaCommands.RequestSense;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer,
|
||||
ref buffer, timeout, false, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
errorCode = statusRegisters.error;
|
||||
@@ -99,5 +105,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,17 +37,20 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
public partial class Device
|
||||
{
|
||||
public bool EnableMediaCardPassThrough(out AtaErrorRegistersCHS statusRegisters, uint timeout, out double duration)
|
||||
public bool EnableMediaCardPassThrough(out AtaErrorRegistersCHS statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return CheckMediaCardType(1, out statusRegisters, timeout, out duration);
|
||||
}
|
||||
|
||||
public bool DisableMediaCardPassThrough(out AtaErrorRegistersCHS statusRegisters, uint timeout, out double duration)
|
||||
public bool DisableMediaCardPassThrough(out AtaErrorRegistersCHS statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return CheckMediaCardType(0, out statusRegisters, timeout, out duration);
|
||||
}
|
||||
|
||||
public bool CheckMediaCardType(byte feature, out AtaErrorRegistersCHS statusRegisters, uint timeout, out double duration)
|
||||
public bool CheckMediaCardType(byte feature, out AtaErrorRegistersCHS statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
byte[] buffer = new byte[0];
|
||||
AtaRegistersCHS registers = new AtaRegistersCHS();
|
||||
@@ -56,8 +59,9 @@ namespace DiscImageChef.Devices
|
||||
registers.command = (byte)AtaCommands.CheckMediaCardType;
|
||||
registers.feature = feature;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer,
|
||||
ref buffer, timeout, false, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "CHECK MEDIA CARD TYPE took {0} ms.", duration);
|
||||
@@ -65,5 +69,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,8 +48,9 @@ namespace DiscImageChef.Devices
|
||||
registers.lbaHigh = 0xC2;
|
||||
registers.lbaMid = 0x4F;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer,
|
||||
ref buffer, timeout, false, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "SMART DISABLE OPERATIONS took {0} ms.", duration);
|
||||
@@ -57,7 +58,8 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool SmartEnableAttributeAutosave(out AtaErrorRegistersLBA28 statusRegisters, uint timeout, out double duration)
|
||||
public bool SmartEnableAttributeAutosave(out AtaErrorRegistersLBA28 statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
byte[] buffer = new byte[0];
|
||||
AtaRegistersLBA28 registers = new AtaRegistersLBA28();
|
||||
@@ -69,8 +71,9 @@ namespace DiscImageChef.Devices
|
||||
registers.lbaMid = 0x4F;
|
||||
registers.sectorCount = 0xF1;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer,
|
||||
ref buffer, timeout, false, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "SMART ENABLE ATTRIBUTE AUTOSAVE took {0} ms.", duration);
|
||||
@@ -78,7 +81,8 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool SmartDisableAttributeAutosave(out AtaErrorRegistersLBA28 statusRegisters, uint timeout, out double duration)
|
||||
public bool SmartDisableAttributeAutosave(out AtaErrorRegistersLBA28 statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
byte[] buffer = new byte[0];
|
||||
AtaRegistersLBA28 registers = new AtaRegistersLBA28();
|
||||
@@ -89,8 +93,9 @@ namespace DiscImageChef.Devices
|
||||
registers.lbaHigh = 0xC2;
|
||||
registers.lbaMid = 0x4F;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer,
|
||||
ref buffer, timeout, false, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "SMART DISABLE ATTRIBUTE AUTOSAVE took {0} ms.", duration);
|
||||
@@ -109,8 +114,9 @@ namespace DiscImageChef.Devices
|
||||
registers.lbaHigh = 0xC2;
|
||||
registers.lbaMid = 0x4F;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer,
|
||||
ref buffer, timeout, false, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "SMART ENABLE OPERATIONS took {0} ms.", duration);
|
||||
@@ -118,7 +124,8 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool SmartExecuteOffLineImmediate(out AtaErrorRegistersLBA28 statusRegisters, byte subcommand, uint timeout, out double duration)
|
||||
public bool SmartExecuteOffLineImmediate(out AtaErrorRegistersLBA28 statusRegisters, byte subcommand,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
byte[] buffer = new byte[0];
|
||||
AtaRegistersLBA28 registers = new AtaRegistersLBA28();
|
||||
@@ -130,8 +137,9 @@ namespace DiscImageChef.Devices
|
||||
registers.lbaMid = 0x4F;
|
||||
registers.lbaLow = subcommand;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer,
|
||||
ref buffer, timeout, false, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "SMART EXECUTE OFF-LINE IMMEDIATE took {0} ms.", duration);
|
||||
@@ -139,7 +147,8 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool SmartReadData(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint timeout, out double duration)
|
||||
public bool SmartReadData(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
buffer = new byte[512];
|
||||
AtaRegistersLBA28 registers = new AtaRegistersLBA28();
|
||||
@@ -150,8 +159,9 @@ namespace DiscImageChef.Devices
|
||||
registers.lbaHigh = 0xC2;
|
||||
registers.lbaMid = 0x4F;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer,
|
||||
ref buffer, timeout, false, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "SMART READ DATA took {0} ms.", duration);
|
||||
@@ -159,7 +169,8 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool SmartReadLog(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, byte logAddress, uint timeout, out double duration)
|
||||
public bool SmartReadLog(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, byte logAddress,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[512];
|
||||
AtaRegistersLBA28 registers = new AtaRegistersLBA28();
|
||||
@@ -171,8 +182,9 @@ namespace DiscImageChef.Devices
|
||||
registers.lbaMid = 0x4F;
|
||||
registers.lbaLow = logAddress;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer,
|
||||
ref buffer, timeout, false, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "SMART READ LOG took {0} ms.", duration);
|
||||
@@ -191,8 +203,9 @@ namespace DiscImageChef.Devices
|
||||
registers.lbaHigh = 0xC2;
|
||||
registers.lbaMid = 0x4F;
|
||||
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer,
|
||||
ref buffer, timeout, false, out duration, out sense);
|
||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("ATA Device", "SMART RETURN STATUS took {0} ms.", duration);
|
||||
|
||||
@@ -47,9 +47,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="direction">SCSI command transfer direction</param>
|
||||
/// <param name="duration">Time it took to execute the command in milliseconds</param>
|
||||
/// <param name="sense"><c>True</c> if SCSI command returned non-OK status and <paramref name="senseBuffer"/> contains SCSI sense</param>
|
||||
public int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, ScsiDirection direction, out double duration, out bool sense)
|
||||
public int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout,
|
||||
ScsiDirection direction, out double duration, out bool sense)
|
||||
{
|
||||
return Command.SendScsiCommand(platformID, fd, cdb, ref buffer, out senseBuffer, timeout, direction, out duration, out sense);
|
||||
return Command.SendScsiCommand(platformID, fd, cdb, ref buffer, out senseBuffer, timeout, direction,
|
||||
out duration, out sense);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -66,11 +68,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Time it took to execute the command in milliseconds</param>
|
||||
/// <param name="sense"><c>True</c> if ATA/ATAPI command returned non-OK status</param>
|
||||
public int SendAtaCommand(AtaRegistersCHS registers, out AtaErrorRegistersCHS errorRegisters,
|
||||
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout,
|
||||
bool transferBlocks, out double duration, out bool sense)
|
||||
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer,
|
||||
uint timeout, bool transferBlocks, out double duration, out bool sense)
|
||||
{
|
||||
return Command.SendAtaCommand(platformID, fd, registers, out errorRegisters, protocol, transferRegister,
|
||||
ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||
ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -87,11 +89,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Time it took to execute the command in milliseconds</param>
|
||||
/// <param name="sense"><c>True</c> if ATA/ATAPI command returned non-OK status</param>
|
||||
public int SendAtaCommand(AtaRegistersLBA28 registers, out AtaErrorRegistersLBA28 errorRegisters,
|
||||
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout,
|
||||
bool transferBlocks, out double duration, out bool sense)
|
||||
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer,
|
||||
uint timeout, bool transferBlocks, out double duration, out bool sense)
|
||||
{
|
||||
return Command.SendAtaCommand(platformID, fd, registers, out errorRegisters, protocol, transferRegister,
|
||||
ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||
ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -108,11 +110,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Time it took to execute the command in milliseconds</param>
|
||||
/// <param name="sense"><c>True</c> if ATA/ATAPI command returned non-OK status</param>
|
||||
public int SendAtaCommand(AtaRegistersLBA48 registers, out AtaErrorRegistersLBA48 errorRegisters,
|
||||
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout,
|
||||
bool transferBlocks, out double duration, out bool sense)
|
||||
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer,
|
||||
uint timeout, bool transferBlocks, out double duration, out bool sense)
|
||||
{
|
||||
return Command.SendAtaCommand(platformID, fd, registers, out errorRegisters, protocol, transferRegister,
|
||||
ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||
ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -131,8 +133,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="argument">Command argument</param>
|
||||
/// <param name="response">Response registers</param>
|
||||
/// <param name="blockSize">Size of block in bytes</param>
|
||||
public int SendMmcCommand(MmcCommands command, bool write, bool isApplication, MmcFlags flags,
|
||||
uint argument, uint blockSize, uint blocks, ref byte[] buffer, out uint[] response,
|
||||
public int SendMmcCommand(MmcCommands command, bool write, bool isApplication, MmcFlags flags, uint argument,
|
||||
uint blockSize, uint blocks, ref byte[] buffer, out uint[] response,
|
||||
out double duration, out bool sense, uint timeout = 0)
|
||||
{
|
||||
if(command == MmcCommands.SendCID && cachedCid != null)
|
||||
@@ -184,9 +186,8 @@ namespace DiscImageChef.Devices
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Command.SendMmcCommand(platformID, fd, command, write, isApplication, flags, argument, blockSize, blocks,
|
||||
ref buffer, out response, out duration, out sense, timeout);
|
||||
return Command.SendMmcCommand(platformID, fd, command, write, isApplication, flags, argument, blockSize,
|
||||
blocks, ref buffer, out response, out duration, out sense, timeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -54,33 +54,33 @@ namespace DiscImageChef.Devices
|
||||
switch(platformID)
|
||||
{
|
||||
case Interop.PlatformID.Win32NT:
|
||||
{
|
||||
fd = Windows.Extern.CreateFile(devicePath,
|
||||
Windows.FileAccess.GenericRead | Windows.FileAccess.GenericWrite,
|
||||
Windows.FileShare.Read | Windows.FileShare.Write, IntPtr.Zero,
|
||||
Windows.FileMode.OpenExisting, Windows.FileAttributes.Normal,
|
||||
IntPtr.Zero);
|
||||
|
||||
if(((SafeFileHandle)fd).IsInvalid)
|
||||
{
|
||||
fd = Windows.Extern.CreateFile(devicePath,
|
||||
Windows.FileAccess.GenericRead | Windows.FileAccess.GenericWrite,
|
||||
Windows.FileShare.Read | Windows.FileShare.Write,
|
||||
IntPtr.Zero, Windows.FileMode.OpenExisting,
|
||||
Windows.FileAttributes.Normal, IntPtr.Zero);
|
||||
|
||||
if(((SafeFileHandle)fd).IsInvalid)
|
||||
{
|
||||
error = true;
|
||||
lastError = Marshal.GetLastWin32Error();
|
||||
}
|
||||
|
||||
break;
|
||||
error = true;
|
||||
lastError = Marshal.GetLastWin32Error();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case Interop.PlatformID.Linux:
|
||||
{
|
||||
fd = Linux.Extern.open(devicePath, Linux.FileFlags.Readonly | Linux.FileFlags.NonBlocking);
|
||||
|
||||
if((int)fd < 0)
|
||||
{
|
||||
fd = Linux.Extern.open(devicePath, Linux.FileFlags.Readonly | Linux.FileFlags.NonBlocking);
|
||||
|
||||
if((int)fd < 0)
|
||||
{
|
||||
error = true;
|
||||
lastError = Marshal.GetLastWin32Error();
|
||||
}
|
||||
|
||||
break;
|
||||
error = true;
|
||||
lastError = Marshal.GetLastWin32Error();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case Interop.PlatformID.FreeBSD:
|
||||
{
|
||||
fd = FreeBSD.Extern.cam_open_device(devicePath, FreeBSD.FileFlags.ReadWrite);
|
||||
@@ -93,9 +93,10 @@ namespace DiscImageChef.Devices
|
||||
|
||||
FreeBSD.cam_device camDevice =
|
||||
(FreeBSD.cam_device)Marshal.PtrToStructure((IntPtr)fd, typeof(FreeBSD.cam_device));
|
||||
|
||||
|
||||
if(StringHandlers.CToString(camDevice.sim_name) == "ata")
|
||||
throw new InvalidOperationException("Parallel ATA devices are not supported on FreeBSD due to upstream bug #224250.");
|
||||
throw new
|
||||
InvalidOperationException("Parallel ATA devices are not supported on FreeBSD due to upstream bug #224250.");
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -103,8 +104,7 @@ namespace DiscImageChef.Devices
|
||||
throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", platformID));
|
||||
}
|
||||
|
||||
if(error)
|
||||
throw new SystemException(string.Format("Error {0} opening device.", lastError));
|
||||
if(error) throw new SystemException(string.Format("Error {0} opening device.", lastError));
|
||||
|
||||
type = DeviceType.Unknown;
|
||||
scsiType = Decoders.SCSI.PeripheralDeviceTypes.UnknownDevice;
|
||||
@@ -115,8 +115,7 @@ namespace DiscImageChef.Devices
|
||||
byte[] senseBuf;
|
||||
byte[] inqBuf = null;
|
||||
|
||||
if(error)
|
||||
throw new SystemException(string.Format("Error {0} trying device.", lastError));
|
||||
if(error) throw new SystemException(string.Format("Error {0} trying device.", lastError));
|
||||
|
||||
bool scsiSense = true;
|
||||
string ntDevicePath = null;
|
||||
@@ -135,21 +134,24 @@ namespace DiscImageChef.Devices
|
||||
uint returned = 0;
|
||||
int error = 0;
|
||||
|
||||
bool hasError = !Windows.Extern.DeviceIoControlStorageQuery((SafeFileHandle)fd, Windows.WindowsIoctl.IOCTL_STORAGE_QUERY_PROPERTY, ref query, (uint)Marshal.SizeOf(query), descriptorPtr, 1000, ref returned, IntPtr.Zero);
|
||||
bool hasError = !Windows.Extern.DeviceIoControlStorageQuery((SafeFileHandle)fd,
|
||||
Windows.WindowsIoctl
|
||||
.IOCTL_STORAGE_QUERY_PROPERTY,
|
||||
ref query, (uint)Marshal.SizeOf(query),
|
||||
descriptorPtr, 1000, ref returned,
|
||||
IntPtr.Zero);
|
||||
|
||||
if(hasError)
|
||||
error = Marshal.GetLastWin32Error();
|
||||
if(hasError) error = Marshal.GetLastWin32Error();
|
||||
|
||||
Marshal.Copy(descriptorPtr, descriptor_b, 0, 1000);
|
||||
|
||||
if(!hasError && error == 0)
|
||||
{
|
||||
|
||||
Windows.StorageDeviceDescriptor descriptor = new Windows.StorageDeviceDescriptor();
|
||||
descriptor.Version = BitConverter.ToUInt32(descriptor_b, 0);
|
||||
descriptor.Size = BitConverter.ToUInt32(descriptor_b, 4);
|
||||
descriptor.DeviceType = descriptor_b[8];
|
||||
descriptor.DeviceTypeModifier= descriptor_b[9];
|
||||
descriptor.DeviceTypeModifier = descriptor_b[9];
|
||||
descriptor.RemovableMedia = descriptor_b[10] > 0;
|
||||
descriptor.CommandQueueing = descriptor_b[11] > 0;
|
||||
descriptor.VendorIdOffset = BitConverter.ToUInt32(descriptor_b, 12);
|
||||
@@ -207,14 +209,12 @@ namespace DiscImageChef.Devices
|
||||
type = DeviceType.ATAPI;
|
||||
Identify.IdentifyDevice? ATAID = Identify.Decode(ataBuf);
|
||||
|
||||
if(ATAID.HasValue)
|
||||
scsiSense = ScsiInquiry(out inqBuf, out senseBuf);
|
||||
if(ATAID.HasValue) scsiSense = ScsiInquiry(out inqBuf, out senseBuf);
|
||||
}
|
||||
else
|
||||
manufacturer = "ATA";
|
||||
else manufacturer = "ATA";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ntDevicePath = Windows.Command.GetDevicePath((SafeFileHandle)fd);
|
||||
DicConsole.DebugWriteLine("Windows devices", "NT device path: {0}", ntDevicePath);
|
||||
Marshal.FreeHGlobal(descriptorPtr);
|
||||
@@ -224,9 +224,11 @@ namespace DiscImageChef.Devices
|
||||
byte[] sdBuffer = new byte[16];
|
||||
bool sense = false;
|
||||
|
||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendCSD, false, false, MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 | MmcFlags.CommandAC,
|
||||
0, 16, 1, ref sdBuffer, out uint[] response, out double duration, out sense, 0);
|
||||
|
||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendCSD, false, false,
|
||||
MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 |
|
||||
MmcFlags.CommandAC, 0, 16, 1, ref sdBuffer,
|
||||
out uint[] response, out double duration, out sense, 0);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
cachedCsd = new byte[16];
|
||||
@@ -236,8 +238,10 @@ namespace DiscImageChef.Devices
|
||||
sdBuffer = new byte[16];
|
||||
sense = false;
|
||||
|
||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendCID, false, false, MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 | MmcFlags.CommandAC,
|
||||
0, 16, 1, ref sdBuffer, out response, out duration, out sense, 0);
|
||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendCID, false, false,
|
||||
MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 |
|
||||
MmcFlags.CommandAC, 0, 16, 1, ref sdBuffer, out response,
|
||||
out duration, out sense, 0);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
@@ -248,8 +252,11 @@ namespace DiscImageChef.Devices
|
||||
sdBuffer = new byte[8];
|
||||
sense = false;
|
||||
|
||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, (MmcCommands)SecureDigitalCommands.SendSCR, false, true, MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC,
|
||||
0, 8, 1, ref sdBuffer, out response, out duration, out sense, 0);
|
||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd,
|
||||
(MmcCommands)SecureDigitalCommands.SendSCR, false, true,
|
||||
MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 |
|
||||
MmcFlags.CommandADTC, 0, 8, 1, ref sdBuffer,
|
||||
out response, out duration, out sense, 0);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
@@ -262,8 +269,12 @@ namespace DiscImageChef.Devices
|
||||
sdBuffer = new byte[4];
|
||||
sense = false;
|
||||
|
||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, (MmcCommands)SecureDigitalCommands.SendOperatingCondition, false, true, MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 | MmcFlags.CommandBCR,
|
||||
0, 4, 1, ref sdBuffer, out response, out duration, out sense, 0);
|
||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd,
|
||||
(MmcCommands)SecureDigitalCommands
|
||||
.SendOperatingCondition, false, true,
|
||||
MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 |
|
||||
MmcFlags.CommandBCR, 0, 4, 1, ref sdBuffer,
|
||||
out response, out duration, out sense, 0);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
@@ -276,8 +287,11 @@ namespace DiscImageChef.Devices
|
||||
sdBuffer = new byte[4];
|
||||
sense = false;
|
||||
|
||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendOpCond, false, true, MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 | MmcFlags.CommandBCR,
|
||||
0, 4, 1, ref sdBuffer, out response, out duration, out sense, 0);
|
||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendOpCond, false,
|
||||
true,
|
||||
MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 |
|
||||
MmcFlags.CommandBCR, 0, 4, 1, ref sdBuffer,
|
||||
out response, out duration, out sense, 0);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
@@ -289,7 +303,9 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
else if(platformID == Interop.PlatformID.Linux)
|
||||
{
|
||||
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) || devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) || devicePath.StartsWith("/dev/st", StringComparison.Ordinal))
|
||||
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) ||
|
||||
devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) ||
|
||||
devicePath.StartsWith("/dev/st", StringComparison.Ordinal))
|
||||
scsiSense = ScsiInquiry(out inqBuf, out senseBuf);
|
||||
// MultiMediaCard and SecureDigital go here
|
||||
else if(devicePath.StartsWith("/dev/mmcblk", StringComparison.Ordinal))
|
||||
@@ -298,31 +314,26 @@ namespace DiscImageChef.Devices
|
||||
if(System.IO.File.Exists("/sys/block/" + devPath + "/device/csd"))
|
||||
{
|
||||
int len = ConvertFromHexASCII("/sys/block/" + devPath + "/device/csd", out cachedCsd);
|
||||
if(len == 0)
|
||||
cachedCsd = null;
|
||||
if(len == 0) cachedCsd = null;
|
||||
}
|
||||
if(System.IO.File.Exists("/sys/block/" + devPath + "/device/cid"))
|
||||
{
|
||||
int len = ConvertFromHexASCII("/sys/block/" + devPath + "/device/cid", out cachedCid);
|
||||
if(len == 0)
|
||||
cachedCid = null;
|
||||
if(len == 0) cachedCid = null;
|
||||
}
|
||||
if(System.IO.File.Exists("/sys/block/" + devPath + "/device/scr"))
|
||||
{
|
||||
int len = ConvertFromHexASCII("/sys/block/" + devPath + "/device/scr", out cachedScr);
|
||||
if(len == 0)
|
||||
cachedScr = null;
|
||||
if(len == 0) cachedScr = null;
|
||||
}
|
||||
if(System.IO.File.Exists("/sys/block/" + devPath + "/device/ocr"))
|
||||
{
|
||||
int len = ConvertFromHexASCII("/sys/block/" + devPath + "/device/ocr", out cachedOcr);
|
||||
if(len == 0)
|
||||
cachedOcr = null;
|
||||
if(len == 0) cachedOcr = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
scsiSense = ScsiInquiry(out inqBuf, out senseBuf);
|
||||
else scsiSense = ScsiInquiry(out inqBuf, out senseBuf);
|
||||
|
||||
#region SecureDigital / MultiMediaCard
|
||||
if(cachedCid != null)
|
||||
@@ -336,7 +347,8 @@ namespace DiscImageChef.Devices
|
||||
Decoders.SecureDigital.CID decoded = Decoders.SecureDigital.Decoders.DecodeCID(cachedCid);
|
||||
manufacturer = Decoders.SecureDigital.VendorString.Prettify(decoded.Manufacturer);
|
||||
model = decoded.ProductName;
|
||||
revision = string.Format("{0:X2}.{1:X2}", (decoded.ProductRevision & 0xF0) >> 4, decoded.ProductRevision & 0x0F);
|
||||
revision = string.Format("{0:X2}.{1:X2}", (decoded.ProductRevision & 0xF0) >> 4,
|
||||
decoded.ProductRevision & 0x0F);
|
||||
serial = string.Format("{0}", decoded.ProductSerialNumber);
|
||||
}
|
||||
else
|
||||
@@ -345,14 +357,14 @@ namespace DiscImageChef.Devices
|
||||
Decoders.MMC.CID decoded = Decoders.MMC.Decoders.DecodeCID(cachedCid);
|
||||
manufacturer = Decoders.MMC.VendorString.Prettify(decoded.Manufacturer);
|
||||
model = decoded.ProductName;
|
||||
revision = string.Format("{0:X2}.{1:X2}", (decoded.ProductRevision & 0xF0) >> 4, decoded.ProductRevision & 0x0F);
|
||||
revision = string.Format("{0:X2}.{1:X2}", (decoded.ProductRevision & 0xF0) >> 4,
|
||||
decoded.ProductRevision & 0x0F);
|
||||
serial = string.Format("{0}", decoded.ProductSerialNumber);
|
||||
}
|
||||
}
|
||||
#endregion SecureDigital / MultiMediaCard
|
||||
|
||||
#region USB
|
||||
|
||||
#region USB
|
||||
if(platformID == Interop.PlatformID.Linux)
|
||||
{
|
||||
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) ||
|
||||
@@ -378,7 +390,8 @@ namespace DiscImageChef.Devices
|
||||
string usbTemp;
|
||||
|
||||
usbFs = new System.IO.FileStream(resolvedLink + "/descriptors",
|
||||
System.IO.FileMode.Open, System.IO.FileAccess.Read);
|
||||
System.IO.FileMode.Open,
|
||||
System.IO.FileAccess.Read);
|
||||
byte[] usbBuf = new byte[65536];
|
||||
int usbCount = usbFs.Read(usbBuf, 0, 65536);
|
||||
usbDescriptors = new byte[usbCount];
|
||||
@@ -388,13 +401,13 @@ namespace DiscImageChef.Devices
|
||||
usbSr = new System.IO.StreamReader(resolvedLink + "/idProduct");
|
||||
usbTemp = usbSr.ReadToEnd();
|
||||
ushort.TryParse(usbTemp, System.Globalization.NumberStyles.HexNumber,
|
||||
System.Globalization.CultureInfo.InvariantCulture, out usbProduct);
|
||||
System.Globalization.CultureInfo.InvariantCulture, out usbProduct);
|
||||
usbSr.Close();
|
||||
|
||||
usbSr = new System.IO.StreamReader(resolvedLink + "/idVendor");
|
||||
usbTemp = usbSr.ReadToEnd();
|
||||
ushort.TryParse(usbTemp, System.Globalization.NumberStyles.HexNumber,
|
||||
System.Globalization.CultureInfo.InvariantCulture, out usbVendor);
|
||||
System.Globalization.CultureInfo.InvariantCulture, out usbVendor);
|
||||
usbSr.Close();
|
||||
|
||||
if(System.IO.File.Exists(resolvedLink + "/manufacturer"))
|
||||
@@ -429,13 +442,16 @@ namespace DiscImageChef.Devices
|
||||
else if(platformID == Interop.PlatformID.Win32NT)
|
||||
{
|
||||
Windows.Usb.USBDevice usbDevice = null;
|
||||
|
||||
|
||||
// I have to search for USB disks, floppies and CD-ROMs as separate device types
|
||||
foreach(string devGuid in new [] { Windows.Usb.GUID_DEVINTERFACE_FLOPPY, Windows.Usb.GUID_DEVINTERFACE_CDROM , Windows.Usb.GUID_DEVINTERFACE_DISK })
|
||||
foreach(string devGuid in new[]
|
||||
{
|
||||
Windows.Usb.GUID_DEVINTERFACE_FLOPPY, Windows.Usb.GUID_DEVINTERFACE_CDROM,
|
||||
Windows.Usb.GUID_DEVINTERFACE_DISK
|
||||
})
|
||||
{
|
||||
usbDevice = Windows.Usb.FindDrivePath(devicePath, devGuid);
|
||||
if (usbDevice != null)
|
||||
break;
|
||||
if(usbDevice != null) break;
|
||||
}
|
||||
|
||||
if(usbDevice != null)
|
||||
@@ -445,19 +461,20 @@ namespace DiscImageChef.Devices
|
||||
usbProduct = (ushort)usbDevice.DeviceDescriptor.idProduct;
|
||||
usbManufacturerString = usbDevice.Manufacturer;
|
||||
usbProductString = usbDevice.Product;
|
||||
usbSerialString = usbDevice.SerialNumber; // This is incorrect filled by Windows with SCSI/ATA serial number
|
||||
usbSerialString =
|
||||
usbDevice.SerialNumber; // This is incorrect filled by Windows with SCSI/ATA serial number
|
||||
}
|
||||
|
||||
}
|
||||
// TODO: Implement for other operating systems
|
||||
else
|
||||
usb = false;
|
||||
else usb = false;
|
||||
#endregion USB
|
||||
|
||||
#region FireWire
|
||||
if(platformID == Interop.PlatformID.Linux)
|
||||
{
|
||||
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) || devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) || devicePath.StartsWith("/dev/st", StringComparison.Ordinal))
|
||||
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) ||
|
||||
devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) ||
|
||||
devicePath.StartsWith("/dev/st", StringComparison.Ordinal))
|
||||
{
|
||||
string devPath = devicePath.Substring(5);
|
||||
if(System.IO.Directory.Exists("/sys/block/" + devPath))
|
||||
@@ -470,25 +487,29 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
resolvedLink = System.IO.Path.GetDirectoryName(resolvedLink);
|
||||
if(System.IO.File.Exists(resolvedLink + "/model") &&
|
||||
System.IO.File.Exists(resolvedLink + "/vendor") &&
|
||||
System.IO.File.Exists(resolvedLink + "/guid"))
|
||||
System.IO.File.Exists(resolvedLink + "/vendor") &&
|
||||
System.IO.File.Exists(resolvedLink + "/guid"))
|
||||
{
|
||||
System.IO.StreamReader fwSr;
|
||||
string fwTemp;
|
||||
|
||||
fwSr = new System.IO.StreamReader(resolvedLink + "/model");
|
||||
fwTemp = fwSr.ReadToEnd();
|
||||
uint.TryParse(fwTemp, System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out firewireModel);
|
||||
uint.TryParse(fwTemp, System.Globalization.NumberStyles.HexNumber,
|
||||
System.Globalization.CultureInfo.InvariantCulture, out firewireModel);
|
||||
fwSr.Close();
|
||||
|
||||
fwSr = new System.IO.StreamReader(resolvedLink + "/vendor");
|
||||
fwTemp = fwSr.ReadToEnd();
|
||||
uint.TryParse(fwTemp, System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out firewireVendor);
|
||||
uint.TryParse(fwTemp, System.Globalization.NumberStyles.HexNumber,
|
||||
System.Globalization.CultureInfo.InvariantCulture,
|
||||
out firewireVendor);
|
||||
fwSr.Close();
|
||||
|
||||
fwSr = new System.IO.StreamReader(resolvedLink + "/guid");
|
||||
fwTemp = fwSr.ReadToEnd();
|
||||
ulong.TryParse(fwTemp, System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out firewireGuid);
|
||||
ulong.TryParse(fwTemp, System.Globalization.NumberStyles.HexNumber,
|
||||
System.Globalization.CultureInfo.InvariantCulture, out firewireGuid);
|
||||
fwSr.Close();
|
||||
|
||||
if(System.IO.File.Exists(resolvedLink + "/model_name"))
|
||||
@@ -514,14 +535,15 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
}
|
||||
// TODO: Implement for other operating systems
|
||||
else
|
||||
firewire = false;
|
||||
else firewire = false;
|
||||
#endregion FireWire
|
||||
|
||||
#region PCMCIA
|
||||
if(platformID == Interop.PlatformID.Linux)
|
||||
{
|
||||
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) || devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) || devicePath.StartsWith("/dev/st", StringComparison.Ordinal))
|
||||
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) ||
|
||||
devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) ||
|
||||
devicePath.StartsWith("/dev/st", StringComparison.Ordinal))
|
||||
{
|
||||
string devPath = devicePath.Substring(5);
|
||||
if(System.IO.Directory.Exists("/sys/block/" + devPath))
|
||||
@@ -535,17 +557,23 @@ namespace DiscImageChef.Devices
|
||||
resolvedLink = System.IO.Path.GetDirectoryName(resolvedLink);
|
||||
if(System.IO.Directory.Exists(resolvedLink + "/pcmcia_socket"))
|
||||
{
|
||||
string[] subdirs = System.IO.Directory.GetDirectories(resolvedLink + "/pcmcia_socket", "pcmcia_socket*", System.IO.SearchOption.TopDirectoryOnly);
|
||||
string[] subdirs =
|
||||
System.IO.Directory.GetDirectories(resolvedLink + "/pcmcia_socket",
|
||||
"pcmcia_socket*",
|
||||
System.IO.SearchOption.TopDirectoryOnly);
|
||||
|
||||
if(subdirs.Length > 0)
|
||||
{
|
||||
string possibleDir = System.IO.Path.Combine(resolvedLink, "pcmcia_socket", subdirs[0]);
|
||||
string possibleDir =
|
||||
System.IO.Path.Combine(resolvedLink, "pcmcia_socket", subdirs[0]);
|
||||
if(System.IO.File.Exists(possibleDir + "/card_type") &&
|
||||
System.IO.File.Exists(possibleDir + "/cis"))
|
||||
{
|
||||
System.IO.FileStream cisFs;
|
||||
|
||||
cisFs = new System.IO.FileStream(possibleDir + "/cis", System.IO.FileMode.Open, System.IO.FileAccess.Read);
|
||||
cisFs = new System.IO.FileStream(possibleDir + "/cis",
|
||||
System.IO.FileMode.Open,
|
||||
System.IO.FileAccess.Read);
|
||||
byte[] cisBuf = new byte[65536];
|
||||
int cisCount = cisFs.Read(cisBuf, 0, 65536);
|
||||
cis = new byte[cisCount];
|
||||
@@ -563,8 +591,7 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
}
|
||||
// TODO: Implement for other operating systems
|
||||
else
|
||||
pcmcia = false;
|
||||
else pcmcia = false;
|
||||
#endregion PCMCIA
|
||||
|
||||
if(!scsiSense)
|
||||
@@ -573,20 +600,16 @@ namespace DiscImageChef.Devices
|
||||
|
||||
type = DeviceType.SCSI;
|
||||
bool serialSense = ScsiInquiry(out inqBuf, out senseBuf, 0x80);
|
||||
if(!serialSense)
|
||||
serial = Decoders.SCSI.EVPD.DecodePage80(inqBuf);
|
||||
if(!serialSense) serial = Decoders.SCSI.EVPD.DecodePage80(inqBuf);
|
||||
|
||||
if(Inquiry.HasValue)
|
||||
{
|
||||
string tmp = StringHandlers.CToString(Inquiry.Value.ProductRevisionLevel);
|
||||
if(tmp != null)
|
||||
revision = tmp.Trim();
|
||||
if(tmp != null) revision = tmp.Trim();
|
||||
tmp = StringHandlers.CToString(Inquiry.Value.ProductIdentification);
|
||||
if(tmp != null)
|
||||
model = tmp.Trim();
|
||||
if(tmp != null) model = tmp.Trim();
|
||||
tmp = StringHandlers.CToString(Inquiry.Value.VendorIdentification);
|
||||
if(tmp != null)
|
||||
manufacturer = tmp.Trim();
|
||||
if(tmp != null) manufacturer = tmp.Trim();
|
||||
removable = Inquiry.Value.RMB;
|
||||
|
||||
scsiType = (Decoders.SCSI.PeripheralDeviceTypes)Inquiry.Value.PeripheralDeviceType;
|
||||
@@ -599,8 +622,7 @@ namespace DiscImageChef.Devices
|
||||
type = DeviceType.ATAPI;
|
||||
Identify.IdentifyDevice? ATAID = Identify.Decode(ataBuf);
|
||||
|
||||
if(ATAID.HasValue)
|
||||
serial = ATAID.Value.SerialNumber;
|
||||
if(ATAID.HasValue) serial = ATAID.Value.SerialNumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -609,7 +631,7 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
}
|
||||
|
||||
if ((scsiSense && (usb || firewire)) || manufacturer == "ATA")
|
||||
if((scsiSense && (usb || firewire)) || manufacturer == "ATA")
|
||||
{
|
||||
bool ataSense = AtaIdentify(out ataBuf, out errorRegisters);
|
||||
if(!ataSense)
|
||||
@@ -621,8 +643,7 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
string[] separated = ATAID.Value.Model.Split(' ');
|
||||
|
||||
if(separated.Length == 1)
|
||||
model = separated[0];
|
||||
if(separated.Length == 1) model = separated[0];
|
||||
else
|
||||
{
|
||||
manufacturer = separated[0];
|
||||
@@ -636,10 +657,11 @@ namespace DiscImageChef.Devices
|
||||
|
||||
if((ushort)ATAID.Value.GeneralConfiguration != 0x848A)
|
||||
{
|
||||
removable |= (ATAID.Value.GeneralConfiguration & Identify.GeneralConfigurationBit.Removable) == Identify.GeneralConfigurationBit.Removable;
|
||||
removable |=
|
||||
(ATAID.Value.GeneralConfiguration & Identify.GeneralConfigurationBit.Removable) ==
|
||||
Identify.GeneralConfigurationBit.Removable;
|
||||
}
|
||||
else
|
||||
compactFlash = true;
|
||||
else compactFlash = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -654,37 +676,20 @@ namespace DiscImageChef.Devices
|
||||
|
||||
if(usb)
|
||||
{
|
||||
if(string.IsNullOrEmpty(manufacturer))
|
||||
manufacturer = usbManufacturerString;
|
||||
if(string.IsNullOrEmpty(model))
|
||||
model = usbProductString;
|
||||
if(string.IsNullOrEmpty(serial))
|
||||
serial = usbSerialString;
|
||||
else
|
||||
{
|
||||
foreach(char c in serial)
|
||||
{
|
||||
if(char.IsControl(c))
|
||||
serial = usbSerialString;
|
||||
}
|
||||
}
|
||||
if(string.IsNullOrEmpty(manufacturer)) manufacturer = usbManufacturerString;
|
||||
if(string.IsNullOrEmpty(model)) model = usbProductString;
|
||||
if(string.IsNullOrEmpty(serial)) serial = usbSerialString;
|
||||
else { foreach(char c in serial) { if(char.IsControl(c)) serial = usbSerialString; } }
|
||||
}
|
||||
|
||||
if(firewire)
|
||||
{
|
||||
if(string.IsNullOrEmpty(manufacturer))
|
||||
manufacturer = firewireVendorName;
|
||||
if(string.IsNullOrEmpty(model))
|
||||
model = firewireModelName;
|
||||
if(string.IsNullOrEmpty(serial))
|
||||
serial = string.Format("{0:X16}", firewireGuid);
|
||||
if(string.IsNullOrEmpty(manufacturer)) manufacturer = firewireVendorName;
|
||||
if(string.IsNullOrEmpty(model)) model = firewireModelName;
|
||||
if(string.IsNullOrEmpty(serial)) serial = string.Format("{0:X16}", firewireGuid);
|
||||
else
|
||||
{
|
||||
foreach(char c in serial)
|
||||
{
|
||||
if(char.IsControl(c))
|
||||
serial = string.Format("{0:X16}", firewireGuid);
|
||||
}
|
||||
foreach(char c in serial) { if(char.IsControl(c)) serial = string.Format("{0:X16}", firewireGuid); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -698,20 +703,16 @@ namespace DiscImageChef.Devices
|
||||
|
||||
try
|
||||
{
|
||||
for(int i = 0; i < ins.Length; i+=2)
|
||||
for(int i = 0; i < ins.Length; i += 2)
|
||||
{
|
||||
outBuf[i/2] = Convert.ToByte(ins.Substring(i, 2), 16);
|
||||
outBuf[i / 2] = Convert.ToByte(ins.Substring(i, 2), 16);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
count = 0;
|
||||
}
|
||||
catch { count = 0; }
|
||||
|
||||
sr.Close();
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -60,5 +60,4 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,16 +50,13 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
switch(Interop.DetectOS.GetRealPlatformID())
|
||||
{
|
||||
case Interop.PlatformID.Win32NT:
|
||||
return Windows.ListDevices.GetList();
|
||||
case Interop.PlatformID.Linux:
|
||||
return Linux.ListDevices.GetList();
|
||||
case Interop.PlatformID.FreeBSD:
|
||||
return FreeBSD.ListDevices.GetList();
|
||||
case Interop.PlatformID.Win32NT: return Windows.ListDevices.GetList();
|
||||
case Interop.PlatformID.Linux: return Linux.ListDevices.GetList();
|
||||
case Interop.PlatformID.FreeBSD: return FreeBSD.ListDevices.GetList();
|
||||
default:
|
||||
throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", Interop.DetectOS.GetRealPlatformID()));
|
||||
throw new InvalidOperationException(string.Format("Platform {0} not yet supported.",
|
||||
Interop.DetectOS.GetRealPlatformID()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,8 +41,9 @@ namespace DiscImageChef.Devices
|
||||
buffer = new byte[16];
|
||||
bool sense = false;
|
||||
|
||||
lastError = SendMmcCommand(MmcCommands.SendCSD, false, false, MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 | MmcFlags.CommandAC,
|
||||
0, 16, 1, ref buffer, out response, out duration, out sense, timeout);
|
||||
lastError = SendMmcCommand(MmcCommands.SendCSD, false, false,
|
||||
MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 | MmcFlags.CommandAC, 0, 16, 1,
|
||||
ref buffer, out response, out duration, out sense, timeout);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("MMC Device", "SEND_CSD took {0} ms.", duration);
|
||||
@@ -55,8 +56,9 @@ namespace DiscImageChef.Devices
|
||||
buffer = new byte[16];
|
||||
bool sense = false;
|
||||
|
||||
lastError = SendMmcCommand(MmcCommands.SendCID, false, false, MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 | MmcFlags.CommandAC,
|
||||
0, 16, 1, ref buffer, out response, out duration, out sense, timeout);
|
||||
lastError = SendMmcCommand(MmcCommands.SendCID, false, false,
|
||||
MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 | MmcFlags.CommandAC, 0, 16, 1,
|
||||
ref buffer, out response, out duration, out sense, timeout);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("MMC Device", "SEND_CID took {0} ms.", duration);
|
||||
@@ -69,8 +71,9 @@ namespace DiscImageChef.Devices
|
||||
buffer = new byte[4];
|
||||
bool sense = false;
|
||||
|
||||
lastError = SendMmcCommand(MmcCommands.SendOpCond, false, true, MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 | MmcFlags.CommandBCR,
|
||||
0, 4, 1, ref buffer, out response, out duration, out sense, timeout);
|
||||
lastError = SendMmcCommand(MmcCommands.SendOpCond, false, true,
|
||||
MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 | MmcFlags.CommandBCR, 0, 4, 1,
|
||||
ref buffer, out response, out duration, out sense, timeout);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SecureDigital Device", "SEND_OP_COND took {0} ms.", duration);
|
||||
@@ -83,8 +86,9 @@ namespace DiscImageChef.Devices
|
||||
buffer = new byte[512];
|
||||
bool sense = false;
|
||||
|
||||
lastError = SendMmcCommand(MmcCommands.SendExtCSD, false, false, MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC,
|
||||
0, 512, 1, ref buffer, out response, out duration, out sense, timeout);
|
||||
lastError = SendMmcCommand(MmcCommands.SendExtCSD, false, false,
|
||||
MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, 0, 512, 1,
|
||||
ref buffer, out response, out duration, out sense, timeout);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("MMC Device", "SEND_EXT_CSD took {0} ms.", duration);
|
||||
@@ -97,8 +101,9 @@ namespace DiscImageChef.Devices
|
||||
byte[] buffer = new byte[0];
|
||||
bool sense = false;
|
||||
|
||||
lastError = SendMmcCommand(MmcCommands.SetBlocklen, false, false, MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandAC,
|
||||
length, 0, 0, ref buffer, out response, out duration, out sense, timeout);
|
||||
lastError = SendMmcCommand(MmcCommands.SetBlocklen, false, false,
|
||||
MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandAC, length, 0,
|
||||
0, ref buffer, out response, out duration, out sense, timeout);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("MMC Device", "SET_BLOCKLEN took {0} ms.", duration);
|
||||
@@ -106,36 +111,35 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool Read(out byte[] buffer, out uint[] response, uint lba, uint blockSize, uint transferLength, bool byteAddressed, uint timeout, out double duration)
|
||||
public bool Read(out byte[] buffer, out uint[] response, uint lba, uint blockSize, uint transferLength,
|
||||
bool byteAddressed, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[transferLength * blockSize];
|
||||
bool sense = false;
|
||||
uint address;
|
||||
if(byteAddressed)
|
||||
address = lba * blockSize;
|
||||
else
|
||||
address = lba;
|
||||
if(byteAddressed) address = lba * blockSize;
|
||||
else address = lba;
|
||||
|
||||
MmcCommands command;
|
||||
if(transferLength > 1)
|
||||
command = MmcCommands.ReadMultipleBlock;
|
||||
else
|
||||
command = MmcCommands.ReadSingleBlock;
|
||||
if(transferLength > 1) command = MmcCommands.ReadMultipleBlock;
|
||||
else command = MmcCommands.ReadSingleBlock;
|
||||
|
||||
lastError = SendMmcCommand(command, false, false, MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC,
|
||||
address, blockSize, transferLength, ref buffer, out response, out duration, out sense, timeout);
|
||||
lastError = SendMmcCommand(command, false, false,
|
||||
MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, address,
|
||||
blockSize, transferLength, ref buffer, out response, out duration, out sense,
|
||||
timeout);
|
||||
error = lastError != 0;
|
||||
|
||||
if(transferLength > 1)
|
||||
{
|
||||
byte[] foo = new byte[0];
|
||||
SendMmcCommand(MmcCommands.StopTransmission, false, false, MmcFlags.Response_R1b | MmcFlags.ResponseSPI_R1b | MmcFlags.CommandAC,
|
||||
0, 0, 0, ref foo, out uint[] responseStop, out double stopDuration, out bool stopSense, timeout);
|
||||
SendMmcCommand(MmcCommands.StopTransmission, false, false,
|
||||
MmcFlags.Response_R1b | MmcFlags.ResponseSPI_R1b | MmcFlags.CommandAC, 0, 0, 0, ref foo,
|
||||
out uint[] responseStop, out double stopDuration, out bool stopSense, timeout);
|
||||
duration += stopDuration;
|
||||
DicConsole.DebugWriteLine("MMC Device", "READ_MULTIPLE_BLOCK took {0} ms.", duration);
|
||||
}
|
||||
else
|
||||
DicConsole.DebugWriteLine("MMC Device", "READ_SINGLE_BLOCK took {0} ms.", duration);
|
||||
else DicConsole.DebugWriteLine("MMC Device", "READ_SINGLE_BLOCK took {0} ms.", duration);
|
||||
|
||||
return sense;
|
||||
}
|
||||
@@ -145,8 +149,9 @@ namespace DiscImageChef.Devices
|
||||
buffer = new byte[4];
|
||||
bool sense = false;
|
||||
|
||||
lastError = SendMmcCommand(MmcCommands.SendStatus, false, true, MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandAC,
|
||||
0, 4, 1, ref buffer, out response, out duration, out sense, timeout);
|
||||
lastError = SendMmcCommand(MmcCommands.SendStatus, false, true,
|
||||
MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandAC, 0, 4, 1,
|
||||
ref buffer, out response, out duration, out sense, timeout);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SecureDigital Device", "SEND_STATUS took {0} ms.", duration);
|
||||
@@ -154,4 +159,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,8 +41,9 @@ namespace DiscImageChef.Devices
|
||||
buffer = new byte[64];
|
||||
bool sense = false;
|
||||
|
||||
lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendStatus, false, true, MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC,
|
||||
0, 64, 1, ref buffer, out response, out duration, out sense, timeout);
|
||||
lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendStatus, false, true,
|
||||
MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, 0, 64, 1,
|
||||
ref buffer, out response, out duration, out sense, timeout);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SecureDigital Device", "SD_STATUS took {0} ms.", duration);
|
||||
@@ -55,22 +56,24 @@ namespace DiscImageChef.Devices
|
||||
buffer = new byte[4];
|
||||
bool sense = false;
|
||||
|
||||
lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendOperatingCondition, false, true, MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 | MmcFlags.CommandBCR,
|
||||
0, 4, 1, ref buffer, out response, out duration, out sense, timeout);
|
||||
lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendOperatingCondition, false, true,
|
||||
MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 | MmcFlags.CommandBCR, 0, 4, 1,
|
||||
ref buffer, out response, out duration, out sense, timeout);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SecureDigital Device", "SD_SEND_OP_COND took {0} ms.", duration);
|
||||
|
||||
return sense;
|
||||
}
|
||||
|
||||
|
||||
public bool ReadSCR(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[8];
|
||||
bool sense = false;
|
||||
|
||||
lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendSCR, false, true, MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC,
|
||||
0, 8, 1, ref buffer, out response, out duration, out sense, timeout);
|
||||
lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendSCR, false, true,
|
||||
MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, 0, 8, 1,
|
||||
ref buffer, out response, out duration, out sense, timeout);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SecureDigital Device", "SEND_SCR took {0} ms.", duration);
|
||||
@@ -78,4 +81,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="lba">SCSI Logical Block Address.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool AdaptecTranslate(out byte[] buffer, out byte[] senseBuffer, uint lba, uint timeout, out double duration)
|
||||
public bool AdaptecTranslate(out byte[] buffer, out byte[] senseBuffer, uint lba, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return AdaptecTranslate(out buffer, out senseBuffer, false, lba, timeout, out duration);
|
||||
}
|
||||
@@ -60,7 +61,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="lba">SCSI Logical Block Address.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool AdaptecTranslate(out byte[] buffer, out byte[] senseBuffer, bool drive1, uint lba, uint timeout, out double duration)
|
||||
public bool AdaptecTranslate(out byte[] buffer, out byte[] senseBuffer, bool drive1, uint lba, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
buffer = new byte[8];
|
||||
byte[] cdb = new byte[6];
|
||||
@@ -71,10 +73,10 @@ namespace DiscImageChef.Devices
|
||||
cdb[1] = (byte)((lba & 0x1F0000) >> 16);
|
||||
cdb[2] = (byte)((lba & 0xFF00) >> 8);
|
||||
cdb[3] = (byte)(lba & 0xFF);
|
||||
if(drive1)
|
||||
cdb[1] += 0x20;
|
||||
if(drive1) cdb[1] += 0x20;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "ADAPTEC TRANSLATE took {0} ms.", duration);
|
||||
@@ -104,7 +106,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="drive1">If set to <c>true</c> set the threshold from drive 1.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool AdaptecSetErrorThreshold(byte threshold, out byte[] senseBuffer, bool drive1, uint timeout, out double duration)
|
||||
public bool AdaptecSetErrorThreshold(byte threshold, out byte[] senseBuffer, bool drive1, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
byte[] buffer = new byte[1];
|
||||
buffer[0] = threshold;
|
||||
@@ -113,11 +116,11 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Adaptec_SetErrorThreshold;
|
||||
if(drive1)
|
||||
cdb[1] += 0x20;
|
||||
if(drive1) cdb[1] += 0x20;
|
||||
cdb[4] = 1;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "ADAPTEC SET ERROR THRESHOLD took {0} ms.", duration);
|
||||
@@ -132,7 +135,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool AdaptecReadUsageCounter(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
|
||||
public bool AdaptecReadUsageCounter(out byte[] buffer, out byte[] senseBuffer, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return AdaptecReadUsageCounter(out buffer, out senseBuffer, false, timeout, out duration);
|
||||
}
|
||||
@@ -145,7 +149,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="drive1">If set to <c>true</c> get the counters from drive 1.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool AdaptecReadUsageCounter(out byte[] buffer, out byte[] senseBuffer, bool drive1, uint timeout, out double duration)
|
||||
public bool AdaptecReadUsageCounter(out byte[] buffer, out byte[] senseBuffer, bool drive1, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
buffer = new byte[9];
|
||||
byte[] cdb = new byte[6];
|
||||
@@ -153,11 +158,11 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Adaptec_Translate;
|
||||
if(drive1)
|
||||
cdb[1] += 0x20;
|
||||
if(drive1) cdb[1] += 0x20;
|
||||
cdb[4] = (byte)buffer.Length;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "ADAPTEC READ/RESET USAGE COUNTER took {0} ms.", duration);
|
||||
@@ -175,10 +180,8 @@ namespace DiscImageChef.Devices
|
||||
public bool AdaptecWriteBuffer(byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
|
||||
{
|
||||
byte[] oneKBuffer = new byte[1024];
|
||||
if(buffer.Length < 1024)
|
||||
Array.Copy(buffer, 0, oneKBuffer, 0, buffer.Length);
|
||||
else
|
||||
Array.Copy(buffer, 0, oneKBuffer, 0, 1024);
|
||||
if(buffer.Length < 1024) Array.Copy(buffer, 0, oneKBuffer, 0, buffer.Length);
|
||||
else Array.Copy(buffer, 0, oneKBuffer, 0, 1024);
|
||||
|
||||
byte[] cdb = new byte[6];
|
||||
senseBuffer = new byte[32];
|
||||
@@ -186,7 +189,8 @@ namespace DiscImageChef.Devices
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Adaptec_WriteBuffer;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref oneKBuffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref oneKBuffer, out senseBuffer, timeout, ScsiDirection.Out, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "ADAPTEC WRITE DATA BUFFER took {0} ms.", duration);
|
||||
@@ -210,7 +214,8 @@ namespace DiscImageChef.Devices
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Adaptec_ReadBuffer;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "ADAPTEC READ DATA BUFFER took {0} ms.", duration);
|
||||
@@ -218,5 +223,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -43,7 +43,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ArchiveCorpRequestBlockAddress(out byte[] buffer, out byte[] senseBuffer, uint lba, uint timeout, out double duration)
|
||||
public bool ArchiveCorpRequestBlockAddress(out byte[] buffer, out byte[] senseBuffer, uint lba, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
buffer = new byte[3];
|
||||
byte[] cdb = new byte[6];
|
||||
@@ -56,7 +57,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[3] = (byte)(lba & 0xFF);
|
||||
cdb[4] = 3;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "ARCHIVE CORP. REQUEST BLOCK ADDRESS took {0} ms.", duration);
|
||||
@@ -84,7 +86,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="lba">Logical Block Address, starting from 1.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ArchiveCorpSeekBlock(out byte[] senseBuffer, bool immediate, uint lba, uint timeout, out double duration)
|
||||
public bool ArchiveCorpSeekBlock(out byte[] senseBuffer, bool immediate, uint lba, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
byte[] buffer = new byte[0];
|
||||
byte[] cdb = new byte[6];
|
||||
@@ -95,10 +98,10 @@ namespace DiscImageChef.Devices
|
||||
cdb[1] = (byte)((lba & 0x1F0000) >> 16);
|
||||
cdb[2] = (byte)((lba & 0xFF00) >> 8);
|
||||
cdb[3] = (byte)(lba & 0xFF);
|
||||
if(immediate)
|
||||
cdb[1] += 0x01;
|
||||
if(immediate) cdb[1] += 0x01;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "ARCHIVE CORP. SEEK BLOCK took {0} ms.", duration);
|
||||
@@ -106,5 +109,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -73,10 +73,10 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Certance_ParkUnpark;
|
||||
if(park)
|
||||
cdb[4] = 1;
|
||||
if(park) cdb[4] = 1;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "CERTANCE PARK UNPARK took {0} ms.", duration);
|
||||
@@ -84,5 +84,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,7 +37,8 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
public partial class Device
|
||||
{
|
||||
public bool FujitsuDisplay(out byte[] senseBuffer, bool flash, FujitsuDisplayModes mode, string firstHalf, string secondHalf, uint timeout, out double duration)
|
||||
public bool FujitsuDisplay(out byte[] senseBuffer, bool flash, FujitsuDisplayModes mode, string firstHalf,
|
||||
string secondHalf, uint timeout, out double duration)
|
||||
{
|
||||
byte[] tmp;
|
||||
byte[] firstHalfBytes = new byte[8];
|
||||
@@ -62,19 +63,19 @@ namespace DiscImageChef.Devices
|
||||
if(mode != FujitsuDisplayModes.Half)
|
||||
{
|
||||
if(!ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) &&
|
||||
!ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes))
|
||||
!ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes))
|
||||
{
|
||||
displayLen = true;
|
||||
halfMsg = false;
|
||||
}
|
||||
else if(ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) &&
|
||||
!ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes))
|
||||
!ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes))
|
||||
{
|
||||
displayLen = false;
|
||||
halfMsg = false;
|
||||
}
|
||||
else if(!ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) &&
|
||||
ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes))
|
||||
ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes))
|
||||
{
|
||||
displayLen = false;
|
||||
halfMsg = true;
|
||||
@@ -87,12 +88,9 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
|
||||
buffer[0] = (byte)((byte)mode << 5);
|
||||
if(displayLen)
|
||||
buffer[0] += 0x10;
|
||||
if(flash)
|
||||
buffer[0] += 0x08;
|
||||
if(halfMsg)
|
||||
buffer[0] += 0x04;
|
||||
if(displayLen) buffer[0] += 0x10;
|
||||
if(flash) buffer[0] += 0x08;
|
||||
if(halfMsg) buffer[0] += 0x04;
|
||||
buffer[0] += 0x01; // Always ASCII
|
||||
|
||||
Array.Copy(firstHalfBytes, 0, buffer, 1, 8);
|
||||
@@ -101,7 +99,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[0] = (byte)ScsiCommands.Fujitsu_Display;
|
||||
cdb[6] = (byte)buffer.Length;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "FUJITSU DISPLAY took {0} ms.", duration);
|
||||
@@ -109,5 +108,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -46,7 +46,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <param name="lba">Start block address.</param>
|
||||
/// <param name="transferLength">How many blocks to read.</param>
|
||||
public bool HlDtStReadRawDvd(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, uint timeout, out double duration)
|
||||
public bool HlDtStReadRawDvd(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[12];
|
||||
@@ -65,7 +66,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[10] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
cdb[11] = (byte)(buffer.Length & 0xFF);
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "HL-DT-ST READ DVD (RAW) took {0} ms.", duration);
|
||||
@@ -73,5 +75,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,9 +48,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="pba">If set to <c>true</c> address contain physical block address.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool HPReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, ushort blockBytes, bool pba, uint timeout, out double duration)
|
||||
public bool HPReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, ushort blockBytes,
|
||||
bool pba, uint timeout, out double duration)
|
||||
{
|
||||
return HPReadLong(out buffer, out senseBuffer, relAddr, address, 0, blockBytes, pba, false, timeout, out duration);
|
||||
return HPReadLong(out buffer, out senseBuffer, relAddr, address, 0, blockBytes, pba, false, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -67,32 +69,30 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="sectorCount">If set to <c>true</c> <paramref name="transferLen"/> is a count of secors to read. Otherwise it will be ignored</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool HPReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, ushort transferLen, ushort blockBytes, bool pba, bool sectorCount, uint timeout, out double duration)
|
||||
public bool HPReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address,
|
||||
ushort transferLen, ushort blockBytes, bool pba, bool sectorCount, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[10];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ReadLong;
|
||||
if(relAddr)
|
||||
cdb[1] += 0x01;
|
||||
if(relAddr) cdb[1] += 0x01;
|
||||
cdb[2] = (byte)((address & 0xFF000000) >> 24);
|
||||
cdb[3] = (byte)((address & 0xFF0000) >> 16);
|
||||
cdb[4] = (byte)((address & 0xFF00) >> 8);
|
||||
cdb[5] = (byte)(address & 0xFF);
|
||||
cdb[7] = (byte)((transferLen & 0xFF00) >> 8);
|
||||
cdb[8] = (byte)(transferLen & 0xFF);
|
||||
if(pba)
|
||||
cdb[9] += 0x80;
|
||||
if(sectorCount)
|
||||
cdb[9] += 0x40;
|
||||
if(pba) cdb[9] += 0x80;
|
||||
if(sectorCount) cdb[9] += 0x40;
|
||||
|
||||
if(sectorCount)
|
||||
buffer = new byte[blockBytes * transferLen];
|
||||
else
|
||||
buffer = new byte[transferLen];
|
||||
if(sectorCount) buffer = new byte[blockBytes * transferLen];
|
||||
else buffer = new byte[transferLen];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "HP READ LONG took {0} ms.", duration);
|
||||
@@ -100,5 +100,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -56,7 +56,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[2] = 0x01;
|
||||
cdb[3] = 0x01;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "KREON DEPRECATED UNLOCK took {0} ms.", duration);
|
||||
@@ -121,7 +122,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[3] = 0x11;
|
||||
cdb[4] = (byte)state;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "KREON SET LOCK STATE took {0} ms.", duration);
|
||||
@@ -137,7 +139,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
/// <param name="features">Features supported by drive.</param>
|
||||
public bool KreonGetFeatureList(out byte[] senseBuffer, out KreonFeatures features, uint timeout, out double duration)
|
||||
public bool KreonGetFeatureList(out byte[] senseBuffer, out KreonFeatures features, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[6];
|
||||
@@ -150,23 +153,21 @@ namespace DiscImageChef.Devices
|
||||
cdb[2] = 0x01;
|
||||
cdb[3] = 0x10;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "KREON GET FEATURE LIST took {0} ms.", duration);
|
||||
|
||||
if(sense)
|
||||
return sense;
|
||||
if(sense) return sense;
|
||||
|
||||
if(buffer[0] != 0xA5 || buffer[1] != 0x5A || buffer[2] != 0x5A || buffer[3] != 0xA5)
|
||||
return true;
|
||||
if(buffer[0] != 0xA5 || buffer[1] != 0x5A || buffer[2] != 0x5A || buffer[3] != 0xA5) return true;
|
||||
|
||||
for(int i = 4; i < 26; i += 2)
|
||||
{
|
||||
ushort feature = BitConverter.ToUInt16(buffer, i);
|
||||
|
||||
if(feature == 0x0000)
|
||||
break;
|
||||
if(feature == 0x0000) break;
|
||||
|
||||
switch(feature)
|
||||
{
|
||||
@@ -214,7 +215,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
/// <param name="buffer">The SS sector.</param>
|
||||
public bool KreonExtractSS(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration, byte requestNumber = 0x00)
|
||||
public bool KreonExtractSS(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration,
|
||||
byte requestNumber = 0x00)
|
||||
{
|
||||
buffer = new byte[2048];
|
||||
byte[] cdb = new byte[12];
|
||||
@@ -234,7 +236,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[10] = requestNumber;
|
||||
cdb[11] = 0xC0;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "KREON EXTRACT SS took {0} ms.", duration);
|
||||
@@ -242,5 +245,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -47,7 +47,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool GetConfiguration(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
|
||||
{
|
||||
return GetConfiguration(out buffer, out senseBuffer, 0x0000, MmcGetConfigurationRt.All, timeout, out duration);
|
||||
return GetConfiguration(out buffer, out senseBuffer, 0x0000, MmcGetConfigurationRt.All, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -59,9 +60,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="startingFeatureNumber">Feature number where the feature list should start from</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool GetConfiguration(out byte[] buffer, out byte[] senseBuffer, ushort startingFeatureNumber, uint timeout, out double duration)
|
||||
public bool GetConfiguration(out byte[] buffer, out byte[] senseBuffer, ushort startingFeatureNumber,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
return GetConfiguration(out buffer, out senseBuffer, startingFeatureNumber, MmcGetConfigurationRt.All, timeout, out duration);
|
||||
return GetConfiguration(out buffer, out senseBuffer, startingFeatureNumber, MmcGetConfigurationRt.All,
|
||||
timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -74,7 +77,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <param name="startingFeatureNumber">Starting Feature number.</param>
|
||||
/// <param name="RT">Return type, <see cref="MmcGetConfigurationRt"/>.</param>
|
||||
public bool GetConfiguration(out byte[] buffer, out byte[] senseBuffer, ushort startingFeatureNumber, MmcGetConfigurationRt RT, uint timeout, out double duration)
|
||||
public bool GetConfiguration(out byte[] buffer, out byte[] senseBuffer, ushort startingFeatureNumber,
|
||||
MmcGetConfigurationRt RT, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[10];
|
||||
@@ -89,11 +93,11 @@ namespace DiscImageChef.Devices
|
||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||
cdb[9] = 0;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if(sense)
|
||||
return true;
|
||||
if(sense) return true;
|
||||
|
||||
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
ushort confLength = (ushort)(((int)buffer[2] << 8) + buffer[3] + 4);
|
||||
@@ -103,7 +107,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||
senseBuffer = new byte[32];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "GET CONFIGURATION took {0} ms.", duration);
|
||||
@@ -124,7 +129,9 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="format">Which disc structure are we requesting</param>
|
||||
/// <param name="AGID">AGID used in medium copy protection</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool ReadDiscStructure(out byte[] buffer, out byte[] senseBuffer, MmcDiscStructureMediaType mediaType, uint address, byte layerNumber, MmcDiscStructureFormat format, byte AGID, uint timeout, out double duration)
|
||||
public bool ReadDiscStructure(out byte[] buffer, out byte[] senseBuffer, MmcDiscStructureMediaType mediaType,
|
||||
uint address, byte layerNumber, MmcDiscStructureFormat format, byte AGID,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[12];
|
||||
@@ -143,11 +150,11 @@ namespace DiscImageChef.Devices
|
||||
cdb[9] = (byte)(buffer.Length & 0xFF);
|
||||
cdb[10] = (byte)((AGID & 0x03) << 6);
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if(sense)
|
||||
return true;
|
||||
if(sense) return true;
|
||||
|
||||
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
ushort strctLength = (ushort)(((int)buffer[0] << 8) + buffer[1] + 2);
|
||||
@@ -157,7 +164,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[9] = (byte)(buffer.Length & 0xFF);
|
||||
senseBuffer = new byte[32];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ DISC STRUCTURE took {0} ms.", duration);
|
||||
@@ -189,7 +197,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="track">Start TOC from this track</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool ReadToc(out byte[] buffer, out byte[] senseBuffer, bool MSF, byte track, uint timeout, out double duration)
|
||||
public bool ReadToc(out byte[] buffer, out byte[] senseBuffer, bool MSF, byte track, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return ReadTocPmaAtip(out buffer, out senseBuffer, MSF, 0, track, timeout, out duration);
|
||||
}
|
||||
@@ -216,7 +225,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="MSF">If <c>true</c>, request data in MM:SS:FF units, otherwise, in blocks</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool ReadSessionInfo(out byte[] buffer, out byte[] senseBuffer, bool MSF, uint timeout, out double duration)
|
||||
public bool ReadSessionInfo(out byte[] buffer, out byte[] senseBuffer, bool MSF, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return ReadTocPmaAtip(out buffer, out senseBuffer, MSF, 1, 0, timeout, out duration);
|
||||
}
|
||||
@@ -230,7 +240,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="sessionNumber">Session which TOC to get</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool ReadRawToc(out byte[] buffer, out byte[] senseBuffer, byte sessionNumber, uint timeout, out double duration)
|
||||
public bool ReadRawToc(out byte[] buffer, out byte[] senseBuffer, byte sessionNumber, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return ReadTocPmaAtip(out buffer, out senseBuffer, true, 2, sessionNumber, timeout, out duration);
|
||||
}
|
||||
@@ -285,27 +296,26 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="trackSessionNumber">Track/Session number</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool ReadTocPmaAtip(out byte[] buffer, out byte[] senseBuffer, bool MSF, byte format, byte trackSessionNumber, uint timeout, out double duration)
|
||||
public bool ReadTocPmaAtip(out byte[] buffer, out byte[] senseBuffer, bool MSF, byte format,
|
||||
byte trackSessionNumber, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[10];
|
||||
byte[] tmpBuffer;
|
||||
bool sense;
|
||||
|
||||
if((format & 0x0F)== 5)
|
||||
tmpBuffer = new byte[32768];
|
||||
else
|
||||
tmpBuffer = new byte[1024];
|
||||
if((format & 0x0F) == 5) tmpBuffer = new byte[32768];
|
||||
else tmpBuffer = new byte[1024];
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ReadTocPmaAtip;
|
||||
if(MSF)
|
||||
cdb[1] = 0x02;
|
||||
if(MSF) cdb[1] = 0x02;
|
||||
cdb[2] = (byte)(format & 0x0F);
|
||||
cdb[6] = trackSessionNumber;
|
||||
cdb[7] = (byte)((tmpBuffer.Length & 0xFF00) >> 8);
|
||||
cdb[8] = (byte)(tmpBuffer.Length & 0xFF);
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref tmpBuffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref tmpBuffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
@@ -322,7 +332,8 @@ namespace DiscImageChef.Devices
|
||||
|
||||
double tmpDuration = duration;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
duration += tmpDuration;
|
||||
@@ -340,7 +351,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool ReadDiscInformation(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
|
||||
{
|
||||
return ReadDiscInformation(out buffer, out senseBuffer, MmcDiscInformationDataTypes.DiscInformation, timeout, out duration);
|
||||
return ReadDiscInformation(out buffer, out senseBuffer, MmcDiscInformationDataTypes.DiscInformation,
|
||||
timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -352,7 +364,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="dataType">Which disc information to read</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool ReadDiscInformation(out byte[] buffer, out byte[] senseBuffer, MmcDiscInformationDataTypes dataType, uint timeout, out double duration)
|
||||
public bool ReadDiscInformation(out byte[] buffer, out byte[] senseBuffer, MmcDiscInformationDataTypes dataType,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[10];
|
||||
@@ -364,7 +377,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[7] = (byte)((tmpBuffer.Length & 0xFF00) >> 8);
|
||||
cdb[8] = (byte)(tmpBuffer.Length & 0xFF);
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref tmpBuffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref tmpBuffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
@@ -398,8 +412,10 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="edcEcc">If set to <c>true</c> we request the EDC/ECC fields for data sectors.</param>
|
||||
/// <param name="C2Error">C2 error options.</param>
|
||||
/// <param name="subchannel">Subchannel selection.</param>
|
||||
public bool ReadCd(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint transferLength, MmcSectorTypes expectedSectorType,
|
||||
bool DAP, bool relAddr, bool sync, MmcHeaderCodes headerCodes, bool userData, bool edcEcc, MmcErrorField C2Error, MmcSubchannel subchannel, uint timeout, out double duration)
|
||||
public bool ReadCd(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint transferLength,
|
||||
MmcSectorTypes expectedSectorType, bool DAP, bool relAddr, bool sync,
|
||||
MmcHeaderCodes headerCodes, bool userData, bool edcEcc, MmcErrorField C2Error,
|
||||
MmcSubchannel subchannel, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[12];
|
||||
@@ -407,10 +423,8 @@ namespace DiscImageChef.Devices
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ReadCd;
|
||||
cdb[1] = (byte)((byte)expectedSectorType << 2);
|
||||
if(DAP)
|
||||
cdb[1] += 0x02;
|
||||
if(relAddr)
|
||||
cdb[1] += 0x01;
|
||||
if(DAP) cdb[1] += 0x02;
|
||||
if(relAddr) cdb[1] += 0x01;
|
||||
cdb[2] = (byte)((lba & 0xFF000000) >> 24);
|
||||
cdb[3] = (byte)((lba & 0xFF0000) >> 16);
|
||||
cdb[4] = (byte)((lba & 0xFF00) >> 8);
|
||||
@@ -420,17 +434,15 @@ namespace DiscImageChef.Devices
|
||||
cdb[8] = (byte)(transferLength & 0xFF);
|
||||
cdb[9] = (byte)((byte)C2Error << 1);
|
||||
cdb[9] += (byte)((byte)headerCodes << 5);
|
||||
if(sync)
|
||||
cdb[9] += 0x80;
|
||||
if(userData)
|
||||
cdb[9] += 0x10;
|
||||
if(edcEcc)
|
||||
cdb[9] += 0x08;
|
||||
if(sync) cdb[9] += 0x80;
|
||||
if(userData) cdb[9] += 0x10;
|
||||
if(edcEcc) cdb[9] += 0x08;
|
||||
cdb[10] = (byte)subchannel;
|
||||
|
||||
buffer = new byte[blockSize * transferLength];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ CD took {0} ms.", duration);
|
||||
@@ -457,8 +469,10 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="edcEcc">If set to <c>true</c> we request the EDC/ECC fields for data sectors.</param>
|
||||
/// <param name="C2Error">C2 error options.</param>
|
||||
/// <param name="subchannel">Subchannel selection.</param>
|
||||
public bool ReadCdMsf(out byte[] buffer, out byte[] senseBuffer, uint startMsf, uint endMsf, uint blockSize, MmcSectorTypes expectedSectorType,
|
||||
bool DAP, bool sync, MmcHeaderCodes headerCodes, bool userData, bool edcEcc, MmcErrorField C2Error, MmcSubchannel subchannel, uint timeout, out double duration)
|
||||
public bool ReadCdMsf(out byte[] buffer, out byte[] senseBuffer, uint startMsf, uint endMsf, uint blockSize,
|
||||
MmcSectorTypes expectedSectorType, bool DAP, bool sync, MmcHeaderCodes headerCodes,
|
||||
bool userData, bool edcEcc, MmcErrorField C2Error, MmcSubchannel subchannel, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[12];
|
||||
@@ -466,8 +480,7 @@ namespace DiscImageChef.Devices
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ReadCdMsf;
|
||||
cdb[1] = (byte)((byte)expectedSectorType << 2);
|
||||
if(DAP)
|
||||
cdb[1] += 0x02;
|
||||
if(DAP) cdb[1] += 0x02;
|
||||
cdb[3] = (byte)((startMsf & 0xFF0000) >> 16);
|
||||
cdb[4] = (byte)((startMsf & 0xFF00) >> 8);
|
||||
cdb[5] = (byte)(startMsf & 0xFF);
|
||||
@@ -476,19 +489,17 @@ namespace DiscImageChef.Devices
|
||||
cdb[8] = (byte)(endMsf & 0xFF);
|
||||
cdb[9] = (byte)((byte)C2Error << 1);
|
||||
cdb[9] += (byte)((byte)headerCodes << 5);
|
||||
if(sync)
|
||||
cdb[9] += 0x80;
|
||||
if(userData)
|
||||
cdb[9] += 0x10;
|
||||
if(edcEcc)
|
||||
cdb[9] += 0x08;
|
||||
if(sync) cdb[9] += 0x80;
|
||||
if(userData) cdb[9] += 0x10;
|
||||
if(edcEcc) cdb[9] += 0x08;
|
||||
cdb[10] = (byte)subchannel;
|
||||
|
||||
uint transferLength = (uint)((cdb[6] - cdb[3]) * 60 * 75 + (cdb[7] - cdb[4]) * 75 + (cdb[8] - cdb[5]));
|
||||
|
||||
buffer = new byte[blockSize * transferLength];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ CD MSF took {0} ms.", duration);
|
||||
@@ -506,7 +517,8 @@ namespace DiscImageChef.Devices
|
||||
return PreventAllowMediumRemoval(out senseBuffer, false, false, timeout, out duration);
|
||||
}
|
||||
|
||||
public bool PreventAllowMediumRemoval(out byte[] senseBuffer, bool persistent, bool prevent, uint timeout, out double duration)
|
||||
public bool PreventAllowMediumRemoval(out byte[] senseBuffer, bool persistent, bool prevent, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[6];
|
||||
@@ -514,12 +526,11 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval;
|
||||
if(prevent)
|
||||
cdb[4] += 0x01;
|
||||
if(persistent)
|
||||
cdb[4] += 0x02;
|
||||
if(prevent) cdb[4] += 0x01;
|
||||
if(persistent) cdb[4] += 0x02;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PREVENT ALLOW MEDIUM REMOVAL took {0} ms.", duration);
|
||||
@@ -547,7 +558,8 @@ namespace DiscImageChef.Devices
|
||||
return StartStopUnit(out senseBuffer, false, 0, 0, false, false, false, timeout, out duration);
|
||||
}
|
||||
|
||||
public bool StartStopUnit(out byte[] senseBuffer, bool immediate, byte formatLayer, byte powerConditions, bool changeFormatLayer, bool loadEject, bool start, uint timeout, out double duration)
|
||||
public bool StartStopUnit(out byte[] senseBuffer, bool immediate, byte formatLayer, byte powerConditions,
|
||||
bool changeFormatLayer, bool loadEject, bool start, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[6];
|
||||
@@ -555,8 +567,7 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.StartStopUnit;
|
||||
if(immediate)
|
||||
cdb[1] += 0x01;
|
||||
if(immediate) cdb[1] += 0x01;
|
||||
if(changeFormatLayer)
|
||||
{
|
||||
cdb[3] = (byte)(formatLayer & 0x03);
|
||||
@@ -564,21 +575,18 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
else
|
||||
{
|
||||
if(loadEject)
|
||||
cdb[4] += 0x02;
|
||||
if(start)
|
||||
cdb[4] += 0x01;
|
||||
if(loadEject) cdb[4] += 0x02;
|
||||
if(start) cdb[4] += 0x01;
|
||||
}
|
||||
cdb[4] += (byte)((powerConditions & 0x0F) << 4);
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "START STOP UNIT took {0} ms.", duration);
|
||||
|
||||
return sense;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -46,7 +46,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <param name="lba">Start block address.</param>
|
||||
/// <param name="transferLength">How many blocks to read.</param>
|
||||
public bool NecReadCdDa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, uint timeout, out double duration)
|
||||
public bool NecReadCdDa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[10];
|
||||
@@ -62,7 +63,8 @@ namespace DiscImageChef.Devices
|
||||
|
||||
buffer = new byte[2352 * transferLength];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ CD-DA took {0} ms.", duration);
|
||||
@@ -70,5 +72,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,7 +48,9 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="transferLength">How many blocks to read.</param>
|
||||
/// <param name="blockSize">Block size.</param>
|
||||
/// <param name="subchannel">Subchannel selection.</param>
|
||||
public bool PioneerReadCdDa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint transferLength, PioneerSubchannel subchannel, uint timeout, out double duration)
|
||||
public bool PioneerReadCdDa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize,
|
||||
uint transferLength, PioneerSubchannel subchannel, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[12];
|
||||
@@ -66,7 +68,8 @@ namespace DiscImageChef.Devices
|
||||
|
||||
buffer = new byte[blockSize * transferLength];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PIONEER READ CD-DA took {0} ms.", duration);
|
||||
@@ -86,7 +89,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="endMsf">End MM:SS:FF of read encoded as 0x00MMSSFF.</param>
|
||||
/// <param name="blockSize">Block size.</param>
|
||||
/// <param name="subchannel">Subchannel selection.</param>
|
||||
public bool PioneerReadCdDaMsf(out byte[] buffer, out byte[] senseBuffer, uint startMsf, uint endMsf, uint blockSize, PioneerSubchannel subchannel, uint timeout, out double duration)
|
||||
public bool PioneerReadCdDaMsf(out byte[] buffer, out byte[] senseBuffer, uint startMsf, uint endMsf,
|
||||
uint blockSize, PioneerSubchannel subchannel, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[12];
|
||||
@@ -104,7 +108,8 @@ namespace DiscImageChef.Devices
|
||||
uint transferLength = (uint)((cdb[7] - cdb[3]) * 60 * 75 + (cdb[8] - cdb[4]) * 75 + (cdb[9] - cdb[5]));
|
||||
buffer = new byte[blockSize * transferLength];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PIONEER READ CD-DA MSF took {0} ms.", duration);
|
||||
@@ -124,7 +129,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="wholeSector">If set to <c>true</c>, returns all 2352 bytes of sector data.</param>
|
||||
/// <param name="lba">Start block address.</param>
|
||||
/// <param name="transferLength">How many blocks to read.</param>
|
||||
public bool PioneerReadCdXa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, bool errorFlags, bool wholeSector, uint timeout, out double duration)
|
||||
public bool PioneerReadCdXa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength,
|
||||
bool errorFlags, bool wholeSector, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[12];
|
||||
@@ -155,7 +161,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[6] = 0x00;
|
||||
}
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PIONEER READ CD-XA took {0} ms.", duration);
|
||||
@@ -163,5 +170,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,9 +48,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="pba">If set to <c>true</c> address contain physical block address.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool PlasmonReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, ushort blockBytes, bool pba, uint timeout, out double duration)
|
||||
public bool PlasmonReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address,
|
||||
ushort blockBytes, bool pba, uint timeout, out double duration)
|
||||
{
|
||||
return HPReadLong(out buffer, out senseBuffer, relAddr, address, 0, blockBytes, pba, false, timeout, out duration);
|
||||
return HPReadLong(out buffer, out senseBuffer, relAddr, address, 0, blockBytes, pba, false, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -67,9 +69,12 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="sectorCount">If set to <c>true</c> <paramref name="transferLen"/> is a count of secors to read. Otherwise it will be ignored</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool PlasmonReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, ushort transferLen, ushort blockBytes, bool pba, bool sectorCount, uint timeout, out double duration)
|
||||
public bool PlasmonReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address,
|
||||
ushort transferLen, ushort blockBytes, bool pba, bool sectorCount, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return HPReadLong(out buffer, out senseBuffer, relAddr, address, transferLen, blockBytes, pba, sectorCount, timeout, out duration);
|
||||
return HPReadLong(out buffer, out senseBuffer, relAddr, address, transferLen, blockBytes, pba, sectorCount,
|
||||
timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -82,7 +87,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="pba">If set to <c>true</c> address contain a physical block address.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool PlasmonReadSectorLocation(out byte[] buffer, out byte[] senseBuffer, uint address, bool pba, uint timeout, out double duration)
|
||||
public bool PlasmonReadSectorLocation(out byte[] buffer, out byte[] senseBuffer, uint address, bool pba,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[10];
|
||||
@@ -93,12 +99,12 @@ namespace DiscImageChef.Devices
|
||||
cdb[3] = (byte)((address & 0xFF0000) >> 16);
|
||||
cdb[4] = (byte)((address & 0xFF00) >> 8);
|
||||
cdb[5] = (byte)(address & 0xFF);
|
||||
if(pba)
|
||||
cdb[9] += 0x80;
|
||||
if(pba) cdb[9] += 0x80;
|
||||
|
||||
buffer = new byte[8];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PLASMON READ SECTOR LOCATION took {0} ms.", duration);
|
||||
@@ -106,5 +112,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -49,7 +49,9 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="transferLength">How many blocks to read.</param>
|
||||
/// <param name="blockSize">Block size.</param>
|
||||
/// <param name="subchannel">Subchannel selection.</param>
|
||||
public bool PlextorReadCdDa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint transferLength, PlextorSubchannel subchannel, uint timeout, out double duration)
|
||||
public bool PlextorReadCdDa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize,
|
||||
uint transferLength, PlextorSubchannel subchannel, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[12];
|
||||
@@ -68,7 +70,8 @@ namespace DiscImageChef.Devices
|
||||
|
||||
buffer = new byte[blockSize * transferLength];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ CD-DA took {0} ms.", duration);
|
||||
@@ -86,7 +89,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <param name="lba">Start block address.</param>
|
||||
/// <param name="transferLength">How many blocks to read.</param>
|
||||
public bool PlextorReadRawDvd(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, uint timeout, out double duration)
|
||||
public bool PlextorReadRawDvd(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[10];
|
||||
@@ -102,7 +106,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[4] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
cdb[5] = (byte)(buffer.Length & 0xFF);
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "Plextor READ DVD (RAW) took {0} ms.", duration);
|
||||
@@ -128,7 +133,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[0] = (byte)ScsiCommands.Plextor_ReadEeprom;
|
||||
cdb[8] = 1;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR READ EEPROM took {0} ms.", duration);
|
||||
@@ -154,7 +160,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[0] = (byte)ScsiCommands.Plextor_ReadEeprom;
|
||||
cdb[8] = 2;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR READ EEPROM took {0} ms.", duration);
|
||||
@@ -172,7 +179,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">How many bytes are in the EEPROM block</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool PlextorReadEepromBlock(out byte[] buffer, out byte[] senseBuffer, byte block, ushort blockSize, uint timeout, out double duration)
|
||||
public bool PlextorReadEepromBlock(out byte[] buffer, out byte[] senseBuffer, byte block, ushort blockSize,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[blockSize];
|
||||
senseBuffer = new byte[32];
|
||||
@@ -185,7 +193,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[8] = (byte)((blockSize & 0xFF00) >> 8);
|
||||
cdb[9] = (byte)(blockSize & 0xFF);
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR READ EEPROM took {0} ms.", duration);
|
||||
@@ -203,7 +212,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="last">Last actual speed.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool PlextorGetSpeeds(out byte[] senseBuffer, out ushort selected, out ushort max, out ushort last, uint timeout, out double duration)
|
||||
public bool PlextorGetSpeeds(out byte[] senseBuffer, out ushort selected, out ushort max, out ushort last,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
byte[] buf = new byte[10];
|
||||
senseBuffer = new byte[32];
|
||||
@@ -217,7 +227,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[0] = (byte)ScsiCommands.Plextor_PoweRec;
|
||||
cdb[9] = (byte)buf.Length;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buf, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buf, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR POWEREC GET SPEEDS took {0} ms.", duration);
|
||||
@@ -242,7 +253,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="speed">PoweRec recommended speed.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool PlextorGetPoweRec(out byte[] senseBuffer, out bool enabled, out ushort speed, uint timeout, out double duration)
|
||||
public bool PlextorGetPoweRec(out byte[] senseBuffer, out bool enabled, out ushort speed, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
byte[] buf = new byte[8];
|
||||
senseBuffer = new byte[32];
|
||||
@@ -256,7 +268,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[1] = (byte)PlextorSubCommands.GetMode;
|
||||
cdb[9] = (byte)buf.Length;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buf, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buf, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR POWEREC GET SPEEDS took {0} ms.", duration);
|
||||
@@ -292,7 +305,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[3] = 4;
|
||||
cdb[10] = (byte)buffer.Length;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SILENT MODE took {0} ms.", duration);
|
||||
@@ -320,7 +334,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[2] = (byte)PlextorSubCommands.GigaRec;
|
||||
cdb[10] = (byte)buffer.Length;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET GIGAREC took {0} ms.", duration);
|
||||
@@ -336,7 +351,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool PlextorGetVariRec(out byte[] buffer, out byte[] senseBuffer, bool dvd, uint timeout, out double duration)
|
||||
public bool PlextorGetVariRec(out byte[] buffer, out byte[] senseBuffer, bool dvd, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
buffer = new byte[8];
|
||||
senseBuffer = new byte[32];
|
||||
@@ -348,12 +364,11 @@ namespace DiscImageChef.Devices
|
||||
cdb[2] = (byte)PlextorSubCommands.VariRec;
|
||||
cdb[10] = (byte)buffer.Length;
|
||||
|
||||
if(dvd)
|
||||
cdb[3] = 0x12;
|
||||
else
|
||||
cdb[3] = 0x02;
|
||||
if(dvd) cdb[3] = 0x12;
|
||||
else cdb[3] = 0x02;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET VARIREC took {0} ms.", duration);
|
||||
@@ -380,7 +395,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[2] = (byte)PlextorSubCommands.SecuRec;
|
||||
cdb[10] = (byte)buffer.Length;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SECUREC took {0} ms.", duration);
|
||||
@@ -408,7 +424,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[2] = (byte)PlextorSubCommands.SpeedRead;
|
||||
cdb[10] = (byte)buffer.Length;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SPEEDREAD took {0} ms.", duration);
|
||||
@@ -436,7 +453,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[2] = (byte)PlextorSubCommands.SessionHide;
|
||||
cdb[9] = (byte)buffer.Length;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SINGLE-SESSION / HIDE CD-R took {0} ms.", duration);
|
||||
@@ -452,7 +470,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool PlextorGetBitsetting(out byte[] buffer, out byte[] senseBuffer, bool dualLayer, uint timeout, out double duration)
|
||||
public bool PlextorGetBitsetting(out byte[] buffer, out byte[] senseBuffer, bool dualLayer, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
buffer = new byte[8];
|
||||
senseBuffer = new byte[32];
|
||||
@@ -464,12 +483,11 @@ namespace DiscImageChef.Devices
|
||||
cdb[2] = (byte)PlextorSubCommands.BitSet;
|
||||
cdb[9] = (byte)buffer.Length;
|
||||
|
||||
if(dualLayer)
|
||||
cdb[3] = (byte)PlextorSubCommands.BitSetRDL;
|
||||
else
|
||||
cdb[3] = (byte)PlextorSubCommands.BitSetR;
|
||||
if(dualLayer) cdb[3] = (byte)PlextorSubCommands.BitSetRDL;
|
||||
else cdb[3] = (byte)PlextorSubCommands.BitSetR;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET BOOK BITSETTING took {0} ms.", duration);
|
||||
@@ -485,7 +503,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool PlextorGetTestWriteDvdPlus(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
|
||||
public bool PlextorGetTestWriteDvdPlus(out byte[] buffer, out byte[] senseBuffer, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
buffer = new byte[8];
|
||||
senseBuffer = new byte[32];
|
||||
@@ -497,7 +516,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[2] = (byte)PlextorSubCommands.TestWriteDvdPlus;
|
||||
cdb[10] = (byte)buffer.Length;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET TEST WRITE DVD+ took {0} ms.", duration);
|
||||
@@ -505,5 +525,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -47,7 +47,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <param name="lba">Starting block.</param>
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
public bool Read6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint timeout, out double duration)
|
||||
public bool Read6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return Read6(out buffer, out senseBuffer, lba, blockSize, 1, timeout, out duration);
|
||||
}
|
||||
@@ -63,7 +64,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="lba">Starting block.</param>
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
/// <param name="transferLength">How many blocks to read.</param>
|
||||
public bool Read6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, byte transferLength, uint timeout, out double duration)
|
||||
public bool Read6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, byte transferLength,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[6];
|
||||
@@ -75,12 +77,11 @@ namespace DiscImageChef.Devices
|
||||
cdb[3] = (byte)(lba & 0xFF);
|
||||
cdb[4] = transferLength;
|
||||
|
||||
if(transferLength == 0)
|
||||
buffer = new byte[256 * blockSize];
|
||||
else
|
||||
buffer = new byte[transferLength * blockSize];
|
||||
if(transferLength == 0) buffer = new byte[256 * blockSize];
|
||||
else buffer = new byte[transferLength * blockSize];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ (6) took {0} ms.", duration);
|
||||
@@ -105,7 +106,9 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="groupNumber">Group number where attributes associated with this command should be collected.</param>
|
||||
/// <param name="transferLength">How many blocks to read.</param>
|
||||
/// <param name="relAddr">If set to <c>true</c> address is relative to current position.</param>
|
||||
public bool Read10(out byte[] buffer, out byte[] senseBuffer, byte rdprotect, bool dpo, bool fua, bool fuaNv, bool relAddr, uint lba, uint blockSize, byte groupNumber, ushort transferLength, uint timeout, out double duration)
|
||||
public bool Read10(out byte[] buffer, out byte[] senseBuffer, byte rdprotect, bool dpo, bool fua, bool fuaNv,
|
||||
bool relAddr, uint lba, uint blockSize, byte groupNumber, ushort transferLength,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[10];
|
||||
@@ -113,14 +116,10 @@ namespace DiscImageChef.Devices
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Read10;
|
||||
cdb[1] = (byte)((rdprotect & 0x07) << 5);
|
||||
if(dpo)
|
||||
cdb[1] += 0x10;
|
||||
if(fua)
|
||||
cdb[1] += 0x08;
|
||||
if(fuaNv)
|
||||
cdb[1] += 0x02;
|
||||
if(relAddr)
|
||||
cdb[1] += 0x01;
|
||||
if(dpo) cdb[1] += 0x10;
|
||||
if(fua) cdb[1] += 0x08;
|
||||
if(fuaNv) cdb[1] += 0x02;
|
||||
if(relAddr) cdb[1] += 0x01;
|
||||
cdb[2] = (byte)((lba & 0xFF000000) >> 24);
|
||||
cdb[3] = (byte)((lba & 0xFF0000) >> 16);
|
||||
cdb[4] = (byte)((lba & 0xFF00) >> 8);
|
||||
@@ -131,7 +130,8 @@ namespace DiscImageChef.Devices
|
||||
|
||||
buffer = new byte[transferLength * blockSize];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ (10) took {0} ms.", duration);
|
||||
@@ -157,7 +157,9 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="transferLength">How many blocks to read.</param>
|
||||
/// <param name="streaming">If set to <c>true</c> the stream playback operation should be used (MMC only).</param>
|
||||
/// <param name="relAddr">If set to <c>true</c> address is relative to current position.</param>
|
||||
public bool Read12(out byte[] buffer, out byte[] senseBuffer, byte rdprotect, bool dpo, bool fua, bool fuaNv, bool relAddr, uint lba, uint blockSize, byte groupNumber, uint transferLength, bool streaming, uint timeout, out double duration)
|
||||
public bool Read12(out byte[] buffer, out byte[] senseBuffer, byte rdprotect, bool dpo, bool fua, bool fuaNv,
|
||||
bool relAddr, uint lba, uint blockSize, byte groupNumber, uint transferLength,
|
||||
bool streaming, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[12];
|
||||
@@ -165,14 +167,10 @@ namespace DiscImageChef.Devices
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Read12;
|
||||
cdb[1] = (byte)((rdprotect & 0x07) << 5);
|
||||
if(dpo)
|
||||
cdb[1] += 0x10;
|
||||
if(fua)
|
||||
cdb[1] += 0x08;
|
||||
if(fuaNv)
|
||||
cdb[1] += 0x02;
|
||||
if(relAddr)
|
||||
cdb[1] += 0x01;
|
||||
if(dpo) cdb[1] += 0x10;
|
||||
if(fua) cdb[1] += 0x08;
|
||||
if(fuaNv) cdb[1] += 0x02;
|
||||
if(relAddr) cdb[1] += 0x01;
|
||||
cdb[2] = (byte)((lba & 0xFF000000) >> 24);
|
||||
cdb[3] = (byte)((lba & 0xFF0000) >> 16);
|
||||
cdb[4] = (byte)((lba & 0xFF00) >> 8);
|
||||
@@ -182,12 +180,12 @@ namespace DiscImageChef.Devices
|
||||
cdb[8] = (byte)((transferLength & 0xFF00) >> 8);
|
||||
cdb[9] = (byte)(transferLength & 0xFF);
|
||||
cdb[10] = (byte)(groupNumber & 0x1F);
|
||||
if(streaming)
|
||||
cdb[10] += 0x80;
|
||||
if(streaming) cdb[10] += 0x80;
|
||||
|
||||
buffer = new byte[transferLength * blockSize];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ (12) took {0} ms.", duration);
|
||||
@@ -212,7 +210,9 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="groupNumber">Group number where attributes associated with this command should be collected.</param>
|
||||
/// <param name="transferLength">How many blocks to read.</param>
|
||||
/// <param name="streaming">If set to <c>true</c> the stream playback operation should be used (MMC only).</param>
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, byte rdprotect, bool dpo, bool fua, bool fuaNv, ulong lba, uint blockSize, byte groupNumber, uint transferLength, bool streaming, uint timeout, out double duration)
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, byte rdprotect, bool dpo, bool fua, bool fuaNv,
|
||||
ulong lba, uint blockSize, byte groupNumber, uint transferLength, bool streaming,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[16];
|
||||
@@ -221,12 +221,9 @@ namespace DiscImageChef.Devices
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Read16;
|
||||
cdb[1] = (byte)((rdprotect & 0x07) << 5);
|
||||
if(dpo)
|
||||
cdb[1] += 0x10;
|
||||
if(fua)
|
||||
cdb[1] += 0x08;
|
||||
if(fuaNv)
|
||||
cdb[1] += 0x02;
|
||||
if(dpo) cdb[1] += 0x10;
|
||||
if(fua) cdb[1] += 0x08;
|
||||
if(fuaNv) cdb[1] += 0x02;
|
||||
cdb[2] = lbaBytes[7];
|
||||
cdb[3] = lbaBytes[6];
|
||||
cdb[4] = lbaBytes[5];
|
||||
@@ -240,12 +237,12 @@ namespace DiscImageChef.Devices
|
||||
cdb[12] = (byte)((transferLength & 0xFF00) >> 8);
|
||||
cdb[13] = (byte)(transferLength & 0xFF);
|
||||
cdb[14] = (byte)(groupNumber & 0x1F);
|
||||
if(streaming)
|
||||
cdb[14] += 0x80;
|
||||
if(streaming) cdb[14] += 0x80;
|
||||
|
||||
buffer = new byte[transferLength * blockSize];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ (16) took {0} ms.", duration);
|
||||
@@ -265,17 +262,16 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="correct">If set to <c>true</c> ask the drive to try to correct errors in the sector.</param>
|
||||
/// <param name="lba">LBA to read.</param>
|
||||
/// <param name="transferBytes">How many bytes to read. If the number is not exactly the drive's size, the command will fail and incidate a delta of the size in SENSE.</param>
|
||||
public bool ReadLong10(out byte[] buffer, out byte[] senseBuffer, bool correct, bool relAddr, uint lba, ushort transferBytes, uint timeout, out double duration)
|
||||
public bool ReadLong10(out byte[] buffer, out byte[] senseBuffer, bool correct, bool relAddr, uint lba,
|
||||
ushort transferBytes, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[10];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ReadLong;
|
||||
if(correct)
|
||||
cdb[1] += 0x02;
|
||||
if(relAddr)
|
||||
cdb[1] += 0x01;
|
||||
if(correct) cdb[1] += 0x02;
|
||||
if(relAddr) cdb[1] += 0x01;
|
||||
cdb[2] = (byte)((lba & 0xFF000000) >> 24);
|
||||
cdb[3] = (byte)((lba & 0xFF0000) >> 16);
|
||||
cdb[4] = (byte)((lba & 0xFF00) >> 8);
|
||||
@@ -285,7 +281,8 @@ namespace DiscImageChef.Devices
|
||||
|
||||
buffer = new byte[transferBytes];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ LONG (10) took {0} ms.", duration);
|
||||
@@ -304,7 +301,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="correct">If set to <c>true</c> ask the drive to try to correct errors in the sector.</param>
|
||||
/// <param name="lba">LBA to read.</param>
|
||||
/// <param name="transferBytes">How many bytes to read. If the number is not exactly the drive's size, the command will fail and incidate a delta of the size in SENSE.</param>
|
||||
public bool ReadLong16(out byte[] buffer, out byte[] senseBuffer, bool correct, ulong lba, uint transferBytes, uint timeout, out double duration)
|
||||
public bool ReadLong16(out byte[] buffer, out byte[] senseBuffer, bool correct, ulong lba, uint transferBytes,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[16];
|
||||
@@ -323,12 +321,12 @@ namespace DiscImageChef.Devices
|
||||
cdb[9] = lbaBytes[0];
|
||||
cdb[12] = (byte)((transferBytes & 0xFF00) >> 8);
|
||||
cdb[13] = (byte)(transferBytes & 0xFF);
|
||||
if(correct)
|
||||
cdb[14] += 0x01;
|
||||
if(correct) cdb[14] += 0x01;
|
||||
|
||||
buffer = new byte[transferBytes];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ LONG (16) took {0} ms.", duration);
|
||||
@@ -355,7 +353,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[2] = (byte)((lba & 0xFF00) >> 8);
|
||||
cdb[3] = (byte)(lba & 0xFF);
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "SEEK (6) took {0} ms.", duration);
|
||||
@@ -383,7 +382,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[4] = (byte)((lba & 0xFF00) >> 8);
|
||||
cdb[5] = (byte)(lba & 0xFF);
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "SEEK (10) took {0} ms.", duration);
|
||||
@@ -391,5 +391,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,7 +50,9 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="cache">If set to <c>true</c> device can return cached data.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, ushort element, byte elementType, byte volume, byte partition, ushort firstAttribute, bool cache, uint timeout, out double duration)
|
||||
public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, ushort element,
|
||||
byte elementType, byte volume, byte partition, ushort firstAttribute, bool cache,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[256];
|
||||
byte[] cdb = new byte[16];
|
||||
@@ -70,17 +72,17 @@ namespace DiscImageChef.Devices
|
||||
cdb[11] = (byte)((buffer.Length & 0xFF0000) >> 16);
|
||||
cdb[12] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
cdb[13] = (byte)(buffer.Length & 0xFF);
|
||||
if(cache)
|
||||
cdb[14] += 0x01;
|
||||
if(cache) cdb[14] += 0x01;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if(sense)
|
||||
return true;
|
||||
if(sense) return true;
|
||||
|
||||
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
uint attrLen = (uint)(((int)buffer[0] << 24) + ((int)buffer[1] << 16) + ((int)buffer[2] << 8) + buffer[3] + 4);
|
||||
uint attrLen = (uint)(((int)buffer[0] << 24) + ((int)buffer[1] << 16) + ((int)buffer[2] << 8) + buffer[3] +
|
||||
4);
|
||||
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
buffer = new byte[attrLen];
|
||||
cdb[10] = (byte)((buffer.Length & 0xFF000000) >> 24);
|
||||
@@ -89,7 +91,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[13] = (byte)(buffer.Length & 0xFF);
|
||||
senseBuffer = new byte[32];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ ATTRIBUTE took {0} ms.", duration);
|
||||
@@ -97,5 +100,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -85,22 +85,23 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
buffer = new byte[36];
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = { (byte)ScsiCommands.Inquiry, 0, 0, 0, 36, 0 };
|
||||
byte[] cdb = {(byte)ScsiCommands.Inquiry, 0, 0, 0, 36, 0};
|
||||
bool sense;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if(sense)
|
||||
return true;
|
||||
if(sense) return true;
|
||||
|
||||
byte pagesLength = (byte)(buffer[4] + 5);
|
||||
|
||||
cdb = new byte[] { (byte)ScsiCommands.Inquiry, 0, 0, 0, pagesLength, 0 };
|
||||
cdb = new byte[] {(byte)ScsiCommands.Inquiry, 0, 0, 0, pagesLength, 0};
|
||||
buffer = new byte[pagesLength];
|
||||
senseBuffer = new byte[32];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "INQUIRY took {0} ms.", duration);
|
||||
@@ -160,26 +161,26 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
buffer = new byte[36];
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = { (byte)ScsiCommands.Inquiry, 1, page, 0, 36, 0 };
|
||||
byte[] cdb = {(byte)ScsiCommands.Inquiry, 1, page, 0, 36, 0};
|
||||
bool sense;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if(sense)
|
||||
return true;
|
||||
if(sense) return true;
|
||||
|
||||
// This is because INQ was returned instead of EVPD
|
||||
if(buffer[1] != page)
|
||||
return true;
|
||||
if(buffer[1] != page) return true;
|
||||
|
||||
byte pagesLength = (byte)(buffer[3] + 4);
|
||||
|
||||
cdb = new byte[] { (byte)ScsiCommands.Inquiry, 1, page, 0, pagesLength, 0 };
|
||||
cdb = new byte[] {(byte)ScsiCommands.Inquiry, 1, page, 0, pagesLength, 0};
|
||||
buffer = new byte[pagesLength];
|
||||
senseBuffer = new byte[32];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "INQUIRY took {0} ms.", duration);
|
||||
@@ -197,11 +198,12 @@ namespace DiscImageChef.Devices
|
||||
public bool ScsiTestUnitReady(out byte[] senseBuffer, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = { (byte)ScsiCommands.TestUnitReady, 0, 0, 0, 0, 0 };
|
||||
byte[] cdb = {(byte)ScsiCommands.TestUnitReady, 0, 0, 0, 0, 0};
|
||||
bool sense;
|
||||
byte[] buffer = new byte[0];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "TEST UNIT READY took {0} ms.", duration);
|
||||
@@ -219,7 +221,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool ModeSense(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
|
||||
{
|
||||
return ModeSense6(out buffer, out senseBuffer, false, ScsiModeSensePageControl.Current, 0, 0, timeout, out duration);
|
||||
return ModeSense6(out buffer, out senseBuffer, false, ScsiModeSensePageControl.Current, 0, 0, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -233,7 +236,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="DBD">If set to <c>true</c> device MUST not return any block descriptor.</param>
|
||||
/// <param name="pageControl">Page control.</param>
|
||||
/// <param name="pageCode">Page code.</param>
|
||||
public bool ModeSense6(out byte[] buffer, out byte[] senseBuffer, bool DBD, ScsiModeSensePageControl pageControl, byte pageCode, uint timeout, out double duration)
|
||||
public bool ModeSense6(out byte[] buffer, out byte[] senseBuffer, bool DBD,
|
||||
ScsiModeSensePageControl pageControl, byte pageCode, uint timeout, out double duration)
|
||||
{
|
||||
return ModeSense6(out buffer, out senseBuffer, DBD, pageControl, pageCode, 0, timeout, out duration);
|
||||
}
|
||||
@@ -250,7 +254,9 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="pageControl">Page control.</param>
|
||||
/// <param name="pageCode">Page code.</param>
|
||||
/// <param name="subPageCode">Sub-page code.</param>
|
||||
public bool ModeSense6(out byte[] buffer, out byte[] senseBuffer, bool DBD, ScsiModeSensePageControl pageControl, byte pageCode, byte subPageCode, uint timeout, out double duration)
|
||||
public bool ModeSense6(out byte[] buffer, out byte[] senseBuffer, bool DBD,
|
||||
ScsiModeSensePageControl pageControl, byte pageCode, byte subPageCode, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[6];
|
||||
@@ -258,26 +264,26 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ModeSense;
|
||||
if(DBD)
|
||||
cdb[1] = 0x08;
|
||||
if(DBD) cdb[1] = 0x08;
|
||||
cdb[2] |= (byte)pageControl;
|
||||
cdb[2] |= (byte)(pageCode & 0x3F);
|
||||
cdb[3] = subPageCode;
|
||||
cdb[4] = (byte)buffer.Length;
|
||||
cdb[5] = 0;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if(sense)
|
||||
return true;
|
||||
if(sense) return true;
|
||||
|
||||
byte modeLength = (byte)(buffer[0] + 1);
|
||||
buffer = new byte[modeLength];
|
||||
cdb[4] = (byte)buffer.Length;
|
||||
senseBuffer = new byte[32];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "MODE SENSE(6) took {0} ms.", duration);
|
||||
@@ -296,9 +302,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="DBD">If set to <c>true</c> device MUST not return any block descriptor.</param>
|
||||
/// <param name="pageControl">Page control.</param>
|
||||
/// <param name="pageCode">Page code.</param>
|
||||
public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool DBD, ScsiModeSensePageControl pageControl, byte pageCode, uint timeout, out double duration)
|
||||
public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool DBD,
|
||||
ScsiModeSensePageControl pageControl, byte pageCode, uint timeout, out double duration)
|
||||
{
|
||||
return ModeSense10(out buffer, out senseBuffer, false, DBD, pageControl, pageCode, 0, timeout, out duration);
|
||||
return ModeSense10(out buffer, out senseBuffer, false, DBD, pageControl, pageCode, 0, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -313,9 +321,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="pageControl">Page control.</param>
|
||||
/// <param name="pageCode">Page code.</param>
|
||||
/// <param name="LLBAA">If set means 64-bit LBAs are accepted by the caller.</param>
|
||||
public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool LLBAA, bool DBD, ScsiModeSensePageControl pageControl, byte pageCode, uint timeout, out double duration)
|
||||
public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool LLBAA, bool DBD,
|
||||
ScsiModeSensePageControl pageControl, byte pageCode, uint timeout, out double duration)
|
||||
{
|
||||
return ModeSense10(out buffer, out senseBuffer, LLBAA, DBD, pageControl, pageCode, 0, timeout, out duration);
|
||||
return ModeSense10(out buffer, out senseBuffer, LLBAA, DBD, pageControl, pageCode, 0, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -331,7 +341,9 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="pageCode">Page code.</param>
|
||||
/// <param name="subPageCode">Sub-page code.</param>
|
||||
/// <param name="LLBAA">If set means 64-bit LBAs are accepted by the caller.</param>
|
||||
public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool LLBAA, bool DBD, ScsiModeSensePageControl pageControl, byte pageCode, byte subPageCode, uint timeout, out double duration)
|
||||
public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool LLBAA, bool DBD,
|
||||
ScsiModeSensePageControl pageControl, byte pageCode, byte subPageCode, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[10];
|
||||
@@ -339,10 +351,8 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ModeSense10;
|
||||
if(LLBAA)
|
||||
cdb[1] |= 0x10;
|
||||
if(DBD)
|
||||
cdb[1] |= 0x08;
|
||||
if(LLBAA) cdb[1] |= 0x10;
|
||||
if(DBD) cdb[1] |= 0x08;
|
||||
cdb[2] |= (byte)pageControl;
|
||||
cdb[2] |= (byte)(pageCode & 0x3F);
|
||||
cdb[3] = subPageCode;
|
||||
@@ -350,11 +360,11 @@ namespace DiscImageChef.Devices
|
||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||
cdb[9] = 0;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if(sense)
|
||||
return true;
|
||||
if(sense) return true;
|
||||
|
||||
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
ushort modeLength = (ushort)(((int)buffer[0] << 8) + buffer[1] + 2);
|
||||
@@ -364,7 +374,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||
senseBuffer = new byte[32];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "MODE SENSE(10) took {0} ms.", duration);
|
||||
@@ -404,10 +415,12 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <param name="prevent"><c>true</c> to prevent medium removal, <c>false</c> to allow it.</param>
|
||||
public bool SpcPreventAllowMediumRemoval(out byte[] senseBuffer, bool prevent, uint timeout, out double duration)
|
||||
public bool SpcPreventAllowMediumRemoval(out byte[] senseBuffer, bool prevent, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
if(prevent)
|
||||
return SpcPreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Prevent, timeout, out duration);
|
||||
return SpcPreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Prevent, timeout,
|
||||
out duration);
|
||||
else
|
||||
return SpcPreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Allow, timeout, out duration);
|
||||
}
|
||||
@@ -420,7 +433,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <param name="preventMode">Prevention mode.</param>
|
||||
public bool SpcPreventAllowMediumRemoval(out byte[] senseBuffer, ScsiPreventAllowMode preventMode, uint timeout, out double duration)
|
||||
public bool SpcPreventAllowMediumRemoval(out byte[] senseBuffer, ScsiPreventAllowMode preventMode, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[6];
|
||||
@@ -430,7 +444,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval;
|
||||
cdb[4] = (byte)((byte)preventMode & 0x03);
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PREVENT ALLOW MEDIUM REMOVAL took {0} ms.", duration);
|
||||
@@ -462,7 +477,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="PMI">If set, it is requesting partial media capacity</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool ReadCapacity(out byte[] buffer, out byte[] senseBuffer, bool RelAddr, uint address, bool PMI, uint timeout, out double duration)
|
||||
public bool ReadCapacity(out byte[] buffer, out byte[] senseBuffer, bool RelAddr, uint address, bool PMI,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[10];
|
||||
@@ -474,8 +490,7 @@ namespace DiscImageChef.Devices
|
||||
if(PMI)
|
||||
{
|
||||
cdb[8] = 0x01;
|
||||
if(RelAddr)
|
||||
cdb[1] = 0x01;
|
||||
if(RelAddr) cdb[1] = 0x01;
|
||||
|
||||
cdb[2] = (byte)((address & 0xFF000000) >> 24);
|
||||
cdb[3] = (byte)((address & 0xFF0000) >> 16);
|
||||
@@ -483,7 +498,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[5] = (byte)(address & 0xFF);
|
||||
}
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ CAPACITY took {0} ms.", duration);
|
||||
@@ -514,7 +530,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="PMI">If set, it is requesting partial media capacity</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool ReadCapacity16(out byte[] buffer, out byte[] senseBuffer, ulong address, bool PMI, uint timeout, out double duration)
|
||||
public bool ReadCapacity16(out byte[] buffer, out byte[] senseBuffer, ulong address, bool PMI, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[16];
|
||||
@@ -543,7 +560,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[12] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
cdb[13] = (byte)(buffer.Length & 0xFF);
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ CAPACITY(16) took {0} ms.", duration);
|
||||
@@ -573,14 +591,15 @@ namespace DiscImageChef.Devices
|
||||
cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
cdb[9] = (byte)(buffer.Length & 0xFF);
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if(sense)
|
||||
return true;
|
||||
if(sense) return true;
|
||||
|
||||
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
uint strctLength = (uint)(((int)buffer[0] << 24) + ((int)buffer[1] << 16) + ((int)buffer[2] << 8) + buffer[3] + 4);
|
||||
uint strctLength = (uint)(((int)buffer[0] << 24) + ((int)buffer[1] << 16) + ((int)buffer[2] << 8) +
|
||||
buffer[3] + 4);
|
||||
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
buffer = new byte[strctLength];
|
||||
cdb[6] = (byte)((buffer.Length & 0xFF000000) >> 24);
|
||||
@@ -589,7 +608,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[9] = (byte)(buffer.Length & 0xFF);
|
||||
senseBuffer = new byte[32];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ MEDIA SERIAL NUMBER took {0} ms.", duration);
|
||||
@@ -608,9 +628,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="cache">If set to <c>true</c> device can return cached data.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, byte partition, ushort firstAttribute, bool cache, uint timeout, out double duration)
|
||||
public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, byte partition,
|
||||
ushort firstAttribute, bool cache, uint timeout, out double duration)
|
||||
{
|
||||
return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, 0, partition, firstAttribute, cache, timeout, out duration);
|
||||
return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, 0, partition, firstAttribute, cache,
|
||||
timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -623,9 +645,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="cache">If set to <c>true</c> device can return cached data.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, ushort firstAttribute, bool cache, uint timeout, out double duration)
|
||||
public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action,
|
||||
ushort firstAttribute, bool cache, uint timeout, out double duration)
|
||||
{
|
||||
return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, 0, 0, firstAttribute, cache, timeout, out duration);
|
||||
return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, 0, 0, firstAttribute, cache, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -638,9 +662,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="firstAttribute">First attribute identifier.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, byte partition, ushort firstAttribute, uint timeout, out double duration)
|
||||
public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, byte partition,
|
||||
ushort firstAttribute, uint timeout, out double duration)
|
||||
{
|
||||
return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, 0, partition, firstAttribute, false, timeout, out duration);
|
||||
return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, 0, partition, firstAttribute, false,
|
||||
timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -652,9 +678,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="firstAttribute">First attribute identifier.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, ushort firstAttribute, uint timeout, out double duration)
|
||||
public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action,
|
||||
ushort firstAttribute, uint timeout, out double duration)
|
||||
{
|
||||
return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, 0, 0, firstAttribute, false, timeout, out duration);
|
||||
return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, 0, 0, firstAttribute, false, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -668,9 +696,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="firstAttribute">First attribute identifier.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, byte volume, byte partition, ushort firstAttribute, uint timeout, out double duration)
|
||||
public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, byte volume,
|
||||
byte partition, ushort firstAttribute, uint timeout, out double duration)
|
||||
{
|
||||
return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, volume, partition, firstAttribute, false, timeout, out duration);
|
||||
return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, volume, partition, firstAttribute, false,
|
||||
timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -685,9 +715,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="cache">If set to <c>true</c> device can return cached data.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, byte volume, byte partition, ushort firstAttribute, bool cache, uint timeout, out double duration)
|
||||
public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, byte volume,
|
||||
byte partition, ushort firstAttribute, bool cache, uint timeout, out double duration)
|
||||
{
|
||||
return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, volume, partition, firstAttribute, cache, timeout, out duration);
|
||||
return ReadAttribute(out buffer, out senseBuffer, action, 0, 0, volume, partition, firstAttribute, cache,
|
||||
timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -698,17 +730,19 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool ModeSelect(byte[] buffer, out byte[] senseBuffer, bool pageFormat, bool savePages, uint timeout, out double duration)
|
||||
public bool ModeSelect(byte[] buffer, out byte[] senseBuffer, bool pageFormat, bool savePages, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
|
||||
// Prevent overflows
|
||||
if(buffer.Length > 255)
|
||||
{
|
||||
if(platformID != Interop.PlatformID.Win32NT && platformID != Interop.PlatformID.Win32S && platformID != Interop.PlatformID.Win32Windows && platformID != Interop.PlatformID.WinCE && platformID != Interop.PlatformID.WindowsPhone && platformID != Interop.PlatformID.Xbox)
|
||||
lastError = 75;
|
||||
else
|
||||
lastError = 111;
|
||||
if(platformID != Interop.PlatformID.Win32NT && platformID != Interop.PlatformID.Win32S &&
|
||||
platformID != Interop.PlatformID.Win32Windows && platformID != Interop.PlatformID.WinCE &&
|
||||
platformID != Interop.PlatformID.WindowsPhone &&
|
||||
platformID != Interop.PlatformID.Xbox) lastError = 75;
|
||||
else lastError = 111;
|
||||
error = true;
|
||||
duration = 0;
|
||||
return true;
|
||||
@@ -718,13 +752,12 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ModeSelect;
|
||||
if(pageFormat)
|
||||
cdb[1] += 0x10;
|
||||
if(savePages)
|
||||
cdb[1] += 0x01;
|
||||
if(pageFormat) cdb[1] += 0x10;
|
||||
if(savePages) cdb[1] += 0x01;
|
||||
cdb[4] = (byte)buffer.Length;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "MODE SELECT(6) took {0} ms.", duration);
|
||||
@@ -740,17 +773,19 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool ModeSelect10(byte[] buffer, out byte[] senseBuffer, bool pageFormat, bool savePages, uint timeout, out double duration)
|
||||
public bool ModeSelect10(byte[] buffer, out byte[] senseBuffer, bool pageFormat, bool savePages, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
|
||||
// Prevent overflows
|
||||
if(buffer.Length > 65535)
|
||||
{
|
||||
if(platformID != Interop.PlatformID.Win32NT && platformID != Interop.PlatformID.Win32S && platformID != Interop.PlatformID.Win32Windows && platformID != Interop.PlatformID.WinCE && platformID != Interop.PlatformID.WindowsPhone && platformID != Interop.PlatformID.Xbox)
|
||||
lastError = 75;
|
||||
else
|
||||
lastError = 111;
|
||||
if(platformID != Interop.PlatformID.Win32NT && platformID != Interop.PlatformID.Win32S &&
|
||||
platformID != Interop.PlatformID.Win32Windows && platformID != Interop.PlatformID.WinCE &&
|
||||
platformID != Interop.PlatformID.WindowsPhone &&
|
||||
platformID != Interop.PlatformID.Xbox) lastError = 75;
|
||||
else lastError = 111;
|
||||
error = true;
|
||||
duration = 0;
|
||||
return true;
|
||||
@@ -760,14 +795,13 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ModeSelect10;
|
||||
if(pageFormat)
|
||||
cdb[1] += 0x10;
|
||||
if(savePages)
|
||||
cdb[1] += 0x01;
|
||||
if(pageFormat) cdb[1] += 0x10;
|
||||
if(savePages) cdb[1] += 0x01;
|
||||
cdb[7] = (byte)((buffer.Length & 0xFF00) << 8);
|
||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "MODE SELECT(10) took {0} ms.", duration);
|
||||
@@ -788,14 +822,14 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.RequestSense;
|
||||
if(descriptor)
|
||||
cdb[1] = 0x01;
|
||||
if(descriptor) cdb[1] = 0x01;
|
||||
cdb[2] = 0;
|
||||
cdb[3] = 0;
|
||||
cdb[4] = (byte)buffer.Length;
|
||||
cdb[5] = 0;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "REQUEST SENSE took {0} ms.", duration);
|
||||
@@ -803,5 +837,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -73,7 +73,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="hold">If set to <c>true</c> and <paramref name="load"/> is also set to <c>true</c>, moves the medium to the drive but does not prepare it for reading.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool LoadUnload(out byte[] senseBuffer, bool immediate, bool load, bool retense, bool endOfTape, bool hold, uint timeout, out double duration)
|
||||
public bool LoadUnload(out byte[] senseBuffer, bool immediate, bool load, bool retense, bool endOfTape,
|
||||
bool hold, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[6];
|
||||
@@ -81,18 +82,14 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.LoadUnload;
|
||||
if(immediate)
|
||||
cdb[1] = 0x01;
|
||||
if(load)
|
||||
cdb[4] += 0x01;
|
||||
if(retense)
|
||||
cdb[4] += 0x02;
|
||||
if(endOfTape)
|
||||
cdb[4] += 0x04;
|
||||
if(hold)
|
||||
cdb[4] += 0x08;
|
||||
if(immediate) cdb[1] = 0x01;
|
||||
if(load) cdb[4] += 0x01;
|
||||
if(retense) cdb[4] += 0x02;
|
||||
if(endOfTape) cdb[4] += 0x04;
|
||||
if(hold) cdb[4] += 0x08;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "LOAD UNLOAD (6) took {0} ms.", duration);
|
||||
@@ -147,7 +144,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="lba">Logical block address.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Locate(out byte[] senseBuffer, bool immediate, byte partition, uint lba, uint timeout, out double duration)
|
||||
public bool Locate(out byte[] senseBuffer, bool immediate, byte partition, uint lba, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return Locate(out senseBuffer, immediate, false, true, partition, lba, timeout, out duration);
|
||||
}
|
||||
@@ -163,7 +161,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="objectId">Object identifier.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Locate(out byte[] senseBuffer, bool immediate, bool blockType, bool changePartition, byte partition, uint objectId, uint timeout, out double duration)
|
||||
public bool Locate(out byte[] senseBuffer, bool immediate, bool blockType, bool changePartition, byte partition,
|
||||
uint objectId, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[10];
|
||||
@@ -171,19 +170,17 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Locate;
|
||||
if(immediate)
|
||||
cdb[1] += 0x01;
|
||||
if(changePartition)
|
||||
cdb[1] += 0x02;
|
||||
if(blockType)
|
||||
cdb[1] += 0x04;
|
||||
if(immediate) cdb[1] += 0x01;
|
||||
if(changePartition) cdb[1] += 0x02;
|
||||
if(blockType) cdb[1] += 0x04;
|
||||
cdb[3] = (byte)((objectId & 0xFF000000) >> 24);
|
||||
cdb[4] = (byte)((objectId & 0xFF0000) >> 16);
|
||||
cdb[5] = (byte)((objectId & 0xFF00) >> 8);
|
||||
cdb[6] = (byte)(objectId & 0xFF);
|
||||
cdb[8] = partition;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "LOCATE (10) took {0} ms.", duration);
|
||||
@@ -200,7 +197,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Locate16(out byte[] senseBuffer, ulong lba, uint timeout, out double duration)
|
||||
{
|
||||
return Locate16(out senseBuffer, false, false, SscLogicalIdTypes.ObjectId, false, 0, lba, timeout, out duration);
|
||||
return Locate16(out senseBuffer, false, false, SscLogicalIdTypes.ObjectId, false, 0, lba, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -213,7 +211,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Locate16(out byte[] senseBuffer, byte partition, ulong lba, uint timeout, out double duration)
|
||||
{
|
||||
return Locate16(out senseBuffer, false, true, SscLogicalIdTypes.ObjectId, false, partition, lba, timeout, out duration);
|
||||
return Locate16(out senseBuffer, false, true, SscLogicalIdTypes.ObjectId, false, partition, lba, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -226,7 +225,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Locate16(out byte[] senseBuffer, bool immediate, ulong lba, uint timeout, out double duration)
|
||||
{
|
||||
return Locate16(out senseBuffer, immediate, false, SscLogicalIdTypes.ObjectId, false, 0, lba, timeout, out duration);
|
||||
return Locate16(out senseBuffer, immediate, false, SscLogicalIdTypes.ObjectId, false, 0, lba, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -238,9 +238,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="lba">Logical block address.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Locate16(out byte[] senseBuffer, bool immediate, byte partition, ulong lba, uint timeout, out double duration)
|
||||
public bool Locate16(out byte[] senseBuffer, bool immediate, byte partition, ulong lba, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return Locate16(out senseBuffer, immediate, true, SscLogicalIdTypes.ObjectId, false, partition, lba, timeout, out duration);
|
||||
return Locate16(out senseBuffer, immediate, true, SscLogicalIdTypes.ObjectId, false, partition, lba,
|
||||
timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -255,7 +257,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="identifier">Destination identifier.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Locate16(out byte[] senseBuffer, bool immediate, bool changePartition, SscLogicalIdTypes destType, bool bam, byte partition, ulong identifier, uint timeout, out double duration)
|
||||
public bool Locate16(out byte[] senseBuffer, bool immediate, bool changePartition, SscLogicalIdTypes destType,
|
||||
bool bam, byte partition, ulong identifier, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[16];
|
||||
@@ -265,12 +268,9 @@ namespace DiscImageChef.Devices
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Locate16;
|
||||
cdb[1] = (byte)((byte)destType << 3);
|
||||
if(immediate)
|
||||
cdb[1] += 0x01;
|
||||
if(changePartition)
|
||||
cdb[1] += 0x02;
|
||||
if(bam)
|
||||
cdb[2] = 0x01;
|
||||
if(immediate) cdb[1] += 0x01;
|
||||
if(changePartition) cdb[1] += 0x02;
|
||||
if(bam) cdb[2] = 0x01;
|
||||
cdb[3] = partition;
|
||||
|
||||
cdb[4] = idBytes[7];
|
||||
@@ -282,7 +282,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[10] = idBytes[1];
|
||||
cdb[11] = idBytes[0];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "LOCATE (16) took {0} ms.", duration);
|
||||
@@ -314,7 +315,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Read6(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen, uint blockSize, uint timeout, out double duration)
|
||||
public bool Read6(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen, uint blockSize,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
return Read6(out buffer, out senseBuffer, sili, false, transferLen, blockSize, timeout, out duration);
|
||||
}
|
||||
@@ -330,26 +332,24 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Read6(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, uint transferLen, uint blockSize, uint timeout, out double duration)
|
||||
public bool Read6(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, uint transferLen,
|
||||
uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
if(fixedLen)
|
||||
buffer = new byte[blockSize * transferLen];
|
||||
else
|
||||
buffer = new byte[transferLen];
|
||||
if(fixedLen) buffer = new byte[blockSize * transferLen];
|
||||
else buffer = new byte[transferLen];
|
||||
byte[] cdb = new byte[6];
|
||||
senseBuffer = new byte[32];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Read6;
|
||||
if(fixedLen)
|
||||
cdb[1] += 0x01;
|
||||
if(sili)
|
||||
cdb[1] += 0x02;
|
||||
if(fixedLen) cdb[1] += 0x01;
|
||||
if(sili) cdb[1] += 0x02;
|
||||
cdb[2] = (byte)((transferLen & 0xFF0000) >> 16);
|
||||
cdb[3] = (byte)((transferLen & 0xFF00) >> 8);
|
||||
cdb[4] = (byte)(transferLen & 0xFF);
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ (6) took {0} ms.", duration);
|
||||
@@ -368,9 +368,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Object size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, ulong objectId, uint blocks, uint blockSize, uint timeout, out double duration)
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, ulong objectId, uint blocks,
|
||||
uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
return Read16(out buffer, out senseBuffer, sili, false, 0, objectId, blocks, blockSize, timeout, out duration);
|
||||
return Read16(out buffer, out senseBuffer, sili, false, 0, objectId, blocks, blockSize, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -385,9 +387,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Object size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, byte partition, ulong objectId, uint blocks, uint blockSize, uint timeout, out double duration)
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, byte partition, ulong objectId,
|
||||
uint blocks, uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
return Read16(out buffer, out senseBuffer, sili, false, partition, objectId, blocks, blockSize, timeout, out duration);
|
||||
return Read16(out buffer, out senseBuffer, sili, false, partition, objectId, blocks, blockSize, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -400,9 +404,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Object size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, ulong objectId, uint blocks, uint blockSize, uint timeout, out double duration)
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, ulong objectId, uint blocks, uint blockSize,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
return Read16(out buffer, out senseBuffer, false, true, 0, objectId, blocks, blockSize, timeout, out duration);
|
||||
return Read16(out buffer, out senseBuffer, false, true, 0, objectId, blocks, blockSize, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -416,9 +422,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Object size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, byte partition, ulong objectId, uint blocks, uint blockSize, uint timeout, out double duration)
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, byte partition, ulong objectId, uint blocks,
|
||||
uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
return Read16(out buffer, out senseBuffer, false, true, partition, objectId, blocks, blockSize, timeout, out duration);
|
||||
return Read16(out buffer, out senseBuffer, false, true, partition, objectId, blocks, blockSize, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -434,22 +442,19 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="objectSize">Object size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, byte partition, ulong objectId, uint transferLen, uint objectSize, uint timeout, out double duration)
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, byte partition,
|
||||
ulong objectId, uint transferLen, uint objectSize, uint timeout, out double duration)
|
||||
{
|
||||
if(fixedLen)
|
||||
buffer = new byte[objectSize * transferLen];
|
||||
else
|
||||
buffer = new byte[transferLen];
|
||||
if(fixedLen) buffer = new byte[objectSize * transferLen];
|
||||
else buffer = new byte[transferLen];
|
||||
byte[] cdb = new byte[6];
|
||||
senseBuffer = new byte[32];
|
||||
bool sense;
|
||||
byte[] idBytes = BitConverter.GetBytes(objectId);
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Read16;
|
||||
if(fixedLen)
|
||||
cdb[1] += 0x01;
|
||||
if(sili)
|
||||
cdb[1] += 0x02;
|
||||
if(fixedLen) cdb[1] += 0x01;
|
||||
if(sili) cdb[1] += 0x02;
|
||||
cdb[3] = partition;
|
||||
cdb[4] = idBytes[7];
|
||||
cdb[5] = idBytes[6];
|
||||
@@ -463,7 +468,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[13] = (byte)((transferLen & 0xFF00) >> 8);
|
||||
cdb[14] = (byte)(transferLen & 0xFF);
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ (16) took {0} ms.", duration);
|
||||
@@ -487,7 +493,8 @@ namespace DiscImageChef.Devices
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ReadBlockLimits;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ BLOCK LIMITS took {0} ms.", duration);
|
||||
@@ -529,15 +536,13 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="totalPosition">Requests current logical position.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadPosition(out byte[] buffer, out byte[] senseBuffer, bool vendorType, bool longForm, bool totalPosition, uint timeout, out double duration)
|
||||
public bool ReadPosition(out byte[] buffer, out byte[] senseBuffer, bool vendorType, bool longForm,
|
||||
bool totalPosition, uint timeout, out double duration)
|
||||
{
|
||||
byte responseForm = 0;
|
||||
if(vendorType)
|
||||
responseForm += 0x01;
|
||||
if(longForm)
|
||||
responseForm += 0x02;
|
||||
if(totalPosition)
|
||||
responseForm += 0x04;
|
||||
if(vendorType) responseForm += 0x01;
|
||||
if(longForm) responseForm += 0x02;
|
||||
if(totalPosition) responseForm += 0x04;
|
||||
|
||||
return ReadPosition(out buffer, out senseBuffer, (SscPositionForms)responseForm, timeout, out duration);
|
||||
}
|
||||
@@ -550,7 +555,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="responseForm">Response form.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadPosition(out byte[] buffer, out byte[] senseBuffer, SscPositionForms responseForm, uint timeout, out double duration)
|
||||
public bool ReadPosition(out byte[] buffer, out byte[] senseBuffer, SscPositionForms responseForm, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
switch(responseForm)
|
||||
{
|
||||
@@ -571,6 +577,7 @@ namespace DiscImageChef.Devices
|
||||
buffer = new byte[32]; // Invalid
|
||||
break;
|
||||
}
|
||||
|
||||
byte[] cdb = new byte[10];
|
||||
senseBuffer = new byte[32];
|
||||
bool sense;
|
||||
@@ -583,7 +590,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||
}
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ POSITION took {0} ms.", duration);
|
||||
@@ -600,9 +608,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, uint blocks, uint blockSize, uint timeout, out double duration)
|
||||
public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, uint blocks, uint blockSize, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return ReadReverse6(out buffer, out senseBuffer, false, false, true, blocks, blockSize, timeout, out duration);
|
||||
return ReadReverse6(out buffer, out senseBuffer, false, false, true, blocks, blockSize, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -615,9 +625,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen, uint blockSize, uint timeout, out double duration)
|
||||
public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen, uint blockSize,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
return ReadReverse6(out buffer, out senseBuffer, false, sili, false, transferLen, blockSize, timeout, out duration);
|
||||
return ReadReverse6(out buffer, out senseBuffer, false, sili, false, transferLen, blockSize, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -632,28 +644,25 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, bool byteOrder, bool sili, bool fixedLen, uint transferLen, uint blockSize, uint timeout, out double duration)
|
||||
public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, bool byteOrder, bool sili, bool fixedLen,
|
||||
uint transferLen, uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
if(fixedLen)
|
||||
buffer = new byte[blockSize * transferLen];
|
||||
else
|
||||
buffer = new byte[transferLen];
|
||||
if(fixedLen) buffer = new byte[blockSize * transferLen];
|
||||
else buffer = new byte[transferLen];
|
||||
byte[] cdb = new byte[6];
|
||||
senseBuffer = new byte[32];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ReadReverse;
|
||||
if(fixedLen)
|
||||
cdb[1] += 0x01;
|
||||
if(sili)
|
||||
cdb[1] += 0x02;
|
||||
if(byteOrder)
|
||||
cdb[1] += 0x04;
|
||||
if(fixedLen) cdb[1] += 0x01;
|
||||
if(sili) cdb[1] += 0x02;
|
||||
if(byteOrder) cdb[1] += 0x04;
|
||||
cdb[2] = (byte)((transferLen & 0xFF0000) >> 16);
|
||||
cdb[3] = (byte)((transferLen & 0xFF00) >> 8);
|
||||
cdb[4] = (byte)(transferLen & 0xFF);
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ REVERSE (6) took {0} ms.", duration);
|
||||
@@ -672,9 +681,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Object size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool sili, ulong objectId, uint blocks, uint blockSize, uint timeout, out double duration)
|
||||
public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool sili, ulong objectId, uint blocks,
|
||||
uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
return ReadReverse16(out buffer, out senseBuffer, false, sili, false, 0, objectId, blocks, blockSize, timeout, out duration);
|
||||
return ReadReverse16(out buffer, out senseBuffer, false, sili, false, 0, objectId, blocks, blockSize,
|
||||
timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -689,9 +700,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Object size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool sili, byte partition, ulong objectId, uint blocks, uint blockSize, uint timeout, out double duration)
|
||||
public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool sili, byte partition, ulong objectId,
|
||||
uint blocks, uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
return ReadReverse16(out buffer, out senseBuffer, false, sili, false, partition, objectId, blocks, blockSize, timeout, out duration);
|
||||
return ReadReverse16(out buffer, out senseBuffer, false, sili, false, partition, objectId, blocks,
|
||||
blockSize, timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -704,9 +717,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Object size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, ulong objectId, uint blocks, uint blockSize, uint timeout, out double duration)
|
||||
public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, ulong objectId, uint blocks,
|
||||
uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
return ReadReverse16(out buffer, out senseBuffer, false, false, true, 0, objectId, blocks, blockSize, timeout, out duration);
|
||||
return ReadReverse16(out buffer, out senseBuffer, false, false, true, 0, objectId, blocks, blockSize,
|
||||
timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -720,9 +735,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Object size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, byte partition, ulong objectId, uint blocks, uint blockSize, uint timeout, out double duration)
|
||||
public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, byte partition, ulong objectId,
|
||||
uint blocks, uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
return ReadReverse16(out buffer, out senseBuffer, false, false, true, partition, objectId, blocks, blockSize, timeout, out duration);
|
||||
return ReadReverse16(out buffer, out senseBuffer, false, false, true, partition, objectId, blocks,
|
||||
blockSize, timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -739,24 +756,21 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="objectSize">Object size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool byteOrder, bool sili, bool fixedLen, byte partition, ulong objectId, uint transferLen, uint objectSize, uint timeout, out double duration)
|
||||
public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool byteOrder, bool sili, bool fixedLen,
|
||||
byte partition, ulong objectId, uint transferLen, uint objectSize, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
if(fixedLen)
|
||||
buffer = new byte[objectSize * transferLen];
|
||||
else
|
||||
buffer = new byte[transferLen];
|
||||
if(fixedLen) buffer = new byte[objectSize * transferLen];
|
||||
else buffer = new byte[transferLen];
|
||||
byte[] cdb = new byte[6];
|
||||
senseBuffer = new byte[32];
|
||||
bool sense;
|
||||
byte[] idBytes = BitConverter.GetBytes(objectId);
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Read16;
|
||||
if(fixedLen)
|
||||
cdb[1] += 0x01;
|
||||
if(sili)
|
||||
cdb[1] += 0x02;
|
||||
if(byteOrder)
|
||||
cdb[1] += 0x04;
|
||||
if(fixedLen) cdb[1] += 0x01;
|
||||
if(sili) cdb[1] += 0x02;
|
||||
if(byteOrder) cdb[1] += 0x04;
|
||||
cdb[3] = partition;
|
||||
cdb[4] = idBytes[7];
|
||||
cdb[5] = idBytes[6];
|
||||
@@ -770,7 +784,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[13] = (byte)((transferLen & 0xFF00) >> 8);
|
||||
cdb[14] = (byte)(transferLen & 0xFF);
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ REVERSE (16) took {0} ms.", duration);
|
||||
@@ -787,9 +802,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, uint blocks, uint blockSize, uint timeout, out double duration)
|
||||
public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, uint blocks, uint blockSize,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
return RecoverBufferedData(out buffer, out senseBuffer, false, true, blocks, blockSize, timeout, out duration);
|
||||
return RecoverBufferedData(out buffer, out senseBuffer, false, true, blocks, blockSize, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -802,9 +819,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen, uint blockSize, uint timeout, out double duration)
|
||||
public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen,
|
||||
uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
return RecoverBufferedData(out buffer, out senseBuffer, sili, false, transferLen, blockSize, timeout, out duration);
|
||||
return RecoverBufferedData(out buffer, out senseBuffer, sili, false, transferLen, blockSize, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -818,26 +837,24 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, uint transferLen, uint blockSize, uint timeout, out double duration)
|
||||
public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen,
|
||||
uint transferLen, uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
if(fixedLen)
|
||||
buffer = new byte[blockSize * transferLen];
|
||||
else
|
||||
buffer = new byte[transferLen];
|
||||
if(fixedLen) buffer = new byte[blockSize * transferLen];
|
||||
else buffer = new byte[transferLen];
|
||||
byte[] cdb = new byte[6];
|
||||
senseBuffer = new byte[32];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.RecoverBufferedData;
|
||||
if(fixedLen)
|
||||
cdb[1] += 0x01;
|
||||
if(sili)
|
||||
cdb[1] += 0x02;
|
||||
if(fixedLen) cdb[1] += 0x01;
|
||||
if(sili) cdb[1] += 0x02;
|
||||
cdb[2] = (byte)((transferLen & 0xFF0000) >> 16);
|
||||
cdb[3] = (byte)((transferLen & 0xFF00) >> 8);
|
||||
cdb[4] = (byte)(transferLen & 0xFF);
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "RECOVER BUFFERED DATA took {0} ms.", duration);
|
||||
@@ -865,7 +882,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="currentMedia">If set to <c>true</c> descriptors should apply to currently inserted media.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReportDensitySupport(out byte[] buffer, out byte[] senseBuffer, bool currentMedia, uint timeout, out double duration)
|
||||
public bool ReportDensitySupport(out byte[] buffer, out byte[] senseBuffer, bool currentMedia, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return ReportDensitySupport(out buffer, out senseBuffer, false, currentMedia, timeout, out duration);
|
||||
}
|
||||
@@ -879,7 +897,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="currentMedia">If set to <c>true</c> descriptors should apply to currently inserted media.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReportDensitySupport(out byte[] buffer, out byte[] senseBuffer, bool mediumType, bool currentMedia, uint timeout, out double duration)
|
||||
public bool ReportDensitySupport(out byte[] buffer, out byte[] senseBuffer, bool mediumType, bool currentMedia,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[256];
|
||||
byte[] cdb = new byte[10];
|
||||
@@ -887,18 +906,16 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ReportDensitySupport;
|
||||
if(currentMedia)
|
||||
cdb[1] += 0x01;
|
||||
if(mediumType)
|
||||
cdb[1] += 0x02;
|
||||
if(currentMedia) cdb[1] += 0x01;
|
||||
if(mediumType) cdb[1] += 0x02;
|
||||
cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if(sense)
|
||||
return true;
|
||||
if(sense) return true;
|
||||
|
||||
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
ushort availableLength = (ushort)(((int)buffer[0] << 8) + buffer[1] + 2);
|
||||
@@ -908,7 +925,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||
senseBuffer = new byte[32];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "REPORT DENSITY SUPPORT took {0} ms.", duration);
|
||||
@@ -942,10 +960,10 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Rewind;
|
||||
if(immediate)
|
||||
cdb[1] += 0x01;
|
||||
if(immediate) cdb[1] += 0x01;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "REWIND took {0} ms.", duration);
|
||||
@@ -971,7 +989,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[0] = (byte)ScsiCommands.TrackSelect;
|
||||
cdb[5] = track;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "TRACK SELECT took {0} ms.", duration);
|
||||
@@ -993,7 +1012,8 @@ namespace DiscImageChef.Devices
|
||||
cdb[3] = count_b[1];
|
||||
cdb[4] = count_b[0];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "SPACE took {0} ms.", duration);
|
||||
@@ -1001,5 +1021,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -46,7 +46,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <param name="lba">Starting block.</param>
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
public bool SyQuestRead6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint timeout, out double duration)
|
||||
public bool SyQuestRead6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return SyQuestRead6(out buffer, out senseBuffer, lba, blockSize, 1, false, false, timeout, out duration);
|
||||
}
|
||||
@@ -61,7 +62,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <param name="lba">Starting block.</param>
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
public bool SyQuestReadLong6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint timeout, out double duration)
|
||||
public bool SyQuestReadLong6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return SyQuestRead6(out buffer, out senseBuffer, lba, blockSize, 1, false, true, timeout, out duration);
|
||||
}
|
||||
@@ -79,7 +81,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="readLong">If set to <c>true</c> drive will return ECC bytes and disable error detection.</param>
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
/// <param name="transferLength">How many blocks to read.</param>
|
||||
public bool SyQuestRead6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, byte transferLength, bool inhibitDma, bool readLong, uint timeout, out double duration)
|
||||
public bool SyQuestRead6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize,
|
||||
byte transferLength, bool inhibitDma, bool readLong, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[6];
|
||||
@@ -90,30 +93,27 @@ namespace DiscImageChef.Devices
|
||||
cdb[2] = (byte)((lba & 0xFF00) >> 8);
|
||||
cdb[3] = (byte)(lba & 0xFF);
|
||||
cdb[4] = transferLength;
|
||||
if(inhibitDma)
|
||||
cdb[5] += 0x80;
|
||||
if(readLong)
|
||||
cdb[5] += 0x40;
|
||||
if(inhibitDma) cdb[5] += 0x80;
|
||||
if(readLong) cdb[5] += 0x40;
|
||||
|
||||
if(!inhibitDma && !readLong)
|
||||
{
|
||||
if(transferLength == 0)
|
||||
buffer = new byte[256 * blockSize];
|
||||
else
|
||||
buffer = new byte[transferLength * blockSize];
|
||||
if(transferLength == 0) buffer = new byte[256 * blockSize];
|
||||
else buffer = new byte[transferLength * blockSize];
|
||||
}
|
||||
else if(readLong)
|
||||
{
|
||||
buffer = new byte[blockSize];
|
||||
cdb[4] = 1;
|
||||
}
|
||||
else
|
||||
buffer = new byte[0];
|
||||
else buffer = new byte[0];
|
||||
|
||||
if(!inhibitDma)
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
else
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
out sense);
|
||||
|
||||
error = lastError != 0;
|
||||
|
||||
@@ -129,7 +129,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool SyQuestReadUsageCounter(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
|
||||
public bool SyQuestReadUsageCounter(out byte[] buffer, out byte[] senseBuffer, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return AdaptecReadUsageCounter(out buffer, out senseBuffer, false, timeout, out duration);
|
||||
}
|
||||
@@ -144,7 +145,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <param name="lba">Starting block.</param>
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
public bool SyQuestReadLong10(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint timeout, out double duration)
|
||||
public bool SyQuestReadLong10(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return SyQuestRead10(out buffer, out senseBuffer, lba, blockSize, 1, false, true, timeout, out duration);
|
||||
}
|
||||
@@ -162,7 +164,9 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="readLong">If set to <c>true</c> drive will return ECC bytes and disable error detection.</param>
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
/// <param name="transferLength">How many blocks to read.</param>
|
||||
public bool SyQuestRead10(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, ushort transferLength, bool inhibitDma, bool readLong, uint timeout, out double duration)
|
||||
public bool SyQuestRead10(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize,
|
||||
ushort transferLength, bool inhibitDma, bool readLong, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[10];
|
||||
@@ -175,27 +179,23 @@ namespace DiscImageChef.Devices
|
||||
cdb[5] = (byte)(lba & 0xFF);
|
||||
cdb[7] = (byte)((transferLength & 0xFF00) >> 8);
|
||||
cdb[8] = (byte)(transferLength & 0xFF);
|
||||
if(inhibitDma)
|
||||
cdb[9] += 0x80;
|
||||
if(readLong)
|
||||
cdb[9] += 0x40;
|
||||
if(inhibitDma) cdb[9] += 0x80;
|
||||
if(readLong) cdb[9] += 0x40;
|
||||
|
||||
if(!inhibitDma && !readLong)
|
||||
{
|
||||
buffer = new byte[transferLength * blockSize];
|
||||
}
|
||||
if(!inhibitDma && !readLong) { buffer = new byte[transferLength * blockSize]; }
|
||||
else if(readLong)
|
||||
{
|
||||
buffer = new byte[blockSize];
|
||||
cdb[4] = 1;
|
||||
}
|
||||
else
|
||||
buffer = new byte[0];
|
||||
else buffer = new byte[0];
|
||||
|
||||
if(!inhibitDma)
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
else
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "SYQUEST READ (10) took {0} ms.", duration);
|
||||
@@ -203,5 +203,4 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -75,10 +75,7 @@ namespace DiscImageChef.Devices
|
||||
/// <value>The Platform ID</value>
|
||||
public Interop.PlatformID PlatformID
|
||||
{
|
||||
get
|
||||
{
|
||||
return platformID;
|
||||
}
|
||||
get { return platformID; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -87,21 +84,14 @@ namespace DiscImageChef.Devices
|
||||
/// <value>The file handle</value>
|
||||
public object FileHandle
|
||||
{
|
||||
get
|
||||
{
|
||||
return fd;
|
||||
}
|
||||
get { return fd; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the standard timeout for commands sent to this device
|
||||
/// </summary>
|
||||
/// <value>The timeout in seconds</value>
|
||||
public uint Timeout
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public uint Timeout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this <see cref="Device"/> is in error.
|
||||
@@ -109,10 +99,7 @@ namespace DiscImageChef.Devices
|
||||
/// <value><c>true</c> if error; otherwise, <c>false</c>.</value>
|
||||
public bool Error
|
||||
{
|
||||
get
|
||||
{
|
||||
return error;
|
||||
}
|
||||
get { return error; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -121,10 +108,7 @@ namespace DiscImageChef.Devices
|
||||
/// <value>The last error.</value>
|
||||
public int LastError
|
||||
{
|
||||
get
|
||||
{
|
||||
return lastError;
|
||||
}
|
||||
get { return lastError; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -133,10 +117,7 @@ namespace DiscImageChef.Devices
|
||||
/// <value>The device type.</value>
|
||||
public DeviceType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return type;
|
||||
}
|
||||
get { return type; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -145,10 +126,7 @@ namespace DiscImageChef.Devices
|
||||
/// <value>The manufacturer.</value>
|
||||
public string Manufacturer
|
||||
{
|
||||
get
|
||||
{
|
||||
return manufacturer;
|
||||
}
|
||||
get { return manufacturer; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -157,10 +135,7 @@ namespace DiscImageChef.Devices
|
||||
/// <value>The model.</value>
|
||||
public string Model
|
||||
{
|
||||
get
|
||||
{
|
||||
return model;
|
||||
}
|
||||
get { return model; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -169,10 +144,7 @@ namespace DiscImageChef.Devices
|
||||
/// <value>The revision.</value>
|
||||
public string Revision
|
||||
{
|
||||
get
|
||||
{
|
||||
return revision;
|
||||
}
|
||||
get { return revision; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -181,10 +153,7 @@ namespace DiscImageChef.Devices
|
||||
/// <value>The serial number.</value>
|
||||
public string Serial
|
||||
{
|
||||
get
|
||||
{
|
||||
return serial;
|
||||
}
|
||||
get { return serial; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -193,10 +162,7 @@ namespace DiscImageChef.Devices
|
||||
/// <value>The SCSI peripheral device type.</value>
|
||||
public Decoders.SCSI.PeripheralDeviceTypes SCSIType
|
||||
{
|
||||
get
|
||||
{
|
||||
return scsiType;
|
||||
}
|
||||
get { return scsiType; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -205,10 +171,7 @@ namespace DiscImageChef.Devices
|
||||
/// <value><c>true</c> if this device's media is removable; otherwise, <c>false</c>.</value>
|
||||
public bool IsRemovable
|
||||
{
|
||||
get
|
||||
{
|
||||
return removable;
|
||||
}
|
||||
get { return removable; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -217,10 +180,7 @@ namespace DiscImageChef.Devices
|
||||
/// <value><c>true</c> if this device is attached via USB; otherwise, <c>false</c>.</value>
|
||||
public bool IsUSB
|
||||
{
|
||||
get
|
||||
{
|
||||
return usb;
|
||||
}
|
||||
get { return usb; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -229,10 +189,7 @@ namespace DiscImageChef.Devices
|
||||
/// <value>The USB vendor ID.</value>
|
||||
public ushort USBVendorID
|
||||
{
|
||||
get
|
||||
{
|
||||
return usbVendor;
|
||||
}
|
||||
get { return usbVendor; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -241,10 +198,7 @@ namespace DiscImageChef.Devices
|
||||
/// <value>The USB product ID.</value>
|
||||
public ushort USBProductID
|
||||
{
|
||||
get
|
||||
{
|
||||
return usbProduct;
|
||||
}
|
||||
get { return usbProduct; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -253,10 +207,7 @@ namespace DiscImageChef.Devices
|
||||
/// <value>The USB descriptors.</value>
|
||||
public byte[] USBDescriptors
|
||||
{
|
||||
get
|
||||
{
|
||||
return usbDescriptors;
|
||||
}
|
||||
get { return usbDescriptors; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -265,10 +216,7 @@ namespace DiscImageChef.Devices
|
||||
/// <value>The USB manufacturer string.</value>
|
||||
public string USBManufacturerString
|
||||
{
|
||||
get
|
||||
{
|
||||
return usbManufacturerString;
|
||||
}
|
||||
get { return usbManufacturerString; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -277,10 +225,7 @@ namespace DiscImageChef.Devices
|
||||
/// <value>The USB product string.</value>
|
||||
public string USBProductString
|
||||
{
|
||||
get
|
||||
{
|
||||
return usbProductString;
|
||||
}
|
||||
get { return usbProductString; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -289,47 +234,62 @@ namespace DiscImageChef.Devices
|
||||
/// <value>The USB serial string.</value>
|
||||
public string USBSerialString
|
||||
{
|
||||
get
|
||||
{
|
||||
return usbSerialString;
|
||||
}
|
||||
get { return usbSerialString; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this device is attached via FireWire.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this device is attached via FireWire; otherwise, <c>false</c>.</value>
|
||||
public bool IsFireWire { get { return firewire; } }
|
||||
public bool IsFireWire
|
||||
{
|
||||
get { return firewire; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the FireWire GUID
|
||||
/// </summary>
|
||||
/// <value>The FireWire GUID.</value>
|
||||
public ulong FireWireGUID { get { return firewireGuid; } }
|
||||
public ulong FireWireGUID
|
||||
{
|
||||
get { return firewireGuid; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the FireWire model number
|
||||
/// </summary>
|
||||
/// <value>The FireWire model.</value>
|
||||
public uint FireWireModel { get { return firewireModel; } }
|
||||
public uint FireWireModel
|
||||
{
|
||||
get { return firewireModel; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the FireWire model name.
|
||||
/// </summary>
|
||||
/// <value>The FireWire model name.</value>
|
||||
public string FireWireModelName { get { return firewireModelName; } }
|
||||
public string FireWireModelName
|
||||
{
|
||||
get { return firewireModelName; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the FireWire vendor number.
|
||||
/// </summary>
|
||||
/// <value>The FireWire vendor number.</value>
|
||||
public uint FireWireVendor { get { return firewireVendor; } }
|
||||
public uint FireWireVendor
|
||||
{
|
||||
get { return firewireVendor; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the FireWire vendor name.
|
||||
/// </summary>
|
||||
/// <value>The FireWire vendor name.</value>
|
||||
public string FireWireVendorName { get { return firewireVendorName; } }
|
||||
public string FireWireVendorName
|
||||
{
|
||||
get { return firewireVendorName; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this device is a CompactFlash device.
|
||||
@@ -337,10 +297,7 @@ namespace DiscImageChef.Devices
|
||||
/// <value><c>true</c> if this device is a CompactFlash device; otherwise, <c>false</c>.</value>
|
||||
public bool IsCompactFlash
|
||||
{
|
||||
get
|
||||
{
|
||||
return compactFlash;
|
||||
}
|
||||
get { return compactFlash; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -349,10 +306,7 @@ namespace DiscImageChef.Devices
|
||||
/// <value><c>true</c> if this device is a PCMCIA device; otherwise, <c>false</c>.</value>
|
||||
public bool IsPCMCIA
|
||||
{
|
||||
get
|
||||
{
|
||||
return pcmcia;
|
||||
}
|
||||
get { return pcmcia; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -360,11 +314,7 @@ namespace DiscImageChef.Devices
|
||||
/// </summary>
|
||||
public byte[] CIS
|
||||
{
|
||||
get
|
||||
{
|
||||
return cis;
|
||||
}
|
||||
get { return cis; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user