diff --git a/DiscImageChef.Devices/ChangeLog b/DiscImageChef.Devices/ChangeLog index 424542f9c..b71da7a55 100644 --- a/DiscImageChef.Devices/ChangeLog +++ b/DiscImageChef.Devices/ChangeLog @@ -1,3 +1,8 @@ +2015-10-24 Natalia Portillo + + * Device/ScsiCommands.cs: + Added SCSI TEST UNIT READY. + 2015-10-24 Natalia Portillo * Enums.cs: diff --git a/DiscImageChef.Devices/Device/ScsiCommands.cs b/DiscImageChef.Devices/Device/ScsiCommands.cs index d765fdd35..b1062959e 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands.cs @@ -187,6 +187,28 @@ namespace DiscImageChef.Devices return sense; } + + /// + /// Sends the SCSI TEST UNIT READY command to the device + /// + /// true, if unit is NOT ready, false otherwise. + /// Sense buffer. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + public bool ScsiTestUnitReady(out byte[] senseBuffer, uint timeout, out double duration) + { + senseBuffer = new byte[32]; + byte[] cdb = { (byte)ScsiCommands.TestUnitReady, 0, 0, 0, 0, 0 }; + bool sense; + byte[] buffer = new byte[0]; + + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + error = lastError != 0; + + DicConsole.DebugWriteLine("SCSI Device", "TEST UNIT READY took {0} ms.", duration); + + return sense; + } } }