* DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs:

* DiscImageChef.CommonTypes/DiscImageChef.CommonTypes.csproj:
	  Added method to calculate MediaType from SCSI parameters
	  (mode, density, medium type, device type, etc).

	* DiscImageChef.Metadata/DeviceReport.cs:
	  Added command to guess drive and media parameters and output
	  an XML report of them.

	* DiscImageChef/Commands/DeviceReport.cs:
	* DiscImageChef.Metadata/DiscImageChef.Metadata.csproj:
	  Added command to guess drive and media parameters and output
	  an XML report of them.

	* DiscImageChef/Commands/DumpMedia.cs:
	  Added preliminary command to dump media. Only SCSI for now.
	  CDs and tapes are not supported. Errors are blalanty
	  ignored. Options are incomplete. Not yet usable.

	* DiscImageChef/Core/Checksum.cs:
	* DiscImageChef/Commands/CreateSidecar.cs:
	  Moved checksum generation to a separate class.

	* CICMMetadata:
	  Added support for ADIP.

	* DiscImageChef.CommonTypes/MediaType.cs:
	  Added parameters of UDO media.
	Moved DataPlay outside of Iomega, as it's not from that
	  manufacturer.
	Added missing Exatape media and corrected 160m XL one.
	Added SyJet media.
	Added all ECMA defined magneto-optical (sectors calculated
	  from specifications, unchecked).
	Added PD media.
	Added Imation 320Gb RDX.
	Added generic USB flash drives.

	* DiscImageChef.Decoders/SCSI/Enums.cs:
	  Make enumerations public.

	* DiscImageChef.Decoders/SCSI/Inquiry.cs:
	* DiscImageChef.Devices/Device/Constructor.cs:
	  Trim space padded strings on SCSI INQUIRY.

	* DiscImageChef.Devices/Device/ScsiCommands/MMC.cs:
	  Added PREVENT ALLOW MEDIUM REMOVAL.
	Added START STOP UNIT.

	* DiscImageChef.Devices/Device/ScsiCommands/NEC.cs:
	  Rename NEC methods.

	* DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs:
	  Corrected Pioneer transfer length calculation.

	* DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs:
	  Renamed Plextor methods.

	* DiscImageChef.Devices/Device/ScsiCommands/SPC.cs:
	  Renamed SSC PREVENT ALLOW MEDIUM REMOVAL to uncollide with
	  MMC same name but different command.

	* DiscImageChef.Devices/DiscImageChef.Devices.csproj:
	  Set platform target to x86 (does it really matter?).

	* DiscImageChef.Devices/Linux/Command.cs:
	  Reduced allocation for readlink() to current kernel
	  MAX_PATH.

	* DiscImageChef.Devices/Linux/Enums.cs:
	  Modified Linux ioctl to 32-bit. Works on 64-bit also. Solves
	  commands not working on 32-bit environments.

	* DiscImageChef.DiscImages/ZZZRawImage.cs:
	  Changed ECMA-184 and ECMA-183 enums.

	* DiscImageChef.Metadata/Dimensions.cs:
	  Added all ECMA defined magneto-opticals.
	Added PD media.
	Added 320Gb RDX.
	Corrected Exatape 160m XL.
	Added Exatape 22m and 28m.

	* DiscImageChef.Metadata/MediaType.cs:
	  Added 356mm magneto-optical media.
	Changed ECMA-184 and ECMA-183 enums.
	Added USB generic flash drive.

	* DiscImageChef/Commands/DeviceInfo.cs:
	  Corrected SCSI INQUIRY naming.
	Corrected SCSI MODE SENSE (6) parameters.
	Reduced SCSI MODE SENSE timeout, some devices just get stuck
	  with unsupported MODE SENSE commanda and must be left to
	  timeout.
	Changed FUJITSU vendor string comparison.

	* DiscImageChef/Commands/MediaInfo.cs:
	  Added method to calculate MediaType from SCSI parameters
	  (mode, density, medium type, device type, etc).
	Changed some error WriteLine() to debug ones. Too much
	  verbosity.
	Added DVD media type decoding from PFI.
	Found a drive that dumps ADIP, enabling it again (not
	  decoded).

	* DiscImageChef/Commands/MediaScan.cs:
	  Added option to generate ImgBurn compatible log to
	  media-scan command.

	* DiscImageChef/DiscImageChef.csproj:
	  Moved checksum generation to a separate class.
	Added command to guess drive and media parameters and output
	  an XML report of them.
	Added preliminary command to dump media. Only SCSI for now.
	  CDs and tapes are not supported. Errors are blalanty
	  ignored. Options are incomplete. Not yet usable.

	* DiscImageChef/Main.cs:
	  Added command to guess drive and media parameters and output
	  an XML report of them.
	Added preliminary command to dump media. Only SCSI for now.
	  CDs and tapes are not supported. Errors are blalanty
	  ignored. Options are incomplete. Not yet usable.

	* DiscImageChef/Options.cs:
	  Added command to guess drive and media parameters and output
	  an XML report of them.
	Added preliminary command to dump media. Only SCSI for now.
	  CDs and tapes are not supported. Errors are blalanty
	  ignored. Options are incomplete. Not yet usable.
	Added option to generate ImgBurn compatible log to media-scan
	  command.
This commit is contained in:
2016-01-31 08:05:56 +00:00
parent 04add8d634
commit bb69a1b8d9
30 changed files with 9476 additions and 944 deletions

View File

@@ -492,6 +492,90 @@ namespace DiscImageChef.Devices
return sense;
}
public bool PreventMediumRemoval(out byte[] senseBuffer, uint timeout, out double duration)
{
return PreventAllowMediumRemoval(out senseBuffer, false, true, timeout, out duration);
}
public bool AllowMediumRemoval(out byte[] senseBuffer, uint timeout, out double duration)
{
return PreventAllowMediumRemoval(out senseBuffer, false, false, timeout, out duration);
}
public bool PreventAllowMediumRemoval(out byte[] senseBuffer, bool persistent, bool prevent, uint timeout, out double duration)
{
senseBuffer = new byte[32];
byte[] cdb = new byte[6];
byte[] buffer = new byte[0];
bool sense;
cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval;
if (prevent)
cdb[4] += 0x01;
if (persistent)
cdb[4] += 0x02;
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
error = lastError != 0;
DicConsole.DebugWriteLine("SCSI Device", "PREVENT ALLOW MEDIUM REMOVAL took {0} ms.", duration);
return sense;
}
public bool LoadTray(out byte[] senseBuffer, uint timeout, out double duration)
{
return StartStopUnit(out senseBuffer, false, 0, 0, false, true, true, timeout, out duration);
}
public bool EjectTray(out byte[] senseBuffer, uint timeout, out double duration)
{
return StartStopUnit(out senseBuffer, false, 0, 0, false, true, false, timeout, out duration);
}
public bool StartUnit(out byte[] senseBuffer, uint timeout, out double duration)
{
return StartStopUnit(out senseBuffer, false, 0, 0, false, false, true, timeout, out duration);
}
public bool StopUnit(out byte[] senseBuffer, uint timeout, out double duration)
{
return StartStopUnit(out senseBuffer, false, 0, 0, false, false, false, timeout, out duration);
}
public bool StartStopUnit(out byte[] senseBuffer, bool immediate, byte formatLayer, byte powerConditions, bool changeFormatLayer, bool loadEject, bool start, uint timeout, out double duration)
{
senseBuffer = new byte[32];
byte[] cdb = new byte[6];
byte[] buffer = new byte[0];
bool sense;
cdb[0] = (byte)ScsiCommands.StartStopUnit;
if (immediate)
cdb[1] += 0x01;
if (changeFormatLayer)
{
cdb[3] = (byte)(formatLayer & 0x03);
cdb[4] += 0x04;
}
else
{
if(loadEject)
cdb[4] += 0x02;
if(start)
cdb[4] += 0x01;
}
cdb[4] += (byte)((powerConditions & 0x0F) << 4);
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
error = lastError != 0;
DicConsole.DebugWriteLine("SCSI Device", "START STOP UNIT took {0} ms.", duration);
return sense;
}
}
}