mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
REFACTOR: Fixed MOST name inconsistencies.
This commit is contained in:
@@ -50,7 +50,7 @@ namespace DiscImageChef.Devices
|
||||
public int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout,
|
||||
ScsiDirection direction, out double duration, out bool sense)
|
||||
{
|
||||
return Command.SendScsiCommand(platformID, fd, cdb, ref buffer, out senseBuffer, timeout, direction,
|
||||
return Command.SendScsiCommand(platformId, fd, cdb, ref buffer, out senseBuffer, timeout, direction,
|
||||
out duration, out sense);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace DiscImageChef.Devices
|
||||
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer,
|
||||
uint timeout, bool transferBlocks, out double duration, out bool sense)
|
||||
{
|
||||
return Command.SendAtaCommand(platformID, fd, registers, out errorRegisters, protocol, transferRegister,
|
||||
return Command.SendAtaCommand(platformId, fd, registers, out errorRegisters, protocol, transferRegister,
|
||||
ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace DiscImageChef.Devices
|
||||
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer,
|
||||
uint timeout, bool transferBlocks, out double duration, out bool sense)
|
||||
{
|
||||
return Command.SendAtaCommand(platformID, fd, registers, out errorRegisters, protocol, transferRegister,
|
||||
return Command.SendAtaCommand(platformId, fd, registers, out errorRegisters, protocol, transferRegister,
|
||||
ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace DiscImageChef.Devices
|
||||
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer,
|
||||
uint timeout, bool transferBlocks, out double duration, out bool sense)
|
||||
{
|
||||
return Command.SendAtaCommand(platformID, fd, registers, out errorRegisters, protocol, transferRegister,
|
||||
return Command.SendAtaCommand(platformId, fd, registers, out errorRegisters, protocol, transferRegister,
|
||||
ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace DiscImageChef.Devices
|
||||
uint blockSize, uint blocks, ref byte[] buffer, out uint[] response,
|
||||
out double duration, out bool sense, uint timeout = 0)
|
||||
{
|
||||
if(command == MmcCommands.SendCID && cachedCid != null)
|
||||
if(command == MmcCommands.SendCid && cachedCid != null)
|
||||
{
|
||||
System.DateTime start = System.DateTime.Now;
|
||||
buffer = new byte[cachedCid.Length];
|
||||
@@ -149,7 +149,7 @@ namespace DiscImageChef.Devices
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(command == MmcCommands.SendCSD && cachedCid != null)
|
||||
if(command == MmcCommands.SendCsd && cachedCid != null)
|
||||
{
|
||||
System.DateTime start = System.DateTime.Now;
|
||||
buffer = new byte[cachedCsd.Length];
|
||||
@@ -161,7 +161,7 @@ namespace DiscImageChef.Devices
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(command == (MmcCommands)SecureDigitalCommands.SendSCR && cachedScr != null)
|
||||
if(command == (MmcCommands)SecureDigitalCommands.SendScr && cachedScr != null)
|
||||
{
|
||||
System.DateTime start = System.DateTime.Now;
|
||||
buffer = new byte[cachedScr.Length];
|
||||
@@ -186,7 +186,7 @@ namespace DiscImageChef.Devices
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Command.SendMmcCommand(platformID, fd, command, write, isApplication, flags, argument, blockSize,
|
||||
return Command.SendMmcCommand(platformId, fd, command, write, isApplication, flags, argument, blockSize,
|
||||
blocks, ref buffer, out response, out duration, out sense, timeout);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,12 +46,12 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="devicePath">Device path</param>
|
||||
public Device(string devicePath)
|
||||
{
|
||||
platformID = Interop.DetectOS.GetRealPlatformID();
|
||||
platformId = Interop.DetectOS.GetRealPlatformID();
|
||||
Timeout = 15;
|
||||
error = false;
|
||||
removable = false;
|
||||
|
||||
switch(platformID)
|
||||
switch(platformId)
|
||||
{
|
||||
case Interop.PlatformID.Win32NT:
|
||||
{
|
||||
@@ -91,17 +91,17 @@ namespace DiscImageChef.Devices
|
||||
lastError = Marshal.GetLastWin32Error();
|
||||
}
|
||||
|
||||
FreeBSD.cam_device camDevice =
|
||||
(FreeBSD.cam_device)Marshal.PtrToStructure((IntPtr)fd, typeof(FreeBSD.cam_device));
|
||||
FreeBSD.CamDevice camDevice =
|
||||
(FreeBSD.CamDevice)Marshal.PtrToStructure((IntPtr)fd, typeof(FreeBSD.CamDevice));
|
||||
|
||||
if(StringHandlers.CToString(camDevice.sim_name) == "ata")
|
||||
if(StringHandlers.CToString(camDevice.SimName) == "ata")
|
||||
throw new
|
||||
InvalidOperationException("Parallel ATA devices are not supported on FreeBSD due to upstream bug #224250.");
|
||||
|
||||
break;
|
||||
}
|
||||
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));
|
||||
@@ -121,7 +121,7 @@ namespace DiscImageChef.Devices
|
||||
string ntDevicePath = null;
|
||||
|
||||
// Windows is answering SCSI INQUIRY for all device types so it needs to be detected first
|
||||
if(platformID == Interop.PlatformID.Win32NT)
|
||||
if(platformId == Interop.PlatformID.Win32NT)
|
||||
{
|
||||
Windows.StoragePropertyQuery query = new Windows.StoragePropertyQuery();
|
||||
query.PropertyId = Windows.StoragePropertyId.Device;
|
||||
@@ -129,39 +129,39 @@ namespace DiscImageChef.Devices
|
||||
query.AdditionalParameters = new byte[1];
|
||||
|
||||
IntPtr descriptorPtr = Marshal.AllocHGlobal(1000);
|
||||
byte[] descriptor_b = new byte[1000];
|
||||
byte[] descriptorB = new byte[1000];
|
||||
|
||||
uint returned = 0;
|
||||
int error = 0;
|
||||
|
||||
bool hasError = !Windows.Extern.DeviceIoControlStorageQuery((SafeFileHandle)fd,
|
||||
Windows.WindowsIoctl
|
||||
.IOCTL_STORAGE_QUERY_PROPERTY,
|
||||
.IoctlStorageQueryProperty,
|
||||
ref query, (uint)Marshal.SizeOf(query),
|
||||
descriptorPtr, 1000, ref returned,
|
||||
IntPtr.Zero);
|
||||
|
||||
if(hasError) error = Marshal.GetLastWin32Error();
|
||||
|
||||
Marshal.Copy(descriptorPtr, descriptor_b, 0, 1000);
|
||||
Marshal.Copy(descriptorPtr, descriptorB, 0, 1000);
|
||||
|
||||
if(!hasError && error == 0)
|
||||
{
|
||||
Windows.StorageDeviceDescriptor descriptor = new Windows.StorageDeviceDescriptor();
|
||||
descriptor.Version = BitConverter.ToUInt32(descriptor_b, 0);
|
||||
descriptor.Size = BitConverter.ToUInt32(descriptor_b, 4);
|
||||
descriptor.DeviceType = descriptor_b[8];
|
||||
descriptor.DeviceTypeModifier = descriptor_b[9];
|
||||
descriptor.RemovableMedia = descriptor_b[10] > 0;
|
||||
descriptor.CommandQueueing = descriptor_b[11] > 0;
|
||||
descriptor.VendorIdOffset = BitConverter.ToUInt32(descriptor_b, 12);
|
||||
descriptor.ProductIdOffset = BitConverter.ToUInt32(descriptor_b, 16);
|
||||
descriptor.ProductRevisionOffset = BitConverter.ToUInt32(descriptor_b, 20);
|
||||
descriptor.SerialNumberOffset = BitConverter.ToUInt32(descriptor_b, 24);
|
||||
descriptor.BusType = (Windows.StorageBusType)BitConverter.ToUInt32(descriptor_b, 28);
|
||||
descriptor.RawPropertiesLength = BitConverter.ToUInt32(descriptor_b, 32);
|
||||
descriptor.Version = BitConverter.ToUInt32(descriptorB, 0);
|
||||
descriptor.Size = BitConverter.ToUInt32(descriptorB, 4);
|
||||
descriptor.DeviceType = descriptorB[8];
|
||||
descriptor.DeviceTypeModifier = descriptorB[9];
|
||||
descriptor.RemovableMedia = descriptorB[10] > 0;
|
||||
descriptor.CommandQueueing = descriptorB[11] > 0;
|
||||
descriptor.VendorIdOffset = BitConverter.ToUInt32(descriptorB, 12);
|
||||
descriptor.ProductIdOffset = BitConverter.ToUInt32(descriptorB, 16);
|
||||
descriptor.ProductRevisionOffset = BitConverter.ToUInt32(descriptorB, 20);
|
||||
descriptor.SerialNumberOffset = BitConverter.ToUInt32(descriptorB, 24);
|
||||
descriptor.BusType = (Windows.StorageBusType)BitConverter.ToUInt32(descriptorB, 28);
|
||||
descriptor.RawPropertiesLength = BitConverter.ToUInt32(descriptorB, 32);
|
||||
descriptor.RawDeviceProperties = new byte[descriptor.RawPropertiesLength];
|
||||
Array.Copy(descriptor_b, 36, descriptor.RawDeviceProperties, 0, descriptor.RawPropertiesLength);
|
||||
Array.Copy(descriptorB, 36, descriptor.RawDeviceProperties, 0, descriptor.RawPropertiesLength);
|
||||
|
||||
switch(descriptor.BusType)
|
||||
{
|
||||
@@ -207,9 +207,9 @@ namespace DiscImageChef.Devices
|
||||
if(!atapiSense)
|
||||
{
|
||||
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";
|
||||
}
|
||||
@@ -224,9 +224,9 @@ namespace DiscImageChef.Devices
|
||||
byte[] sdBuffer = new byte[16];
|
||||
bool sense = false;
|
||||
|
||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendCSD, false, false,
|
||||
MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 |
|
||||
MmcFlags.CommandAC, 0, 16, 1, ref sdBuffer,
|
||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendCsd, false, false,
|
||||
MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 |
|
||||
MmcFlags.CommandAc, 0, 16, 1, ref sdBuffer,
|
||||
out uint[] response, out double duration, out sense, 0);
|
||||
|
||||
if(!sense)
|
||||
@@ -238,9 +238,9 @@ namespace DiscImageChef.Devices
|
||||
sdBuffer = new byte[16];
|
||||
sense = false;
|
||||
|
||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendCID, false, false,
|
||||
MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 |
|
||||
MmcFlags.CommandAC, 0, 16, 1, ref sdBuffer, out response,
|
||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendCid, false, false,
|
||||
MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 |
|
||||
MmcFlags.CommandAc, 0, 16, 1, ref sdBuffer, out response,
|
||||
out duration, out sense, 0);
|
||||
|
||||
if(!sense)
|
||||
@@ -253,9 +253,9 @@ namespace DiscImageChef.Devices
|
||||
sense = false;
|
||||
|
||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd,
|
||||
(MmcCommands)SecureDigitalCommands.SendSCR, false, true,
|
||||
MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 |
|
||||
MmcFlags.CommandADTC, 0, 8, 1, ref sdBuffer,
|
||||
(MmcCommands)SecureDigitalCommands.SendScr, false, true,
|
||||
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 |
|
||||
MmcFlags.CommandAdtc, 0, 8, 1, ref sdBuffer,
|
||||
out response, out duration, out sense, 0);
|
||||
|
||||
if(!sense)
|
||||
@@ -272,8 +272,8 @@ namespace DiscImageChef.Devices
|
||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd,
|
||||
(MmcCommands)SecureDigitalCommands
|
||||
.SendOperatingCondition, false, true,
|
||||
MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 |
|
||||
MmcFlags.CommandBCR, 0, 4, 1, ref sdBuffer,
|
||||
MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 |
|
||||
MmcFlags.CommandBcr, 0, 4, 1, ref sdBuffer,
|
||||
out response, out duration, out sense, 0);
|
||||
|
||||
if(!sense)
|
||||
@@ -289,8 +289,8 @@ namespace DiscImageChef.Devices
|
||||
|
||||
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendOpCond, false,
|
||||
true,
|
||||
MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 |
|
||||
MmcFlags.CommandBCR, 0, 4, 1, ref sdBuffer,
|
||||
MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 |
|
||||
MmcFlags.CommandBcr, 0, 4, 1, ref sdBuffer,
|
||||
out response, out duration, out sense, 0);
|
||||
|
||||
if(!sense)
|
||||
@@ -301,7 +301,7 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(platformID == Interop.PlatformID.Linux)
|
||||
else if(platformId == Interop.PlatformID.Linux)
|
||||
{
|
||||
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) ||
|
||||
devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) ||
|
||||
@@ -313,22 +313,22 @@ namespace DiscImageChef.Devices
|
||||
string devPath = devicePath.Substring(5);
|
||||
if(System.IO.File.Exists("/sys/block/" + devPath + "/device/csd"))
|
||||
{
|
||||
int len = ConvertFromHexASCII("/sys/block/" + devPath + "/device/csd", out cachedCsd);
|
||||
int len = ConvertFromHexAscii("/sys/block/" + devPath + "/device/csd", out cachedCsd);
|
||||
if(len == 0) cachedCsd = null;
|
||||
}
|
||||
if(System.IO.File.Exists("/sys/block/" + devPath + "/device/cid"))
|
||||
{
|
||||
int len = ConvertFromHexASCII("/sys/block/" + devPath + "/device/cid", out cachedCid);
|
||||
int len = ConvertFromHexAscii("/sys/block/" + devPath + "/device/cid", out cachedCid);
|
||||
if(len == 0) cachedCid = null;
|
||||
}
|
||||
if(System.IO.File.Exists("/sys/block/" + devPath + "/device/scr"))
|
||||
{
|
||||
int len = ConvertFromHexASCII("/sys/block/" + devPath + "/device/scr", out cachedScr);
|
||||
int len = ConvertFromHexAscii("/sys/block/" + devPath + "/device/scr", out cachedScr);
|
||||
if(len == 0) cachedScr = null;
|
||||
}
|
||||
if(System.IO.File.Exists("/sys/block/" + devPath + "/device/ocr"))
|
||||
{
|
||||
int len = ConvertFromHexASCII("/sys/block/" + devPath + "/device/ocr", out cachedOcr);
|
||||
int len = ConvertFromHexAscii("/sys/block/" + devPath + "/device/ocr", out cachedOcr);
|
||||
if(len == 0) cachedOcr = null;
|
||||
}
|
||||
}
|
||||
@@ -365,7 +365,7 @@ namespace DiscImageChef.Devices
|
||||
#endregion SecureDigital / MultiMediaCard
|
||||
|
||||
#region USB
|
||||
if(platformID == Interop.PlatformID.Linux)
|
||||
if(platformId == Interop.PlatformID.Linux)
|
||||
{
|
||||
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) ||
|
||||
devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) ||
|
||||
@@ -439,15 +439,15 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(platformID == Interop.PlatformID.Win32NT)
|
||||
else if(platformId == Interop.PlatformID.Win32NT)
|
||||
{
|
||||
Windows.Usb.USBDevice usbDevice = null;
|
||||
Windows.Usb.UsbDevice usbDevice = null;
|
||||
|
||||
// I have to search for USB disks, floppies and CD-ROMs as separate device types
|
||||
foreach(string devGuid in new[]
|
||||
{
|
||||
Windows.Usb.GUID_DEVINTERFACE_FLOPPY, Windows.Usb.GUID_DEVINTERFACE_CDROM,
|
||||
Windows.Usb.GUID_DEVINTERFACE_DISK
|
||||
Windows.Usb.GuidDevinterfaceFloppy, Windows.Usb.GuidDevinterfaceCdrom,
|
||||
Windows.Usb.GuidDevinterfaceDisk
|
||||
})
|
||||
{
|
||||
usbDevice = Windows.Usb.FindDrivePath(devicePath, devGuid);
|
||||
@@ -470,7 +470,7 @@ namespace DiscImageChef.Devices
|
||||
#endregion USB
|
||||
|
||||
#region FireWire
|
||||
if(platformID == Interop.PlatformID.Linux)
|
||||
if(platformId == Interop.PlatformID.Linux)
|
||||
{
|
||||
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) ||
|
||||
devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) ||
|
||||
@@ -539,7 +539,7 @@ namespace DiscImageChef.Devices
|
||||
#endregion FireWire
|
||||
|
||||
#region PCMCIA
|
||||
if(platformID == Interop.PlatformID.Linux)
|
||||
if(platformId == Interop.PlatformID.Linux)
|
||||
{
|
||||
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) ||
|
||||
devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) ||
|
||||
@@ -596,23 +596,23 @@ namespace DiscImageChef.Devices
|
||||
|
||||
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;
|
||||
bool serialSense = ScsiInquiry(out inqBuf, out senseBuf, 0x80);
|
||||
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();
|
||||
tmp = StringHandlers.CToString(Inquiry.Value.ProductIdentification);
|
||||
tmp = StringHandlers.CToString(inquiry.Value.ProductIdentification);
|
||||
if(tmp != null) model = tmp.Trim();
|
||||
tmp = StringHandlers.CToString(Inquiry.Value.VendorIdentification);
|
||||
tmp = StringHandlers.CToString(inquiry.Value.VendorIdentification);
|
||||
if(tmp != null) manufacturer = tmp.Trim();
|
||||
removable = Inquiry.Value.RMB;
|
||||
removable = inquiry.Value.RMB;
|
||||
|
||||
scsiType = (Decoders.SCSI.PeripheralDeviceTypes)Inquiry.Value.PeripheralDeviceType;
|
||||
scsiType = (Decoders.SCSI.PeripheralDeviceTypes)inquiry.Value.PeripheralDeviceType;
|
||||
}
|
||||
|
||||
bool atapiSense = AtapiIdentify(out ataBuf, out errorRegisters);
|
||||
@@ -620,9 +620,9 @@ namespace DiscImageChef.Devices
|
||||
if(!atapiSense)
|
||||
{
|
||||
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
|
||||
{
|
||||
@@ -637,11 +637,11 @@ namespace DiscImageChef.Devices
|
||||
if(!ataSense)
|
||||
{
|
||||
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];
|
||||
else
|
||||
@@ -650,15 +650,15 @@ namespace DiscImageChef.Devices
|
||||
model = separated[separated.Length - 1];
|
||||
}
|
||||
|
||||
revision = ATAID.Value.FirmwareRevision;
|
||||
serial = ATAID.Value.SerialNumber;
|
||||
revision = ataid.Value.FirmwareRevision;
|
||||
serial = ataid.Value.SerialNumber;
|
||||
|
||||
scsiType = Decoders.SCSI.PeripheralDeviceTypes.DirectAccess;
|
||||
|
||||
if((ushort)ATAID.Value.GeneralConfiguration != 0x848A)
|
||||
if((ushort)ataid.Value.GeneralConfiguration != 0x848A)
|
||||
{
|
||||
removable |=
|
||||
(ATAID.Value.GeneralConfiguration & Identify.GeneralConfigurationBit.Removable) ==
|
||||
(ataid.Value.GeneralConfiguration & Identify.GeneralConfigurationBit.Removable) ==
|
||||
Identify.GeneralConfigurationBit.Removable;
|
||||
}
|
||||
else compactFlash = true;
|
||||
@@ -694,7 +694,7 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
}
|
||||
|
||||
static int ConvertFromHexASCII(string file, out byte[] outBuf)
|
||||
static int ConvertFromHexAscii(string file, out byte[] outBuf)
|
||||
{
|
||||
System.IO.StreamReader sr = new System.IO.StreamReader(file);
|
||||
string ins = sr.ReadToEnd().Trim();
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
if(fd != null)
|
||||
{
|
||||
switch(platformID)
|
||||
switch(platformId)
|
||||
{
|
||||
case Interop.PlatformID.Win32NT:
|
||||
Windows.Extern.CloseHandle((SafeFileHandle)fd);
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
public struct DeviceInfo
|
||||
{
|
||||
public string path;
|
||||
public string vendor;
|
||||
public string model;
|
||||
public string serial;
|
||||
public string bus;
|
||||
public bool supported;
|
||||
public string Path;
|
||||
public string Vendor;
|
||||
public string Model;
|
||||
public string Serial;
|
||||
public string Bus;
|
||||
public bool Supported;
|
||||
}
|
||||
|
||||
public partial class Device
|
||||
|
||||
@@ -36,13 +36,13 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
public partial class Device
|
||||
{
|
||||
public bool ReadCSD(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
public bool ReadCsd(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[16];
|
||||
bool sense = false;
|
||||
|
||||
lastError = SendMmcCommand(MmcCommands.SendCSD, false, false,
|
||||
MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 | MmcFlags.CommandAC, 0, 16, 1,
|
||||
lastError = SendMmcCommand(MmcCommands.SendCsd, false, false,
|
||||
MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 | MmcFlags.CommandAc, 0, 16, 1,
|
||||
ref buffer, out response, out duration, out sense, timeout);
|
||||
error = lastError != 0;
|
||||
|
||||
@@ -51,13 +51,13 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool ReadCID(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
public bool ReadCid(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[16];
|
||||
bool sense = false;
|
||||
|
||||
lastError = SendMmcCommand(MmcCommands.SendCID, false, false,
|
||||
MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 | MmcFlags.CommandAC, 0, 16, 1,
|
||||
lastError = SendMmcCommand(MmcCommands.SendCid, false, false,
|
||||
MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 | MmcFlags.CommandAc, 0, 16, 1,
|
||||
ref buffer, out response, out duration, out sense, timeout);
|
||||
error = lastError != 0;
|
||||
|
||||
@@ -66,13 +66,13 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool ReadOCR(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
public bool ReadOcr(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[4];
|
||||
bool sense = false;
|
||||
|
||||
lastError = SendMmcCommand(MmcCommands.SendOpCond, false, true,
|
||||
MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 | MmcFlags.CommandBCR, 0, 4, 1,
|
||||
MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 | MmcFlags.CommandBcr, 0, 4, 1,
|
||||
ref buffer, out response, out duration, out sense, timeout);
|
||||
error = lastError != 0;
|
||||
|
||||
@@ -81,13 +81,13 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool ReadExtendedCSD(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
public bool ReadExtendedCsd(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[512];
|
||||
bool sense = false;
|
||||
|
||||
lastError = SendMmcCommand(MmcCommands.SendExtCSD, false, false,
|
||||
MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, 0, 512, 1,
|
||||
lastError = SendMmcCommand(MmcCommands.SendExtCsd, false, false,
|
||||
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, 0, 512, 1,
|
||||
ref buffer, out response, out duration, out sense, timeout);
|
||||
error = lastError != 0;
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace DiscImageChef.Devices
|
||||
bool sense = false;
|
||||
|
||||
lastError = SendMmcCommand(MmcCommands.SetBlocklen, false, false,
|
||||
MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandAC, length, 0,
|
||||
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAc, length, 0,
|
||||
0, ref buffer, out response, out duration, out sense, timeout);
|
||||
error = lastError != 0;
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace DiscImageChef.Devices
|
||||
else command = MmcCommands.ReadSingleBlock;
|
||||
|
||||
lastError = SendMmcCommand(command, false, false,
|
||||
MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, address,
|
||||
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, address,
|
||||
blockSize, transferLength, ref buffer, out response, out duration, out sense,
|
||||
timeout);
|
||||
error = lastError != 0;
|
||||
@@ -134,7 +134,7 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
byte[] foo = new byte[0];
|
||||
SendMmcCommand(MmcCommands.StopTransmission, false, false,
|
||||
MmcFlags.Response_R1b | MmcFlags.ResponseSPI_R1b | MmcFlags.CommandAC, 0, 0, 0, ref foo,
|
||||
MmcFlags.ResponseR1B | MmcFlags.ResponseSpiR1B | MmcFlags.CommandAc, 0, 0, 0, ref foo,
|
||||
out uint[] responseStop, out double stopDuration, out bool stopSense, timeout);
|
||||
duration += stopDuration;
|
||||
DicConsole.DebugWriteLine("MMC Device", "READ_MULTIPLE_BLOCK took {0} ms.", duration);
|
||||
@@ -150,7 +150,7 @@ namespace DiscImageChef.Devices
|
||||
bool sense = false;
|
||||
|
||||
lastError = SendMmcCommand(MmcCommands.SendStatus, false, true,
|
||||
MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandAC, 0, 4, 1,
|
||||
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAc, 0, 4, 1,
|
||||
ref buffer, out response, out duration, out sense, timeout);
|
||||
error = lastError != 0;
|
||||
|
||||
|
||||
@@ -36,13 +36,13 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
public partial class Device
|
||||
{
|
||||
public bool ReadSDStatus(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
public bool ReadSdStatus(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[64];
|
||||
bool sense = false;
|
||||
|
||||
lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendStatus, false, true,
|
||||
MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, 0, 64, 1,
|
||||
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, 0, 64, 1,
|
||||
ref buffer, out response, out duration, out sense, timeout);
|
||||
error = lastError != 0;
|
||||
|
||||
@@ -51,13 +51,13 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool ReadSDOCR(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
public bool ReadSdocr(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[4];
|
||||
bool sense = false;
|
||||
|
||||
lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendOperatingCondition, false, true,
|
||||
MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 | MmcFlags.CommandBCR, 0, 4, 1,
|
||||
MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 | MmcFlags.CommandBcr, 0, 4, 1,
|
||||
ref buffer, out response, out duration, out sense, timeout);
|
||||
error = lastError != 0;
|
||||
|
||||
@@ -66,13 +66,13 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool ReadSCR(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
public bool ReadScr(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[8];
|
||||
bool sense = false;
|
||||
|
||||
lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendSCR, false, true,
|
||||
MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, 0, 8, 1,
|
||||
lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendScr, false, true,
|
||||
MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, 0, 8, 1,
|
||||
ref buffer, out response, out duration, out sense, timeout);
|
||||
error = lastError != 0;
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace DiscImageChef.Devices
|
||||
senseBuffer = new byte[32];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Adaptec_Translate;
|
||||
cdb[0] = (byte)ScsiCommands.AdaptecTranslate;
|
||||
cdb[1] = (byte)((lba & 0x1F0000) >> 16);
|
||||
cdb[2] = (byte)((lba & 0xFF00) >> 8);
|
||||
cdb[3] = (byte)(lba & 0xFF);
|
||||
@@ -115,7 +115,7 @@ namespace DiscImageChef.Devices
|
||||
senseBuffer = new byte[32];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Adaptec_SetErrorThreshold;
|
||||
cdb[0] = (byte)ScsiCommands.AdaptecSetErrorThreshold;
|
||||
if(drive1) cdb[1] += 0x20;
|
||||
cdb[4] = 1;
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace DiscImageChef.Devices
|
||||
senseBuffer = new byte[32];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Adaptec_Translate;
|
||||
cdb[0] = (byte)ScsiCommands.AdaptecTranslate;
|
||||
if(drive1) cdb[1] += 0x20;
|
||||
cdb[4] = (byte)buffer.Length;
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace DiscImageChef.Devices
|
||||
senseBuffer = new byte[32];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Adaptec_WriteBuffer;
|
||||
cdb[0] = (byte)ScsiCommands.AdaptecWriteBuffer;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref oneKBuffer, out senseBuffer, timeout, ScsiDirection.Out, out duration,
|
||||
out sense);
|
||||
@@ -212,7 +212,7 @@ namespace DiscImageChef.Devices
|
||||
senseBuffer = new byte[32];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Adaptec_ReadBuffer;
|
||||
cdb[0] = (byte)ScsiCommands.AdaptecReadBuffer;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
out sense);
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace DiscImageChef.Devices
|
||||
senseBuffer = new byte[32];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Archive_RequestBlockAddress;
|
||||
cdb[0] = (byte)ScsiCommands.ArchiveRequestBlockAddress;
|
||||
cdb[1] = (byte)((lba & 0x1F0000) >> 16);
|
||||
cdb[2] = (byte)((lba & 0xFF00) >> 8);
|
||||
cdb[3] = (byte)(lba & 0xFF);
|
||||
@@ -94,7 +94,7 @@ namespace DiscImageChef.Devices
|
||||
senseBuffer = new byte[32];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Archive_SeekBlock;
|
||||
cdb[0] = (byte)ScsiCommands.ArchiveSeekBlock;
|
||||
cdb[1] = (byte)((lba & 0x1F0000) >> 16);
|
||||
cdb[2] = (byte)((lba & 0xFF00) >> 8);
|
||||
cdb[3] = (byte)(lba & 0xFF);
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace DiscImageChef.Devices
|
||||
senseBuffer = new byte[32];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Certance_ParkUnpark;
|
||||
cdb[0] = (byte)ScsiCommands.CertanceParkUnpark;
|
||||
if(park) cdb[4] = 1;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace DiscImageChef.Devices
|
||||
Array.Copy(firstHalfBytes, 0, buffer, 1, 8);
|
||||
Array.Copy(secondHalfBytes, 0, buffer, 9, 8);
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Fujitsu_Display;
|
||||
cdb[0] = (byte)ScsiCommands.FujitsuDisplay;
|
||||
cdb[6] = (byte)buffer.Length;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration,
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace DiscImageChef.Devices
|
||||
buffer = new byte[2064 * transferLength];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.HlDtSt_Vendor;
|
||||
cdb[0] = (byte)ScsiCommands.HlDtStVendor;
|
||||
cdb[1] = 0x48;
|
||||
cdb[2] = 0x49;
|
||||
cdb[3] = 0x54;
|
||||
|
||||
@@ -48,10 +48,10 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="pba">If set to <c>true</c> address contain physical block address.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool HPReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, ushort blockBytes,
|
||||
public bool HpReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, ushort blockBytes,
|
||||
bool pba, uint timeout, out double duration)
|
||||
{
|
||||
return HPReadLong(out buffer, out senseBuffer, relAddr, address, 0, blockBytes, pba, false, timeout,
|
||||
return HpReadLong(out buffer, out senseBuffer, relAddr, address, 0, blockBytes, pba, false, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="sectorCount">If set to <c>true</c> <paramref name="transferLen"/> is a count of secors to read. Otherwise it will be ignored</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool HPReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address,
|
||||
public bool HpReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address,
|
||||
ushort transferLen, ushort blockBytes, bool pba, bool sectorCount, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace DiscImageChef.Devices
|
||||
byte[] buffer = new byte[0];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Kreon_Command;
|
||||
cdb[0] = (byte)ScsiCommands.KreonCommand;
|
||||
cdb[1] = 0x08;
|
||||
cdb[2] = 0x01;
|
||||
cdb[3] = 0x01;
|
||||
@@ -116,7 +116,7 @@ namespace DiscImageChef.Devices
|
||||
byte[] buffer = new byte[0];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Kreon_Command;
|
||||
cdb[0] = (byte)ScsiCommands.KreonCommand;
|
||||
cdb[1] = 0x08;
|
||||
cdb[2] = 0x01;
|
||||
cdb[3] = 0x11;
|
||||
@@ -148,7 +148,7 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
features = 0;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Kreon_Command;
|
||||
cdb[0] = (byte)ScsiCommands.KreonCommand;
|
||||
cdb[1] = 0x08;
|
||||
cdb[2] = 0x01;
|
||||
cdb[3] = 0x10;
|
||||
@@ -178,7 +178,7 @@ namespace DiscImageChef.Devices
|
||||
features |= KreonFeatures.WxripperUnlock360;
|
||||
break;
|
||||
case 0x2001:
|
||||
features |= KreonFeatures.DecryptSS360;
|
||||
features |= KreonFeatures.DecryptSs360;
|
||||
break;
|
||||
case 0x2101:
|
||||
features |= KreonFeatures.ChallengeResponse360;
|
||||
@@ -190,7 +190,7 @@ namespace DiscImageChef.Devices
|
||||
features |= KreonFeatures.WxripperUnlock;
|
||||
break;
|
||||
case 0x2002:
|
||||
features |= KreonFeatures.DecryptSS;
|
||||
features |= KreonFeatures.DecryptSs;
|
||||
break;
|
||||
case 0x2102:
|
||||
features |= KreonFeatures.ChallengeResponse;
|
||||
@@ -215,7 +215,7 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
/// <param name="buffer">The SS sector.</param>
|
||||
public bool KreonExtractSS(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration,
|
||||
public bool KreonExtractSs(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration,
|
||||
byte requestNumber = 0x00)
|
||||
{
|
||||
buffer = new byte[2048];
|
||||
@@ -223,7 +223,7 @@ namespace DiscImageChef.Devices
|
||||
senseBuffer = new byte[32];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Kreon_SS_Command;
|
||||
cdb[0] = (byte)ScsiCommands.KreonSsCommand;
|
||||
cdb[1] = 0x00;
|
||||
cdb[2] = 0xFF;
|
||||
cdb[3] = 0x02;
|
||||
|
||||
@@ -76,9 +76,9 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <param name="startingFeatureNumber">Starting Feature number.</param>
|
||||
/// <param name="RT">Return type, <see cref="MmcGetConfigurationRt"/>.</param>
|
||||
/// <param name="rt">Return type, <see cref="MmcGetConfigurationRt"/>.</param>
|
||||
public bool GetConfiguration(out byte[] buffer, out byte[] senseBuffer, ushort startingFeatureNumber,
|
||||
MmcGetConfigurationRt RT, uint timeout, out double duration)
|
||||
MmcGetConfigurationRt rt, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[10];
|
||||
@@ -86,7 +86,7 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.GetConfiguration;
|
||||
cdb[1] = (byte)((byte)RT & 0x03);
|
||||
cdb[1] = (byte)((byte)rt & 0x03);
|
||||
cdb[2] = (byte)((startingFeatureNumber & 0xFF00) >> 8);
|
||||
cdb[3] = (byte)(startingFeatureNumber & 0xFF);
|
||||
cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
@@ -127,10 +127,10 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="layerNumber">Medium layer for requested disc structure</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="format">Which disc structure are we requesting</param>
|
||||
/// <param name="AGID">AGID used in medium copy protection</param>
|
||||
/// <param name="agid">AGID used in medium copy protection</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool ReadDiscStructure(out byte[] buffer, out byte[] senseBuffer, MmcDiscStructureMediaType mediaType,
|
||||
uint address, byte layerNumber, MmcDiscStructureFormat format, byte AGID,
|
||||
uint address, byte layerNumber, MmcDiscStructureFormat format, byte agid,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
@@ -148,7 +148,7 @@ namespace DiscImageChef.Devices
|
||||
cdb[7] = (byte)format;
|
||||
cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
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,
|
||||
out sense);
|
||||
@@ -193,14 +193,14 @@ namespace DiscImageChef.Devices
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer"/> contains the sense buffer.</returns>
|
||||
/// <param name="buffer">Buffer where the SCSI READ TOC/PMA/ATIP response will be stored</param>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="MSF">If <c>true</c>, request data in MM:SS:FF units, otherwise, in blocks</param>
|
||||
/// <param name="msf">If <c>true</c>, request data in MM:SS:FF units, otherwise, in blocks</param>
|
||||
/// <param name="track">Start TOC from this track</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool ReadToc(out byte[] buffer, out byte[] senseBuffer, bool MSF, byte track, uint timeout,
|
||||
public bool ReadToc(out byte[] buffer, out byte[] senseBuffer, bool msf, byte track, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return ReadTocPmaAtip(out buffer, out senseBuffer, MSF, 0, track, timeout, out duration);
|
||||
return ReadTocPmaAtip(out buffer, out senseBuffer, msf, 0, track, timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -222,13 +222,13 @@ namespace DiscImageChef.Devices
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer"/> contains the sense buffer.</returns>
|
||||
/// <param name="buffer">Buffer where the SCSI READ TOC/PMA/ATIP response will be stored</param>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="MSF">If <c>true</c>, request data in MM:SS:FF units, otherwise, in blocks</param>
|
||||
/// <param name="msf">If <c>true</c>, request data in MM:SS:FF units, otherwise, in blocks</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool ReadSessionInfo(out byte[] buffer, out byte[] senseBuffer, bool MSF, uint timeout,
|
||||
public bool ReadSessionInfo(out byte[] buffer, out byte[] senseBuffer, bool msf, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return ReadTocPmaAtip(out buffer, out senseBuffer, MSF, 1, 0, timeout, out duration);
|
||||
return ReadTocPmaAtip(out buffer, out senseBuffer, msf, 1, 0, timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -291,12 +291,12 @@ namespace DiscImageChef.Devices
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer"/> contains the sense buffer.</returns>
|
||||
/// <param name="buffer">Buffer where the SCSI READ TOC/PMA/ATIP response will be stored</param>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="MSF">If <c>true</c>, request data in MM:SS:FF units, otherwise, in blocks</param>
|
||||
/// <param name="msf">If <c>true</c>, request data in MM:SS:FF units, otherwise, in blocks</param>
|
||||
/// <param name="format">What structure is requested</param>
|
||||
/// <param name="trackSessionNumber">Track/Session number</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool ReadTocPmaAtip(out byte[] buffer, out byte[] senseBuffer, bool MSF, byte format,
|
||||
public bool ReadTocPmaAtip(out byte[] buffer, out byte[] senseBuffer, bool msf, byte format,
|
||||
byte trackSessionNumber, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
@@ -308,7 +308,7 @@ namespace DiscImageChef.Devices
|
||||
else tmpBuffer = new byte[1024];
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ReadTocPmaAtip;
|
||||
if(MSF) cdb[1] = 0x02;
|
||||
if(msf) cdb[1] = 0x02;
|
||||
cdb[2] = (byte)(format & 0x0F);
|
||||
cdb[6] = trackSessionNumber;
|
||||
cdb[7] = (byte)((tmpBuffer.Length & 0xFF00) >> 8);
|
||||
@@ -404,17 +404,17 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="transferLength">How many blocks to read.</param>
|
||||
/// <param name="blockSize">Block size.</param>
|
||||
/// <param name="expectedSectorType">Expected sector type.</param>
|
||||
/// <param name="DAP">If set to <c>true</c> CD-DA should be modified by mute and interpolation</param>
|
||||
/// <param name="dap">If set to <c>true</c> CD-DA should be modified by mute and interpolation</param>
|
||||
/// <param name="relAddr">If set to <c>true</c> address is relative to current position.</param>
|
||||
/// <param name="sync">If set to <c>true</c> we request the sync bytes for data sectors.</param>
|
||||
/// <param name="headerCodes">Header codes.</param>
|
||||
/// <param name="userData">If set to <c>true</c> we request the user data.</param>
|
||||
/// <param name="edcEcc">If set to <c>true</c> we request the EDC/ECC fields for data sectors.</param>
|
||||
/// <param name="C2Error">C2 error options.</param>
|
||||
/// <param name="c2Error">C2 error options.</param>
|
||||
/// <param name="subchannel">Subchannel selection.</param>
|
||||
public bool ReadCd(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint transferLength,
|
||||
MmcSectorTypes expectedSectorType, bool DAP, bool relAddr, bool sync,
|
||||
MmcHeaderCodes headerCodes, bool userData, bool edcEcc, MmcErrorField C2Error,
|
||||
MmcSectorTypes expectedSectorType, bool dap, bool relAddr, bool sync,
|
||||
MmcHeaderCodes headerCodes, bool userData, bool edcEcc, MmcErrorField c2Error,
|
||||
MmcSubchannel subchannel, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
@@ -423,7 +423,7 @@ namespace DiscImageChef.Devices
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ReadCd;
|
||||
cdb[1] = (byte)((byte)expectedSectorType << 2);
|
||||
if(DAP) cdb[1] += 0x02;
|
||||
if(dap) cdb[1] += 0x02;
|
||||
if(relAddr) cdb[1] += 0x01;
|
||||
cdb[2] = (byte)((lba & 0xFF000000) >> 24);
|
||||
cdb[3] = (byte)((lba & 0xFF0000) >> 16);
|
||||
@@ -432,7 +432,7 @@ namespace DiscImageChef.Devices
|
||||
cdb[6] = (byte)((transferLength & 0xFF0000) >> 16);
|
||||
cdb[7] = (byte)((transferLength & 0xFF00) >> 8);
|
||||
cdb[8] = (byte)(transferLength & 0xFF);
|
||||
cdb[9] = (byte)((byte)C2Error << 1);
|
||||
cdb[9] = (byte)((byte)c2Error << 1);
|
||||
cdb[9] += (byte)((byte)headerCodes << 5);
|
||||
if(sync) cdb[9] += 0x80;
|
||||
if(userData) cdb[9] += 0x10;
|
||||
@@ -462,16 +462,16 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="endMsf">End MM:SS:FF of read encoded as 0x00MMSSFF.</param>
|
||||
/// <param name="blockSize">Block size.</param>
|
||||
/// <param name="expectedSectorType">Expected sector type.</param>
|
||||
/// <param name="DAP">If set to <c>true</c> CD-DA should be modified by mute and interpolation</param>
|
||||
/// <param name="dap">If set to <c>true</c> CD-DA should be modified by mute and interpolation</param>
|
||||
/// <param name="sync">If set to <c>true</c> we request the sync bytes for data sectors.</param>
|
||||
/// <param name="headerCodes">Header codes.</param>
|
||||
/// <param name="userData">If set to <c>true</c> we request the user data.</param>
|
||||
/// <param name="edcEcc">If set to <c>true</c> we request the EDC/ECC fields for data sectors.</param>
|
||||
/// <param name="C2Error">C2 error options.</param>
|
||||
/// <param name="c2Error">C2 error options.</param>
|
||||
/// <param name="subchannel">Subchannel selection.</param>
|
||||
public bool ReadCdMsf(out byte[] buffer, out byte[] senseBuffer, uint startMsf, uint endMsf, uint blockSize,
|
||||
MmcSectorTypes expectedSectorType, bool DAP, bool sync, MmcHeaderCodes headerCodes,
|
||||
bool userData, bool edcEcc, MmcErrorField C2Error, MmcSubchannel subchannel, uint timeout,
|
||||
MmcSectorTypes expectedSectorType, bool dap, bool sync, MmcHeaderCodes headerCodes,
|
||||
bool userData, bool edcEcc, MmcErrorField c2Error, MmcSubchannel subchannel, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
@@ -480,14 +480,14 @@ namespace DiscImageChef.Devices
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ReadCdMsf;
|
||||
cdb[1] = (byte)((byte)expectedSectorType << 2);
|
||||
if(DAP) cdb[1] += 0x02;
|
||||
if(dap) cdb[1] += 0x02;
|
||||
cdb[3] = (byte)((startMsf & 0xFF0000) >> 16);
|
||||
cdb[4] = (byte)((startMsf & 0xFF00) >> 8);
|
||||
cdb[5] = (byte)(startMsf & 0xFF);
|
||||
cdb[6] = (byte)((endMsf & 0xFF0000) >> 16);
|
||||
cdb[7] = (byte)((endMsf & 0xFF00) >> 8);
|
||||
cdb[8] = (byte)(endMsf & 0xFF);
|
||||
cdb[9] = (byte)((byte)C2Error << 1);
|
||||
cdb[9] = (byte)((byte)c2Error << 1);
|
||||
cdb[9] += (byte)((byte)headerCodes << 5);
|
||||
if(sync) cdb[9] += 0x80;
|
||||
if(userData) cdb[9] += 0x10;
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace DiscImageChef.Devices
|
||||
byte[] cdb = new byte[10];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.NEC_ReadCdDa;
|
||||
cdb[0] = (byte)ScsiCommands.NecReadCdDa;
|
||||
cdb[2] = (byte)((lba & 0xFF000000) >> 24);
|
||||
cdb[3] = (byte)((lba & 0xFF0000) >> 16);
|
||||
cdb[4] = (byte)((lba & 0xFF00) >> 8);
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace DiscImageChef.Devices
|
||||
public bool PlasmonReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address,
|
||||
ushort blockBytes, bool pba, uint timeout, out double duration)
|
||||
{
|
||||
return HPReadLong(out buffer, out senseBuffer, relAddr, address, 0, blockBytes, pba, false, timeout,
|
||||
return HpReadLong(out buffer, out senseBuffer, relAddr, address, 0, blockBytes, pba, false, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace DiscImageChef.Devices
|
||||
ushort transferLen, ushort blockBytes, bool pba, bool sectorCount, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
return HPReadLong(out buffer, out senseBuffer, relAddr, address, transferLen, blockBytes, pba, sectorCount,
|
||||
return HpReadLong(out buffer, out senseBuffer, relAddr, address, transferLen, blockBytes, pba, sectorCount,
|
||||
timeout, out duration);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace DiscImageChef.Devices
|
||||
byte[] cdb = new byte[10];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Plasmon_ReadSectorLocation;
|
||||
cdb[0] = (byte)ScsiCommands.PlasmonReadSectorLocation;
|
||||
cdb[2] = (byte)((address & 0xFF000000) >> 24);
|
||||
cdb[3] = (byte)((address & 0xFF0000) >> 16);
|
||||
cdb[4] = (byte)((address & 0xFF00) >> 8);
|
||||
|
||||
@@ -123,14 +123,14 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool PlextorReadEepromCDR(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
|
||||
public bool PlextorReadEepromCdr(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[256];
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[12];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Plextor_ReadEeprom;
|
||||
cdb[0] = (byte)ScsiCommands.PlextorReadEeprom;
|
||||
cdb[8] = 1;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
@@ -157,7 +157,7 @@ namespace DiscImageChef.Devices
|
||||
byte[] cdb = new byte[12];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Plextor_ReadEeprom;
|
||||
cdb[0] = (byte)ScsiCommands.PlextorReadEeprom;
|
||||
cdb[8] = 2;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
@@ -187,7 +187,7 @@ namespace DiscImageChef.Devices
|
||||
byte[] cdb = new byte[12];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Plextor_ReadEeprom;
|
||||
cdb[0] = (byte)ScsiCommands.PlextorReadEeprom;
|
||||
cdb[1] = 1;
|
||||
cdb[7] = block;
|
||||
cdb[8] = (byte)((blockSize & 0xFF00) >> 8);
|
||||
@@ -224,7 +224,7 @@ namespace DiscImageChef.Devices
|
||||
max = 0;
|
||||
last = 0;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Plextor_PoweRec;
|
||||
cdb[0] = (byte)ScsiCommands.PlextorPoweRec;
|
||||
cdb[9] = (byte)buf.Length;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buf, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
@@ -264,7 +264,7 @@ namespace DiscImageChef.Devices
|
||||
enabled = false;
|
||||
speed = 0;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Plextor_Extend2;
|
||||
cdb[0] = (byte)ScsiCommands.PlextorExtend2;
|
||||
cdb[1] = (byte)PlextorSubCommands.GetMode;
|
||||
cdb[9] = (byte)buf.Length;
|
||||
|
||||
@@ -299,7 +299,7 @@ namespace DiscImageChef.Devices
|
||||
byte[] cdb = new byte[12];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Plextor_Extend;
|
||||
cdb[0] = (byte)ScsiCommands.PlextorExtend;
|
||||
cdb[1] = (byte)PlextorSubCommands.GetMode;
|
||||
cdb[2] = (byte)PlextorSubCommands.Silent;
|
||||
cdb[3] = 4;
|
||||
@@ -329,7 +329,7 @@ namespace DiscImageChef.Devices
|
||||
byte[] cdb = new byte[12];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Plextor_Extend;
|
||||
cdb[0] = (byte)ScsiCommands.PlextorExtend;
|
||||
cdb[1] = (byte)PlextorSubCommands.GetMode;
|
||||
cdb[2] = (byte)PlextorSubCommands.GigaRec;
|
||||
cdb[10] = (byte)buffer.Length;
|
||||
@@ -359,7 +359,7 @@ namespace DiscImageChef.Devices
|
||||
byte[] cdb = new byte[12];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Plextor_Extend;
|
||||
cdb[0] = (byte)ScsiCommands.PlextorExtend;
|
||||
cdb[1] = (byte)PlextorSubCommands.GetMode;
|
||||
cdb[2] = (byte)PlextorSubCommands.VariRec;
|
||||
cdb[10] = (byte)buffer.Length;
|
||||
@@ -391,7 +391,7 @@ namespace DiscImageChef.Devices
|
||||
byte[] cdb = new byte[12];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Plextor_Extend;
|
||||
cdb[0] = (byte)ScsiCommands.PlextorExtend;
|
||||
cdb[2] = (byte)PlextorSubCommands.SecuRec;
|
||||
cdb[10] = (byte)buffer.Length;
|
||||
|
||||
@@ -419,7 +419,7 @@ namespace DiscImageChef.Devices
|
||||
byte[] cdb = new byte[12];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Plextor_Extend;
|
||||
cdb[0] = (byte)ScsiCommands.PlextorExtend;
|
||||
cdb[1] = (byte)PlextorSubCommands.GetMode;
|
||||
cdb[2] = (byte)PlextorSubCommands.SpeedRead;
|
||||
cdb[10] = (byte)buffer.Length;
|
||||
@@ -448,7 +448,7 @@ namespace DiscImageChef.Devices
|
||||
byte[] cdb = new byte[12];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Plextor_Extend;
|
||||
cdb[0] = (byte)ScsiCommands.PlextorExtend;
|
||||
cdb[1] = (byte)PlextorSubCommands.GetMode;
|
||||
cdb[2] = (byte)PlextorSubCommands.SessionHide;
|
||||
cdb[9] = (byte)buffer.Length;
|
||||
@@ -478,12 +478,12 @@ namespace DiscImageChef.Devices
|
||||
byte[] cdb = new byte[12];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Plextor_Extend;
|
||||
cdb[0] = (byte)ScsiCommands.PlextorExtend;
|
||||
cdb[1] = (byte)PlextorSubCommands.GetMode;
|
||||
cdb[2] = (byte)PlextorSubCommands.BitSet;
|
||||
cdb[9] = (byte)buffer.Length;
|
||||
|
||||
if(dualLayer) cdb[3] = (byte)PlextorSubCommands.BitSetRDL;
|
||||
if(dualLayer) cdb[3] = (byte)PlextorSubCommands.BitSetRdl;
|
||||
else cdb[3] = (byte)PlextorSubCommands.BitSetR;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
@@ -511,7 +511,7 @@ namespace DiscImageChef.Devices
|
||||
byte[] cdb = new byte[12];
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Plextor_Extend;
|
||||
cdb[0] = (byte)ScsiCommands.PlextorExtend;
|
||||
cdb[1] = (byte)PlextorSubCommands.GetMode;
|
||||
cdb[2] = (byte)PlextorSubCommands.TestWriteDvdPlus;
|
||||
cdb[10] = (byte)buffer.Length;
|
||||
|
||||
@@ -233,13 +233,13 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <param name="DBD">If set to <c>true</c> device MUST not return any block descriptor.</param>
|
||||
/// <param name="dbd">If set to <c>true</c> device MUST not return any block descriptor.</param>
|
||||
/// <param name="pageControl">Page control.</param>
|
||||
/// <param name="pageCode">Page code.</param>
|
||||
public bool ModeSense6(out byte[] buffer, out byte[] senseBuffer, bool DBD,
|
||||
public bool ModeSense6(out byte[] buffer, out byte[] senseBuffer, bool dbd,
|
||||
ScsiModeSensePageControl pageControl, byte pageCode, uint timeout, out double duration)
|
||||
{
|
||||
return ModeSense6(out buffer, out senseBuffer, DBD, pageControl, pageCode, 0, timeout, out duration);
|
||||
return ModeSense6(out buffer, out senseBuffer, dbd, pageControl, pageCode, 0, timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -250,11 +250,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <param name="DBD">If set to <c>true</c> device MUST not return any block descriptor.</param>
|
||||
/// <param name="dbd">If set to <c>true</c> device MUST not return any block descriptor.</param>
|
||||
/// <param name="pageControl">Page control.</param>
|
||||
/// <param name="pageCode">Page code.</param>
|
||||
/// <param name="subPageCode">Sub-page code.</param>
|
||||
public bool ModeSense6(out byte[] buffer, out byte[] senseBuffer, bool DBD,
|
||||
public bool ModeSense6(out byte[] buffer, out byte[] senseBuffer, bool dbd,
|
||||
ScsiModeSensePageControl pageControl, byte pageCode, byte subPageCode, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
@@ -264,7 +264,7 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ModeSense;
|
||||
if(DBD) cdb[1] = 0x08;
|
||||
if(dbd) cdb[1] = 0x08;
|
||||
cdb[2] |= (byte)pageControl;
|
||||
cdb[2] |= (byte)(pageCode & 0x3F);
|
||||
cdb[3] = subPageCode;
|
||||
@@ -299,13 +299,13 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <param name="DBD">If set to <c>true</c> device MUST not return any block descriptor.</param>
|
||||
/// <param name="dbd">If set to <c>true</c> device MUST not return any block descriptor.</param>
|
||||
/// <param name="pageControl">Page control.</param>
|
||||
/// <param name="pageCode">Page code.</param>
|
||||
public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool DBD,
|
||||
public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool dbd,
|
||||
ScsiModeSensePageControl pageControl, byte pageCode, uint timeout, out double duration)
|
||||
{
|
||||
return ModeSense10(out buffer, out senseBuffer, false, DBD, pageControl, pageCode, 0, timeout,
|
||||
return ModeSense10(out buffer, out senseBuffer, false, dbd, pageControl, pageCode, 0, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
@@ -317,14 +317,14 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <param name="DBD">If set to <c>true</c> device MUST not return any block descriptor.</param>
|
||||
/// <param name="dbd">If set to <c>true</c> device MUST not return any block descriptor.</param>
|
||||
/// <param name="pageControl">Page control.</param>
|
||||
/// <param name="pageCode">Page code.</param>
|
||||
/// <param name="LLBAA">If set means 64-bit LBAs are accepted by the caller.</param>
|
||||
public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool LLBAA, bool DBD,
|
||||
/// <param name="llbaa">If set means 64-bit LBAs are accepted by the caller.</param>
|
||||
public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool llbaa, bool dbd,
|
||||
ScsiModeSensePageControl pageControl, byte pageCode, uint timeout, out double duration)
|
||||
{
|
||||
return ModeSense10(out buffer, out senseBuffer, LLBAA, DBD, pageControl, pageCode, 0, timeout,
|
||||
return ModeSense10(out buffer, out senseBuffer, llbaa, dbd, pageControl, pageCode, 0, timeout,
|
||||
out duration);
|
||||
}
|
||||
|
||||
@@ -336,12 +336,12 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <param name="DBD">If set to <c>true</c> device MUST not return any block descriptor.</param>
|
||||
/// <param name="dbd">If set to <c>true</c> device MUST not return any block descriptor.</param>
|
||||
/// <param name="pageControl">Page control.</param>
|
||||
/// <param name="pageCode">Page code.</param>
|
||||
/// <param name="subPageCode">Sub-page code.</param>
|
||||
/// <param name="LLBAA">If set means 64-bit LBAs are accepted by the caller.</param>
|
||||
public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool LLBAA, bool DBD,
|
||||
/// <param name="llbaa">If set means 64-bit LBAs are accepted by the caller.</param>
|
||||
public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool llbaa, bool dbd,
|
||||
ScsiModeSensePageControl pageControl, byte pageCode, byte subPageCode, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
@@ -351,8 +351,8 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ModeSense10;
|
||||
if(LLBAA) cdb[1] |= 0x10;
|
||||
if(DBD) cdb[1] |= 0x08;
|
||||
if(llbaa) cdb[1] |= 0x10;
|
||||
if(dbd) cdb[1] |= 0x08;
|
||||
cdb[2] |= (byte)pageControl;
|
||||
cdb[2] |= (byte)(pageCode & 0x3F);
|
||||
cdb[3] = subPageCode;
|
||||
@@ -472,12 +472,12 @@ namespace DiscImageChef.Devices
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer"/> contains the sense buffer.</returns>
|
||||
/// <param name="buffer">Buffer where the SCSI READ CAPACITY response will be stored</param>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="RelAddr">Indicates that <paramref name="address"/> is relative to current medium position</param>
|
||||
/// <param name="address">Address where information is requested from, only valid if <paramref name="PMI"/> is set</param>
|
||||
/// <param name="PMI">If set, it is requesting partial media capacity</param>
|
||||
/// <param name="relAddr">Indicates that <paramref name="address"/> is relative to current medium position</param>
|
||||
/// <param name="address">Address where information is requested from, only valid if <paramref name="pmi"/> is set</param>
|
||||
/// <param name="pmi">If set, it is requesting partial media capacity</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool ReadCapacity(out byte[] buffer, out byte[] senseBuffer, bool RelAddr, uint address, bool PMI,
|
||||
public bool ReadCapacity(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, bool pmi,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
@@ -487,10 +487,10 @@ namespace DiscImageChef.Devices
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ReadCapacity;
|
||||
|
||||
if(PMI)
|
||||
if(pmi)
|
||||
{
|
||||
cdb[8] = 0x01;
|
||||
if(RelAddr) cdb[1] = 0x01;
|
||||
if(relAddr) cdb[1] = 0x01;
|
||||
|
||||
cdb[2] = (byte)((address & 0xFF000000) >> 24);
|
||||
cdb[3] = (byte)((address & 0xFF0000) >> 16);
|
||||
@@ -526,11 +526,11 @@ namespace DiscImageChef.Devices
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer"/> contains the sense buffer.</returns>
|
||||
/// <param name="buffer">Buffer where the SCSI READ CAPACITY(16) response will be stored</param>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="address">Address where information is requested from, only valid if <paramref name="PMI"/> is set</param>
|
||||
/// <param name="PMI">If set, it is requesting partial media capacity</param>
|
||||
/// <param name="address">Address where information is requested from, only valid if <paramref name="pmi"/> is set</param>
|
||||
/// <param name="pmi">If set, it is requesting partial media capacity</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
public bool ReadCapacity16(out byte[] buffer, out byte[] senseBuffer, ulong address, bool PMI, uint timeout,
|
||||
public bool ReadCapacity16(out byte[] buffer, out byte[] senseBuffer, ulong address, bool pmi, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
@@ -541,7 +541,7 @@ namespace DiscImageChef.Devices
|
||||
cdb[0] = (byte)ScsiCommands.ServiceActionIn;
|
||||
cdb[1] = (byte)ScsiServiceActions.ReadCapacity16;
|
||||
|
||||
if(PMI)
|
||||
if(pmi)
|
||||
{
|
||||
cdb[14] = 0x01;
|
||||
byte[] temp = BitConverter.GetBytes(address);
|
||||
@@ -738,10 +738,10 @@ namespace DiscImageChef.Devices
|
||||
// Prevent overflows
|
||||
if(buffer.Length > 255)
|
||||
{
|
||||
if(platformID != Interop.PlatformID.Win32NT && platformID != Interop.PlatformID.Win32S &&
|
||||
platformID != Interop.PlatformID.Win32Windows && platformID != Interop.PlatformID.WinCE &&
|
||||
platformID != Interop.PlatformID.WindowsPhone &&
|
||||
platformID != Interop.PlatformID.Xbox) lastError = 75;
|
||||
if(platformId != Interop.PlatformID.Win32NT && platformId != Interop.PlatformID.Win32S &&
|
||||
platformId != Interop.PlatformID.Win32Windows && platformId != Interop.PlatformID.WinCE &&
|
||||
platformId != Interop.PlatformID.WindowsPhone &&
|
||||
platformId != Interop.PlatformID.Xbox) lastError = 75;
|
||||
else lastError = 111;
|
||||
error = true;
|
||||
duration = 0;
|
||||
@@ -781,10 +781,10 @@ namespace DiscImageChef.Devices
|
||||
// Prevent overflows
|
||||
if(buffer.Length > 65535)
|
||||
{
|
||||
if(platformID != Interop.PlatformID.Win32NT && platformID != Interop.PlatformID.Win32S &&
|
||||
platformID != Interop.PlatformID.Win32Windows && platformID != Interop.PlatformID.WinCE &&
|
||||
platformID != Interop.PlatformID.WindowsPhone &&
|
||||
platformID != Interop.PlatformID.Xbox) lastError = 75;
|
||||
if(platformId != Interop.PlatformID.Win32NT && platformId != Interop.PlatformID.Win32S &&
|
||||
platformId != Interop.PlatformID.Win32Windows && platformId != Interop.PlatformID.WinCE &&
|
||||
platformId != Interop.PlatformID.WindowsPhone &&
|
||||
platformId != Interop.PlatformID.Xbox) lastError = 75;
|
||||
else lastError = 111;
|
||||
error = true;
|
||||
duration = 0;
|
||||
|
||||
@@ -1004,13 +1004,13 @@ namespace DiscImageChef.Devices
|
||||
byte[] cdb = new byte[6];
|
||||
byte[] buffer = new byte[0];
|
||||
bool sense;
|
||||
byte[] count_b = BitConverter.GetBytes(count);
|
||||
byte[] countB = BitConverter.GetBytes(count);
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Space;
|
||||
cdb[1] = (byte)((byte)code & 0x0F);
|
||||
cdb[2] = count_b[2];
|
||||
cdb[3] = count_b[1];
|
||||
cdb[4] = count_b[0];
|
||||
cdb[2] = countB[2];
|
||||
cdb[3] = countB[1];
|
||||
cdb[4] = countB[0];
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
out sense);
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
public partial class Device
|
||||
{
|
||||
Interop.PlatformID platformID;
|
||||
Interop.PlatformID platformId;
|
||||
object fd;
|
||||
bool error;
|
||||
int lastError;
|
||||
@@ -73,9 +73,9 @@ namespace DiscImageChef.Devices
|
||||
/// Gets the Platform ID for this device
|
||||
/// </summary>
|
||||
/// <value>The Platform ID</value>
|
||||
public Interop.PlatformID PlatformID
|
||||
public Interop.PlatformID PlatformId
|
||||
{
|
||||
get { return platformID; }
|
||||
get { return platformId; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -160,7 +160,7 @@ namespace DiscImageChef.Devices
|
||||
/// Gets the device's SCSI peripheral device type
|
||||
/// </summary>
|
||||
/// <value>The SCSI peripheral device type.</value>
|
||||
public Decoders.SCSI.PeripheralDeviceTypes SCSIType
|
||||
public Decoders.SCSI.PeripheralDeviceTypes ScsiType
|
||||
{
|
||||
get { return scsiType; }
|
||||
}
|
||||
@@ -178,7 +178,7 @@ namespace DiscImageChef.Devices
|
||||
/// Gets a value indicating whether this device is attached via USB.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this device is attached via USB; otherwise, <c>false</c>.</value>
|
||||
public bool IsUSB
|
||||
public bool IsUsb
|
||||
{
|
||||
get { return usb; }
|
||||
}
|
||||
@@ -187,7 +187,7 @@ namespace DiscImageChef.Devices
|
||||
/// Gets the USB vendor ID.
|
||||
/// </summary>
|
||||
/// <value>The USB vendor ID.</value>
|
||||
public ushort USBVendorID
|
||||
public ushort UsbVendorId
|
||||
{
|
||||
get { return usbVendor; }
|
||||
}
|
||||
@@ -196,7 +196,7 @@ namespace DiscImageChef.Devices
|
||||
/// Gets the USB product ID.
|
||||
/// </summary>
|
||||
/// <value>The USB product ID.</value>
|
||||
public ushort USBProductID
|
||||
public ushort UsbProductId
|
||||
{
|
||||
get { return usbProduct; }
|
||||
}
|
||||
@@ -205,7 +205,7 @@ namespace DiscImageChef.Devices
|
||||
/// Gets the USB descriptors.
|
||||
/// </summary>
|
||||
/// <value>The USB descriptors.</value>
|
||||
public byte[] USBDescriptors
|
||||
public byte[] UsbDescriptors
|
||||
{
|
||||
get { return usbDescriptors; }
|
||||
}
|
||||
@@ -214,7 +214,7 @@ namespace DiscImageChef.Devices
|
||||
/// Gets the USB manufacturer string.
|
||||
/// </summary>
|
||||
/// <value>The USB manufacturer string.</value>
|
||||
public string USBManufacturerString
|
||||
public string UsbManufacturerString
|
||||
{
|
||||
get { return usbManufacturerString; }
|
||||
}
|
||||
@@ -223,7 +223,7 @@ namespace DiscImageChef.Devices
|
||||
/// Gets the USB product string.
|
||||
/// </summary>
|
||||
/// <value>The USB product string.</value>
|
||||
public string USBProductString
|
||||
public string UsbProductString
|
||||
{
|
||||
get { return usbProductString; }
|
||||
}
|
||||
@@ -232,7 +232,7 @@ namespace DiscImageChef.Devices
|
||||
/// Gets the USB serial string.
|
||||
/// </summary>
|
||||
/// <value>The USB serial string.</value>
|
||||
public string USBSerialString
|
||||
public string UsbSerialString
|
||||
{
|
||||
get { return usbSerialString; }
|
||||
}
|
||||
@@ -250,7 +250,7 @@ namespace DiscImageChef.Devices
|
||||
/// Gets the FireWire GUID
|
||||
/// </summary>
|
||||
/// <value>The FireWire GUID.</value>
|
||||
public ulong FireWireGUID
|
||||
public ulong FireWireGuid
|
||||
{
|
||||
get { return firewireGuid; }
|
||||
}
|
||||
@@ -304,7 +304,7 @@ namespace DiscImageChef.Devices
|
||||
/// Gets a value indicating whether this device is a PCMCIA device.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this device is a PCMCIA device; otherwise, <c>false</c>.</value>
|
||||
public bool IsPCMCIA
|
||||
public bool IsPcmcia
|
||||
{
|
||||
get { return pcmcia; }
|
||||
}
|
||||
@@ -312,7 +312,7 @@ namespace DiscImageChef.Devices
|
||||
/// <summary>
|
||||
/// Contains the PCMCIA CIS if applicable
|
||||
/// </summary>
|
||||
public byte[] CIS
|
||||
public byte[] Cis
|
||||
{
|
||||
get { return cis; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user