mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
REFACTOR: Convert variables to auto setters.
This commit is contained in:
@@ -40,42 +40,14 @@ namespace DiscImageChef.Core.Devices
|
|||||||
{
|
{
|
||||||
Device dev;
|
Device dev;
|
||||||
uint timeout;
|
uint timeout;
|
||||||
ulong blocks;
|
|
||||||
uint blocksToRead;
|
|
||||||
string errorMessage;
|
|
||||||
bool readRaw;
|
|
||||||
uint blockSize;
|
|
||||||
uint physicalsectorsize;
|
|
||||||
uint longBlockSize;
|
|
||||||
|
|
||||||
internal string ErrorMessage
|
internal string ErrorMessage { get; private set; }
|
||||||
{
|
internal ulong Blocks { get; set; }
|
||||||
get { return errorMessage; }
|
internal uint BlocksToRead { get; private set; }
|
||||||
}
|
internal uint LogicalBlockSize { get; private set; }
|
||||||
internal ulong Blocks
|
internal uint PhysicalBlockSize { get; private set; }
|
||||||
{
|
internal uint LongBlockSize { get; private set; }
|
||||||
get { return blocks; }
|
internal bool CanReadRaw { get; private set; }
|
||||||
}
|
|
||||||
internal uint BlocksToRead
|
|
||||||
{
|
|
||||||
get { return blocksToRead; }
|
|
||||||
}
|
|
||||||
internal uint LogicalBlockSize
|
|
||||||
{
|
|
||||||
get { return blockSize; }
|
|
||||||
}
|
|
||||||
internal uint PhysicalBlockSize
|
|
||||||
{
|
|
||||||
get { return physicalsectorsize; }
|
|
||||||
}
|
|
||||||
internal uint LongBlockSize
|
|
||||||
{
|
|
||||||
get { return longBlockSize; }
|
|
||||||
}
|
|
||||||
internal bool CanReadRaw
|
|
||||||
{
|
|
||||||
get { return readRaw; }
|
|
||||||
}
|
|
||||||
internal bool CanSeek
|
internal bool CanSeek
|
||||||
{
|
{
|
||||||
get { return ataSeek || seek6 || seek10; }
|
get { return ataSeek || seek6 || seek10; }
|
||||||
@@ -89,8 +61,8 @@ namespace DiscImageChef.Core.Devices
|
|||||||
{
|
{
|
||||||
this.dev = dev;
|
this.dev = dev;
|
||||||
this.timeout = timeout;
|
this.timeout = timeout;
|
||||||
blocksToRead = 64;
|
BlocksToRead = 64;
|
||||||
readRaw = raw;
|
CanReadRaw = raw;
|
||||||
|
|
||||||
switch(dev.Type)
|
switch(dev.Type)
|
||||||
{
|
{
|
||||||
@@ -109,7 +81,7 @@ namespace DiscImageChef.Core.Devices
|
|||||||
case DeviceType.ATAPI:
|
case DeviceType.ATAPI:
|
||||||
case DeviceType.SCSI: return ScsiGetBlocks();
|
case DeviceType.SCSI: return ScsiGetBlocks();
|
||||||
default:
|
default:
|
||||||
errorMessage = string.Format("Unknown device type {0}.", dev.Type);
|
ErrorMessage = string.Format("Unknown device type {0}.", dev.Type);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -122,7 +94,7 @@ namespace DiscImageChef.Core.Devices
|
|||||||
case DeviceType.ATAPI:
|
case DeviceType.ATAPI:
|
||||||
case DeviceType.SCSI: return ScsiFindReadCommand();
|
case DeviceType.SCSI: return ScsiFindReadCommand();
|
||||||
default:
|
default:
|
||||||
errorMessage = string.Format("Unknown device type {0}.", dev.Type);
|
ErrorMessage = string.Format("Unknown device type {0}.", dev.Type);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,7 +107,7 @@ namespace DiscImageChef.Core.Devices
|
|||||||
case DeviceType.ATAPI:
|
case DeviceType.ATAPI:
|
||||||
case DeviceType.SCSI: return ScsiGetBlockSize();
|
case DeviceType.SCSI: return ScsiGetBlockSize();
|
||||||
default:
|
default:
|
||||||
errorMessage = string.Format("Unknown device type {0}.", dev.Type);
|
ErrorMessage = string.Format("Unknown device type {0}.", dev.Type);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -148,7 +120,7 @@ namespace DiscImageChef.Core.Devices
|
|||||||
case DeviceType.ATAPI:
|
case DeviceType.ATAPI:
|
||||||
case DeviceType.SCSI: return ScsiGetBlocksToRead(startWithBlocks);
|
case DeviceType.SCSI: return ScsiGetBlocksToRead(startWithBlocks);
|
||||||
default:
|
default:
|
||||||
errorMessage = string.Format("Unknown device type {0}.", dev.Type);
|
ErrorMessage = string.Format("Unknown device type {0}.", dev.Type);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -160,7 +132,7 @@ namespace DiscImageChef.Core.Devices
|
|||||||
|
|
||||||
internal bool ReadBlocks(out byte[] buffer, ulong block, out double duration)
|
internal bool ReadBlocks(out byte[] buffer, ulong block, out double duration)
|
||||||
{
|
{
|
||||||
return ReadBlocks(out buffer, block, blocksToRead, out duration);
|
return ReadBlocks(out buffer, block, BlocksToRead, out duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal bool ReadBlocks(out byte[] buffer, ulong block, uint count, out double duration)
|
internal bool ReadBlocks(out byte[] buffer, ulong block, uint count, out double duration)
|
||||||
|
|||||||
@@ -49,30 +49,15 @@ namespace DiscImageChef.Core.Devices
|
|||||||
bool ataReadRetry;
|
bool ataReadRetry;
|
||||||
bool ataReadDma;
|
bool ataReadDma;
|
||||||
bool ataReadDmaRetry;
|
bool ataReadDmaRetry;
|
||||||
bool lbaMode;
|
|
||||||
ushort cylinders;
|
|
||||||
byte heads, sectors;
|
|
||||||
bool ataSeek;
|
bool ataSeek;
|
||||||
bool ataSeekLba;
|
bool ataSeekLba;
|
||||||
|
|
||||||
Identify.IdentifyDevice ataId;
|
Identify.IdentifyDevice ataId;
|
||||||
|
|
||||||
internal bool IsLba
|
internal bool IsLba { get; private set; }
|
||||||
{
|
internal ushort Cylinders { get; private set; }
|
||||||
get { return lbaMode; }
|
internal byte Heads { get; private set; }
|
||||||
}
|
internal byte Sectors { get; private set; }
|
||||||
internal ushort Cylinders
|
|
||||||
{
|
|
||||||
get { return cylinders; }
|
|
||||||
}
|
|
||||||
internal byte Heads
|
|
||||||
{
|
|
||||||
get { return heads; }
|
|
||||||
}
|
|
||||||
internal byte Sectors
|
|
||||||
{
|
|
||||||
get { return sectors; }
|
|
||||||
}
|
|
||||||
|
|
||||||
(uint, byte, byte) GetDeviceChs()
|
(uint, byte, byte) GetDeviceChs()
|
||||||
{
|
{
|
||||||
@@ -80,22 +65,22 @@ namespace DiscImageChef.Core.Devices
|
|||||||
|
|
||||||
if(ataId.CurrentCylinders > 0 && ataId.CurrentHeads > 0 && ataId.CurrentSectorsPerTrack > 0)
|
if(ataId.CurrentCylinders > 0 && ataId.CurrentHeads > 0 && ataId.CurrentSectorsPerTrack > 0)
|
||||||
{
|
{
|
||||||
cylinders = ataId.CurrentCylinders;
|
Cylinders = ataId.CurrentCylinders;
|
||||||
heads = (byte)ataId.CurrentHeads;
|
Heads = (byte)ataId.CurrentHeads;
|
||||||
sectors = (byte)ataId.CurrentSectorsPerTrack;
|
Sectors = (byte)ataId.CurrentSectorsPerTrack;
|
||||||
blocks = (ulong)(cylinders * heads * sectors);
|
Blocks = (ulong)(Cylinders * Heads * Sectors);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((ataId.CurrentCylinders != 0 && ataId.CurrentHeads != 0 && ataId.CurrentSectorsPerTrack != 0) ||
|
if((ataId.CurrentCylinders != 0 && ataId.CurrentHeads != 0 && ataId.CurrentSectorsPerTrack != 0) ||
|
||||||
ataId.Cylinders <= 0 || ataId.Heads <= 0 ||
|
ataId.Cylinders <= 0 || ataId.Heads <= 0 ||
|
||||||
ataId.SectorsPerTrack <= 0) return (cylinders, heads, sectors);
|
ataId.SectorsPerTrack <= 0) return (Cylinders, Heads, Sectors);
|
||||||
|
|
||||||
cylinders = ataId.Cylinders;
|
Cylinders = ataId.Cylinders;
|
||||||
heads = (byte)ataId.Heads;
|
Heads = (byte)ataId.Heads;
|
||||||
sectors = (byte)ataId.SectorsPerTrack;
|
Sectors = (byte)ataId.SectorsPerTrack;
|
||||||
blocks = (ulong)(cylinders * heads * sectors);
|
Blocks = (ulong)(Cylinders * Heads * Sectors);
|
||||||
|
|
||||||
return (cylinders, heads, sectors);
|
return (Cylinders, Heads, Sectors);
|
||||||
}
|
}
|
||||||
|
|
||||||
ulong AtaGetBlocks()
|
ulong AtaGetBlocks()
|
||||||
@@ -104,16 +89,16 @@ namespace DiscImageChef.Core.Devices
|
|||||||
|
|
||||||
if(ataId.Capabilities.HasFlag(Identify.CapabilitiesBit.LBASupport))
|
if(ataId.Capabilities.HasFlag(Identify.CapabilitiesBit.LBASupport))
|
||||||
{
|
{
|
||||||
blocks = ataId.LBASectors;
|
Blocks = ataId.LBASectors;
|
||||||
lbaMode = true;
|
IsLba = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ataId.CommandSet2.HasFlag(Identify.CommandSetBit2.LBA48)) return blocks;
|
if(!ataId.CommandSet2.HasFlag(Identify.CommandSetBit2.LBA48)) return Blocks;
|
||||||
|
|
||||||
blocks = ataId.LBA48Sectors;
|
Blocks = ataId.LBA48Sectors;
|
||||||
lbaMode = true;
|
IsLba = true;
|
||||||
|
|
||||||
return blocks;
|
return Blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AtaFindReadCommand()
|
bool AtaFindReadCommand()
|
||||||
@@ -153,17 +138,17 @@ namespace DiscImageChef.Core.Devices
|
|||||||
sense = dev.Seek(out errorLba, 0, timeout, out duration);
|
sense = dev.Seek(out errorLba, 0, timeout, out duration);
|
||||||
ataSeekLba = !sense && (errorLba.status & 0x27) == 0 && errorChs.error == 0;
|
ataSeekLba = !sense && (errorLba.status & 0x27) == 0 && errorChs.error == 0;
|
||||||
|
|
||||||
if(lbaMode)
|
if(IsLba)
|
||||||
{
|
{
|
||||||
if(blocks > 0xFFFFFFF && !ataReadLba48 && !ataReadDmaLba48)
|
if(Blocks > 0xFFFFFFF && !ataReadLba48 && !ataReadDmaLba48)
|
||||||
{
|
{
|
||||||
errorMessage = "Device needs 48-bit LBA commands but I can't issue them... Aborting.";
|
ErrorMessage = "Device needs 48-bit LBA commands but I can't issue them... Aborting.";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ataReadLba && !ataReadRetryLba && !ataReadDmaLba && !ataReadDmaRetryLba)
|
if(!ataReadLba && !ataReadRetryLba && !ataReadDmaLba && !ataReadDmaRetryLba)
|
||||||
{
|
{
|
||||||
errorMessage = "Device needs 28-bit LBA commands but I can't issue them... Aborting.";
|
ErrorMessage = "Device needs 28-bit LBA commands but I can't issue them... Aborting.";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -171,7 +156,7 @@ namespace DiscImageChef.Core.Devices
|
|||||||
{
|
{
|
||||||
if(!ataRead && !ataReadRetry && !ataReadDma && !ataReadDmaRetry)
|
if(!ataRead && !ataReadRetry && !ataReadDma && !ataReadDmaRetry)
|
||||||
{
|
{
|
||||||
errorMessage = "Device needs CHS commands but I can't issue them... Aborting.";
|
ErrorMessage = "Device needs CHS commands but I can't issue them... Aborting.";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -188,7 +173,7 @@ namespace DiscImageChef.Core.Devices
|
|||||||
else if(ataRead) DicConsole.WriteLine("Using ATA READ command (CHS).");
|
else if(ataRead) DicConsole.WriteLine("Using ATA READ command (CHS).");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
errorMessage = "Could not get a working read command!";
|
ErrorMessage = "Could not get a working read command!";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,37 +185,37 @@ namespace DiscImageChef.Core.Devices
|
|||||||
if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000)
|
if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000)
|
||||||
{
|
{
|
||||||
if((ataId.PhysLogSectorSize & 0x1000) == 0x1000)
|
if((ataId.PhysLogSectorSize & 0x1000) == 0x1000)
|
||||||
if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) blockSize = 512;
|
if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) LogicalBlockSize = 512;
|
||||||
else blockSize = ataId.LogicalSectorWords * 2;
|
else LogicalBlockSize = ataId.LogicalSectorWords * 2;
|
||||||
else blockSize = 512;
|
else LogicalBlockSize = 512;
|
||||||
|
|
||||||
if((ataId.PhysLogSectorSize & 0x2000) == 0x2000)
|
if((ataId.PhysLogSectorSize & 0x2000) == 0x2000)
|
||||||
{
|
{
|
||||||
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
|
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
|
||||||
physicalsectorsize = blockSize * (uint)Math.Pow(2, (double)(ataId.PhysLogSectorSize & 0xF));
|
PhysicalBlockSize = LogicalBlockSize * (uint)Math.Pow(2, (double)(ataId.PhysLogSectorSize & 0xF));
|
||||||
#pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created
|
#pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created
|
||||||
}
|
}
|
||||||
else physicalsectorsize = blockSize;
|
else PhysicalBlockSize = LogicalBlockSize;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
blockSize = 512;
|
LogicalBlockSize = 512;
|
||||||
physicalsectorsize = 512;
|
PhysicalBlockSize = 512;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: ATA READ LONG
|
// TODO: ATA READ LONG
|
||||||
longBlockSize = 0;
|
LongBlockSize = 0;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AtaGetBlocksToRead(uint startWithBlocks)
|
bool AtaGetBlocksToRead(uint startWithBlocks)
|
||||||
{
|
{
|
||||||
blocksToRead = startWithBlocks;
|
BlocksToRead = startWithBlocks;
|
||||||
|
|
||||||
if(!lbaMode)
|
if(!IsLba)
|
||||||
{
|
{
|
||||||
blocksToRead = 1;
|
BlocksToRead = 1;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,48 +226,48 @@ namespace DiscImageChef.Core.Devices
|
|||||||
double duration;
|
double duration;
|
||||||
bool error = true;
|
bool error = true;
|
||||||
|
|
||||||
while(lbaMode)
|
while(IsLba)
|
||||||
{
|
{
|
||||||
if(ataReadDmaLba48)
|
if(ataReadDmaLba48)
|
||||||
{
|
{
|
||||||
sense = dev.ReadDma(out cmdBuf, out errorLba48, 0, (byte)blocksToRead, timeout, out duration);
|
sense = dev.ReadDma(out cmdBuf, out errorLba48, 0, (byte)BlocksToRead, timeout, out duration);
|
||||||
error = !(!sense && (errorLba48.status & 0x27) == 0 && errorLba48.error == 0 && cmdBuf.Length > 0);
|
error = !(!sense && (errorLba48.status & 0x27) == 0 && errorLba48.error == 0 && cmdBuf.Length > 0);
|
||||||
}
|
}
|
||||||
else if(ataReadLba48)
|
else if(ataReadLba48)
|
||||||
{
|
{
|
||||||
sense = dev.Read(out cmdBuf, out errorLba48, 0, (byte)blocksToRead, timeout, out duration);
|
sense = dev.Read(out cmdBuf, out errorLba48, 0, (byte)BlocksToRead, timeout, out duration);
|
||||||
error = !(!sense && (errorLba48.status & 0x27) == 0 && errorLba48.error == 0 && cmdBuf.Length > 0);
|
error = !(!sense && (errorLba48.status & 0x27) == 0 && errorLba48.error == 0 && cmdBuf.Length > 0);
|
||||||
}
|
}
|
||||||
else if(ataReadDmaRetryLba)
|
else if(ataReadDmaRetryLba)
|
||||||
{
|
{
|
||||||
sense = dev.ReadDma(out cmdBuf, out errorLba, true, 0, (byte)blocksToRead, timeout, out duration);
|
sense = dev.ReadDma(out cmdBuf, out errorLba, true, 0, (byte)BlocksToRead, timeout, out duration);
|
||||||
error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0);
|
error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0);
|
||||||
}
|
}
|
||||||
else if(ataReadDmaLba)
|
else if(ataReadDmaLba)
|
||||||
{
|
{
|
||||||
sense = dev.ReadDma(out cmdBuf, out errorLba, false, 0, (byte)blocksToRead, timeout, out duration);
|
sense = dev.ReadDma(out cmdBuf, out errorLba, false, 0, (byte)BlocksToRead, timeout, out duration);
|
||||||
error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0);
|
error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0);
|
||||||
}
|
}
|
||||||
else if(ataReadRetryLba)
|
else if(ataReadRetryLba)
|
||||||
{
|
{
|
||||||
sense = dev.Read(out cmdBuf, out errorLba, true, 0, (byte)blocksToRead, timeout, out duration);
|
sense = dev.Read(out cmdBuf, out errorLba, true, 0, (byte)BlocksToRead, timeout, out duration);
|
||||||
error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0);
|
error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0);
|
||||||
}
|
}
|
||||||
else if(ataReadLba)
|
else if(ataReadLba)
|
||||||
{
|
{
|
||||||
sense = dev.Read(out cmdBuf, out errorLba, false, 0, (byte)blocksToRead, timeout, out duration);
|
sense = dev.Read(out cmdBuf, out errorLba, false, 0, (byte)BlocksToRead, timeout, out duration);
|
||||||
error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0);
|
error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(error) blocksToRead /= 2;
|
if(error) BlocksToRead /= 2;
|
||||||
|
|
||||||
if(!error || blocksToRead == 1) break;
|
if(!error || BlocksToRead == 1) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!error || !lbaMode) return false;
|
if(!error || !IsLba) return false;
|
||||||
|
|
||||||
blocksToRead = 1;
|
BlocksToRead = 1;
|
||||||
errorMessage = string.Format("Device error {0} trying to guess ideal transfer length.", dev.LastError);
|
ErrorMessage = string.Format("Device error {0} trying to guess ideal transfer length.", dev.LastError);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace DiscImageChef.Core.Devices
|
|||||||
|
|
||||||
ulong ScsiGetBlocks()
|
ulong ScsiGetBlocks()
|
||||||
{
|
{
|
||||||
return ScsiGetBlockSize() ? 0 : blocks;
|
return ScsiGetBlockSize() ? 0 : Blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScsiFindReadCommand()
|
bool ScsiFindReadCommand()
|
||||||
@@ -63,15 +63,15 @@ namespace DiscImageChef.Core.Devices
|
|||||||
byte[] senseBuf;
|
byte[] senseBuf;
|
||||||
double duration;
|
double duration;
|
||||||
|
|
||||||
read6 = !dev.Read6(out readBuffer, out senseBuf, 0, blockSize, timeout, out duration);
|
read6 = !dev.Read6(out readBuffer, out senseBuf, 0, LogicalBlockSize, timeout, out duration);
|
||||||
|
|
||||||
read10 = !dev.Read10(out readBuffer, out senseBuf, 0, false, true, false, false, 0, blockSize, 0, 1,
|
read10 = !dev.Read10(out readBuffer, out senseBuf, 0, false, true, false, false, 0, LogicalBlockSize, 0, 1,
|
||||||
timeout, out duration);
|
timeout, out duration);
|
||||||
|
|
||||||
read12 = !dev.Read12(out readBuffer, out senseBuf, 0, false, true, false, false, 0, blockSize, 0, 1, false,
|
read12 = !dev.Read12(out readBuffer, out senseBuf, 0, false, true, false, false, 0, LogicalBlockSize, 0, 1, false,
|
||||||
timeout, out duration);
|
timeout, out duration);
|
||||||
|
|
||||||
read16 = !dev.Read16(out readBuffer, out senseBuf, 0, false, true, false, 0, blockSize, 0, 1, false,
|
read16 = !dev.Read16(out readBuffer, out senseBuf, 0, false, true, false, 0, LogicalBlockSize, 0, 1, false,
|
||||||
timeout, out duration);
|
timeout, out duration);
|
||||||
|
|
||||||
seek6 = !dev.Seek6(out senseBuf, 0, timeout, out duration);
|
seek6 = !dev.Seek6(out senseBuf, 0, timeout, out duration);
|
||||||
@@ -80,35 +80,35 @@ namespace DiscImageChef.Core.Devices
|
|||||||
|
|
||||||
if(!read6 && !read10 && !read12 && !read16)
|
if(!read6 && !read10 && !read12 && !read16)
|
||||||
{
|
{
|
||||||
errorMessage = "Cannot read medium, aborting scan...";
|
ErrorMessage = "Cannot read medium, aborting scan...";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(read6 && !read10 && !read12 && !read16 && blocks > 0x001FFFFF + 1)
|
if(read6 && !read10 && !read12 && !read16 && Blocks > 0x001FFFFF + 1)
|
||||||
{
|
{
|
||||||
errorMessage =
|
ErrorMessage =
|
||||||
string.Format("Device only supports SCSI READ (6) but has more than {0} blocks ({1} blocks total)",
|
string.Format("Device only supports SCSI READ (6) but has more than {0} blocks ({1} blocks total)",
|
||||||
0x001FFFFF + 1, blocks);
|
0x001FFFFF + 1, Blocks);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable IDE0004 // Remove Unnecessary Cast
|
#pragma warning disable IDE0004 // Remove Unnecessary Cast
|
||||||
if(!read16 && blocks > (long)0xFFFFFFFF + (long)1)
|
if(!read16 && Blocks > (long)0xFFFFFFFF + (long)1)
|
||||||
#pragma warning restore IDE0004 // Remove Unnecessary Cast
|
#pragma warning restore IDE0004 // Remove Unnecessary Cast
|
||||||
{
|
{
|
||||||
#pragma warning disable IDE0004 // Remove Unnecessary Cast
|
#pragma warning disable IDE0004 // Remove Unnecessary Cast
|
||||||
errorMessage =
|
ErrorMessage =
|
||||||
string.Format("Device only supports SCSI READ (10) but has more than {0} blocks ({1} blocks total)",
|
string.Format("Device only supports SCSI READ (10) but has more than {0} blocks ({1} blocks total)",
|
||||||
(long)0xFFFFFFFF + (long)1, blocks);
|
(long)0xFFFFFFFF + (long)1, Blocks);
|
||||||
#pragma warning restore IDE0004 // Remove Unnecessary Cast
|
#pragma warning restore IDE0004 // Remove Unnecessary Cast
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(readRaw)
|
if(CanReadRaw)
|
||||||
{
|
{
|
||||||
bool testSense;
|
bool testSense;
|
||||||
Decoders.SCSI.FixedSense? decSense;
|
Decoders.SCSI.FixedSense? decSense;
|
||||||
readRaw = false;
|
CanReadRaw = false;
|
||||||
|
|
||||||
if(dev.ScsiType != Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
|
if(dev.ScsiType != Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
|
||||||
{
|
{
|
||||||
@@ -140,18 +140,18 @@ namespace DiscImageChef.Core.Devices
|
|||||||
if(decSense.Value.SenseKey == Decoders.SCSI.SenseKeys.IllegalRequest &&
|
if(decSense.Value.SenseKey == Decoders.SCSI.SenseKeys.IllegalRequest &&
|
||||||
decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00)
|
decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00)
|
||||||
{
|
{
|
||||||
readRaw = true;
|
CanReadRaw = true;
|
||||||
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
||||||
{
|
{
|
||||||
longBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF);
|
LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF);
|
||||||
readLong10 = !dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0,
|
readLong10 = !dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0,
|
||||||
(ushort)longBlockSize, timeout, out duration);
|
(ushort)LongBlockSize, timeout, out duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(readRaw && longBlockSize == blockSize)
|
if(CanReadRaw && LongBlockSize == LogicalBlockSize)
|
||||||
if(blockSize == 512)
|
if(LogicalBlockSize == 512)
|
||||||
foreach(ushort testSize in new[]
|
foreach(ushort testSize in new[]
|
||||||
{
|
{
|
||||||
// Long sector sizes for floppies
|
// Long sector sizes for floppies
|
||||||
@@ -167,8 +167,8 @@ namespace DiscImageChef.Core.Devices
|
|||||||
if(!testSense && !dev.Error)
|
if(!testSense && !dev.Error)
|
||||||
{
|
{
|
||||||
readLong16 = true;
|
readLong16 = true;
|
||||||
longBlockSize = testSize;
|
LongBlockSize = testSize;
|
||||||
readRaw = true;
|
CanReadRaw = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,11 +177,11 @@ namespace DiscImageChef.Core.Devices
|
|||||||
if(testSense || dev.Error) continue;
|
if(testSense || dev.Error) continue;
|
||||||
|
|
||||||
readLong10 = true;
|
readLong10 = true;
|
||||||
longBlockSize = testSize;
|
LongBlockSize = testSize;
|
||||||
readRaw = true;
|
CanReadRaw = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(blockSize == 1024)
|
else if(LogicalBlockSize == 1024)
|
||||||
foreach(ushort testSize in new[]
|
foreach(ushort testSize in new[]
|
||||||
{
|
{
|
||||||
// Long sector sizes for floppies
|
// Long sector sizes for floppies
|
||||||
@@ -195,8 +195,8 @@ namespace DiscImageChef.Core.Devices
|
|||||||
if(!testSense && !dev.Error)
|
if(!testSense && !dev.Error)
|
||||||
{
|
{
|
||||||
readLong16 = true;
|
readLong16 = true;
|
||||||
longBlockSize = testSize;
|
LongBlockSize = testSize;
|
||||||
readRaw = true;
|
CanReadRaw = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,19 +205,19 @@ namespace DiscImageChef.Core.Devices
|
|||||||
if(testSense || dev.Error) continue;
|
if(testSense || dev.Error) continue;
|
||||||
|
|
||||||
readLong10 = true;
|
readLong10 = true;
|
||||||
longBlockSize = testSize;
|
LongBlockSize = testSize;
|
||||||
readRaw = true;
|
CanReadRaw = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(blockSize == 2048)
|
else if(LogicalBlockSize == 2048)
|
||||||
{
|
{
|
||||||
testSense = dev.ReadLong16(out readBuffer, out senseBuf, false, 0, 2380, timeout,
|
testSense = dev.ReadLong16(out readBuffer, out senseBuf, false, 0, 2380, timeout,
|
||||||
out duration);
|
out duration);
|
||||||
if(!testSense && !dev.Error)
|
if(!testSense && !dev.Error)
|
||||||
{
|
{
|
||||||
readLong16 = true;
|
readLong16 = true;
|
||||||
longBlockSize = 2380;
|
LongBlockSize = 2380;
|
||||||
readRaw = true;
|
CanReadRaw = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -226,20 +226,20 @@ namespace DiscImageChef.Core.Devices
|
|||||||
if(!testSense && !dev.Error)
|
if(!testSense && !dev.Error)
|
||||||
{
|
{
|
||||||
readLong10 = true;
|
readLong10 = true;
|
||||||
longBlockSize = 2380;
|
LongBlockSize = 2380;
|
||||||
readRaw = true;
|
CanReadRaw = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(blockSize == 4096)
|
else if(LogicalBlockSize == 4096)
|
||||||
{
|
{
|
||||||
testSense = dev.ReadLong16(out readBuffer, out senseBuf, false, 0, 4760, timeout,
|
testSense = dev.ReadLong16(out readBuffer, out senseBuf, false, 0, 4760, timeout,
|
||||||
out duration);
|
out duration);
|
||||||
if(!testSense && !dev.Error)
|
if(!testSense && !dev.Error)
|
||||||
{
|
{
|
||||||
readLong16 = true;
|
readLong16 = true;
|
||||||
longBlockSize = 4760;
|
LongBlockSize = 4760;
|
||||||
readRaw = true;
|
CanReadRaw = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -248,20 +248,20 @@ namespace DiscImageChef.Core.Devices
|
|||||||
if(!testSense && !dev.Error)
|
if(!testSense && !dev.Error)
|
||||||
{
|
{
|
||||||
readLong10 = true;
|
readLong10 = true;
|
||||||
longBlockSize = 4760;
|
LongBlockSize = 4760;
|
||||||
readRaw = true;
|
CanReadRaw = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(blockSize == 8192)
|
else if(LogicalBlockSize == 8192)
|
||||||
{
|
{
|
||||||
testSense = dev.ReadLong16(out readBuffer, out senseBuf, false, 0, 9424, timeout,
|
testSense = dev.ReadLong16(out readBuffer, out senseBuf, false, 0, 9424, timeout,
|
||||||
out duration);
|
out duration);
|
||||||
if(!testSense && !dev.Error)
|
if(!testSense && !dev.Error)
|
||||||
{
|
{
|
||||||
readLong16 = true;
|
readLong16 = true;
|
||||||
longBlockSize = 9424;
|
LongBlockSize = 9424;
|
||||||
readRaw = true;
|
CanReadRaw = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -270,13 +270,13 @@ namespace DiscImageChef.Core.Devices
|
|||||||
if(!testSense && !dev.Error)
|
if(!testSense && !dev.Error)
|
||||||
{
|
{
|
||||||
readLong10 = true;
|
readLong10 = true;
|
||||||
longBlockSize = 9424;
|
LongBlockSize = 9424;
|
||||||
readRaw = true;
|
CanReadRaw = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!readRaw && dev.Manufacturer == "SYQUEST")
|
if(!CanReadRaw && dev.Manufacturer == "SYQUEST")
|
||||||
{
|
{
|
||||||
testSense = dev.SyQuestReadLong10(out readBuffer, out senseBuf, 0, 0xFFFF, timeout,
|
testSense = dev.SyQuestReadLong10(out readBuffer, out senseBuf, 0, 0xFFFF, timeout,
|
||||||
out duration);
|
out duration);
|
||||||
@@ -287,12 +287,12 @@ namespace DiscImageChef.Core.Devices
|
|||||||
if(decSense.Value.SenseKey == Decoders.SCSI.SenseKeys.IllegalRequest &&
|
if(decSense.Value.SenseKey == Decoders.SCSI.SenseKeys.IllegalRequest &&
|
||||||
decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00)
|
decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00)
|
||||||
{
|
{
|
||||||
readRaw = true;
|
CanReadRaw = true;
|
||||||
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
||||||
{
|
{
|
||||||
longBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF);
|
LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF);
|
||||||
syqReadLong10 =
|
syqReadLong10 =
|
||||||
!dev.SyQuestReadLong10(out readBuffer, out senseBuf, 0, longBlockSize,
|
!dev.SyQuestReadLong10(out readBuffer, out senseBuf, 0, LongBlockSize,
|
||||||
timeout, out duration);
|
timeout, out duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -307,28 +307,28 @@ namespace DiscImageChef.Core.Devices
|
|||||||
if(decSense.Value.SenseKey == Decoders.SCSI.SenseKeys.IllegalRequest &&
|
if(decSense.Value.SenseKey == Decoders.SCSI.SenseKeys.IllegalRequest &&
|
||||||
decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00)
|
decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00)
|
||||||
{
|
{
|
||||||
readRaw = true;
|
CanReadRaw = true;
|
||||||
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
||||||
{
|
{
|
||||||
longBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF);
|
LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF);
|
||||||
syqReadLong6 =
|
syqReadLong6 =
|
||||||
!dev.SyQuestReadLong6(out readBuffer, out senseBuf, 0,
|
!dev.SyQuestReadLong6(out readBuffer, out senseBuf, 0,
|
||||||
longBlockSize, timeout, out duration);
|
LongBlockSize, timeout, out duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!readRaw && blockSize == 256)
|
if(!CanReadRaw && LogicalBlockSize == 256)
|
||||||
{
|
{
|
||||||
testSense = dev.SyQuestReadLong6(out readBuffer, out senseBuf, 0, 262, timeout,
|
testSense = dev.SyQuestReadLong6(out readBuffer, out senseBuf, 0, 262, timeout,
|
||||||
out duration);
|
out duration);
|
||||||
if(!testSense && !dev.Error)
|
if(!testSense && !dev.Error)
|
||||||
{
|
{
|
||||||
syqReadLong6 = true;
|
syqReadLong6 = true;
|
||||||
longBlockSize = 262;
|
LongBlockSize = 262;
|
||||||
readRaw = true;
|
CanReadRaw = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -348,26 +348,26 @@ namespace DiscImageChef.Core.Devices
|
|||||||
|
|
||||||
if(hldtstReadRaw || plextorReadRaw)
|
if(hldtstReadRaw || plextorReadRaw)
|
||||||
{
|
{
|
||||||
readRaw = true;
|
CanReadRaw = true;
|
||||||
longBlockSize = 2064;
|
LongBlockSize = 2064;
|
||||||
}
|
}
|
||||||
|
|
||||||
// READ LONG (10) for some DVD drives
|
// READ LONG (10) for some DVD drives
|
||||||
if(!readRaw && dev.Manufacturer == "MATSHITA")
|
if(!CanReadRaw && dev.Manufacturer == "MATSHITA")
|
||||||
{
|
{
|
||||||
testSense = dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, 37856, timeout,
|
testSense = dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, 37856, timeout,
|
||||||
out duration);
|
out duration);
|
||||||
if(!testSense && !dev.Error)
|
if(!testSense && !dev.Error)
|
||||||
{
|
{
|
||||||
readLongDvd = true;
|
readLongDvd = true;
|
||||||
longBlockSize = 37856;
|
LongBlockSize = 37856;
|
||||||
readRaw = true;
|
CanReadRaw = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(readRaw)
|
if(CanReadRaw)
|
||||||
{
|
{
|
||||||
if(readLong16) DicConsole.WriteLine("Using SCSI READ LONG (16) command.");
|
if(readLong16) DicConsole.WriteLine("Using SCSI READ LONG (16) command.");
|
||||||
else if(readLong10 || readLongDvd) DicConsole.WriteLine("Using SCSI READ LONG (10) command.");
|
else if(readLong10 || readLongDvd) DicConsole.WriteLine("Using SCSI READ LONG (10) command.");
|
||||||
@@ -390,23 +390,23 @@ namespace DiscImageChef.Core.Devices
|
|||||||
byte[] cmdBuf;
|
byte[] cmdBuf;
|
||||||
byte[] senseBuf;
|
byte[] senseBuf;
|
||||||
double duration;
|
double duration;
|
||||||
blocks = 0;
|
Blocks = 0;
|
||||||
|
|
||||||
sense = dev.ReadCapacity(out cmdBuf, out senseBuf, timeout, out duration);
|
sense = dev.ReadCapacity(out cmdBuf, out senseBuf, timeout, out duration);
|
||||||
if(!sense)
|
if(!sense)
|
||||||
{
|
{
|
||||||
blocks = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + cmdBuf[3]);
|
Blocks = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + cmdBuf[3]);
|
||||||
blockSize = (uint)((cmdBuf[5] << 24) + (cmdBuf[5] << 16) + (cmdBuf[6] << 8) + cmdBuf[7]);
|
LogicalBlockSize = (uint)((cmdBuf[5] << 24) + (cmdBuf[5] << 16) + (cmdBuf[6] << 8) + cmdBuf[7]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sense || blocks == 0xFFFFFFFF)
|
if(sense || Blocks == 0xFFFFFFFF)
|
||||||
{
|
{
|
||||||
sense = dev.ReadCapacity16(out cmdBuf, out senseBuf, timeout, out duration);
|
sense = dev.ReadCapacity16(out cmdBuf, out senseBuf, timeout, out duration);
|
||||||
|
|
||||||
if(sense && blocks == 0)
|
if(sense && Blocks == 0)
|
||||||
if(dev.ScsiType != Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
|
if(dev.ScsiType != Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
|
||||||
{
|
{
|
||||||
errorMessage = string.Format("Unable to get media capacity\n" + "{0}",
|
ErrorMessage = string.Format("Unable to get media capacity\n" + "{0}",
|
||||||
Decoders.SCSI.Sense.PrettifySense(senseBuf));
|
Decoders.SCSI.Sense.PrettifySense(senseBuf));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -418,13 +418,13 @@ namespace DiscImageChef.Core.Devices
|
|||||||
|
|
||||||
Array.Copy(cmdBuf, 0, temp, 0, 8);
|
Array.Copy(cmdBuf, 0, temp, 0, 8);
|
||||||
Array.Reverse(temp);
|
Array.Reverse(temp);
|
||||||
blocks = BitConverter.ToUInt64(temp, 0);
|
Blocks = BitConverter.ToUInt64(temp, 0);
|
||||||
blockSize = (uint)((cmdBuf[5] << 24) + (cmdBuf[5] << 16) + (cmdBuf[6] << 8) + cmdBuf[7]);
|
LogicalBlockSize = (uint)((cmdBuf[5] << 24) + (cmdBuf[5] << 16) + (cmdBuf[6] << 8) + cmdBuf[7]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
physicalsectorsize = blockSize;
|
PhysicalBlockSize = LogicalBlockSize;
|
||||||
longBlockSize = blockSize;
|
LongBlockSize = LogicalBlockSize;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -434,42 +434,42 @@ namespace DiscImageChef.Core.Devices
|
|||||||
byte[] readBuffer;
|
byte[] readBuffer;
|
||||||
byte[] senseBuf;
|
byte[] senseBuf;
|
||||||
double duration;
|
double duration;
|
||||||
blocksToRead = startWithBlocks;
|
BlocksToRead = startWithBlocks;
|
||||||
|
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
if(read16)
|
if(read16)
|
||||||
{
|
{
|
||||||
sense = dev.Read16(out readBuffer, out senseBuf, 0, false, true, false, 0, blockSize, 0,
|
sense = dev.Read16(out readBuffer, out senseBuf, 0, false, true, false, 0, LogicalBlockSize, 0,
|
||||||
blocksToRead, false, timeout, out duration);
|
BlocksToRead, false, timeout, out duration);
|
||||||
if(dev.Error) blocksToRead /= 2;
|
if(dev.Error) BlocksToRead /= 2;
|
||||||
}
|
}
|
||||||
else if(read12)
|
else if(read12)
|
||||||
{
|
{
|
||||||
sense = dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, 0, blockSize, 0,
|
sense = dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, 0, LogicalBlockSize, 0,
|
||||||
blocksToRead, false, timeout, out duration);
|
BlocksToRead, false, timeout, out duration);
|
||||||
if(dev.Error) blocksToRead /= 2;
|
if(dev.Error) BlocksToRead /= 2;
|
||||||
}
|
}
|
||||||
else if(read10)
|
else if(read10)
|
||||||
{
|
{
|
||||||
sense = dev.Read10(out readBuffer, out senseBuf, 0, false, true, false, false, 0, blockSize, 0,
|
sense = dev.Read10(out readBuffer, out senseBuf, 0, false, true, false, false, 0, LogicalBlockSize, 0,
|
||||||
(ushort)blocksToRead, timeout, out duration);
|
(ushort)BlocksToRead, timeout, out duration);
|
||||||
if(dev.Error) blocksToRead /= 2;
|
if(dev.Error) BlocksToRead /= 2;
|
||||||
}
|
}
|
||||||
else if(read6)
|
else if(read6)
|
||||||
{
|
{
|
||||||
sense = dev.Read6(out readBuffer, out senseBuf, 0, blockSize, (byte)blocksToRead, timeout,
|
sense = dev.Read6(out readBuffer, out senseBuf, 0, LogicalBlockSize, (byte)BlocksToRead, timeout,
|
||||||
out duration);
|
out duration);
|
||||||
if(dev.Error) blocksToRead /= 2;
|
if(dev.Error) BlocksToRead /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!dev.Error || blocksToRead == 1) break;
|
if(!dev.Error || BlocksToRead == 1) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!dev.Error) return false;
|
if(!dev.Error) return false;
|
||||||
|
|
||||||
blocksToRead = 1;
|
BlocksToRead = 1;
|
||||||
errorMessage = string.Format("Device error {0} trying to guess ideal transfer length.", dev.LastError);
|
ErrorMessage = string.Format("Device error {0} trying to guess ideal transfer length.", dev.LastError);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -480,39 +480,39 @@ namespace DiscImageChef.Core.Devices
|
|||||||
buffer = null;
|
buffer = null;
|
||||||
duration = 0;
|
duration = 0;
|
||||||
|
|
||||||
if(readRaw)
|
if(CanReadRaw)
|
||||||
if(readLong16)
|
if(readLong16)
|
||||||
sense = dev.ReadLong16(out buffer, out senseBuf, false, block, longBlockSize, timeout,
|
sense = dev.ReadLong16(out buffer, out senseBuf, false, block, LongBlockSize, timeout,
|
||||||
out duration);
|
out duration);
|
||||||
else if(readLong10)
|
else if(readLong10)
|
||||||
sense = dev.ReadLong10(out buffer, out senseBuf, false, false, (uint)block, (ushort)longBlockSize,
|
sense = dev.ReadLong10(out buffer, out senseBuf, false, false, (uint)block, (ushort)LongBlockSize,
|
||||||
timeout, out duration);
|
timeout, out duration);
|
||||||
else if(syqReadLong10)
|
else if(syqReadLong10)
|
||||||
sense = dev.SyQuestReadLong10(out buffer, out senseBuf, (uint)block, longBlockSize, timeout,
|
sense = dev.SyQuestReadLong10(out buffer, out senseBuf, (uint)block, LongBlockSize, timeout,
|
||||||
out duration);
|
out duration);
|
||||||
else if(syqReadLong6)
|
else if(syqReadLong6)
|
||||||
sense = dev.SyQuestReadLong6(out buffer, out senseBuf, (uint)block, longBlockSize, timeout,
|
sense = dev.SyQuestReadLong6(out buffer, out senseBuf, (uint)block, LongBlockSize, timeout,
|
||||||
out duration);
|
out duration);
|
||||||
else if(hldtstReadRaw)
|
else if(hldtstReadRaw)
|
||||||
sense = dev.HlDtStReadRawDvd(out buffer, out senseBuf, (uint)block, longBlockSize, timeout,
|
sense = dev.HlDtStReadRawDvd(out buffer, out senseBuf, (uint)block, LongBlockSize, timeout,
|
||||||
out duration);
|
out duration);
|
||||||
else if(plextorReadRaw)
|
else if(plextorReadRaw)
|
||||||
sense = dev.PlextorReadRawDvd(out buffer, out senseBuf, (uint)block, longBlockSize, timeout,
|
sense = dev.PlextorReadRawDvd(out buffer, out senseBuf, (uint)block, LongBlockSize, timeout,
|
||||||
out duration);
|
out duration);
|
||||||
else return true;
|
else return true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(read16)
|
if(read16)
|
||||||
sense = dev.Read16(out buffer, out senseBuf, 0, false, true, false, block, blockSize, 0, count,
|
sense = dev.Read16(out buffer, out senseBuf, 0, false, true, false, block, LogicalBlockSize, 0, count,
|
||||||
false, timeout, out duration);
|
false, timeout, out duration);
|
||||||
else if(read12)
|
else if(read12)
|
||||||
sense = dev.Read12(out buffer, out senseBuf, 0, false, false, false, false, (uint)block, blockSize,
|
sense = dev.Read12(out buffer, out senseBuf, 0, false, false, false, false, (uint)block, LogicalBlockSize,
|
||||||
0, count, false, timeout, out duration);
|
0, count, false, timeout, out duration);
|
||||||
else if(read10)
|
else if(read10)
|
||||||
sense = dev.Read10(out buffer, out senseBuf, 0, false, true, false, false, (uint)block, blockSize,
|
sense = dev.Read10(out buffer, out senseBuf, 0, false, true, false, false, (uint)block, LogicalBlockSize,
|
||||||
0, (ushort)count, timeout, out duration);
|
0, (ushort)count, timeout, out duration);
|
||||||
else if(read6)
|
else if(read6)
|
||||||
sense = dev.Read6(out buffer, out senseBuf, (uint)block, blockSize, (byte)count, timeout,
|
sense = dev.Read6(out buffer, out senseBuf, (uint)block, LogicalBlockSize, (byte)count, timeout,
|
||||||
out duration);
|
out duration);
|
||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,10 +46,10 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
registers.command = (byte)AtaCommands.ReadBuffer;
|
registers.command = (byte)AtaCommands.ReadBuffer;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "READ BUFFER took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "READ BUFFER took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -65,9 +65,9 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
registers.command = (byte)AtaCommands.ReadBufferDma;
|
registers.command = (byte)AtaCommands.ReadBufferDma;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.NoTransfer,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.NoTransfer,
|
||||||
ref buffer, timeout, false, out duration, out sense);
|
ref buffer, timeout, false, out duration, out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "READ BUFFER DMA took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "READ BUFFER DMA took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -97,9 +97,9 @@ namespace DiscImageChef.Devices
|
|||||||
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
|
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
|
||||||
registers.deviceHead += 0x40;
|
registers.deviceHead += 0x40;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount,
|
||||||
ref buffer, timeout, true, out duration, out sense);
|
ref buffer, timeout, true, out duration, out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "READ DMA took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "READ DMA took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -122,10 +122,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
|
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
|
||||||
registers.deviceHead += 0x40;
|
registers.deviceHead += 0x40;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "READ MULTIPLE took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "READ MULTIPLE took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -143,10 +143,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.command = (byte)AtaCommands.ReadNativeMaxAddress;
|
registers.command = (byte)AtaCommands.ReadNativeMaxAddress;
|
||||||
registers.deviceHead += 0x40;
|
registers.deviceHead += 0x40;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
if((statusRegisters.status & 0x23) == 0)
|
if((statusRegisters.status & 0x23) == 0)
|
||||||
{
|
{
|
||||||
@@ -185,10 +185,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
|
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
|
||||||
registers.deviceHead += 0x40;
|
registers.deviceHead += 0x40;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "READ SECTORS took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "READ SECTORS took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -217,10 +217,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
|
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
|
||||||
registers.deviceHead += 0x40;
|
registers.deviceHead += 0x40;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "READ LONG took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "READ LONG took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -240,10 +240,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
|
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
|
||||||
registers.deviceHead += 0x40;
|
registers.deviceHead += 0x40;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "SEEK took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "SEEK took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -48,10 +48,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.command = (byte)AtaCommands.NativeMaxAddress;
|
registers.command = (byte)AtaCommands.NativeMaxAddress;
|
||||||
registers.feature = 0x0000;
|
registers.feature = 0x0000;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
if((statusRegisters.status & 0x23) == 0)
|
if((statusRegisters.status & 0x23) == 0)
|
||||||
{
|
{
|
||||||
@@ -81,9 +81,9 @@ namespace DiscImageChef.Devices
|
|||||||
registers.lbaLow = (ushort)((lba & 0xFFFF) / 0x1);
|
registers.lbaLow = (ushort)((lba & 0xFFFF) / 0x1);
|
||||||
registers.deviceHead += 0x40;
|
registers.deviceHead += 0x40;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount,
|
||||||
ref buffer, timeout, true, out duration, out sense);
|
ref buffer, timeout, true, out duration, out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "READ DMA EXT took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "READ DMA EXT took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -103,10 +103,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.lbaLow += logAddress;
|
registers.lbaLow += logAddress;
|
||||||
registers.lbaHigh = (ushort)((pageNumber & 0xFF00) / 0x100);
|
registers.lbaHigh = (ushort)((pageNumber & 0xFF00) / 0x100);
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "READ LOG EXT took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "READ LOG EXT took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -126,9 +126,9 @@ namespace DiscImageChef.Devices
|
|||||||
registers.lbaLow += logAddress;
|
registers.lbaLow += logAddress;
|
||||||
registers.lbaHigh = (ushort)((pageNumber & 0xFF00) / 0x100);
|
registers.lbaHigh = (ushort)((pageNumber & 0xFF00) / 0x100);
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount,
|
||||||
ref buffer, timeout, true, out duration, out sense);
|
ref buffer, timeout, true, out duration, out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "READ LOG DMA EXT took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "READ LOG DMA EXT took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -150,10 +150,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.lbaLow = (ushort)((lba & 0xFFFF) / 0x1);
|
registers.lbaLow = (ushort)((lba & 0xFFFF) / 0x1);
|
||||||
registers.deviceHead += 0x40;
|
registers.deviceHead += 0x40;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "READ MULTIPLE EXT took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "READ MULTIPLE EXT took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -171,10 +171,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.command = (byte)AtaCommands.ReadNativeMaxAddressExt;
|
registers.command = (byte)AtaCommands.ReadNativeMaxAddressExt;
|
||||||
registers.deviceHead += 0x40;
|
registers.deviceHead += 0x40;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
if((statusRegisters.status & 0x23) == 0)
|
if((statusRegisters.status & 0x23) == 0)
|
||||||
{
|
{
|
||||||
@@ -204,10 +204,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.lbaLow = (ushort)((lba & 0xFFFF) / 0x1);
|
registers.lbaLow = (ushort)((lba & 0xFFFF) / 0x1);
|
||||||
registers.deviceHead += 0x40;
|
registers.deviceHead += 0x40;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "READ SECTORS EXT took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "READ SECTORS EXT took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -90,10 +90,10 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
registers.command = (byte)AtaCommands.IdentifyDevice;
|
registers.command = (byte)AtaCommands.IdentifyDevice;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "IDENTIFY DEVICE took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "IDENTIFY DEVICE took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -122,9 +122,9 @@ namespace DiscImageChef.Devices
|
|||||||
registers.deviceHead = (byte)(head & 0x0F);
|
registers.deviceHead = (byte)(head & 0x0F);
|
||||||
registers.sector = sector;
|
registers.sector = sector;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount,
|
||||||
ref buffer, timeout, true, out duration, out sense);
|
ref buffer, timeout, true, out duration, out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "READ DMA took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "READ DMA took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -146,10 +146,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.deviceHead = (byte)(head & 0x0F);
|
registers.deviceHead = (byte)(head & 0x0F);
|
||||||
registers.sector = sector;
|
registers.sector = sector;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "READ MULTIPLE took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "READ MULTIPLE took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -178,10 +178,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.deviceHead = (byte)(head & 0x0F);
|
registers.deviceHead = (byte)(head & 0x0F);
|
||||||
registers.sector = sector;
|
registers.sector = sector;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "READ SECTORS took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "READ SECTORS took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -210,10 +210,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.deviceHead = (byte)(head & 0x0F);
|
registers.deviceHead = (byte)(head & 0x0F);
|
||||||
registers.sector = sector;
|
registers.sector = sector;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||||
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "READ LONG took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "READ LONG took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -233,10 +233,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.deviceHead = (byte)(head & 0x0F);
|
registers.deviceHead = (byte)(head & 0x0F);
|
||||||
registers.sector = sector;
|
registers.sector = sector;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, true, out duration,
|
AtaTransferRegister.NoTransfer, ref buffer, timeout, true, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "SEEK took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "SEEK took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -90,10 +90,10 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
registers.command = (byte)AtaCommands.IdentifyPacketDevice;
|
registers.command = (byte)AtaCommands.IdentifyPacketDevice;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "IDENTIFY PACKET DEVICE took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "IDENTIFY PACKET DEVICE took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -51,10 +51,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
|
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
|
||||||
registers.deviceHead += 0x40;
|
registers.deviceHead += 0x40;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "CFA TRANSLATE SECTOR took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "CFA TRANSLATE SECTOR took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -74,10 +74,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.sector = sector;
|
registers.sector = sector;
|
||||||
registers.deviceHead = (byte)(head & 0x0F);
|
registers.deviceHead = (byte)(head & 0x0F);
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "CFA TRANSLATE SECTOR took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "CFA TRANSLATE SECTOR took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -93,10 +93,10 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
registers.command = (byte)AtaCommands.RequestSense;
|
registers.command = (byte)AtaCommands.RequestSense;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
errorCode = statusRegisters.error;
|
errorCode = statusRegisters.error;
|
||||||
|
|
||||||
|
|||||||
@@ -59,10 +59,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.command = (byte)AtaCommands.CheckMediaCardType;
|
registers.command = (byte)AtaCommands.CheckMediaCardType;
|
||||||
registers.feature = feature;
|
registers.feature = feature;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "CHECK MEDIA CARD TYPE took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "CHECK MEDIA CARD TYPE took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -48,10 +48,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.lbaHigh = 0xC2;
|
registers.lbaHigh = 0xC2;
|
||||||
registers.lbaMid = 0x4F;
|
registers.lbaMid = 0x4F;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "SMART DISABLE OPERATIONS took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "SMART DISABLE OPERATIONS took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -71,10 +71,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.lbaMid = 0x4F;
|
registers.lbaMid = 0x4F;
|
||||||
registers.sectorCount = 0xF1;
|
registers.sectorCount = 0xF1;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "SMART ENABLE ATTRIBUTE AUTOSAVE took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "SMART ENABLE ATTRIBUTE AUTOSAVE took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -93,10 +93,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.lbaHigh = 0xC2;
|
registers.lbaHigh = 0xC2;
|
||||||
registers.lbaMid = 0x4F;
|
registers.lbaMid = 0x4F;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "SMART DISABLE ATTRIBUTE AUTOSAVE took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "SMART DISABLE ATTRIBUTE AUTOSAVE took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -114,10 +114,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.lbaHigh = 0xC2;
|
registers.lbaHigh = 0xC2;
|
||||||
registers.lbaMid = 0x4F;
|
registers.lbaMid = 0x4F;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "SMART ENABLE OPERATIONS took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "SMART ENABLE OPERATIONS took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -137,10 +137,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.lbaMid = 0x4F;
|
registers.lbaMid = 0x4F;
|
||||||
registers.lbaLow = subcommand;
|
registers.lbaLow = subcommand;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "SMART EXECUTE OFF-LINE IMMEDIATE took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "SMART EXECUTE OFF-LINE IMMEDIATE took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -159,10 +159,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.lbaHigh = 0xC2;
|
registers.lbaHigh = 0xC2;
|
||||||
registers.lbaMid = 0x4F;
|
registers.lbaMid = 0x4F;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "SMART READ DATA took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "SMART READ DATA took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -182,10 +182,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.lbaMid = 0x4F;
|
registers.lbaMid = 0x4F;
|
||||||
registers.lbaLow = logAddress;
|
registers.lbaLow = logAddress;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "SMART READ LOG took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "SMART READ LOG took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -203,10 +203,10 @@ namespace DiscImageChef.Devices
|
|||||||
registers.lbaHigh = 0xC2;
|
registers.lbaHigh = 0xC2;
|
||||||
registers.lbaMid = 0x4F;
|
registers.lbaMid = 0x4F;
|
||||||
|
|
||||||
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
|
||||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ATA Device", "SMART RETURN STATUS took {0} ms.", duration);
|
DicConsole.DebugWriteLine("ATA Device", "SMART RETURN STATUS took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace DiscImageChef.Devices
|
|||||||
public int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout,
|
public int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout,
|
||||||
ScsiDirection direction, out double duration, out bool sense)
|
ScsiDirection direction, out double duration, out bool sense)
|
||||||
{
|
{
|
||||||
return Command.SendScsiCommand(platformId, fd, cdb, ref buffer, out senseBuffer, timeout, direction,
|
return Command.SendScsiCommand(PlatformId, FileHandle, cdb, ref buffer, out senseBuffer, timeout, direction,
|
||||||
out duration, out sense);
|
out duration, out sense);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ namespace DiscImageChef.Devices
|
|||||||
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer,
|
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer,
|
||||||
uint timeout, bool transferBlocks, out double duration, out bool sense)
|
uint timeout, bool transferBlocks, out double duration, out bool sense)
|
||||||
{
|
{
|
||||||
return Command.SendAtaCommand(platformId, fd, registers, out errorRegisters, protocol, transferRegister,
|
return Command.SendAtaCommand(PlatformId, FileHandle, registers, out errorRegisters, protocol, transferRegister,
|
||||||
ref buffer, timeout, transferBlocks, out duration, out sense);
|
ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ namespace DiscImageChef.Devices
|
|||||||
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer,
|
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer,
|
||||||
uint timeout, bool transferBlocks, out double duration, out bool sense)
|
uint timeout, bool transferBlocks, out double duration, out bool sense)
|
||||||
{
|
{
|
||||||
return Command.SendAtaCommand(platformId, fd, registers, out errorRegisters, protocol, transferRegister,
|
return Command.SendAtaCommand(PlatformId, FileHandle, registers, out errorRegisters, protocol, transferRegister,
|
||||||
ref buffer, timeout, transferBlocks, out duration, out sense);
|
ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ namespace DiscImageChef.Devices
|
|||||||
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer,
|
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer,
|
||||||
uint timeout, bool transferBlocks, out double duration, out bool sense)
|
uint timeout, bool transferBlocks, out double duration, out bool sense)
|
||||||
{
|
{
|
||||||
return Command.SendAtaCommand(platformId, fd, registers, out errorRegisters, protocol, transferRegister,
|
return Command.SendAtaCommand(PlatformId, FileHandle, registers, out errorRegisters, protocol, transferRegister,
|
||||||
ref buffer, timeout, transferBlocks, out duration, out sense);
|
ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
if((command != (MmcCommands)SecureDigitalCommands.SendOperatingCondition &&
|
if((command != (MmcCommands)SecureDigitalCommands.SendOperatingCondition &&
|
||||||
command != MmcCommands.SendOpCond) || cachedOcr == null)
|
command != MmcCommands.SendOpCond) || cachedOcr == null)
|
||||||
return Command.SendMmcCommand(platformId, fd, command, write, isApplication, flags, argument, blockSize,
|
return Command.SendMmcCommand(PlatformId, FileHandle, command, write, isApplication, flags, argument, blockSize,
|
||||||
blocks, ref buffer, out response, out duration, out sense, timeout);
|
blocks, ref buffer, out response, out duration, out sense, timeout);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,53 +47,53 @@ namespace DiscImageChef.Devices
|
|||||||
/// <param name="devicePath">Device path</param>
|
/// <param name="devicePath">Device path</param>
|
||||||
public Device(string devicePath)
|
public Device(string devicePath)
|
||||||
{
|
{
|
||||||
platformId = Interop.DetectOS.GetRealPlatformID();
|
PlatformId = Interop.DetectOS.GetRealPlatformID();
|
||||||
Timeout = 15;
|
Timeout = 15;
|
||||||
error = false;
|
Error = false;
|
||||||
removable = false;
|
IsRemovable = false;
|
||||||
|
|
||||||
switch(platformId)
|
switch(PlatformId)
|
||||||
{
|
{
|
||||||
case Interop.PlatformID.Win32NT:
|
case Interop.PlatformID.Win32NT:
|
||||||
{
|
{
|
||||||
fd = Windows.Extern.CreateFile(devicePath,
|
FileHandle = Windows.Extern.CreateFile(devicePath,
|
||||||
Windows.FileAccess.GenericRead | Windows.FileAccess.GenericWrite,
|
Windows.FileAccess.GenericRead | Windows.FileAccess.GenericWrite,
|
||||||
Windows.FileShare.Read | Windows.FileShare.Write, IntPtr.Zero,
|
Windows.FileShare.Read | Windows.FileShare.Write, IntPtr.Zero,
|
||||||
Windows.FileMode.OpenExisting, Windows.FileAttributes.Normal,
|
Windows.FileMode.OpenExisting, Windows.FileAttributes.Normal,
|
||||||
IntPtr.Zero);
|
IntPtr.Zero);
|
||||||
|
|
||||||
if(((SafeFileHandle)fd).IsInvalid)
|
if(((SafeFileHandle)FileHandle).IsInvalid)
|
||||||
{
|
{
|
||||||
error = true;
|
Error = true;
|
||||||
lastError = Marshal.GetLastWin32Error();
|
LastError = Marshal.GetLastWin32Error();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Interop.PlatformID.Linux:
|
case Interop.PlatformID.Linux:
|
||||||
{
|
{
|
||||||
fd = Linux.Extern.open(devicePath, Linux.FileFlags.Readonly | Linux.FileFlags.NonBlocking);
|
FileHandle = Linux.Extern.open(devicePath, Linux.FileFlags.Readonly | Linux.FileFlags.NonBlocking);
|
||||||
|
|
||||||
if((int)fd < 0)
|
if((int)FileHandle < 0)
|
||||||
{
|
{
|
||||||
error = true;
|
Error = true;
|
||||||
lastError = Marshal.GetLastWin32Error();
|
LastError = Marshal.GetLastWin32Error();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Interop.PlatformID.FreeBSD:
|
case Interop.PlatformID.FreeBSD:
|
||||||
{
|
{
|
||||||
fd = FreeBSD.Extern.cam_open_device(devicePath, FreeBSD.FileFlags.ReadWrite);
|
FileHandle = FreeBSD.Extern.cam_open_device(devicePath, FreeBSD.FileFlags.ReadWrite);
|
||||||
|
|
||||||
if(((IntPtr)fd).ToInt64() == 0)
|
if(((IntPtr)FileHandle).ToInt64() == 0)
|
||||||
{
|
{
|
||||||
error = true;
|
Error = true;
|
||||||
lastError = Marshal.GetLastWin32Error();
|
LastError = Marshal.GetLastWin32Error();
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeBSD.CamDevice camDevice =
|
FreeBSD.CamDevice camDevice =
|
||||||
(FreeBSD.CamDevice)Marshal.PtrToStructure((IntPtr)fd, typeof(FreeBSD.CamDevice));
|
(FreeBSD.CamDevice)Marshal.PtrToStructure((IntPtr)FileHandle, typeof(FreeBSD.CamDevice));
|
||||||
|
|
||||||
if(StringHandlers.CToString(camDevice.SimName) == "ata")
|
if(StringHandlers.CToString(camDevice.SimName) == "ata")
|
||||||
throw new
|
throw new
|
||||||
@@ -102,13 +102,13 @@ namespace DiscImageChef.Devices
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", platformId));
|
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;
|
Type = DeviceType.Unknown;
|
||||||
scsiType = Decoders.SCSI.PeripheralDeviceTypes.UnknownDevice;
|
ScsiType = Decoders.SCSI.PeripheralDeviceTypes.UnknownDevice;
|
||||||
|
|
||||||
AtaErrorRegistersCHS errorRegisters;
|
AtaErrorRegistersCHS errorRegisters;
|
||||||
|
|
||||||
@@ -116,13 +116,13 @@ namespace DiscImageChef.Devices
|
|||||||
byte[] senseBuf;
|
byte[] senseBuf;
|
||||||
byte[] inqBuf = null;
|
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;
|
bool scsiSense = true;
|
||||||
string ntDevicePath = null;
|
string ntDevicePath = null;
|
||||||
|
|
||||||
// Windows is answering SCSI INQUIRY for all device types so it needs to be detected first
|
// Windows is answering SCSI INQUIRY for all device types so it needs to be detected first
|
||||||
switch(platformId) {
|
switch(PlatformId) {
|
||||||
case Interop.PlatformID.Win32NT:
|
case Interop.PlatformID.Win32NT:
|
||||||
Windows.StoragePropertyQuery query = new Windows.StoragePropertyQuery();
|
Windows.StoragePropertyQuery query = new Windows.StoragePropertyQuery();
|
||||||
query.PropertyId = Windows.StoragePropertyId.Device;
|
query.PropertyId = Windows.StoragePropertyId.Device;
|
||||||
@@ -135,7 +135,7 @@ namespace DiscImageChef.Devices
|
|||||||
uint returned = 0;
|
uint returned = 0;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
bool hasError = !Windows.Extern.DeviceIoControlStorageQuery((SafeFileHandle)fd,
|
bool hasError = !Windows.Extern.DeviceIoControlStorageQuery((SafeFileHandle)FileHandle,
|
||||||
Windows.WindowsIoctl
|
Windows.WindowsIoctl
|
||||||
.IoctlStorageQueryProperty,
|
.IoctlStorageQueryProperty,
|
||||||
ref query, (uint)Marshal.SizeOf(query),
|
ref query, (uint)Marshal.SizeOf(query),
|
||||||
@@ -171,35 +171,35 @@ namespace DiscImageChef.Devices
|
|||||||
case Windows.StorageBusType.Fibre:
|
case Windows.StorageBusType.Fibre:
|
||||||
case Windows.StorageBusType.iSCSI:
|
case Windows.StorageBusType.iSCSI:
|
||||||
case Windows.StorageBusType.SAS:
|
case Windows.StorageBusType.SAS:
|
||||||
type = DeviceType.SCSI;
|
Type = DeviceType.SCSI;
|
||||||
break;
|
break;
|
||||||
case Windows.StorageBusType.FireWire:
|
case Windows.StorageBusType.FireWire:
|
||||||
firewire = true;
|
IsFireWire = true;
|
||||||
type = DeviceType.SCSI;
|
Type = DeviceType.SCSI;
|
||||||
break;
|
break;
|
||||||
case Windows.StorageBusType.USB:
|
case Windows.StorageBusType.USB:
|
||||||
usb = true;
|
IsUsb = true;
|
||||||
type = DeviceType.SCSI;
|
Type = DeviceType.SCSI;
|
||||||
break;
|
break;
|
||||||
case Windows.StorageBusType.ATAPI:
|
case Windows.StorageBusType.ATAPI:
|
||||||
type = DeviceType.ATAPI;
|
Type = DeviceType.ATAPI;
|
||||||
break;
|
break;
|
||||||
case Windows.StorageBusType.ATA:
|
case Windows.StorageBusType.ATA:
|
||||||
case Windows.StorageBusType.SATA:
|
case Windows.StorageBusType.SATA:
|
||||||
type = DeviceType.ATA;
|
Type = DeviceType.ATA;
|
||||||
break;
|
break;
|
||||||
case Windows.StorageBusType.MultiMediaCard:
|
case Windows.StorageBusType.MultiMediaCard:
|
||||||
type = DeviceType.MMC;
|
Type = DeviceType.MMC;
|
||||||
break;
|
break;
|
||||||
case Windows.StorageBusType.SecureDigital:
|
case Windows.StorageBusType.SecureDigital:
|
||||||
type = DeviceType.SecureDigital;
|
Type = DeviceType.SecureDigital;
|
||||||
break;
|
break;
|
||||||
case Windows.StorageBusType.NVMe:
|
case Windows.StorageBusType.NVMe:
|
||||||
type = DeviceType.NVMe;
|
Type = DeviceType.NVMe;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(type) {
|
switch(Type) {
|
||||||
case DeviceType.SCSI:
|
case DeviceType.SCSI:
|
||||||
case DeviceType.ATAPI: scsiSense = ScsiInquiry(out inqBuf, out senseBuf);
|
case DeviceType.ATAPI: scsiSense = ScsiInquiry(out inqBuf, out senseBuf);
|
||||||
break;
|
break;
|
||||||
@@ -208,26 +208,26 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
if(!atapiSense)
|
if(!atapiSense)
|
||||||
{
|
{
|
||||||
type = DeviceType.ATAPI;
|
Type = DeviceType.ATAPI;
|
||||||
Identify.IdentifyDevice? ataid = Identify.Decode(ataBuf);
|
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";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ntDevicePath = Windows.Command.GetDevicePath((SafeFileHandle)fd);
|
ntDevicePath = Windows.Command.GetDevicePath((SafeFileHandle)FileHandle);
|
||||||
DicConsole.DebugWriteLine("Windows devices", "NT device path: {0}", ntDevicePath);
|
DicConsole.DebugWriteLine("Windows devices", "NT device path: {0}", ntDevicePath);
|
||||||
Marshal.FreeHGlobal(descriptorPtr);
|
Marshal.FreeHGlobal(descriptorPtr);
|
||||||
|
|
||||||
if(Windows.Command.IsSdhci((SafeFileHandle)fd))
|
if(Windows.Command.IsSdhci((SafeFileHandle)FileHandle))
|
||||||
{
|
{
|
||||||
byte[] sdBuffer = new byte[16];
|
byte[] sdBuffer = new byte[16];
|
||||||
bool sense = false;
|
bool sense = false;
|
||||||
|
|
||||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendCsd, false, false,
|
LastError = Windows.Command.SendMmcCommand((SafeFileHandle)FileHandle, MmcCommands.SendCsd, false, false,
|
||||||
MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 |
|
MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 |
|
||||||
MmcFlags.CommandAc, 0, 16, 1, ref sdBuffer,
|
MmcFlags.CommandAc, 0, 16, 1, ref sdBuffer,
|
||||||
out uint[] response, out double duration, out sense, 0);
|
out uint[] response, out double duration, out sense, 0);
|
||||||
@@ -241,7 +241,7 @@ namespace DiscImageChef.Devices
|
|||||||
sdBuffer = new byte[16];
|
sdBuffer = new byte[16];
|
||||||
sense = false;
|
sense = false;
|
||||||
|
|
||||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendCid, false, false,
|
LastError = Windows.Command.SendMmcCommand((SafeFileHandle)FileHandle, MmcCommands.SendCid, false, false,
|
||||||
MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 |
|
MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 |
|
||||||
MmcFlags.CommandAc, 0, 16, 1, ref sdBuffer, out response,
|
MmcFlags.CommandAc, 0, 16, 1, ref sdBuffer, out response,
|
||||||
out duration, out sense, 0);
|
out duration, out sense, 0);
|
||||||
@@ -255,7 +255,7 @@ namespace DiscImageChef.Devices
|
|||||||
sdBuffer = new byte[8];
|
sdBuffer = new byte[8];
|
||||||
sense = false;
|
sense = false;
|
||||||
|
|
||||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd,
|
LastError = Windows.Command.SendMmcCommand((SafeFileHandle)FileHandle,
|
||||||
(MmcCommands)SecureDigitalCommands.SendScr, false, true,
|
(MmcCommands)SecureDigitalCommands.SendScr, false, true,
|
||||||
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 |
|
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 |
|
||||||
MmcFlags.CommandAdtc, 0, 8, 1, ref sdBuffer,
|
MmcFlags.CommandAdtc, 0, 8, 1, ref sdBuffer,
|
||||||
@@ -272,7 +272,7 @@ namespace DiscImageChef.Devices
|
|||||||
sdBuffer = new byte[4];
|
sdBuffer = new byte[4];
|
||||||
sense = false;
|
sense = false;
|
||||||
|
|
||||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd,
|
LastError = Windows.Command.SendMmcCommand((SafeFileHandle)FileHandle,
|
||||||
(MmcCommands)SecureDigitalCommands
|
(MmcCommands)SecureDigitalCommands
|
||||||
.SendOperatingCondition, false, true,
|
.SendOperatingCondition, false, true,
|
||||||
MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 |
|
MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 |
|
||||||
@@ -290,7 +290,7 @@ namespace DiscImageChef.Devices
|
|||||||
sdBuffer = new byte[4];
|
sdBuffer = new byte[4];
|
||||||
sense = false;
|
sense = false;
|
||||||
|
|
||||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendOpCond, false,
|
LastError = Windows.Command.SendMmcCommand((SafeFileHandle)FileHandle, MmcCommands.SendOpCond, false,
|
||||||
true,
|
true,
|
||||||
MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 |
|
MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 |
|
||||||
MmcFlags.CommandBcr, 0, 4, 1, ref sdBuffer,
|
MmcFlags.CommandBcr, 0, 4, 1, ref sdBuffer,
|
||||||
@@ -342,34 +342,34 @@ namespace DiscImageChef.Devices
|
|||||||
#region SecureDigital / MultiMediaCard
|
#region SecureDigital / MultiMediaCard
|
||||||
if(cachedCid != null)
|
if(cachedCid != null)
|
||||||
{
|
{
|
||||||
scsiType = Decoders.SCSI.PeripheralDeviceTypes.DirectAccess;
|
ScsiType = Decoders.SCSI.PeripheralDeviceTypes.DirectAccess;
|
||||||
removable = false;
|
IsRemovable = false;
|
||||||
|
|
||||||
if(cachedScr != null)
|
if(cachedScr != null)
|
||||||
{
|
{
|
||||||
type = DeviceType.SecureDigital;
|
Type = DeviceType.SecureDigital;
|
||||||
Decoders.SecureDigital.CID decoded = Decoders.SecureDigital.Decoders.DecodeCID(cachedCid);
|
Decoders.SecureDigital.CID decoded = Decoders.SecureDigital.Decoders.DecodeCID(cachedCid);
|
||||||
manufacturer = Decoders.SecureDigital.VendorString.Prettify(decoded.Manufacturer);
|
Manufacturer = Decoders.SecureDigital.VendorString.Prettify(decoded.Manufacturer);
|
||||||
model = decoded.ProductName;
|
Model = decoded.ProductName;
|
||||||
revision = string.Format("{0:X2}.{1:X2}", (decoded.ProductRevision & 0xF0) >> 4,
|
Revision = string.Format("{0:X2}.{1:X2}", (decoded.ProductRevision & 0xF0) >> 4,
|
||||||
decoded.ProductRevision & 0x0F);
|
decoded.ProductRevision & 0x0F);
|
||||||
serial = string.Format("{0}", decoded.ProductSerialNumber);
|
Serial = string.Format("{0}", decoded.ProductSerialNumber);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
type = DeviceType.MMC;
|
Type = DeviceType.MMC;
|
||||||
Decoders.MMC.CID decoded = Decoders.MMC.Decoders.DecodeCID(cachedCid);
|
Decoders.MMC.CID decoded = Decoders.MMC.Decoders.DecodeCID(cachedCid);
|
||||||
manufacturer = Decoders.MMC.VendorString.Prettify(decoded.Manufacturer);
|
Manufacturer = Decoders.MMC.VendorString.Prettify(decoded.Manufacturer);
|
||||||
model = decoded.ProductName;
|
Model = decoded.ProductName;
|
||||||
revision = string.Format("{0:X2}.{1:X2}", (decoded.ProductRevision & 0xF0) >> 4,
|
Revision = string.Format("{0:X2}.{1:X2}", (decoded.ProductRevision & 0xF0) >> 4,
|
||||||
decoded.ProductRevision & 0x0F);
|
decoded.ProductRevision & 0x0F);
|
||||||
serial = string.Format("{0}", decoded.ProductSerialNumber);
|
Serial = string.Format("{0}", decoded.ProductSerialNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion SecureDigital / MultiMediaCard
|
#endregion SecureDigital / MultiMediaCard
|
||||||
|
|
||||||
#region USB
|
#region USB
|
||||||
switch(platformId) {
|
switch(PlatformId) {
|
||||||
case Interop.PlatformID.Linux:
|
case Interop.PlatformID.Linux:
|
||||||
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) ||
|
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) ||
|
||||||
devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) ||
|
devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) ||
|
||||||
@@ -397,8 +397,8 @@ namespace DiscImageChef.Devices
|
|||||||
System.IO.FileAccess.Read);
|
System.IO.FileAccess.Read);
|
||||||
byte[] usbBuf = new byte[65536];
|
byte[] usbBuf = new byte[65536];
|
||||||
int usbCount = usbFs.Read(usbBuf, 0, 65536);
|
int usbCount = usbFs.Read(usbBuf, 0, 65536);
|
||||||
usbDescriptors = new byte[usbCount];
|
UsbDescriptors = new byte[usbCount];
|
||||||
Array.Copy(usbBuf, 0, usbDescriptors, 0, usbCount);
|
Array.Copy(usbBuf, 0, UsbDescriptors, 0, usbCount);
|
||||||
usbFs.Close();
|
usbFs.Close();
|
||||||
|
|
||||||
usbSr = new System.IO.StreamReader(resolvedLink + "/idProduct");
|
usbSr = new System.IO.StreamReader(resolvedLink + "/idProduct");
|
||||||
@@ -416,25 +416,25 @@ namespace DiscImageChef.Devices
|
|||||||
if(System.IO.File.Exists(resolvedLink + "/manufacturer"))
|
if(System.IO.File.Exists(resolvedLink + "/manufacturer"))
|
||||||
{
|
{
|
||||||
usbSr = new System.IO.StreamReader(resolvedLink + "/manufacturer");
|
usbSr = new System.IO.StreamReader(resolvedLink + "/manufacturer");
|
||||||
usbManufacturerString = usbSr.ReadToEnd().Trim();
|
UsbManufacturerString = usbSr.ReadToEnd().Trim();
|
||||||
usbSr.Close();
|
usbSr.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(System.IO.File.Exists(resolvedLink + "/product"))
|
if(System.IO.File.Exists(resolvedLink + "/product"))
|
||||||
{
|
{
|
||||||
usbSr = new System.IO.StreamReader(resolvedLink + "/product");
|
usbSr = new System.IO.StreamReader(resolvedLink + "/product");
|
||||||
usbProductString = usbSr.ReadToEnd().Trim();
|
UsbProductString = usbSr.ReadToEnd().Trim();
|
||||||
usbSr.Close();
|
usbSr.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(System.IO.File.Exists(resolvedLink + "/serial"))
|
if(System.IO.File.Exists(resolvedLink + "/serial"))
|
||||||
{
|
{
|
||||||
usbSr = new System.IO.StreamReader(resolvedLink + "/serial");
|
usbSr = new System.IO.StreamReader(resolvedLink + "/serial");
|
||||||
usbSerialString = usbSr.ReadToEnd().Trim();
|
UsbSerialString = usbSr.ReadToEnd().Trim();
|
||||||
usbSr.Close();
|
usbSr.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
usb = true;
|
IsUsb = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -457,22 +457,22 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
if(usbDevice != null)
|
if(usbDevice != null)
|
||||||
{
|
{
|
||||||
usbDescriptors = usbDevice.BinaryDescriptors;
|
UsbDescriptors = usbDevice.BinaryDescriptors;
|
||||||
usbVendor = (ushort)usbDevice.DeviceDescriptor.idVendor;
|
usbVendor = (ushort)usbDevice.DeviceDescriptor.idVendor;
|
||||||
usbProduct = (ushort)usbDevice.DeviceDescriptor.idProduct;
|
usbProduct = (ushort)usbDevice.DeviceDescriptor.idProduct;
|
||||||
usbManufacturerString = usbDevice.Manufacturer;
|
UsbManufacturerString = usbDevice.Manufacturer;
|
||||||
usbProductString = usbDevice.Product;
|
UsbProductString = usbDevice.Product;
|
||||||
usbSerialString =
|
UsbSerialString =
|
||||||
usbDevice.SerialNumber; // This is incorrect filled by Windows with SCSI/ATA serial number
|
usbDevice.SerialNumber; // This is incorrect filled by Windows with SCSI/ATA serial number
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: usb = false;
|
default: IsUsb = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endregion USB
|
#endregion USB
|
||||||
|
|
||||||
#region FireWire
|
#region FireWire
|
||||||
if(platformId == Interop.PlatformID.Linux)
|
if(PlatformId == Interop.PlatformID.Linux)
|
||||||
{
|
{
|
||||||
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) ||
|
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) ||
|
||||||
devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) ||
|
devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) ||
|
||||||
@@ -516,29 +516,29 @@ namespace DiscImageChef.Devices
|
|||||||
if(System.IO.File.Exists(resolvedLink + "/model_name"))
|
if(System.IO.File.Exists(resolvedLink + "/model_name"))
|
||||||
{
|
{
|
||||||
fwSr = new System.IO.StreamReader(resolvedLink + "/model_name");
|
fwSr = new System.IO.StreamReader(resolvedLink + "/model_name");
|
||||||
firewireModelName = fwSr.ReadToEnd().Trim();
|
FireWireModelName = fwSr.ReadToEnd().Trim();
|
||||||
fwSr.Close();
|
fwSr.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(System.IO.File.Exists(resolvedLink + "/vendor_name"))
|
if(System.IO.File.Exists(resolvedLink + "/vendor_name"))
|
||||||
{
|
{
|
||||||
fwSr = new System.IO.StreamReader(resolvedLink + "/vendor_name");
|
fwSr = new System.IO.StreamReader(resolvedLink + "/vendor_name");
|
||||||
firewireVendorName = fwSr.ReadToEnd().Trim();
|
FireWireVendorName = fwSr.ReadToEnd().Trim();
|
||||||
fwSr.Close();
|
fwSr.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
firewire = true;
|
IsFireWire = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: Implement for other operating systems
|
// TODO: Implement for other operating systems
|
||||||
else firewire = false;
|
else IsFireWire = false;
|
||||||
#endregion FireWire
|
#endregion FireWire
|
||||||
|
|
||||||
#region PCMCIA
|
#region PCMCIA
|
||||||
if(platformId == Interop.PlatformID.Linux)
|
if(PlatformId == Interop.PlatformID.Linux)
|
||||||
{
|
{
|
||||||
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) ||
|
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) ||
|
||||||
devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) ||
|
devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) ||
|
||||||
@@ -574,112 +574,112 @@ namespace DiscImageChef.Devices
|
|||||||
System.IO.FileAccess.Read);
|
System.IO.FileAccess.Read);
|
||||||
byte[] cisBuf = new byte[65536];
|
byte[] cisBuf = new byte[65536];
|
||||||
int cisCount = cisFs.Read(cisBuf, 0, 65536);
|
int cisCount = cisFs.Read(cisBuf, 0, 65536);
|
||||||
cis = new byte[cisCount];
|
Cis = new byte[cisCount];
|
||||||
Array.Copy(cisBuf, 0, cis, 0, cisCount);
|
Array.Copy(cisBuf, 0, Cis, 0, cisCount);
|
||||||
cisFs.Close();
|
cisFs.Close();
|
||||||
|
|
||||||
pcmcia = true;
|
IsPcmcia = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: Implement for other operating systems
|
// TODO: Implement for other operating systems
|
||||||
else pcmcia = false;
|
else IsPcmcia = false;
|
||||||
#endregion PCMCIA
|
#endregion PCMCIA
|
||||||
|
|
||||||
if(!scsiSense)
|
if(!scsiSense)
|
||||||
{
|
{
|
||||||
Decoders.SCSI.Inquiry.SCSIInquiry? inquiry = Decoders.SCSI.Inquiry.Decode(inqBuf);
|
Decoders.SCSI.Inquiry.SCSIInquiry? inquiry = Decoders.SCSI.Inquiry.Decode(inqBuf);
|
||||||
|
|
||||||
type = DeviceType.SCSI;
|
Type = DeviceType.SCSI;
|
||||||
bool serialSense = ScsiInquiry(out inqBuf, out senseBuf, 0x80);
|
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)
|
if(inquiry.HasValue)
|
||||||
{
|
{
|
||||||
string tmp = StringHandlers.CToString(inquiry.Value.ProductRevisionLevel);
|
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);
|
tmp = StringHandlers.CToString(inquiry.Value.ProductIdentification);
|
||||||
if(tmp != null) model = tmp.Trim();
|
if(tmp != null) Model = tmp.Trim();
|
||||||
tmp = StringHandlers.CToString(inquiry.Value.VendorIdentification);
|
tmp = StringHandlers.CToString(inquiry.Value.VendorIdentification);
|
||||||
if(tmp != null) manufacturer = tmp.Trim();
|
if(tmp != null) Manufacturer = tmp.Trim();
|
||||||
removable = inquiry.Value.RMB;
|
IsRemovable = inquiry.Value.RMB;
|
||||||
|
|
||||||
scsiType = (Decoders.SCSI.PeripheralDeviceTypes)inquiry.Value.PeripheralDeviceType;
|
ScsiType = (Decoders.SCSI.PeripheralDeviceTypes)inquiry.Value.PeripheralDeviceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool atapiSense = AtapiIdentify(out ataBuf, out errorRegisters);
|
bool atapiSense = AtapiIdentify(out ataBuf, out errorRegisters);
|
||||||
|
|
||||||
if(!atapiSense)
|
if(!atapiSense)
|
||||||
{
|
{
|
||||||
type = DeviceType.ATAPI;
|
Type = DeviceType.ATAPI;
|
||||||
Identify.IdentifyDevice? ataId = Identify.Decode(ataBuf);
|
Identify.IdentifyDevice? ataId = Identify.Decode(ataBuf);
|
||||||
|
|
||||||
if(ataId.HasValue) serial = ataId.Value.SerialNumber;
|
if(ataId.HasValue) Serial = ataId.Value.SerialNumber;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lastError = 0;
|
LastError = 0;
|
||||||
error = false;
|
Error = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(scsiSense && (usb || firewire) || manufacturer == "ATA")
|
if(scsiSense && (IsUsb || IsFireWire) || Manufacturer == "ATA")
|
||||||
{
|
{
|
||||||
bool ataSense = AtaIdentify(out ataBuf, out errorRegisters);
|
bool ataSense = AtaIdentify(out ataBuf, out errorRegisters);
|
||||||
if(!ataSense)
|
if(!ataSense)
|
||||||
{
|
{
|
||||||
type = DeviceType.ATA;
|
Type = DeviceType.ATA;
|
||||||
Identify.IdentifyDevice? ataid = Identify.Decode(ataBuf);
|
Identify.IdentifyDevice? ataid = Identify.Decode(ataBuf);
|
||||||
|
|
||||||
if(ataid.HasValue)
|
if(ataid.HasValue)
|
||||||
{
|
{
|
||||||
string[] separated = ataid.Value.Model.Split(' ');
|
string[] separated = ataid.Value.Model.Split(' ');
|
||||||
|
|
||||||
if(separated.Length == 1) model = separated[0];
|
if(separated.Length == 1) Model = separated[0];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
manufacturer = separated[0];
|
Manufacturer = separated[0];
|
||||||
model = separated[separated.Length - 1];
|
Model = separated[separated.Length - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
revision = ataid.Value.FirmwareRevision;
|
Revision = ataid.Value.FirmwareRevision;
|
||||||
serial = ataid.Value.SerialNumber;
|
Serial = ataid.Value.SerialNumber;
|
||||||
|
|
||||||
scsiType = Decoders.SCSI.PeripheralDeviceTypes.DirectAccess;
|
ScsiType = Decoders.SCSI.PeripheralDeviceTypes.DirectAccess;
|
||||||
|
|
||||||
if((ushort)ataid.Value.GeneralConfiguration != 0x848A)
|
if((ushort)ataid.Value.GeneralConfiguration != 0x848A)
|
||||||
removable |=
|
IsRemovable |=
|
||||||
(ataid.Value.GeneralConfiguration & Identify.GeneralConfigurationBit.Removable) ==
|
(ataid.Value.GeneralConfiguration & Identify.GeneralConfigurationBit.Removable) ==
|
||||||
Identify.GeneralConfigurationBit.Removable;
|
Identify.GeneralConfigurationBit.Removable;
|
||||||
else compactFlash = true;
|
else IsCompactFlash = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(type == DeviceType.Unknown)
|
if(Type == DeviceType.Unknown)
|
||||||
{
|
{
|
||||||
manufacturer = null;
|
Manufacturer = null;
|
||||||
model = null;
|
Model = null;
|
||||||
revision = null;
|
Revision = null;
|
||||||
serial = null;
|
Serial = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(usb)
|
if(IsUsb)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrEmpty(manufacturer)) manufacturer = usbManufacturerString;
|
if(string.IsNullOrEmpty(Manufacturer)) Manufacturer = UsbManufacturerString;
|
||||||
if(string.IsNullOrEmpty(model)) model = usbProductString;
|
if(string.IsNullOrEmpty(Model)) Model = UsbProductString;
|
||||||
if(string.IsNullOrEmpty(serial)) serial = usbSerialString;
|
if(string.IsNullOrEmpty(Serial)) Serial = UsbSerialString;
|
||||||
else foreach(char c in serial.Where(c => char.IsControl(c))) serial = usbSerialString;
|
else foreach(char c in Serial.Where(c => char.IsControl(c))) Serial = UsbSerialString;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!firewire) return;
|
if(!IsFireWire) return;
|
||||||
|
|
||||||
if(string.IsNullOrEmpty(manufacturer)) manufacturer = firewireVendorName;
|
if(string.IsNullOrEmpty(Manufacturer)) Manufacturer = FireWireVendorName;
|
||||||
if(string.IsNullOrEmpty(model)) model = firewireModelName;
|
if(string.IsNullOrEmpty(Model)) Model = FireWireModelName;
|
||||||
if(string.IsNullOrEmpty(serial)) serial = string.Format("{0:X16}", firewireGuid);
|
if(string.IsNullOrEmpty(Serial)) Serial = string.Format("{0:X16}", firewireGuid);
|
||||||
else foreach(char c in serial.Where(c => char.IsControl(c))) serial = string.Format("{0:X16}", firewireGuid);
|
else foreach(char c in Serial.Where(c => char.IsControl(c))) Serial = string.Format("{0:X16}", firewireGuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ConvertFromHexAscii(string file, out byte[] outBuf)
|
static int ConvertFromHexAscii(string file, out byte[] outBuf)
|
||||||
|
|||||||
@@ -43,18 +43,18 @@ namespace DiscImageChef.Devices
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
~Device()
|
~Device()
|
||||||
{
|
{
|
||||||
if(fd == null) return;
|
if(FileHandle == null) return;
|
||||||
|
|
||||||
switch(platformId)
|
switch(PlatformId)
|
||||||
{
|
{
|
||||||
case Interop.PlatformID.Win32NT:
|
case Interop.PlatformID.Win32NT:
|
||||||
Windows.Extern.CloseHandle((SafeFileHandle)fd);
|
Windows.Extern.CloseHandle((SafeFileHandle)FileHandle);
|
||||||
break;
|
break;
|
||||||
case Interop.PlatformID.Linux:
|
case Interop.PlatformID.Linux:
|
||||||
Linux.Extern.close((int)fd);
|
Linux.Extern.close((int)FileHandle);
|
||||||
break;
|
break;
|
||||||
case Interop.PlatformID.FreeBSD:
|
case Interop.PlatformID.FreeBSD:
|
||||||
FreeBSD.Extern.cam_close_device((IntPtr)fd);
|
FreeBSD.Extern.cam_close_device((IntPtr)FileHandle);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,10 +41,10 @@ namespace DiscImageChef.Devices
|
|||||||
buffer = new byte[16];
|
buffer = new byte[16];
|
||||||
bool sense = false;
|
bool sense = false;
|
||||||
|
|
||||||
lastError = SendMmcCommand(MmcCommands.SendCsd, false, false,
|
LastError = SendMmcCommand(MmcCommands.SendCsd, false, false,
|
||||||
MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 | MmcFlags.CommandAc, 0, 16, 1,
|
MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 | MmcFlags.CommandAc, 0, 16, 1,
|
||||||
ref buffer, out response, out duration, out sense, timeout);
|
ref buffer, out response, out duration, out sense, timeout);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("MMC Device", "SEND_CSD took {0} ms.", duration);
|
DicConsole.DebugWriteLine("MMC Device", "SEND_CSD took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -56,10 +56,10 @@ namespace DiscImageChef.Devices
|
|||||||
buffer = new byte[16];
|
buffer = new byte[16];
|
||||||
bool sense = false;
|
bool sense = false;
|
||||||
|
|
||||||
lastError = SendMmcCommand(MmcCommands.SendCid, false, false,
|
LastError = SendMmcCommand(MmcCommands.SendCid, false, false,
|
||||||
MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 | MmcFlags.CommandAc, 0, 16, 1,
|
MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 | MmcFlags.CommandAc, 0, 16, 1,
|
||||||
ref buffer, out response, out duration, out sense, timeout);
|
ref buffer, out response, out duration, out sense, timeout);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("MMC Device", "SEND_CID took {0} ms.", duration);
|
DicConsole.DebugWriteLine("MMC Device", "SEND_CID took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -71,10 +71,10 @@ namespace DiscImageChef.Devices
|
|||||||
buffer = new byte[4];
|
buffer = new byte[4];
|
||||||
bool sense = false;
|
bool sense = false;
|
||||||
|
|
||||||
lastError = SendMmcCommand(MmcCommands.SendOpCond, false, true,
|
LastError = SendMmcCommand(MmcCommands.SendOpCond, false, true,
|
||||||
MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 | MmcFlags.CommandBcr, 0, 4, 1,
|
MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 | MmcFlags.CommandBcr, 0, 4, 1,
|
||||||
ref buffer, out response, out duration, out sense, timeout);
|
ref buffer, out response, out duration, out sense, timeout);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SecureDigital Device", "SEND_OP_COND took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SecureDigital Device", "SEND_OP_COND took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -86,10 +86,10 @@ namespace DiscImageChef.Devices
|
|||||||
buffer = new byte[512];
|
buffer = new byte[512];
|
||||||
bool sense = false;
|
bool sense = false;
|
||||||
|
|
||||||
lastError = SendMmcCommand(MmcCommands.SendExtCsd, false, false,
|
LastError = SendMmcCommand(MmcCommands.SendExtCsd, false, false,
|
||||||
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, 0, 512, 1,
|
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, 0, 512, 1,
|
||||||
ref buffer, out response, out duration, out sense, timeout);
|
ref buffer, out response, out duration, out sense, timeout);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("MMC Device", "SEND_EXT_CSD took {0} ms.", duration);
|
DicConsole.DebugWriteLine("MMC Device", "SEND_EXT_CSD took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -101,10 +101,10 @@ namespace DiscImageChef.Devices
|
|||||||
byte[] buffer = new byte[0];
|
byte[] buffer = new byte[0];
|
||||||
bool sense = false;
|
bool sense = false;
|
||||||
|
|
||||||
lastError = SendMmcCommand(MmcCommands.SetBlocklen, false, false,
|
LastError = SendMmcCommand(MmcCommands.SetBlocklen, false, false,
|
||||||
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAc, length, 0,
|
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAc, length, 0,
|
||||||
0, ref buffer, out response, out duration, out sense, timeout);
|
0, ref buffer, out response, out duration, out sense, timeout);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("MMC Device", "SET_BLOCKLEN took {0} ms.", duration);
|
DicConsole.DebugWriteLine("MMC Device", "SET_BLOCKLEN took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -124,11 +124,11 @@ namespace DiscImageChef.Devices
|
|||||||
if(transferLength > 1) command = MmcCommands.ReadMultipleBlock;
|
if(transferLength > 1) command = MmcCommands.ReadMultipleBlock;
|
||||||
else command = MmcCommands.ReadSingleBlock;
|
else command = MmcCommands.ReadSingleBlock;
|
||||||
|
|
||||||
lastError = SendMmcCommand(command, false, false,
|
LastError = SendMmcCommand(command, false, false,
|
||||||
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, address,
|
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, address,
|
||||||
blockSize, transferLength, ref buffer, out response, out duration, out sense,
|
blockSize, transferLength, ref buffer, out response, out duration, out sense,
|
||||||
timeout);
|
timeout);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
if(transferLength > 1)
|
if(transferLength > 1)
|
||||||
{
|
{
|
||||||
@@ -149,10 +149,10 @@ namespace DiscImageChef.Devices
|
|||||||
buffer = new byte[4];
|
buffer = new byte[4];
|
||||||
bool sense = false;
|
bool sense = false;
|
||||||
|
|
||||||
lastError = SendMmcCommand(MmcCommands.SendStatus, false, true,
|
LastError = SendMmcCommand(MmcCommands.SendStatus, false, true,
|
||||||
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAc, 0, 4, 1,
|
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAc, 0, 4, 1,
|
||||||
ref buffer, out response, out duration, out sense, timeout);
|
ref buffer, out response, out duration, out sense, timeout);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SecureDigital Device", "SEND_STATUS took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SecureDigital Device", "SEND_STATUS took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -41,10 +41,10 @@ namespace DiscImageChef.Devices
|
|||||||
buffer = new byte[64];
|
buffer = new byte[64];
|
||||||
bool sense = false;
|
bool sense = false;
|
||||||
|
|
||||||
lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendStatus, false, true,
|
LastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendStatus, false, true,
|
||||||
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, 0, 64, 1,
|
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, 0, 64, 1,
|
||||||
ref buffer, out response, out duration, out sense, timeout);
|
ref buffer, out response, out duration, out sense, timeout);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SecureDigital Device", "SD_STATUS took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SecureDigital Device", "SD_STATUS took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -56,10 +56,10 @@ namespace DiscImageChef.Devices
|
|||||||
buffer = new byte[4];
|
buffer = new byte[4];
|
||||||
bool sense = false;
|
bool sense = false;
|
||||||
|
|
||||||
lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendOperatingCondition, false, true,
|
LastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendOperatingCondition, false, true,
|
||||||
MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 | MmcFlags.CommandBcr, 0, 4, 1,
|
MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 | MmcFlags.CommandBcr, 0, 4, 1,
|
||||||
ref buffer, out response, out duration, out sense, timeout);
|
ref buffer, out response, out duration, out sense, timeout);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SecureDigital Device", "SD_SEND_OP_COND took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SecureDigital Device", "SD_SEND_OP_COND took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -71,10 +71,10 @@ namespace DiscImageChef.Devices
|
|||||||
buffer = new byte[8];
|
buffer = new byte[8];
|
||||||
bool sense = false;
|
bool sense = false;
|
||||||
|
|
||||||
lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendScr, false, true,
|
LastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendScr, false, true,
|
||||||
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, 0, 8, 1,
|
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, 0, 8, 1,
|
||||||
ref buffer, out response, out duration, out sense, timeout);
|
ref buffer, out response, out duration, out sense, timeout);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SecureDigital Device", "SEND_SCR took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SecureDigital Device", "SEND_SCR took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -75,9 +75,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[3] = (byte)(lba & 0xFF);
|
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,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "ADAPTEC TRANSLATE took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "ADAPTEC TRANSLATE took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -119,9 +119,9 @@ namespace DiscImageChef.Devices
|
|||||||
if(drive1) cdb[1] += 0x20;
|
if(drive1) cdb[1] += 0x20;
|
||||||
cdb[4] = 1;
|
cdb[4] = 1;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "ADAPTEC SET ERROR THRESHOLD took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "ADAPTEC SET ERROR THRESHOLD took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -161,9 +161,9 @@ namespace DiscImageChef.Devices
|
|||||||
if(drive1) cdb[1] += 0x20;
|
if(drive1) cdb[1] += 0x20;
|
||||||
cdb[4] = (byte)buffer.Length;
|
cdb[4] = (byte)buffer.Length;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "ADAPTEC READ/RESET USAGE COUNTER took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "ADAPTEC READ/RESET USAGE COUNTER took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -189,9 +189,9 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
cdb[0] = (byte)ScsiCommands.AdaptecWriteBuffer;
|
cdb[0] = (byte)ScsiCommands.AdaptecWriteBuffer;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref oneKBuffer, out senseBuffer, timeout, ScsiDirection.Out, out duration,
|
LastError = SendScsiCommand(cdb, ref oneKBuffer, out senseBuffer, timeout, ScsiDirection.Out, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "ADAPTEC WRITE DATA BUFFER took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "ADAPTEC WRITE DATA BUFFER took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -214,9 +214,9 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
cdb[0] = (byte)ScsiCommands.AdaptecReadBuffer;
|
cdb[0] = (byte)ScsiCommands.AdaptecReadBuffer;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "ADAPTEC READ DATA BUFFER took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "ADAPTEC READ DATA BUFFER took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -57,9 +57,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[3] = (byte)(lba & 0xFF);
|
cdb[3] = (byte)(lba & 0xFF);
|
||||||
cdb[4] = 3;
|
cdb[4] = 3;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "ARCHIVE CORP. REQUEST BLOCK ADDRESS took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "ARCHIVE CORP. REQUEST BLOCK ADDRESS took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -100,9 +100,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[3] = (byte)(lba & 0xFF);
|
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,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "ARCHIVE CORP. SEEK BLOCK took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "ARCHIVE CORP. SEEK BLOCK took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -75,9 +75,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[0] = (byte)ScsiCommands.CertanceParkUnpark;
|
cdb[0] = (byte)ScsiCommands.CertanceParkUnpark;
|
||||||
if(park) cdb[4] = 1;
|
if(park) cdb[4] = 1;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "CERTANCE PARK UNPARK took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "CERTANCE PARK UNPARK took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -97,9 +97,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[0] = (byte)ScsiCommands.FujitsuDisplay;
|
cdb[0] = (byte)ScsiCommands.FujitsuDisplay;
|
||||||
cdb[6] = (byte)buffer.Length;
|
cdb[6] = (byte)buffer.Length;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "FUJITSU DISPLAY took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "FUJITSU DISPLAY took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -66,9 +66,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[10] = (byte)((buffer.Length & 0xFF00) >> 8);
|
cdb[10] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||||
cdb[11] = (byte)(buffer.Length & 0xFF);
|
cdb[11] = (byte)(buffer.Length & 0xFF);
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "HL-DT-ST READ DVD (RAW) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "HL-DT-ST READ DVD (RAW) took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -91,9 +91,9 @@ namespace DiscImageChef.Devices
|
|||||||
if(sectorCount) buffer = new byte[blockBytes * transferLen];
|
if(sectorCount) buffer = new byte[blockBytes * transferLen];
|
||||||
else buffer = new byte[transferLen];
|
else buffer = new byte[transferLen];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "HP READ LONG took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "HP READ LONG took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -56,9 +56,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[2] = 0x01;
|
cdb[2] = 0x01;
|
||||||
cdb[3] = 0x01;
|
cdb[3] = 0x01;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "KREON DEPRECATED UNLOCK took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "KREON DEPRECATED UNLOCK took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -122,9 +122,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[3] = 0x11;
|
cdb[3] = 0x11;
|
||||||
cdb[4] = (byte)state;
|
cdb[4] = (byte)state;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "KREON SET LOCK STATE took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "KREON SET LOCK STATE took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -153,9 +153,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[2] = 0x01;
|
cdb[2] = 0x01;
|
||||||
cdb[3] = 0x10;
|
cdb[3] = 0x10;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "KREON GET FEATURE LIST took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "KREON GET FEATURE LIST took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -236,9 +236,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[10] = requestNumber;
|
cdb[10] = requestNumber;
|
||||||
cdb[11] = 0xC0;
|
cdb[11] = 0xC0;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "KREON EXTRACT SS took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "KREON EXTRACT SS took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -93,9 +93,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||||
cdb[9] = 0;
|
cdb[9] = 0;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
if(sense) return true;
|
if(sense) return true;
|
||||||
|
|
||||||
@@ -107,9 +107,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||||
senseBuffer = new byte[32];
|
senseBuffer = new byte[32];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "GET CONFIGURATION took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "GET CONFIGURATION took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -150,9 +150,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[9] = (byte)(buffer.Length & 0xFF);
|
cdb[9] = (byte)(buffer.Length & 0xFF);
|
||||||
cdb[10] = (byte)((agid & 0x03) << 6);
|
cdb[10] = (byte)((agid & 0x03) << 6);
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
if(sense) return true;
|
if(sense) return true;
|
||||||
|
|
||||||
@@ -164,9 +164,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[9] = (byte)(buffer.Length & 0xFF);
|
cdb[9] = (byte)(buffer.Length & 0xFF);
|
||||||
senseBuffer = new byte[32];
|
senseBuffer = new byte[32];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ DISC STRUCTURE took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ DISC STRUCTURE took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -314,9 +314,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[7] = (byte)((tmpBuffer.Length & 0xFF00) >> 8);
|
cdb[7] = (byte)((tmpBuffer.Length & 0xFF00) >> 8);
|
||||||
cdb[8] = (byte)(tmpBuffer.Length & 0xFF);
|
cdb[8] = (byte)(tmpBuffer.Length & 0xFF);
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref tmpBuffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref tmpBuffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
|
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||||
uint strctLength = (uint)(((int)tmpBuffer[0] << 8) + tmpBuffer[1] + 2);
|
uint strctLength = (uint)(((int)tmpBuffer[0] << 8) + tmpBuffer[1] + 2);
|
||||||
@@ -332,9 +332,9 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
double tmpDuration = duration;
|
double tmpDuration = duration;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
duration += tmpDuration;
|
duration += tmpDuration;
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ TOC/PMA/ATIP took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ TOC/PMA/ATIP took {0} ms.", duration);
|
||||||
@@ -377,9 +377,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[7] = (byte)((tmpBuffer.Length & 0xFF00) >> 8);
|
cdb[7] = (byte)((tmpBuffer.Length & 0xFF00) >> 8);
|
||||||
cdb[8] = (byte)(tmpBuffer.Length & 0xFF);
|
cdb[8] = (byte)(tmpBuffer.Length & 0xFF);
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref tmpBuffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref tmpBuffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
|
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||||
uint strctLength = (uint)(((int)tmpBuffer[0] << 8) + tmpBuffer[1] + 2);
|
uint strctLength = (uint)(((int)tmpBuffer[0] << 8) + tmpBuffer[1] + 2);
|
||||||
@@ -441,9 +441,9 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
buffer = new byte[blockSize * transferLength];
|
buffer = new byte[blockSize * transferLength];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ CD took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ CD took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -498,9 +498,9 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
buffer = new byte[blockSize * transferLength];
|
buffer = new byte[blockSize * transferLength];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ CD MSF took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ CD MSF took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -529,9 +529,9 @@ namespace DiscImageChef.Devices
|
|||||||
if(prevent) cdb[4] += 0x01;
|
if(prevent) cdb[4] += 0x01;
|
||||||
if(persistent) cdb[4] += 0x02;
|
if(persistent) cdb[4] += 0x02;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "PREVENT ALLOW MEDIUM REMOVAL took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "PREVENT ALLOW MEDIUM REMOVAL took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -580,9 +580,9 @@ namespace DiscImageChef.Devices
|
|||||||
}
|
}
|
||||||
cdb[4] += (byte)((powerConditions & 0x0F) << 4);
|
cdb[4] += (byte)((powerConditions & 0x0F) << 4);
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "START STOP UNIT took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "START STOP UNIT took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
buffer = new byte[2352 * transferLength];
|
buffer = new byte[2352 * transferLength];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ CD-DA took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ CD-DA took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -68,9 +68,9 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
buffer = new byte[blockSize * transferLength];
|
buffer = new byte[blockSize * transferLength];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "PIONEER READ CD-DA took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "PIONEER READ CD-DA took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -108,9 +108,9 @@ namespace DiscImageChef.Devices
|
|||||||
uint transferLength = (uint)((cdb[7] - cdb[3]) * 60 * 75 + (cdb[8] - cdb[4]) * 75 + (cdb[9] - cdb[5]));
|
uint transferLength = (uint)((cdb[7] - cdb[3]) * 60 * 75 + (cdb[8] - cdb[4]) * 75 + (cdb[9] - cdb[5]));
|
||||||
buffer = new byte[blockSize * transferLength];
|
buffer = new byte[blockSize * transferLength];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "PIONEER READ CD-DA MSF took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "PIONEER READ CD-DA MSF took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -161,9 +161,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[6] = 0x00;
|
cdb[6] = 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "PIONEER READ CD-XA took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "PIONEER READ CD-XA took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -103,9 +103,9 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
buffer = new byte[8];
|
buffer = new byte[8];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "PLASMON READ SECTOR LOCATION took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "PLASMON READ SECTOR LOCATION took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -70,9 +70,9 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
buffer = new byte[blockSize * transferLength];
|
buffer = new byte[blockSize * transferLength];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ CD-DA took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ CD-DA took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -106,9 +106,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[4] = (byte)((buffer.Length & 0xFF00) >> 8);
|
cdb[4] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||||
cdb[5] = (byte)(buffer.Length & 0xFF);
|
cdb[5] = (byte)(buffer.Length & 0xFF);
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "Plextor READ DVD (RAW) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "Plextor READ DVD (RAW) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -133,9 +133,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[0] = (byte)ScsiCommands.PlextorReadEeprom;
|
cdb[0] = (byte)ScsiCommands.PlextorReadEeprom;
|
||||||
cdb[8] = 1;
|
cdb[8] = 1;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR READ EEPROM took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR READ EEPROM took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -160,9 +160,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[0] = (byte)ScsiCommands.PlextorReadEeprom;
|
cdb[0] = (byte)ScsiCommands.PlextorReadEeprom;
|
||||||
cdb[8] = 2;
|
cdb[8] = 2;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR READ EEPROM took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR READ EEPROM took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -193,9 +193,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[8] = (byte)((blockSize & 0xFF00) >> 8);
|
cdb[8] = (byte)((blockSize & 0xFF00) >> 8);
|
||||||
cdb[9] = (byte)(blockSize & 0xFF);
|
cdb[9] = (byte)(blockSize & 0xFF);
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR READ EEPROM took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR READ EEPROM took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -227,13 +227,13 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[0] = (byte)ScsiCommands.PlextorPoweRec;
|
cdb[0] = (byte)ScsiCommands.PlextorPoweRec;
|
||||||
cdb[9] = (byte)buf.Length;
|
cdb[9] = (byte)buf.Length;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buf, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buf, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR POWEREC GET SPEEDS took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR POWEREC GET SPEEDS took {0} ms.", duration);
|
||||||
|
|
||||||
if(sense || error) return sense;
|
if(sense || Error) return sense;
|
||||||
|
|
||||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||||
selected = BigEndianBitConverter.ToUInt16(buf, 4);
|
selected = BigEndianBitConverter.ToUInt16(buf, 4);
|
||||||
@@ -267,13 +267,13 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[1] = (byte)PlextorSubCommands.GetMode;
|
cdb[1] = (byte)PlextorSubCommands.GetMode;
|
||||||
cdb[9] = (byte)buf.Length;
|
cdb[9] = (byte)buf.Length;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buf, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buf, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR POWEREC GET SPEEDS took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR POWEREC GET SPEEDS took {0} ms.", duration);
|
||||||
|
|
||||||
if(sense || error) return sense;
|
if(sense || Error) return sense;
|
||||||
|
|
||||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||||
enabled = buf[2] != 0;
|
enabled = buf[2] != 0;
|
||||||
@@ -303,9 +303,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[3] = 4;
|
cdb[3] = 4;
|
||||||
cdb[10] = (byte)buffer.Length;
|
cdb[10] = (byte)buffer.Length;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SILENT MODE took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SILENT MODE took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -332,9 +332,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[2] = (byte)PlextorSubCommands.GigaRec;
|
cdb[2] = (byte)PlextorSubCommands.GigaRec;
|
||||||
cdb[10] = (byte)buffer.Length;
|
cdb[10] = (byte)buffer.Length;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET GIGAREC took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET GIGAREC took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -365,9 +365,9 @@ namespace DiscImageChef.Devices
|
|||||||
if(dvd) cdb[3] = 0x12;
|
if(dvd) cdb[3] = 0x12;
|
||||||
else cdb[3] = 0x02;
|
else cdb[3] = 0x02;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET VARIREC took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET VARIREC took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -393,9 +393,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[2] = (byte)PlextorSubCommands.SecuRec;
|
cdb[2] = (byte)PlextorSubCommands.SecuRec;
|
||||||
cdb[10] = (byte)buffer.Length;
|
cdb[10] = (byte)buffer.Length;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SECUREC took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SECUREC took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -422,9 +422,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[2] = (byte)PlextorSubCommands.SpeedRead;
|
cdb[2] = (byte)PlextorSubCommands.SpeedRead;
|
||||||
cdb[10] = (byte)buffer.Length;
|
cdb[10] = (byte)buffer.Length;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SPEEDREAD took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SPEEDREAD took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -451,9 +451,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[2] = (byte)PlextorSubCommands.SessionHide;
|
cdb[2] = (byte)PlextorSubCommands.SessionHide;
|
||||||
cdb[9] = (byte)buffer.Length;
|
cdb[9] = (byte)buffer.Length;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SINGLE-SESSION / HIDE CD-R took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SINGLE-SESSION / HIDE CD-R took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -484,9 +484,9 @@ namespace DiscImageChef.Devices
|
|||||||
if(dualLayer) cdb[3] = (byte)PlextorSubCommands.BitSetRdl;
|
if(dualLayer) cdb[3] = (byte)PlextorSubCommands.BitSetRdl;
|
||||||
else cdb[3] = (byte)PlextorSubCommands.BitSetR;
|
else cdb[3] = (byte)PlextorSubCommands.BitSetR;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET BOOK BITSETTING took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET BOOK BITSETTING took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -514,9 +514,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[2] = (byte)PlextorSubCommands.TestWriteDvdPlus;
|
cdb[2] = (byte)PlextorSubCommands.TestWriteDvdPlus;
|
||||||
cdb[10] = (byte)buffer.Length;
|
cdb[10] = (byte)buffer.Length;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET TEST WRITE DVD+ took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET TEST WRITE DVD+ took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -80,9 +80,9 @@ namespace DiscImageChef.Devices
|
|||||||
if(transferLength == 0) buffer = new byte[256 * blockSize];
|
if(transferLength == 0) buffer = new byte[256 * blockSize];
|
||||||
else buffer = new byte[transferLength * blockSize];
|
else buffer = new byte[transferLength * blockSize];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ (6) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ (6) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -130,9 +130,9 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
buffer = new byte[transferLength * blockSize];
|
buffer = new byte[transferLength * blockSize];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ (10) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ (10) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -184,9 +184,9 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
buffer = new byte[transferLength * blockSize];
|
buffer = new byte[transferLength * blockSize];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ (12) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ (12) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -241,9 +241,9 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
buffer = new byte[transferLength * blockSize];
|
buffer = new byte[transferLength * blockSize];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ (16) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ (16) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -281,9 +281,9 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
buffer = new byte[transferBytes];
|
buffer = new byte[transferBytes];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ LONG (10) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ LONG (10) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -325,9 +325,9 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
buffer = new byte[transferBytes];
|
buffer = new byte[transferBytes];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ LONG (16) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ LONG (16) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -353,9 +353,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[2] = (byte)((lba & 0xFF00) >> 8);
|
cdb[2] = (byte)((lba & 0xFF00) >> 8);
|
||||||
cdb[3] = (byte)(lba & 0xFF);
|
cdb[3] = (byte)(lba & 0xFF);
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "SEEK (6) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "SEEK (6) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -382,9 +382,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[4] = (byte)((lba & 0xFF00) >> 8);
|
cdb[4] = (byte)((lba & 0xFF00) >> 8);
|
||||||
cdb[5] = (byte)(lba & 0xFF);
|
cdb[5] = (byte)(lba & 0xFF);
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "SEEK (10) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "SEEK (10) took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[13] = (byte)(buffer.Length & 0xFF);
|
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,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
if(sense) return true;
|
if(sense) return true;
|
||||||
|
|
||||||
@@ -91,9 +91,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[13] = (byte)(buffer.Length & 0xFF);
|
cdb[13] = (byte)(buffer.Length & 0xFF);
|
||||||
senseBuffer = new byte[32];
|
senseBuffer = new byte[32];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ ATTRIBUTE took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ ATTRIBUTE took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -88,9 +88,9 @@ namespace DiscImageChef.Devices
|
|||||||
byte[] cdb = {(byte)ScsiCommands.Inquiry, 0, 0, 0, 36, 0};
|
byte[] cdb = {(byte)ScsiCommands.Inquiry, 0, 0, 0, 36, 0};
|
||||||
bool sense;
|
bool sense;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
if(sense) return true;
|
if(sense) return true;
|
||||||
|
|
||||||
@@ -100,9 +100,9 @@ namespace DiscImageChef.Devices
|
|||||||
buffer = new byte[pagesLength];
|
buffer = new byte[pagesLength];
|
||||||
senseBuffer = new byte[32];
|
senseBuffer = new byte[32];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "INQUIRY took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "INQUIRY took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -164,9 +164,9 @@ namespace DiscImageChef.Devices
|
|||||||
byte[] cdb = {(byte)ScsiCommands.Inquiry, 1, page, 0, 36, 0};
|
byte[] cdb = {(byte)ScsiCommands.Inquiry, 1, page, 0, 36, 0};
|
||||||
bool sense;
|
bool sense;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
if(sense) return true;
|
if(sense) return true;
|
||||||
|
|
||||||
@@ -179,9 +179,9 @@ namespace DiscImageChef.Devices
|
|||||||
buffer = new byte[pagesLength];
|
buffer = new byte[pagesLength];
|
||||||
senseBuffer = new byte[32];
|
senseBuffer = new byte[32];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "INQUIRY took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "INQUIRY took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -202,9 +202,9 @@ namespace DiscImageChef.Devices
|
|||||||
bool sense;
|
bool sense;
|
||||||
byte[] buffer = new byte[0];
|
byte[] buffer = new byte[0];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "TEST UNIT READY took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "TEST UNIT READY took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -271,9 +271,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[4] = (byte)buffer.Length;
|
cdb[4] = (byte)buffer.Length;
|
||||||
cdb[5] = 0;
|
cdb[5] = 0;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
if(sense) return true;
|
if(sense) return true;
|
||||||
|
|
||||||
@@ -282,9 +282,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[4] = (byte)buffer.Length;
|
cdb[4] = (byte)buffer.Length;
|
||||||
senseBuffer = new byte[32];
|
senseBuffer = new byte[32];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "MODE SENSE(6) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "MODE SENSE(6) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -360,9 +360,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||||
cdb[9] = 0;
|
cdb[9] = 0;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
if(sense) return true;
|
if(sense) return true;
|
||||||
|
|
||||||
@@ -374,9 +374,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||||
senseBuffer = new byte[32];
|
senseBuffer = new byte[32];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "MODE SENSE(10) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "MODE SENSE(10) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -444,9 +444,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval;
|
cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval;
|
||||||
cdb[4] = (byte)((byte)preventMode & 0x03);
|
cdb[4] = (byte)((byte)preventMode & 0x03);
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "PREVENT ALLOW MEDIUM REMOVAL took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "PREVENT ALLOW MEDIUM REMOVAL took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -498,9 +498,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[5] = (byte)(address & 0xFF);
|
cdb[5] = (byte)(address & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ CAPACITY took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ CAPACITY took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -560,9 +560,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[12] = (byte)((buffer.Length & 0xFF00) >> 8);
|
cdb[12] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||||
cdb[13] = (byte)(buffer.Length & 0xFF);
|
cdb[13] = (byte)(buffer.Length & 0xFF);
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ CAPACITY(16) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ CAPACITY(16) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -591,9 +591,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8);
|
cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||||
cdb[9] = (byte)(buffer.Length & 0xFF);
|
cdb[9] = (byte)(buffer.Length & 0xFF);
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
if(sense) return true;
|
if(sense) return true;
|
||||||
|
|
||||||
@@ -608,9 +608,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[9] = (byte)(buffer.Length & 0xFF);
|
cdb[9] = (byte)(buffer.Length & 0xFF);
|
||||||
senseBuffer = new byte[32];
|
senseBuffer = new byte[32];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ MEDIA SERIAL NUMBER took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ MEDIA SERIAL NUMBER took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -738,12 +738,12 @@ namespace DiscImageChef.Devices
|
|||||||
// Prevent overflows
|
// Prevent overflows
|
||||||
if(buffer.Length > 255)
|
if(buffer.Length > 255)
|
||||||
{
|
{
|
||||||
if(platformId != Interop.PlatformID.Win32NT && platformId != Interop.PlatformID.Win32S &&
|
if(PlatformId != Interop.PlatformID.Win32NT && PlatformId != Interop.PlatformID.Win32S &&
|
||||||
platformId != Interop.PlatformID.Win32Windows && platformId != Interop.PlatformID.WinCE &&
|
PlatformId != Interop.PlatformID.Win32Windows && PlatformId != Interop.PlatformID.WinCE &&
|
||||||
platformId != Interop.PlatformID.WindowsPhone &&
|
PlatformId != Interop.PlatformID.WindowsPhone &&
|
||||||
platformId != Interop.PlatformID.Xbox) lastError = 75;
|
PlatformId != Interop.PlatformID.Xbox) LastError = 75;
|
||||||
else lastError = 111;
|
else LastError = 111;
|
||||||
error = true;
|
Error = true;
|
||||||
duration = 0;
|
duration = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -756,9 +756,9 @@ namespace DiscImageChef.Devices
|
|||||||
if(savePages) cdb[1] += 0x01;
|
if(savePages) cdb[1] += 0x01;
|
||||||
cdb[4] = (byte)buffer.Length;
|
cdb[4] = (byte)buffer.Length;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "MODE SELECT(6) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "MODE SELECT(6) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -781,12 +781,12 @@ namespace DiscImageChef.Devices
|
|||||||
// Prevent overflows
|
// Prevent overflows
|
||||||
if(buffer.Length > 65535)
|
if(buffer.Length > 65535)
|
||||||
{
|
{
|
||||||
if(platformId != Interop.PlatformID.Win32NT && platformId != Interop.PlatformID.Win32S &&
|
if(PlatformId != Interop.PlatformID.Win32NT && PlatformId != Interop.PlatformID.Win32S &&
|
||||||
platformId != Interop.PlatformID.Win32Windows && platformId != Interop.PlatformID.WinCE &&
|
PlatformId != Interop.PlatformID.Win32Windows && PlatformId != Interop.PlatformID.WinCE &&
|
||||||
platformId != Interop.PlatformID.WindowsPhone &&
|
PlatformId != Interop.PlatformID.WindowsPhone &&
|
||||||
platformId != Interop.PlatformID.Xbox) lastError = 75;
|
PlatformId != Interop.PlatformID.Xbox) LastError = 75;
|
||||||
else lastError = 111;
|
else LastError = 111;
|
||||||
error = true;
|
Error = true;
|
||||||
duration = 0;
|
duration = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -800,9 +800,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[7] = (byte)((buffer.Length & 0xFF00) << 8);
|
cdb[7] = (byte)((buffer.Length & 0xFF00) << 8);
|
||||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "MODE SELECT(10) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "MODE SELECT(10) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -828,9 +828,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[4] = (byte)buffer.Length;
|
cdb[4] = (byte)buffer.Length;
|
||||||
cdb[5] = 0;
|
cdb[5] = 0;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "REQUEST SENSE took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "REQUEST SENSE took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -88,9 +88,9 @@ namespace DiscImageChef.Devices
|
|||||||
if(endOfTape) cdb[4] += 0x04;
|
if(endOfTape) cdb[4] += 0x04;
|
||||||
if(hold) cdb[4] += 0x08;
|
if(hold) cdb[4] += 0x08;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "LOAD UNLOAD (6) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "LOAD UNLOAD (6) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -179,9 +179,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[6] = (byte)(objectId & 0xFF);
|
cdb[6] = (byte)(objectId & 0xFF);
|
||||||
cdb[8] = partition;
|
cdb[8] = partition;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "LOCATE (10) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "LOCATE (10) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -282,9 +282,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[10] = idBytes[1];
|
cdb[10] = idBytes[1];
|
||||||
cdb[11] = idBytes[0];
|
cdb[11] = idBytes[0];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "LOCATE (16) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "LOCATE (16) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -348,9 +348,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[3] = (byte)((transferLen & 0xFF00) >> 8);
|
cdb[3] = (byte)((transferLen & 0xFF00) >> 8);
|
||||||
cdb[4] = (byte)(transferLen & 0xFF);
|
cdb[4] = (byte)(transferLen & 0xFF);
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ (6) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ (6) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -468,9 +468,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[13] = (byte)((transferLen & 0xFF00) >> 8);
|
cdb[13] = (byte)((transferLen & 0xFF00) >> 8);
|
||||||
cdb[14] = (byte)(transferLen & 0xFF);
|
cdb[14] = (byte)(transferLen & 0xFF);
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ (16) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ (16) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -493,9 +493,9 @@ namespace DiscImageChef.Devices
|
|||||||
|
|
||||||
cdb[0] = (byte)ScsiCommands.ReadBlockLimits;
|
cdb[0] = (byte)ScsiCommands.ReadBlockLimits;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ BLOCK LIMITS took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ BLOCK LIMITS took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -590,9 +590,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ POSITION took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ POSITION took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -661,9 +661,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[3] = (byte)((transferLen & 0xFF00) >> 8);
|
cdb[3] = (byte)((transferLen & 0xFF00) >> 8);
|
||||||
cdb[4] = (byte)(transferLen & 0xFF);
|
cdb[4] = (byte)(transferLen & 0xFF);
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ REVERSE (6) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ REVERSE (6) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -784,9 +784,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[13] = (byte)((transferLen & 0xFF00) >> 8);
|
cdb[13] = (byte)((transferLen & 0xFF00) >> 8);
|
||||||
cdb[14] = (byte)(transferLen & 0xFF);
|
cdb[14] = (byte)(transferLen & 0xFF);
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "READ REVERSE (16) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "READ REVERSE (16) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -853,9 +853,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[3] = (byte)((transferLen & 0xFF00) >> 8);
|
cdb[3] = (byte)((transferLen & 0xFF00) >> 8);
|
||||||
cdb[4] = (byte)(transferLen & 0xFF);
|
cdb[4] = (byte)(transferLen & 0xFF);
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "RECOVER BUFFERED DATA took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "RECOVER BUFFERED DATA took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -911,9 +911,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8);
|
cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
if(sense) return true;
|
if(sense) return true;
|
||||||
|
|
||||||
@@ -925,9 +925,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||||
senseBuffer = new byte[32];
|
senseBuffer = new byte[32];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "REPORT DENSITY SUPPORT took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "REPORT DENSITY SUPPORT took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -962,9 +962,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[0] = (byte)ScsiCommands.Rewind;
|
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,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "REWIND took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "REWIND took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -989,9 +989,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[0] = (byte)ScsiCommands.TrackSelect;
|
cdb[0] = (byte)ScsiCommands.TrackSelect;
|
||||||
cdb[5] = track;
|
cdb[5] = track;
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "TRACK SELECT took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "TRACK SELECT took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -1012,9 +1012,9 @@ namespace DiscImageChef.Devices
|
|||||||
cdb[3] = countB[1];
|
cdb[3] = countB[1];
|
||||||
cdb[4] = countB[0];
|
cdb[4] = countB[0];
|
||||||
|
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "SPACE took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "SPACE took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -107,13 +107,13 @@ namespace DiscImageChef.Devices
|
|||||||
else buffer = new byte[0];
|
else buffer = new byte[0];
|
||||||
|
|
||||||
if(!inhibitDma)
|
if(!inhibitDma)
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
else
|
else
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
|
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "SYQUEST READ (6) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "SYQUEST READ (6) took {0} ms.", duration);
|
||||||
|
|
||||||
@@ -189,12 +189,12 @@ namespace DiscImageChef.Devices
|
|||||||
else buffer = new byte[0];
|
else buffer = new byte[0];
|
||||||
|
|
||||||
if(!inhibitDma)
|
if(!inhibitDma)
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
else
|
else
|
||||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||||
out sense);
|
out sense);
|
||||||
error = lastError != 0;
|
Error = LastError != 0;
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("SCSI Device", "SYQUEST READ (10) took {0} ms.", duration);
|
DicConsole.DebugWriteLine("SCSI Device", "SYQUEST READ (10) took {0} ms.", duration);
|
||||||
|
|
||||||
|
|||||||
@@ -34,33 +34,11 @@ namespace DiscImageChef.Devices
|
|||||||
{
|
{
|
||||||
public partial class Device
|
public partial class Device
|
||||||
{
|
{
|
||||||
Interop.PlatformID platformId;
|
|
||||||
object fd;
|
|
||||||
bool error;
|
|
||||||
int lastError;
|
|
||||||
readonly DeviceType type;
|
|
||||||
readonly string manufacturer;
|
|
||||||
readonly string model;
|
|
||||||
readonly string revision;
|
|
||||||
readonly string serial;
|
|
||||||
readonly Decoders.SCSI.PeripheralDeviceTypes scsiType;
|
|
||||||
readonly bool removable;
|
|
||||||
readonly bool usb;
|
|
||||||
readonly ushort usbVendor;
|
readonly ushort usbVendor;
|
||||||
readonly ushort usbProduct;
|
readonly ushort usbProduct;
|
||||||
readonly byte[] usbDescriptors;
|
|
||||||
readonly string usbManufacturerString;
|
|
||||||
readonly string usbProductString;
|
|
||||||
readonly string usbSerialString;
|
|
||||||
readonly bool firewire;
|
|
||||||
readonly ulong firewireGuid;
|
readonly ulong firewireGuid;
|
||||||
readonly uint firewireModel;
|
readonly uint firewireModel;
|
||||||
readonly string firewireModelName;
|
|
||||||
readonly uint firewireVendor;
|
readonly uint firewireVendor;
|
||||||
readonly string firewireVendorName;
|
|
||||||
readonly bool compactFlash;
|
|
||||||
readonly bool pcmcia;
|
|
||||||
readonly byte[] cis;
|
|
||||||
|
|
||||||
// MMC and SecureDigital, values that need to be get with card idle, something that may
|
// MMC and SecureDigital, values that need to be get with card idle, something that may
|
||||||
// not be possible to do but usually is already done by the SDHCI driver.
|
// not be possible to do but usually is already done by the SDHCI driver.
|
||||||
@@ -73,115 +51,79 @@ namespace DiscImageChef.Devices
|
|||||||
/// Gets the Platform ID for this device
|
/// Gets the Platform ID for this device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The Platform ID</value>
|
/// <value>The Platform ID</value>
|
||||||
public Interop.PlatformID PlatformId
|
public Interop.PlatformID PlatformId { get; }
|
||||||
{
|
|
||||||
get { return platformId; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the file handle representing this device
|
/// Gets the file handle representing this device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The file handle</value>
|
/// <value>The file handle</value>
|
||||||
public object FileHandle
|
public object FileHandle { get; }
|
||||||
{
|
|
||||||
get { return fd; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the standard timeout for commands sent to this device
|
/// Gets or sets the standard timeout for commands sent to this device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The timeout in seconds</value>
|
/// <value>The timeout in seconds</value>
|
||||||
public uint Timeout { get; set; }
|
public uint Timeout { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this <see cref="Device"/> is in error.
|
/// Gets a value indicating whether this <see cref="Device"/> is in error.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if error; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if error; otherwise, <c>false</c>.</value>
|
||||||
public bool Error
|
public bool Error { get; }
|
||||||
{
|
|
||||||
get { return error; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the last error number.
|
/// Gets the last error number.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The last error.</value>
|
/// <value>The last error.</value>
|
||||||
public int LastError
|
public int LastError { get; }
|
||||||
{
|
|
||||||
get { return lastError; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the device type.
|
/// Gets the device type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The device type.</value>
|
/// <value>The device type.</value>
|
||||||
public DeviceType Type
|
public DeviceType Type { get; }
|
||||||
{
|
|
||||||
get { return type; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the device's manufacturer
|
/// Gets the device's manufacturer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The manufacturer.</value>
|
/// <value>The manufacturer.</value>
|
||||||
public string Manufacturer
|
public string Manufacturer { get; }
|
||||||
{
|
|
||||||
get { return manufacturer; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the device model
|
/// Gets the device model
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The model.</value>
|
/// <value>The model.</value>
|
||||||
public string Model
|
public string Model { get; }
|
||||||
{
|
|
||||||
get { return model; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the device's revision.
|
/// Gets the device's revision.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The revision.</value>
|
/// <value>The revision.</value>
|
||||||
public string Revision
|
public string Revision { get; }
|
||||||
{
|
|
||||||
get { return revision; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the device's serial number.
|
/// Gets the device's serial number.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The serial number.</value>
|
/// <value>The serial number.</value>
|
||||||
public string Serial
|
public string Serial { get; }
|
||||||
{
|
|
||||||
get { return serial; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the device's SCSI peripheral device type
|
/// Gets the device's SCSI peripheral device type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The SCSI peripheral device type.</value>
|
/// <value>The SCSI peripheral device type.</value>
|
||||||
public Decoders.SCSI.PeripheralDeviceTypes ScsiType
|
public Decoders.SCSI.PeripheralDeviceTypes ScsiType { get; }
|
||||||
{
|
|
||||||
get { return scsiType; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this device's media is removable.
|
/// Gets a value indicating whether this device's media is removable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if this device's media is removable; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this device's media is removable; otherwise, <c>false</c>.</value>
|
||||||
public bool IsRemovable
|
public bool IsRemovable { get; }
|
||||||
{
|
|
||||||
get { return removable; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this device is attached via USB.
|
/// Gets a value indicating whether this device is attached via USB.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if this device is attached via USB; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this device is attached via USB; otherwise, <c>false</c>.</value>
|
||||||
public bool IsUsb
|
public bool IsUsb { get; }
|
||||||
{
|
|
||||||
get { return usb; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the USB vendor ID.
|
/// Gets the USB vendor ID.
|
||||||
@@ -189,7 +131,7 @@ namespace DiscImageChef.Devices
|
|||||||
/// <value>The USB vendor ID.</value>
|
/// <value>The USB vendor ID.</value>
|
||||||
public ushort UsbVendorId
|
public ushort UsbVendorId
|
||||||
{
|
{
|
||||||
get { return usbVendor; }
|
get => usbVendor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -198,53 +140,38 @@ namespace DiscImageChef.Devices
|
|||||||
/// <value>The USB product ID.</value>
|
/// <value>The USB product ID.</value>
|
||||||
public ushort UsbProductId
|
public ushort UsbProductId
|
||||||
{
|
{
|
||||||
get { return usbProduct; }
|
get => usbProduct;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the USB descriptors.
|
/// Gets the USB descriptors.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The USB descriptors.</value>
|
/// <value>The USB descriptors.</value>
|
||||||
public byte[] UsbDescriptors
|
public byte[] UsbDescriptors { get; }
|
||||||
{
|
|
||||||
get { return usbDescriptors; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the USB manufacturer string.
|
/// Gets the USB manufacturer string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The USB manufacturer string.</value>
|
/// <value>The USB manufacturer string.</value>
|
||||||
public string UsbManufacturerString
|
public string UsbManufacturerString { get; }
|
||||||
{
|
|
||||||
get { return usbManufacturerString; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the USB product string.
|
/// Gets the USB product string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The USB product string.</value>
|
/// <value>The USB product string.</value>
|
||||||
public string UsbProductString
|
public string UsbProductString { get; }
|
||||||
{
|
|
||||||
get { return usbProductString; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the USB serial string.
|
/// Gets the USB serial string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The USB serial string.</value>
|
/// <value>The USB serial string.</value>
|
||||||
public string UsbSerialString
|
public string UsbSerialString { get; }
|
||||||
{
|
|
||||||
get { return usbSerialString; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this device is attached via FireWire.
|
/// Gets a value indicating whether this device is attached via FireWire.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if this device is attached via FireWire; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this device is attached via FireWire; otherwise, <c>false</c>.</value>
|
||||||
public bool IsFireWire
|
public bool IsFireWire { get; }
|
||||||
{
|
|
||||||
get { return firewire; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the FireWire GUID
|
/// Gets the FireWire GUID
|
||||||
@@ -252,7 +179,7 @@ namespace DiscImageChef.Devices
|
|||||||
/// <value>The FireWire GUID.</value>
|
/// <value>The FireWire GUID.</value>
|
||||||
public ulong FireWireGuid
|
public ulong FireWireGuid
|
||||||
{
|
{
|
||||||
get { return firewireGuid; }
|
get => firewireGuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -261,17 +188,14 @@ namespace DiscImageChef.Devices
|
|||||||
/// <value>The FireWire model.</value>
|
/// <value>The FireWire model.</value>
|
||||||
public uint FireWireModel
|
public uint FireWireModel
|
||||||
{
|
{
|
||||||
get { return firewireModel; }
|
get => firewireModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the FireWire model name.
|
/// Gets the FireWire model name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The FireWire model name.</value>
|
/// <value>The FireWire model name.</value>
|
||||||
public string FireWireModelName
|
public string FireWireModelName { get; }
|
||||||
{
|
|
||||||
get { return firewireModelName; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the FireWire vendor number.
|
/// Gets the FireWire vendor number.
|
||||||
@@ -279,42 +203,30 @@ namespace DiscImageChef.Devices
|
|||||||
/// <value>The FireWire vendor number.</value>
|
/// <value>The FireWire vendor number.</value>
|
||||||
public uint FireWireVendor
|
public uint FireWireVendor
|
||||||
{
|
{
|
||||||
get { return firewireVendor; }
|
get => firewireVendor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the FireWire vendor name.
|
/// Gets the FireWire vendor name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The FireWire vendor name.</value>
|
/// <value>The FireWire vendor name.</value>
|
||||||
public string FireWireVendorName
|
public string FireWireVendorName { get; }
|
||||||
{
|
|
||||||
get { return firewireVendorName; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this device is a CompactFlash device.
|
/// Gets a value indicating whether this device is a CompactFlash device.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if this device is a CompactFlash device; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this device is a CompactFlash device; otherwise, <c>false</c>.</value>
|
||||||
public bool IsCompactFlash
|
public bool IsCompactFlash { get; }
|
||||||
{
|
|
||||||
get { return compactFlash; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this device is a PCMCIA device.
|
/// Gets a value indicating whether this device is a PCMCIA device.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if this device is a PCMCIA device; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this device is a PCMCIA device; otherwise, <c>false</c>.</value>
|
||||||
public bool IsPcmcia
|
public bool IsPcmcia { get; }
|
||||||
{
|
|
||||||
get { return pcmcia; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contains the PCMCIA CIS if applicable
|
/// Contains the PCMCIA CIS if applicable
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public byte[] Cis
|
public byte[] Cis { get; }
|
||||||
{
|
|
||||||
get { return cis; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,75 +147,49 @@ namespace DiscImageChef.Filesystems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class FileEntryInfo
|
public class FileEntryInfo
|
||||||
{
|
{
|
||||||
DateTime crtimeUtc;
|
|
||||||
DateTime atimeUtc;
|
|
||||||
DateTime ctimeUtc;
|
|
||||||
DateTime btimeUtc;
|
|
||||||
DateTime mtimeUtc;
|
|
||||||
|
|
||||||
/// <summary>File attributes</summary>
|
/// <summary>File attributes</summary>
|
||||||
public FileAttributes Attributes;
|
public FileAttributes Attributes;
|
||||||
|
|
||||||
/// <summary>File creation date in UTC</summary>
|
/// <summary>File creation date in UTC</summary>
|
||||||
public DateTime CreationTimeUtc
|
public DateTime CreationTimeUtc { get; set; }
|
||||||
{
|
|
||||||
get { return crtimeUtc; }
|
|
||||||
set { crtimeUtc = value; }
|
|
||||||
}
|
|
||||||
/// <summary>File last access date in UTC</summary>
|
/// <summary>File last access date in UTC</summary>
|
||||||
public DateTime AccessTimeUtc
|
public DateTime AccessTimeUtc { get; set; }
|
||||||
{
|
|
||||||
get { return atimeUtc; }
|
|
||||||
set { atimeUtc = value; }
|
|
||||||
}
|
|
||||||
/// <summary>File attributes change date in UTC</summary>
|
/// <summary>File attributes change date in UTC</summary>
|
||||||
public DateTime StatusChangeTimeUtc
|
public DateTime StatusChangeTimeUtc { get; set; }
|
||||||
{
|
|
||||||
get { return ctimeUtc; }
|
|
||||||
set { ctimeUtc = value; }
|
|
||||||
}
|
|
||||||
/// <summary>File last backup date in UTC</summary>
|
/// <summary>File last backup date in UTC</summary>
|
||||||
public DateTime BackupTimeUtc
|
public DateTime BackupTimeUtc { get; set; }
|
||||||
{
|
|
||||||
get { return btimeUtc; }
|
|
||||||
set { btimeUtc = value; }
|
|
||||||
}
|
|
||||||
/// <summary>File last modification date in UTC</summary>
|
/// <summary>File last modification date in UTC</summary>
|
||||||
public DateTime LastWriteTimeUtc
|
public DateTime LastWriteTimeUtc { get; set; }
|
||||||
{
|
|
||||||
get { return mtimeUtc; }
|
|
||||||
set { mtimeUtc = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>File creation date</summary>
|
/// <summary>File creation date</summary>
|
||||||
public DateTime CreationTime
|
public DateTime CreationTime
|
||||||
{
|
{
|
||||||
get { return crtimeUtc.ToLocalTime(); }
|
get { return CreationTimeUtc.ToLocalTime(); }
|
||||||
set { crtimeUtc = value.ToUniversalTime(); }
|
set { CreationTimeUtc = value.ToUniversalTime(); }
|
||||||
}
|
}
|
||||||
/// <summary>File last access date</summary>
|
/// <summary>File last access date</summary>
|
||||||
public DateTime AccessTime
|
public DateTime AccessTime
|
||||||
{
|
{
|
||||||
get { return atimeUtc.ToLocalTime(); }
|
get { return AccessTimeUtc.ToLocalTime(); }
|
||||||
set { atimeUtc = value.ToUniversalTime(); }
|
set { AccessTimeUtc = value.ToUniversalTime(); }
|
||||||
}
|
}
|
||||||
/// <summary>File attributes change date</summary>
|
/// <summary>File attributes change date</summary>
|
||||||
public DateTime StatusChangeTime
|
public DateTime StatusChangeTime
|
||||||
{
|
{
|
||||||
get { return ctimeUtc.ToLocalTime(); }
|
get { return StatusChangeTimeUtc.ToLocalTime(); }
|
||||||
set { ctimeUtc = value.ToUniversalTime(); }
|
set { StatusChangeTimeUtc = value.ToUniversalTime(); }
|
||||||
}
|
}
|
||||||
/// <summary>File last backup date</summary>
|
/// <summary>File last backup date</summary>
|
||||||
public DateTime BackupTime
|
public DateTime BackupTime
|
||||||
{
|
{
|
||||||
get { return btimeUtc.ToLocalTime(); }
|
get { return BackupTimeUtc.ToLocalTime(); }
|
||||||
set { btimeUtc = value.ToUniversalTime(); }
|
set { BackupTimeUtc = value.ToUniversalTime(); }
|
||||||
}
|
}
|
||||||
/// <summary>File last modification date</summary>
|
/// <summary>File last modification date</summary>
|
||||||
public DateTime LastWriteTime
|
public DateTime LastWriteTime
|
||||||
{
|
{
|
||||||
get { return mtimeUtc.ToLocalTime(); }
|
get { return LastWriteTimeUtc.ToLocalTime(); }
|
||||||
set { mtimeUtc = value.ToUniversalTime(); }
|
set { LastWriteTimeUtc = value.ToUniversalTime(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>inode number for this file</summary>
|
/// <summary>inode number for this file</summary>
|
||||||
|
|||||||
@@ -70,18 +70,10 @@ namespace DiscImageChef.Settings
|
|||||||
public static class Settings
|
public static class Settings
|
||||||
{
|
{
|
||||||
public static DicSettings Current;
|
public static DicSettings Current;
|
||||||
static string reportsPath;
|
|
||||||
static string statsPath;
|
|
||||||
|
|
||||||
public static string ReportsPath
|
static string ReportsPath { get; set; }
|
||||||
{
|
|
||||||
get { return reportsPath; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string StatsPath
|
public static string StatsPath { get; private set; }
|
||||||
{
|
|
||||||
get { return statsPath; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void LoadSettings()
|
public static void LoadSettings()
|
||||||
{
|
{
|
||||||
@@ -103,11 +95,11 @@ namespace DiscImageChef.Settings
|
|||||||
string dicPath = Path.Combine(appSupportPath, "DiscImageChef");
|
string dicPath = Path.Combine(appSupportPath, "DiscImageChef");
|
||||||
if(!Directory.Exists(dicPath)) Directory.CreateDirectory(dicPath);
|
if(!Directory.Exists(dicPath)) Directory.CreateDirectory(dicPath);
|
||||||
|
|
||||||
reportsPath = Path.Combine(dicPath, "Reports");
|
ReportsPath = Path.Combine(dicPath, "Reports");
|
||||||
if(!Directory.Exists(reportsPath)) Directory.CreateDirectory(reportsPath);
|
if(!Directory.Exists(ReportsPath)) Directory.CreateDirectory(ReportsPath);
|
||||||
|
|
||||||
statsPath = Path.Combine(dicPath, "Statistics");
|
StatsPath = Path.Combine(dicPath, "Statistics");
|
||||||
if(!Directory.Exists(statsPath)) Directory.CreateDirectory(statsPath);
|
if(!Directory.Exists(StatsPath)) Directory.CreateDirectory(StatsPath);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Interop.PlatformID.Win32NT:
|
case Interop.PlatformID.Win32NT:
|
||||||
@@ -124,11 +116,11 @@ namespace DiscImageChef.Settings
|
|||||||
string dicPath = Path.Combine(appSupportPath, "DiscImageChef");
|
string dicPath = Path.Combine(appSupportPath, "DiscImageChef");
|
||||||
if(!Directory.Exists(dicPath)) Directory.CreateDirectory(dicPath);
|
if(!Directory.Exists(dicPath)) Directory.CreateDirectory(dicPath);
|
||||||
|
|
||||||
reportsPath = Path.Combine(dicPath, "Reports");
|
ReportsPath = Path.Combine(dicPath, "Reports");
|
||||||
if(!Directory.Exists(reportsPath)) Directory.CreateDirectory(reportsPath);
|
if(!Directory.Exists(ReportsPath)) Directory.CreateDirectory(ReportsPath);
|
||||||
|
|
||||||
statsPath = Path.Combine(dicPath, "Statistics");
|
StatsPath = Path.Combine(dicPath, "Statistics");
|
||||||
if(!Directory.Exists(statsPath)) Directory.CreateDirectory(statsPath);
|
if(!Directory.Exists(StatsPath)) Directory.CreateDirectory(StatsPath);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -141,16 +133,16 @@ namespace DiscImageChef.Settings
|
|||||||
string dicPath = Path.Combine(appSupportPath, "DiscImageChef");
|
string dicPath = Path.Combine(appSupportPath, "DiscImageChef");
|
||||||
if(!Directory.Exists(dicPath)) Directory.CreateDirectory(dicPath);
|
if(!Directory.Exists(dicPath)) Directory.CreateDirectory(dicPath);
|
||||||
|
|
||||||
reportsPath = Path.Combine(dicPath, "Reports");
|
ReportsPath = Path.Combine(dicPath, "Reports");
|
||||||
if(!Directory.Exists(reportsPath)) Directory.CreateDirectory(reportsPath);
|
if(!Directory.Exists(ReportsPath)) Directory.CreateDirectory(ReportsPath);
|
||||||
|
|
||||||
statsPath = Path.Combine(dicPath, "Statistics");
|
StatsPath = Path.Combine(dicPath, "Statistics");
|
||||||
if(!Directory.Exists(statsPath)) Directory.CreateDirectory(statsPath);
|
if(!Directory.Exists(StatsPath)) Directory.CreateDirectory(StatsPath);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch { reportsPath = null; }
|
catch { ReportsPath = null; }
|
||||||
|
|
||||||
FileStream prefsFs = null;
|
FileStream prefsFs = null;
|
||||||
StreamReader prefsSr = null;
|
StreamReader prefsSr = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user