* DiscImageChef.Decoders/SCSI/Modes.cs:

Check for vendor pages not following page format (even if
	  they must).

	* DiscImageChef.Devices/Device/Constructor.cs:
	  Some devices (at least smsc usb-floppy) crash and reset when
	  receiving ata over the ATA PASS-THROUGH scsi command. This
	  will check for SCSI compliance first giving devices time to
	  reset.

	* DiscImageChef.Devices/Device/ScsiCommands.cs:
	  Some devices (smsc usb floppies) return the real command
	  result size disregarding allocation length and generating a
	  buffer overflow.

	* DiscImageChef.Devices/Enums.cs:
	  Added some vendor commands for Plextor and HL-DT-ST devices.

	* DiscImageChef/Commands/DeviceInfo.cs:
	  Mode sense should be written even if it can't be decoded.
This commit is contained in:
2015-11-05 06:50:02 +00:00
parent 626c9062eb
commit 361b8977b0
8 changed files with 110 additions and 49 deletions

View File

@@ -88,9 +88,9 @@ namespace DiscImageChef.Devices
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
public bool ScsiInquiry(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
{
buffer = new byte[5];
buffer = new byte[36];
senseBuffer = new byte[32];
byte[] cdb = { (byte)ScsiCommands.Inquiry, 0, 0, 0, 5, 0 };
byte[] cdb = { (byte)ScsiCommands.Inquiry, 0, 0, 0, 36, 0 };
bool sense;
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
@@ -163,9 +163,9 @@ namespace DiscImageChef.Devices
/// <param name="page">The Extended Vital Product Data</param>
public bool ScsiInquiry(out byte[] buffer, out byte[] senseBuffer, byte page, uint timeout, out double duration)
{
buffer = new byte[5];
buffer = new byte[36];
senseBuffer = new byte[32];
byte[] cdb = { (byte)ScsiCommands.Inquiry, 1, page, 0, 5, 0 };
byte[] cdb = { (byte)ScsiCommands.Inquiry, 1, page, 0, 36, 0 };
bool sense;
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
@@ -174,6 +174,10 @@ namespace DiscImageChef.Devices
if (sense)
return true;
// This is because INQ was returned instead of EVPD
if (buffer[1] != page)
return true;
byte pagesLength = (byte)(buffer[3] + 4);
cdb = new byte[] { (byte)ScsiCommands.Inquiry, 1, page, 0, pagesLength, 0 };
@@ -336,7 +340,7 @@ namespace DiscImageChef.Devices
{
senseBuffer = new byte[32];
byte[] cdb = new byte[10];
buffer = new byte[4];
buffer = new byte[4096];
bool sense;
cdb[0] = (byte)ScsiCommands.ModeSense10;