mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Added XML documentation.
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
2015-10-12 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* Enums.cs:
|
||||
* Command.cs:
|
||||
* Linux/Command.cs:
|
||||
* Device/Commands.cs:
|
||||
* Windows/Command.cs:
|
||||
* Device/Variables.cs:
|
||||
* Device/Destructor.cs:
|
||||
* Device/Constructor.cs:
|
||||
* Device/ScsiCommands.cs:
|
||||
Added XML documentation.
|
||||
|
||||
2015-10-12 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* Enums.cs:
|
||||
|
||||
@@ -44,6 +44,18 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
public static class Command
|
||||
{
|
||||
/// <summary>
|
||||
/// Sends a SCSI command
|
||||
/// </summary>
|
||||
/// <returns>0 if no error occurred, otherwise, errno</returns>
|
||||
/// <param name="fd">File handle</param>
|
||||
/// <param name="cdb">SCSI CDB</param>
|
||||
/// <param name="buffer">Buffer for SCSI command response</param>
|
||||
/// <param name="senseBuffer">Buffer with the SCSI sense</param>
|
||||
/// <param name="timeout">Timeout in seconds</param>
|
||||
/// <param name="direction">SCSI command transfer direction</param>
|
||||
/// <param name="duration">Time it took to execute the command in milliseconds</param>
|
||||
/// <param name="sense"><c>True</c> if SCSI error returned non-OK status and <paramref name="senseBuffer"/> contains SCSI sense</param>
|
||||
public static int SendScsiCommand(object fd, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, Enums.ScsiDirection direction, out double duration, out bool sense)
|
||||
{
|
||||
Interop.PlatformID ptID = DetectOS.GetRealPlatformID();
|
||||
@@ -51,6 +63,19 @@ namespace DiscImageChef.Devices
|
||||
return SendScsiCommand(ptID, (SafeFileHandle)fd, cdb, ref buffer, out senseBuffer, timeout, direction, out duration, out sense);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a SCSI command
|
||||
/// </summary>
|
||||
/// <returns>0 if no error occurred, otherwise, errno</returns>
|
||||
/// <param name="ptID">Platform ID for executing the command</param>
|
||||
/// <param name="fd">File handle</param>
|
||||
/// <param name="cdb">SCSI CDB</param>
|
||||
/// <param name="buffer">Buffer for SCSI command response</param>
|
||||
/// <param name="senseBuffer">Buffer with the SCSI sense</param>
|
||||
/// <param name="timeout">Timeout in seconds</param>
|
||||
/// <param name="direction">SCSI command transfer direction</param>
|
||||
/// <param name="duration">Time it took to execute the command in milliseconds</param>
|
||||
/// <param name="sense"><c>True</c> if SCSI error returned non-OK status and <paramref name="senseBuffer"/> contains SCSI sense</param>
|
||||
public static int SendScsiCommand(Interop.PlatformID ptID, object fd, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, Enums.ScsiDirection direction, out double duration, out bool sense)
|
||||
{
|
||||
switch (ptID)
|
||||
|
||||
@@ -41,6 +41,17 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
public partial class Device
|
||||
{
|
||||
/// <summary>
|
||||
/// Sends a SCSI command to this device
|
||||
/// </summary>
|
||||
/// <returns>0 if no error occurred, otherwise, errno</returns>
|
||||
/// <param name="cdb">SCSI CDB</param>
|
||||
/// <param name="buffer">Buffer for SCSI command response</param>
|
||||
/// <param name="senseBuffer">Buffer with the SCSI sense</param>
|
||||
/// <param name="timeout">Timeout in seconds</param>
|
||||
/// <param name="direction">SCSI command transfer direction</param>
|
||||
/// <param name="duration">Time it took to execute the command in milliseconds</param>
|
||||
/// <param name="sense"><c>True</c> if SCSI error returned non-OK status and <paramref name="senseBuffer"/> contains SCSI sense</param>
|
||||
public int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, Enums.ScsiDirection direction, out double duration, out bool sense)
|
||||
{
|
||||
return Command.SendScsiCommand(platformID, fd, cdb, ref buffer, out senseBuffer, timeout, direction, out duration, out sense);
|
||||
|
||||
@@ -42,6 +42,10 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
public partial class Device
|
||||
{
|
||||
/// <summary>
|
||||
/// Opens the device for sending direct commands
|
||||
/// </summary>
|
||||
/// <param name="devicePath">Device path</param>
|
||||
public Device(string devicePath)
|
||||
{
|
||||
platformID = Interop.DetectOS.GetRealPlatformID();
|
||||
|
||||
@@ -42,6 +42,10 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
public partial class Device
|
||||
{
|
||||
/// <summary>
|
||||
/// Releases unmanaged resources and performs other cleanup operations before the
|
||||
/// <see cref="DiscImageChef.Devices.Device"/> is reclaimed by garbage collection.
|
||||
/// </summary>
|
||||
~Device()
|
||||
{
|
||||
if (fd != null)
|
||||
|
||||
@@ -41,22 +41,50 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
public partial class Device
|
||||
{
|
||||
/// <summary>
|
||||
/// Sends the SCSI INQUIRY command to the device using default device timeout.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer"/> contains the sense buffer.</returns>
|
||||
/// <param name="buffer">Buffer where the SCSI INQUIRY response will be stored</param>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
public bool ScsiInquiry(out byte[] buffer, out byte[] senseBuffer)
|
||||
{
|
||||
return ScsiInquiry(out buffer, out senseBuffer, Timeout);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends the SCSI INQUIRY command to the device using default device timeout.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer"/> contains the sense buffer.</returns>
|
||||
/// <param name="buffer">Buffer where the SCSI INQUIRY response will be stored</param>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <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, out double duration)
|
||||
{
|
||||
return ScsiInquiry(out buffer, out senseBuffer, Timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends the SCSI INQUIRY command to the device.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer"/> contains the sense buffer.</returns>
|
||||
/// <param name="buffer">Buffer where the SCSI INQUIRY response will be stored</param>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
public bool ScsiInquiry(out byte[] buffer, out byte[] senseBuffer, uint timeout)
|
||||
{
|
||||
double duration;
|
||||
return ScsiInquiry(out buffer, out senseBuffer, timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends the SCSI INQUIRY command to the device.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer"/> contains the sense buffer.</returns>
|
||||
/// <param name="buffer">Buffer where the SCSI INQUIRY response will be stored</param>
|
||||
/// <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>
|
||||
public bool ScsiInquiry(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[5];
|
||||
@@ -80,22 +108,54 @@ namespace DiscImageChef.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends the SCSI INQUIRY command to the device with an Extended Vital Product Data page using default device timeout.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer"/> contains the sense buffer.</returns>
|
||||
/// <param name="buffer">Buffer where the SCSI INQUIRY response will be stored</param>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="page">The Extended Vital Product Data</param>
|
||||
public bool ScsiInquiry(out byte[] buffer, out byte[] senseBuffer, byte page)
|
||||
{
|
||||
return ScsiInquiry(out buffer, out senseBuffer, page, Timeout);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends the SCSI INQUIRY command to the device with an Extended Vital Product Data page using default device timeout.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer"/> contains the sense buffer.</returns>
|
||||
/// <param name="buffer">Buffer where the SCSI INQUIRY response will be stored</param>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <param name="page">The Extended Vital Product Data</param>
|
||||
public bool ScsiInquiry(out byte[] buffer, out byte[] senseBuffer, byte page, out double duration)
|
||||
{
|
||||
return ScsiInquiry(out buffer, out senseBuffer, page, Timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends the SCSI INQUIRY command to the device with an Extended Vital Product Data page.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer"/> contains the sense buffer.</returns>
|
||||
/// <param name="buffer">Buffer where the SCSI INQUIRY response will be stored</param>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="page">The Extended Vital Product Data</param>
|
||||
public bool ScsiInquiry(out byte[] buffer, out byte[] senseBuffer, byte page, uint timeout)
|
||||
{
|
||||
double duration;
|
||||
return ScsiInquiry(out buffer, out senseBuffer, page, timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends the SCSI INQUIRY command to the device with an Extended Vital Product Data page.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer"/> contains the sense buffer.</returns>
|
||||
/// <param name="buffer">Buffer where the SCSI INQUIRY response will be stored</param>
|
||||
/// <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="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];
|
||||
|
||||
@@ -45,6 +45,10 @@ namespace DiscImageChef.Devices
|
||||
Interop.PlatformID platformID;
|
||||
object fd;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Platform ID for this device
|
||||
/// </summary>
|
||||
/// <value>The Platform ID</value>
|
||||
public Interop.PlatformID PlatformID
|
||||
{
|
||||
get
|
||||
@@ -53,6 +57,10 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the file handle representing this device
|
||||
/// </summary>
|
||||
/// <value>The file handle</value>
|
||||
public object FileHandle
|
||||
{
|
||||
get
|
||||
@@ -61,6 +69,10 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the standard timeout for commands sent to this device
|
||||
/// </summary>
|
||||
/// <value>The timeout in seconds</value>
|
||||
public uint Timeout
|
||||
{
|
||||
get;
|
||||
|
||||
@@ -43,6 +43,9 @@ namespace DiscImageChef.Devices
|
||||
public static class Enums
|
||||
{
|
||||
#region ATA Commands
|
||||
/// <summary>
|
||||
/// All known ATA commands
|
||||
/// </summary>
|
||||
public enum AtaCommands : byte
|
||||
{
|
||||
#region Commands defined on Western Digital WD1000 Winchester Disk Controller
|
||||
@@ -657,6 +660,9 @@ namespace DiscImageChef.Devices
|
||||
#endregion ATA Commands
|
||||
|
||||
#region ATA SMART SubCommands
|
||||
/// <summary>
|
||||
/// All known ATA SMART sub-commands
|
||||
/// </summary>
|
||||
public enum AtaSmartSubCommands : byte
|
||||
{
|
||||
#region Commands defined on ATA-3 rev. 7b
|
||||
@@ -715,6 +721,9 @@ namespace DiscImageChef.Devices
|
||||
#endregion ATA SMART SubCommands
|
||||
|
||||
#region ATA Device Configuration Overlay SubCommands
|
||||
/// <summary>
|
||||
/// All known ATA DEVICE CONFIGURATION sub-commands
|
||||
/// </summary>
|
||||
public enum AtaDeviceConfigurationSubCommands : byte
|
||||
{
|
||||
#region Commands defined on ATA/ATAPI-6 rev. 3b
|
||||
@@ -739,6 +748,9 @@ namespace DiscImageChef.Devices
|
||||
#endregion ATA Device Configuration Overlay SubCommands
|
||||
|
||||
#region ATA SET MAX SubCommands
|
||||
/// <summary>
|
||||
/// All known ATA SET MAX sub-commands
|
||||
/// </summary>
|
||||
public enum AtaSetMaxSubCommands : byte
|
||||
{
|
||||
#region Commands defined on ATA/ATAPI-6 rev. 3b
|
||||
@@ -767,6 +779,9 @@ namespace DiscImageChef.Devices
|
||||
#endregion ATA SET MAX SubCommands
|
||||
|
||||
#region ATA Non Volatile Cache SubCommands
|
||||
/// <summary>
|
||||
/// All known ATA NV CACHE sub-commands
|
||||
/// </summary>
|
||||
public enum AtaNonVolatileCacheSubCommands : byte
|
||||
{
|
||||
#region Commands defined on ATA/ATAPI-8 rev. 3f
|
||||
@@ -804,6 +819,9 @@ namespace DiscImageChef.Devices
|
||||
#endregion ATA Non Volatile Cache SubCommands
|
||||
|
||||
#region ATA Sanitize SubCommands
|
||||
/// <summary>
|
||||
/// All known ATA SANITIZE sub-commands
|
||||
/// </summary>
|
||||
public enum AtaSanitizeSubCommands : ushort
|
||||
{
|
||||
#region Commands defined on ATA/ATAPI Command Set 2 (ACS-2) rev. 2
|
||||
@@ -839,6 +857,9 @@ namespace DiscImageChef.Devices
|
||||
#endregion ATA Sanitize SubCommands
|
||||
|
||||
#region ATA NCQ Queue Management SubCommands
|
||||
/// <summary>
|
||||
/// All known ATA NCQ QUEUE MANAGEMENT sub-commands
|
||||
/// </summary>
|
||||
public enum AtaNCQQueueManagementSubcommands : byte
|
||||
{
|
||||
#region Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 5
|
||||
@@ -855,7 +876,7 @@ namespace DiscImageChef.Devices
|
||||
#endregion ATA NCQ Queue Management SubCommands
|
||||
|
||||
/// <summary>
|
||||
/// SASI commands
|
||||
/// All known SASI commands
|
||||
/// Commands 0x00 to 0x1F are 6-byte
|
||||
/// Commands 0x20 to 0x3F are 10-byte
|
||||
/// Commands 0x40 to 0x5F are 8-byte
|
||||
@@ -1199,6 +1220,9 @@ namespace DiscImageChef.Devices
|
||||
#endregion SASI Commands
|
||||
|
||||
#region SCSI Commands
|
||||
/// <summary>
|
||||
/// All known SCSI and ATAPI commands
|
||||
/// </summary>
|
||||
public enum ScsiCommands : byte
|
||||
{
|
||||
#region SCSI Primary Commands (SPC)
|
||||
@@ -2347,6 +2371,9 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
#endregion SCSI Commands
|
||||
|
||||
/// <summary>
|
||||
/// SCSI command transfer direction
|
||||
/// </summary>
|
||||
public enum ScsiDirection
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -44,6 +44,18 @@ namespace DiscImageChef.Devices.Linux
|
||||
{
|
||||
static class Command
|
||||
{
|
||||
/// <summary>
|
||||
/// Sends a SCSI command
|
||||
/// </summary>
|
||||
/// <returns>0 if no error occurred, otherwise, errno</returns>
|
||||
/// <param name="fd">File handle</param>
|
||||
/// <param name="cdb">SCSI CDB</param>
|
||||
/// <param name="buffer">Buffer for SCSI command response</param>
|
||||
/// <param name="senseBuffer">Buffer with the SCSI sense</param>
|
||||
/// <param name="timeout">Timeout in seconds</param>
|
||||
/// <param name="direction">SCSI command transfer direction</param>
|
||||
/// <param name="duration">Time it took to execute the command in milliseconds</param>
|
||||
/// <param name="sense"><c>True</c> if SCSI error returned non-OK status and <paramref name="senseBuffer"/> contains SCSI sense</param>
|
||||
internal static int SendScsiCommand(int fd, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, ScsiIoctlDirection direction, out double duration, out bool sense)
|
||||
{
|
||||
senseBuffer = null;
|
||||
|
||||
@@ -45,6 +45,18 @@ namespace DiscImageChef.Devices.Windows
|
||||
{
|
||||
static class Command
|
||||
{
|
||||
/// <summary>
|
||||
/// Sends a SCSI command
|
||||
/// </summary>
|
||||
/// <returns>0 if no error occurred, otherwise, errno</returns>
|
||||
/// <param name="fd">File handle</param>
|
||||
/// <param name="cdb">SCSI CDB</param>
|
||||
/// <param name="buffer">Buffer for SCSI command response</param>
|
||||
/// <param name="senseBuffer">Buffer with the SCSI sense</param>
|
||||
/// <param name="timeout">Timeout in seconds</param>
|
||||
/// <param name="direction">SCSI command transfer direction</param>
|
||||
/// <param name="duration">Time it took to execute the command in milliseconds</param>
|
||||
/// <param name="sense"><c>True</c> if SCSI error returned non-OK status and <paramref name="senseBuffer"/> contains SCSI sense</param>
|
||||
internal static int SendScsiCommand(SafeFileHandle fd, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, ScsiIoctlDirection direction, out double duration, out bool sense)
|
||||
{
|
||||
senseBuffer = null;
|
||||
|
||||
Reference in New Issue
Block a user