From 536888507fb2577a07954b98907b899dc9427361 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sat, 23 Dec 2017 20:04:36 +0000 Subject: [PATCH] REFACTOR: Final cleanup of DiscImageChef.Devices. --- DiscImageChef.Devices/Command.cs | 94 +- .../Device/AtaCommands/Ata28.cs | 2 - .../Device/AtaCommands/Ata48.cs | 1 - .../Device/AtaCommands/AtaCHS.cs | 22 +- .../Device/AtaCommands/Atapi.cs | 17 +- .../Device/AtaCommands/Cfa.cs | 2 - .../Device/AtaCommands/MCPT.cs | 1 - .../Device/AtaCommands/Smart.cs | 8 - DiscImageChef.Devices/Device/Commands.cs | 57 +- DiscImageChef.Devices/Device/Constructor.cs | 107 +- DiscImageChef.Devices/Device/Destructor.cs | 4 +- .../Device/MmcCommands/MMC.cs | 8 +- .../Device/ScsiCommands/Adaptec.cs | 16 +- .../Device/ScsiCommands/ArchiveCorp.cs | 6 +- .../Device/ScsiCommands/Certance.cs | 6 +- .../Device/ScsiCommands/Fujitsu.cs | 6 +- .../Device/ScsiCommands/HL-DT-ST.cs | 4 +- .../Device/ScsiCommands/HP.cs | 13 +- .../Device/ScsiCommands/Kreon.cs | 28 +- .../Device/ScsiCommands/MMC.cs | 70 +- .../Device/ScsiCommands/NEC.cs | 4 +- .../Device/ScsiCommands/Pioneer.cs | 17 +- .../Device/ScsiCommands/Plasmon.cs | 17 +- .../Device/ScsiCommands/Plextor.cs | 34 +- .../Device/ScsiCommands/SBC.cs | 74 +- .../Device/ScsiCommands/SMC.cs | 7 +- .../Device/ScsiCommands/SPC.cs | 141 +- .../Device/ScsiCommands/SSC.cs | 149 +- .../Device/ScsiCommands/SyQuest.cs | 22 +- DiscImageChef.Devices/Device/Variables.cs | 81 +- DiscImageChef.Devices/Enums.cs | 2123 +++++++++-------- DiscImageChef.Devices/FreeBSD/Command.cs | 22 +- DiscImageChef.Devices/FreeBSD/Enums.cs | 198 +- DiscImageChef.Devices/FreeBSD/ListDevices.cs | 2 +- DiscImageChef.Devices/FreeBSD/Structs.cs | 275 ++- DiscImageChef.Devices/Linux/Command.cs | 19 +- DiscImageChef.Devices/Linux/Enums.cs | 70 +- DiscImageChef.Devices/Linux/ListDevices.cs | 6 +- DiscImageChef.Devices/Linux/Structs.cs | 40 +- DiscImageChef.Devices/Windows/Command.cs | 59 +- DiscImageChef.Devices/Windows/Enums.cs | 152 +- DiscImageChef.Devices/Windows/ListDevices.cs | 14 +- DiscImageChef.Devices/Windows/Structs.cs | 30 +- DiscImageChef.Devices/Windows/Usb.cs | 1417 ++++++----- DiscImageChef.Devices/Windows/UsbFunctions.cs | 54 +- 45 files changed, 2811 insertions(+), 2688 deletions(-) diff --git a/DiscImageChef.Devices/Command.cs b/DiscImageChef.Devices/Command.cs index eee27285..3acc03ab 100644 --- a/DiscImageChef.Devices/Command.cs +++ b/DiscImageChef.Devices/Command.cs @@ -43,7 +43,7 @@ namespace DiscImageChef.Devices static class Command { /// - /// Sends a SCSI command + /// Sends a SCSI command /// /// 0 if no error occurred, otherwise, errno /// File handle @@ -53,10 +53,13 @@ namespace DiscImageChef.Devices /// Timeout in seconds /// SCSI command transfer direction /// Time it took to execute the command in milliseconds - /// True if SCSI error returned non-OK status and contains SCSI sense + /// + /// True if SCSI error returned non-OK status and contains SCSI + /// sense + /// /// If the specified platform is not supported internal static int SendScsiCommand(object fd, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, - uint timeout, ScsiDirection direction, out double duration, out bool sense) + uint timeout, ScsiDirection direction, out double duration, out bool sense) { PlatformID ptId = DetectOS.GetRealPlatformID(); @@ -65,7 +68,7 @@ namespace DiscImageChef.Devices } /// - /// Sends a SCSI command + /// Sends a SCSI command /// /// 0 if no error occurred, otherwise, errno /// Platform ID for executing the command @@ -76,11 +79,14 @@ namespace DiscImageChef.Devices /// Timeout in seconds /// SCSI command transfer direction /// Time it took to execute the command in milliseconds - /// True if SCSI error returned non-OK status and contains SCSI sense + /// + /// True if SCSI error returned non-OK status and contains SCSI + /// sense + /// /// If the specified platform is not supported internal static int SendScsiCommand(PlatformID ptId, object fd, byte[] cdb, ref byte[] buffer, - out byte[] senseBuffer, uint timeout, ScsiDirection direction, - out double duration, out bool sense) + out byte[] senseBuffer, uint timeout, ScsiDirection direction, + out double duration, out bool sense) { switch(ptId) { @@ -161,7 +167,7 @@ namespace DiscImageChef.Devices } /// - /// Sends an ATA command in CHS format + /// Sends an ATA command in CHS format /// /// 0 if no error occurred, otherwise, errno /// File handle @@ -175,9 +181,10 @@ namespace DiscImageChef.Devices /// What register contains the transfer length /// Set to true if the transfer length is in block, otherwise it is in bytes /// If the specified platform is not supported - internal static int SendAtaCommand(object fd, AtaRegistersChs registers, out AtaErrorRegistersChs errorRegisters, - AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer, - uint timeout, bool transferBlocks, out double duration, out bool sense) + internal static int SendAtaCommand(object fd, AtaRegistersChs registers, + out AtaErrorRegistersChs errorRegisters, AtaProtocol protocol, + AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, + bool transferBlocks, out double duration, out bool sense) { PlatformID ptId = DetectOS.GetRealPlatformID(); @@ -186,7 +193,7 @@ namespace DiscImageChef.Devices } /// - /// Sends an ATA command in CHS format + /// Sends an ATA command in CHS format /// /// 0 if no error occurred, otherwise, errno /// Platform ID for executing the command @@ -202,9 +209,9 @@ namespace DiscImageChef.Devices /// Set to true if the transfer length is in block, otherwise it is in bytes /// If the specified platform is not supported internal static int SendAtaCommand(PlatformID ptId, object fd, AtaRegistersChs registers, - out AtaErrorRegistersChs errorRegisters, AtaProtocol protocol, - AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, - bool transferBlocks, out double duration, out bool sense) + out AtaErrorRegistersChs errorRegisters, AtaProtocol protocol, + AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, + bool transferBlocks, out double duration, out bool sense) { switch(ptId) { @@ -212,8 +219,8 @@ namespace DiscImageChef.Devices { if(Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor == 1 && (Environment.OSVersion.ServicePack == "Service Pack 1" || - Environment.OSVersion.ServicePack == "") || Environment.OSVersion.Version.Major == 5 && - Environment.OSVersion.Version.Minor == 0) + Environment.OSVersion.ServicePack == "") || + Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor == 0) return Windows.Command.SendIdeCommand((SafeFileHandle)fd, registers, out errorRegisters, protocol, ref buffer, timeout, out duration, out sense); // Windows NT 4 or earlier, requires special ATA pass thru SCSI. But DiscImageChef cannot run there (or can it?) @@ -239,7 +246,7 @@ namespace DiscImageChef.Devices } /// - /// Sends an ATA command in CHS format + /// Sends an ATA command in CHS format /// /// 0 if no error occurred, otherwise, errno /// File handle @@ -254,9 +261,9 @@ namespace DiscImageChef.Devices /// Set to true if the transfer length is in block, otherwise it is in bytes /// If the specified platform is not supported internal static int SendAtaCommand(object fd, AtaRegistersLba28 registers, - out AtaErrorRegistersLba28 errorRegisters, AtaProtocol protocol, - AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, - bool transferBlocks, out double duration, out bool sense) + out AtaErrorRegistersLba28 errorRegisters, AtaProtocol protocol, + AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, + bool transferBlocks, out double duration, out bool sense) { PlatformID ptId = DetectOS.GetRealPlatformID(); @@ -265,7 +272,7 @@ namespace DiscImageChef.Devices } /// - /// Sends an ATA command in 28-bit LBA format + /// Sends an ATA command in 28-bit LBA format /// /// 0 if no error occurred, otherwise, errno /// Platform ID for executing the command @@ -281,9 +288,9 @@ namespace DiscImageChef.Devices /// Set to true if the transfer length is in block, otherwise it is in bytes /// If the specified platform is not supported internal static int SendAtaCommand(PlatformID ptId, object fd, AtaRegistersLba28 registers, - out AtaErrorRegistersLba28 errorRegisters, AtaProtocol protocol, - AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, - bool transferBlocks, out double duration, out bool sense) + out AtaErrorRegistersLba28 errorRegisters, AtaProtocol protocol, + AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, + bool transferBlocks, out double duration, out bool sense) { switch(ptId) { @@ -291,8 +298,8 @@ namespace DiscImageChef.Devices { if(Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor == 1 && (Environment.OSVersion.ServicePack == "Service Pack 1" || - Environment.OSVersion.ServicePack == "") || Environment.OSVersion.Version.Major == 5 && - Environment.OSVersion.Version.Minor == 0) + Environment.OSVersion.ServicePack == "") || + Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor == 0) return Windows.Command.SendIdeCommand((SafeFileHandle)fd, registers, out errorRegisters, protocol, ref buffer, timeout, out duration, out sense); // Windows NT 4 or earlier, requires special ATA pass thru SCSI. But DiscImageChef cannot run there (or can it?) @@ -318,7 +325,7 @@ namespace DiscImageChef.Devices } /// - /// Sends an ATA command in 48-bit LBA format + /// Sends an ATA command in 48-bit LBA format /// /// 0 if no error occurred, otherwise, errno /// File handle @@ -333,9 +340,9 @@ namespace DiscImageChef.Devices /// Set to true if the transfer length is in block, otherwise it is in bytes /// If the specified platform is not supported internal static int SendAtaCommand(object fd, AtaRegistersLba48 registers, - out AtaErrorRegistersLba48 errorRegisters, AtaProtocol protocol, - AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, - bool transferBlocks, out double duration, out bool sense) + out AtaErrorRegistersLba48 errorRegisters, AtaProtocol protocol, + AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, + bool transferBlocks, out double duration, out bool sense) { PlatformID ptId = DetectOS.GetRealPlatformID(); @@ -344,7 +351,7 @@ namespace DiscImageChef.Devices } /// - /// Sends an ATA command in 48-bit format + /// Sends an ATA command in 48-bit format /// /// 0 if no error occurred, otherwise, errno /// Platform ID for executing the command @@ -360,9 +367,9 @@ namespace DiscImageChef.Devices /// Set to true if the transfer length is in block, otherwise it is in bytes /// If the specified platform is not supported internal static int SendAtaCommand(PlatformID ptId, object fd, AtaRegistersLba48 registers, - out AtaErrorRegistersLba48 errorRegisters, AtaProtocol protocol, - AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, - bool transferBlocks, out double duration, out bool sense) + out AtaErrorRegistersLba48 errorRegisters, AtaProtocol protocol, + AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, + bool transferBlocks, out double duration, out bool sense) { switch(ptId) { @@ -388,7 +395,7 @@ namespace DiscImageChef.Devices } /// - /// Sends a MMC/SD command + /// Sends a MMC/SD command /// /// The result of the command. /// File handle @@ -405,9 +412,10 @@ namespace DiscImageChef.Devices /// Response registers /// Size of block in bytes /// If the specified platform is not supported - internal static int SendMmcCommand(object fd, MmcCommands command, bool write, bool isApplication, MmcFlags flags, - uint argument, uint blockSize, uint blocks, ref byte[] buffer, - out uint[] response, out double duration, out bool sense, uint timeout = 0) + internal static int SendMmcCommand(object fd, MmcCommands command, bool write, bool isApplication, + MmcFlags flags, uint argument, uint blockSize, uint blocks, + ref byte[] buffer, out uint[] response, out double duration, out bool sense, + uint timeout = 0) { PlatformID ptId = DetectOS.GetRealPlatformID(); @@ -416,7 +424,7 @@ namespace DiscImageChef.Devices } /// - /// Sends a MMC/SD command + /// Sends a MMC/SD command /// /// The result of the command. /// Platform ID for executing the command @@ -435,9 +443,9 @@ namespace DiscImageChef.Devices /// Size of block in bytes /// If the specified platform is not supported internal static int SendMmcCommand(PlatformID ptId, object fd, MmcCommands command, bool write, - bool isApplication, MmcFlags flags, uint argument, uint blockSize, uint blocks, - ref byte[] buffer, out uint[] response, out double duration, out bool sense, - uint timeout = 0) + bool isApplication, MmcFlags flags, uint argument, uint blockSize, + uint blocks, ref byte[] buffer, out uint[] response, out double duration, + out bool sense, uint timeout = 0) { switch(ptId) { diff --git a/DiscImageChef.Devices/Device/AtaCommands/Ata28.cs b/DiscImageChef.Devices/Device/AtaCommands/Ata28.cs index 8a6ad8bd..83d0418f 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/Ata28.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/Ata28.cs @@ -43,7 +43,6 @@ namespace DiscImageChef.Devices buffer = new byte[512]; AtaRegistersLba28 registers = new AtaRegistersLba28 {Command = (byte)AtaCommands.ReadBuffer}; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, out bool sense); @@ -60,7 +59,6 @@ namespace DiscImageChef.Devices buffer = new byte[512]; AtaRegistersLba28 registers = new AtaRegistersLba28 {Command = (byte)AtaCommands.ReadBufferDma}; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, out bool sense); Error = LastError != 0; diff --git a/DiscImageChef.Devices/Device/AtaCommands/Ata48.cs b/DiscImageChef.Devices/Device/AtaCommands/Ata48.cs index 477f2b94..2050f6e4 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/Ata48.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/Ata48.cs @@ -45,7 +45,6 @@ namespace DiscImageChef.Devices AtaRegistersLba48 registers = new AtaRegistersLba48 {Command = (byte)AtaCommands.NativeMaxAddress, Feature = 0x0000}; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, out bool sense); diff --git a/DiscImageChef.Devices/Device/AtaCommands/AtaCHS.cs b/DiscImageChef.Devices/Device/AtaCommands/AtaCHS.cs index 7cc2e38b..50b178a8 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/AtaCHS.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/AtaCHS.cs @@ -38,9 +38,9 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Sends the ATA IDENTIFY DEVICE command to the device, using default device timeout + /// Sends the ATA IDENTIFY DEVICE command to the device, using default device timeout /// - /// true if the command failed and contains the error registers. + /// true if the command failed and contains the error registers. /// Buffer. /// Status registers. public bool AtaIdentify(out byte[] buffer, out AtaErrorRegistersChs statusRegisters) @@ -49,9 +49,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the ATA IDENTIFY DEVICE command to the device, using default device timeout + /// Sends the ATA IDENTIFY DEVICE command to the device, using default device timeout /// - /// true if the command failed and contains the error registers. + /// true if the command failed and contains the error registers. /// Buffer. /// Status registers. /// Duration. @@ -61,9 +61,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the ATA IDENTIFY DEVICE command to the device + /// Sends the ATA IDENTIFY DEVICE command to the device /// - /// true if the command failed and contains the error registers. + /// true if the command failed and contains the error registers. /// Buffer. /// Status registers. /// Timeout. @@ -73,9 +73,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the ATA IDENTIFY DEVICE command to the device + /// Sends the ATA IDENTIFY DEVICE command to the device /// - /// true if the command failed and contains the error registers. + /// true if the command failed and contains the error registers. /// Buffer. /// Status registers. /// Timeout. @@ -86,7 +86,6 @@ namespace DiscImageChef.Devices buffer = new byte[512]; AtaRegistersChs registers = new AtaRegistersChs {Command = (byte)AtaCommands.IdentifyDevice}; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, out bool sense); @@ -117,7 +116,6 @@ namespace DiscImageChef.Devices Command = retry ? (byte)AtaCommands.ReadDmaRetry : (byte)AtaCommands.ReadDma }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -141,7 +139,6 @@ namespace DiscImageChef.Devices Sector = sector }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, out bool sense); @@ -172,7 +169,6 @@ namespace DiscImageChef.Devices Sector = sector }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, out bool sense); @@ -204,7 +200,6 @@ namespace DiscImageChef.Devices Sector = sector }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration, out bool sense); @@ -228,7 +223,6 @@ namespace DiscImageChef.Devices Sector = sector }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, ref buffer, timeout, true, out duration, out bool sense); diff --git a/DiscImageChef.Devices/Device/AtaCommands/Atapi.cs b/DiscImageChef.Devices/Device/AtaCommands/Atapi.cs index 3e8e59f8..5d475f65 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/Atapi.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/Atapi.cs @@ -38,9 +38,9 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Sends the ATA IDENTIFY PACKET DEVICE command to the device, using default device timeout + /// Sends the ATA IDENTIFY PACKET DEVICE command to the device, using default device timeout /// - /// true if the command failed and contains the error registers. + /// true if the command failed and contains the error registers. /// Buffer. /// Status registers. public bool AtapiIdentify(out byte[] buffer, out AtaErrorRegistersChs statusRegisters) @@ -49,9 +49,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the ATA IDENTIFY PACKET DEVICE command to the device, using default device timeout + /// Sends the ATA IDENTIFY PACKET DEVICE command to the device, using default device timeout /// - /// true if the command failed and contains the error registers. + /// true if the command failed and contains the error registers. /// Buffer. /// Status registers. /// Duration. @@ -61,9 +61,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the ATA IDENTIFY PACKET DEVICE command to the device + /// Sends the ATA IDENTIFY PACKET DEVICE command to the device /// - /// true if the command failed and contains the error registers. + /// true if the command failed and contains the error registers. /// Buffer. /// Status registers. /// Timeout. @@ -73,9 +73,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the ATA IDENTIFY PACKET DEVICE command to the device + /// Sends the ATA IDENTIFY PACKET DEVICE command to the device /// - /// true if the command failed and contains the error registers. + /// true if the command failed and contains the error registers. /// Buffer. /// Status registers. /// Timeout. @@ -86,7 +86,6 @@ namespace DiscImageChef.Devices buffer = new byte[512]; AtaRegistersChs registers = new AtaRegistersChs {Command = (byte)AtaCommands.IdentifyPacketDevice}; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, out bool sense); diff --git a/DiscImageChef.Devices/Device/AtaCommands/Cfa.cs b/DiscImageChef.Devices/Device/AtaCommands/Cfa.cs index 7e67f5f5..426c7158 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/Cfa.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/Cfa.cs @@ -75,7 +75,6 @@ namespace DiscImageChef.Devices DeviceHead = (byte)(head & 0x0F) }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, out bool sense); @@ -92,7 +91,6 @@ namespace DiscImageChef.Devices byte[] buffer = new byte[0]; AtaRegistersLba28 registers = new AtaRegistersLba28 {Command = (byte)AtaCommands.RequestSense}; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, out bool sense); diff --git a/DiscImageChef.Devices/Device/AtaCommands/MCPT.cs b/DiscImageChef.Devices/Device/AtaCommands/MCPT.cs index 0e0a50c7..ad78996b 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/MCPT.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/MCPT.cs @@ -56,7 +56,6 @@ namespace DiscImageChef.Devices AtaRegistersChs registers = new AtaRegistersChs {Command = (byte)AtaCommands.CheckMediaCardType, Feature = feature}; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, out bool sense); diff --git a/DiscImageChef.Devices/Device/AtaCommands/Smart.cs b/DiscImageChef.Devices/Device/AtaCommands/Smart.cs index aa4d7823..f0ad7d68 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/Smart.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/Smart.cs @@ -48,7 +48,6 @@ namespace DiscImageChef.Devices LbaMid = 0x4F }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, out bool sense); @@ -72,7 +71,6 @@ namespace DiscImageChef.Devices SectorCount = 0xF1 }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, out bool sense); @@ -95,7 +93,6 @@ namespace DiscImageChef.Devices LbaMid = 0x4F }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, out bool sense); @@ -117,7 +114,6 @@ namespace DiscImageChef.Devices LbaMid = 0x4F }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, out bool sense); @@ -141,7 +137,6 @@ namespace DiscImageChef.Devices LbaLow = subcommand }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, out bool sense); @@ -164,7 +159,6 @@ namespace DiscImageChef.Devices LbaMid = 0x4F }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, out bool sense); @@ -188,7 +182,6 @@ namespace DiscImageChef.Devices LbaLow = logAddress }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, out bool sense); @@ -210,7 +203,6 @@ namespace DiscImageChef.Devices LbaMid = 0x4F }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, out bool sense); diff --git a/DiscImageChef.Devices/Device/Commands.cs b/DiscImageChef.Devices/Device/Commands.cs index 987c3211..ed7caa9e 100644 --- a/DiscImageChef.Devices/Device/Commands.cs +++ b/DiscImageChef.Devices/Device/Commands.cs @@ -40,7 +40,7 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Sends a SCSI command to this device + /// Sends a SCSI command to this device /// /// 0 if no error occurred, otherwise, errno /// SCSI CDB @@ -49,7 +49,10 @@ namespace DiscImageChef.Devices /// Timeout in seconds /// SCSI command transfer direction /// Time it took to execute the command in milliseconds - /// True if SCSI command returned non-OK status and contains SCSI sense + /// + /// True if SCSI command returned non-OK status and contains + /// SCSI sense + /// public int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, ScsiDirection direction, out double duration, out bool sense) { @@ -58,7 +61,7 @@ namespace DiscImageChef.Devices } /// - /// Sends an ATA/ATAPI command to this device using CHS addressing + /// Sends an ATA/ATAPI command to this device using CHS addressing /// /// 0 if no error occurred, otherwise, errno /// ATA registers. @@ -67,19 +70,23 @@ namespace DiscImageChef.Devices /// Indicates which register indicates the transfer length /// Buffer for ATA/ATAPI command response /// Timeout in seconds - /// If set to true, transfer is indicated in blocks, otherwise, it is indicated in bytes. + /// + /// If set to true, transfer is indicated in blocks, otherwise, it is indicated in + /// bytes. + /// /// Time it took to execute the command in milliseconds /// True if ATA/ATAPI command returned non-OK status public int SendAtaCommand(AtaRegistersChs registers, out AtaErrorRegistersChs errorRegisters, AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, bool transferBlocks, out double duration, out bool sense) { - return Command.SendAtaCommand(PlatformId, FileHandle, registers, out errorRegisters, protocol, transferRegister, - ref buffer, timeout, transferBlocks, out duration, out sense); + return Command.SendAtaCommand(PlatformId, FileHandle, registers, out errorRegisters, protocol, + transferRegister, ref buffer, timeout, transferBlocks, out duration, + out sense); } /// - /// Sends an ATA/ATAPI command to this device using 28-bit LBA addressing + /// Sends an ATA/ATAPI command to this device using 28-bit LBA addressing /// /// 0 if no error occurred, otherwise, errno /// ATA registers. @@ -88,19 +95,23 @@ namespace DiscImageChef.Devices /// Indicates which register indicates the transfer length /// Buffer for ATA/ATAPI command response /// Timeout in seconds - /// If set to true, transfer is indicated in blocks, otherwise, it is indicated in bytes. + /// + /// If set to true, transfer is indicated in blocks, otherwise, it is indicated in + /// bytes. + /// /// Time it took to execute the command in milliseconds /// True if ATA/ATAPI command returned non-OK status public int SendAtaCommand(AtaRegistersLba28 registers, out AtaErrorRegistersLba28 errorRegisters, AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, bool transferBlocks, out double duration, out bool sense) { - return Command.SendAtaCommand(PlatformId, FileHandle, registers, out errorRegisters, protocol, transferRegister, - ref buffer, timeout, transferBlocks, out duration, out sense); + return Command.SendAtaCommand(PlatformId, FileHandle, registers, out errorRegisters, protocol, + transferRegister, ref buffer, timeout, transferBlocks, out duration, + out sense); } /// - /// Sends an ATA/ATAPI command to this device using 48-bit LBA addressing + /// Sends an ATA/ATAPI command to this device using 48-bit LBA addressing /// /// 0 if no error occurred, otherwise, errno /// ATA registers. @@ -109,19 +120,23 @@ namespace DiscImageChef.Devices /// Indicates which register indicates the transfer length /// Buffer for ATA/ATAPI command response /// Timeout in seconds - /// If set to true, transfer is indicated in blocks, otherwise, it is indicated in bytes. + /// + /// If set to true, transfer is indicated in blocks, otherwise, it is indicated in + /// bytes. + /// /// Time it took to execute the command in milliseconds /// True if ATA/ATAPI command returned non-OK status public int SendAtaCommand(AtaRegistersLba48 registers, out AtaErrorRegistersLba48 errorRegisters, AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, bool transferBlocks, out double duration, out bool sense) { - return Command.SendAtaCommand(PlatformId, FileHandle, registers, out errorRegisters, protocol, transferRegister, - ref buffer, timeout, transferBlocks, out duration, out sense); + return Command.SendAtaCommand(PlatformId, FileHandle, registers, out errorRegisters, protocol, + transferRegister, ref buffer, timeout, transferBlocks, out duration, + out sense); } /// - /// Sends a MMC/SD command to this device + /// Sends a MMC/SD command to this device /// /// The result of the command. /// MMC/SD opcode @@ -140,7 +155,8 @@ namespace DiscImageChef.Devices uint blockSize, uint blocks, ref byte[] buffer, out uint[] response, out double duration, out bool sense, uint timeout = 0) { - switch(command) { + switch(command) + { case MmcCommands.SendCid when cachedCid != null: { DateTime start = DateTime.Now; @@ -176,10 +192,11 @@ namespace DiscImageChef.Devices } } - if((command != (MmcCommands)SecureDigitalCommands.SendOperatingCondition && - command != MmcCommands.SendOpCond) || cachedOcr == null) - return Command.SendMmcCommand(PlatformId, FileHandle, command, write, isApplication, flags, argument, blockSize, - blocks, ref buffer, out response, out duration, out sense, timeout); + if(command != (MmcCommands)SecureDigitalCommands.SendOperatingCondition && + command != MmcCommands.SendOpCond || cachedOcr == null) + return Command.SendMmcCommand(PlatformId, FileHandle, command, write, isApplication, flags, argument, + blockSize, blocks, ref buffer, out response, out duration, out sense, + timeout); { DateTime start = DateTime.Now; diff --git a/DiscImageChef.Devices/Device/Constructor.cs b/DiscImageChef.Devices/Device/Constructor.cs index 24f9788f..5d3b7f67 100644 --- a/DiscImageChef.Devices/Device/Constructor.cs +++ b/DiscImageChef.Devices/Device/Constructor.cs @@ -57,7 +57,7 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Opens the device for sending direct commands + /// Opens the device for sending direct commands /// /// Device path public Device(string devicePath) @@ -71,11 +71,9 @@ namespace DiscImageChef.Devices { case PlatformID.Win32NT: { - FileHandle = Extern.CreateFile(devicePath, - FileAccess.GenericRead | FileAccess.GenericWrite, - FileShare.Read | FileShare.Write, IntPtr.Zero, - FileMode.OpenExisting, FileAttributes.Normal, - IntPtr.Zero); + FileHandle = Extern.CreateFile(devicePath, FileAccess.GenericRead | FileAccess.GenericWrite, + FileShare.Read | FileShare.Write, IntPtr.Zero, FileMode.OpenExisting, + FileAttributes.Normal, IntPtr.Zero); if(((SafeFileHandle)FileHandle).IsInvalid) { @@ -107,8 +105,7 @@ namespace DiscImageChef.Devices LastError = Marshal.GetLastWin32Error(); } - CamDevice camDevice = - (CamDevice)Marshal.PtrToStructure((IntPtr)FileHandle, typeof(CamDevice)); + CamDevice camDevice = (CamDevice)Marshal.PtrToStructure((IntPtr)FileHandle, typeof(CamDevice)); if(StringHandlers.CToString(camDevice.SimName) == "ata") throw new @@ -116,8 +113,7 @@ namespace DiscImageChef.Devices break; } - default: - throw new InvalidOperationException($"Platform {PlatformId} not yet supported."); + default: throw new InvalidOperationException($"Platform {PlatformId} not yet supported."); } if(Error) throw new SystemException($"Error {LastError} opening device."); @@ -133,7 +129,8 @@ namespace DiscImageChef.Devices bool scsiSense = true; // Windows is answering SCSI INQUIRY for all device types so it needs to be detected first - switch(PlatformId) { + switch(PlatformId) + { case PlatformID.Win32NT: StoragePropertyQuery query = new StoragePropertyQuery(); query.PropertyId = StoragePropertyId.Device; @@ -147,11 +144,9 @@ namespace DiscImageChef.Devices int error = 0; bool hasError = !Extern.DeviceIoControlStorageQuery((SafeFileHandle)FileHandle, - WindowsIoctl - .IoctlStorageQueryProperty, - ref query, (uint)Marshal.SizeOf(query), - descriptorPtr, 1000, ref returned, - IntPtr.Zero); + WindowsIoctl.IoctlStorageQueryProperty, + ref query, (uint)Marshal.SizeOf(query), + descriptorPtr, 1000, ref returned, IntPtr.Zero); if(hasError) error = Marshal.GetLastWin32Error(); @@ -212,9 +207,11 @@ namespace DiscImageChef.Devices break; } - switch(Type) { + switch(Type) + { case DeviceType.SCSI: - case DeviceType.ATAPI: scsiSense = ScsiInquiry(out inqBuf, out _); + case DeviceType.ATAPI: + scsiSense = ScsiInquiry(out inqBuf, out _); break; case DeviceType.ATA: bool atapiSense = AtapiIdentify(out ataBuf, out _); @@ -239,10 +236,11 @@ namespace DiscImageChef.Devices { byte[] sdBuffer = new byte[16]; - LastError = Windows.Command.SendMmcCommand((SafeFileHandle)FileHandle, MmcCommands.SendCsd, false, false, + LastError = Windows.Command.SendMmcCommand((SafeFileHandle)FileHandle, MmcCommands.SendCsd, + false, false, MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 | - MmcFlags.CommandAc, 0, 16, 1, ref sdBuffer, - out _, out _, out bool sense); + MmcFlags.CommandAc, 0, 16, 1, ref sdBuffer, out _, + out _, out bool sense); if(!sense) { @@ -252,7 +250,8 @@ namespace DiscImageChef.Devices sdBuffer = new byte[16]; - LastError = Windows.Command.SendMmcCommand((SafeFileHandle)FileHandle, MmcCommands.SendCid, false, false, + LastError = Windows.Command.SendMmcCommand((SafeFileHandle)FileHandle, MmcCommands.SendCid, + false, false, MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 | MmcFlags.CommandAc, 0, 16, 1, ref sdBuffer, out _, out _, out sense); @@ -266,10 +265,11 @@ namespace DiscImageChef.Devices sdBuffer = new byte[8]; LastError = Windows.Command.SendMmcCommand((SafeFileHandle)FileHandle, - (MmcCommands)SecureDigitalCommands.SendScr, false, true, + (MmcCommands)SecureDigitalCommands.SendScr, false, + true, MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | - MmcFlags.CommandAdtc, 0, 8, 1, ref sdBuffer, - out _, out _, out sense); + MmcFlags.CommandAdtc, 0, 8, 1, ref sdBuffer, out _, + out _, out sense); if(!sense) { @@ -298,8 +298,8 @@ namespace DiscImageChef.Devices { sdBuffer = new byte[4]; - LastError = Windows.Command.SendMmcCommand((SafeFileHandle)FileHandle, MmcCommands.SendOpCond, false, - true, + LastError = Windows.Command.SendMmcCommand((SafeFileHandle)FileHandle, + MmcCommands.SendOpCond, false, true, MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 | MmcFlags.CommandBcr, 0, 4, 1, ref sdBuffer, out _, out _, out sense); @@ -343,7 +343,8 @@ namespace DiscImageChef.Devices } } break; - default: scsiSense = ScsiInquiry(out inqBuf, out _); + default: + scsiSense = ScsiInquiry(out inqBuf, out _); break; } @@ -375,7 +376,8 @@ namespace DiscImageChef.Devices #endregion SecureDigital / MultiMediaCard #region USB - switch(PlatformId) { + switch(PlatformId) + { case PlatformID.Linux: if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) || devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) || @@ -405,14 +407,14 @@ namespace DiscImageChef.Devices StreamReader usbSr = new StreamReader(resolvedLink + "/idProduct"); string usbTemp = usbSr.ReadToEnd(); - ushort.TryParse(usbTemp, NumberStyles.HexNumber, - CultureInfo.InvariantCulture, out usbProduct); + ushort.TryParse(usbTemp, NumberStyles.HexNumber, CultureInfo.InvariantCulture, + out usbProduct); usbSr.Close(); usbSr = new StreamReader(resolvedLink + "/idVendor"); usbTemp = usbSr.ReadToEnd(); - ushort.TryParse(usbTemp, NumberStyles.HexNumber, - CultureInfo.InvariantCulture, out usbVendor); + ushort.TryParse(usbTemp, NumberStyles.HexNumber, CultureInfo.InvariantCulture, + out usbVendor); usbSr.Close(); if(File.Exists(resolvedLink + "/manufacturer")) @@ -448,10 +450,7 @@ namespace DiscImageChef.Devices // I have to search for USB disks, floppies and CD-ROMs as separate device types foreach(string devGuid in new[] - { - Usb.GuidDevinterfaceFloppy, Usb.GuidDevinterfaceCdrom, - Usb.GuidDevinterfaceDisk - }) + {Usb.GuidDevinterfaceFloppy, Usb.GuidDevinterfaceCdrom, Usb.GuidDevinterfaceDisk}) { usbDevice = Usb.FindDrivePath(devicePath, devGuid); if(usbDevice != null) break; @@ -468,7 +467,8 @@ namespace DiscImageChef.Devices usbDevice.SerialNumber; // This is incorrect filled by Windows with SCSI/ATA serial number } break; - default: IsUsb = false; + default: + IsUsb = false; break; } #endregion USB @@ -489,27 +489,25 @@ namespace DiscImageChef.Devices while(resolvedLink.Contains("firewire")) { resolvedLink = Path.GetDirectoryName(resolvedLink); - if(!File.Exists(resolvedLink + "/model") || - !File.Exists(resolvedLink + "/vendor") || + if(!File.Exists(resolvedLink + "/model") || !File.Exists(resolvedLink + "/vendor") || !File.Exists(resolvedLink + "/guid")) continue; StreamReader fwSr = new StreamReader(resolvedLink + "/model"); string fwTemp = fwSr.ReadToEnd(); - uint.TryParse(fwTemp, NumberStyles.HexNumber, - CultureInfo.InvariantCulture, out firewireModel); + uint.TryParse(fwTemp, NumberStyles.HexNumber, CultureInfo.InvariantCulture, + out firewireModel); fwSr.Close(); fwSr = new StreamReader(resolvedLink + "/vendor"); fwTemp = fwSr.ReadToEnd(); - uint.TryParse(fwTemp, NumberStyles.HexNumber, - CultureInfo.InvariantCulture, + uint.TryParse(fwTemp, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out firewireVendor); fwSr.Close(); fwSr = new StreamReader(resolvedLink + "/guid"); fwTemp = fwSr.ReadToEnd(); - ulong.TryParse(fwTemp, NumberStyles.HexNumber, - CultureInfo.InvariantCulture, out firewireGuid); + ulong.TryParse(fwTemp, NumberStyles.HexNumber, CultureInfo.InvariantCulture, + out firewireGuid); fwSr.Close(); if(File.Exists(resolvedLink + "/model_name")) @@ -554,20 +552,17 @@ namespace DiscImageChef.Devices resolvedLink = Path.GetDirectoryName(resolvedLink); if(!Directory.Exists(resolvedLink + "/pcmcia_socket")) continue; - string[] subdirs = - Directory.GetDirectories(resolvedLink + "/pcmcia_socket", - "pcmcia_socket*", - SearchOption.TopDirectoryOnly); + string[] subdirs = Directory.GetDirectories(resolvedLink + "/pcmcia_socket", + "pcmcia_socket*", + SearchOption.TopDirectoryOnly); if(subdirs.Length <= 0) continue; - string possibleDir = - Path.Combine(resolvedLink, "pcmcia_socket", subdirs[0]); - if(!File.Exists(possibleDir + "/card_type") || - !File.Exists(possibleDir + "/cis")) continue; + string possibleDir = Path.Combine(resolvedLink, "pcmcia_socket", subdirs[0]); + if(!File.Exists(possibleDir + "/card_type") || !File.Exists(possibleDir + "/cis")) + continue; - FileStream cisFs = new FileStream(possibleDir + "/cis", - System.IO.FileMode.Open, + FileStream cisFs = new FileStream(possibleDir + "/cis", System.IO.FileMode.Open, System.IO.FileAccess.Read); byte[] cisBuf = new byte[65536]; int cisCount = cisFs.Read(cisBuf, 0, 65536); diff --git a/DiscImageChef.Devices/Device/Destructor.cs b/DiscImageChef.Devices/Device/Destructor.cs index 12e7fff0..07b8b982 100644 --- a/DiscImageChef.Devices/Device/Destructor.cs +++ b/DiscImageChef.Devices/Device/Destructor.cs @@ -40,8 +40,8 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Releases unmanaged resources and performs other cleanup operations before the - /// is reclaimed by garbage collection. + /// Releases unmanaged resources and performs other cleanup operations before the + /// is reclaimed by garbage collection. /// ~Device() { diff --git a/DiscImageChef.Devices/Device/MmcCommands/MMC.cs b/DiscImageChef.Devices/Device/MmcCommands/MMC.cs index 451e60aa..3385bd6b 100644 --- a/DiscImageChef.Devices/Device/MmcCommands/MMC.cs +++ b/DiscImageChef.Devices/Device/MmcCommands/MMC.cs @@ -97,8 +97,8 @@ namespace DiscImageChef.Devices byte[] buffer = new byte[0]; LastError = SendMmcCommand(MmcCommands.SetBlocklen, false, false, - MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAc, length, 0, - 0, ref buffer, out response, out duration, out bool sense, timeout); + MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAc, length, 0, 0, + ref buffer, out response, out duration, out bool sense, timeout); Error = LastError != 0; DicConsole.DebugWriteLine("MMC Device", "SET_BLOCKLEN took {0} ms.", duration); @@ -118,8 +118,8 @@ namespace DiscImageChef.Devices LastError = SendMmcCommand(command, false, false, MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, address, - blockSize, transferLength, ref buffer, out response, out duration, out bool sense, - timeout); + blockSize, transferLength, ref buffer, out response, out duration, + out bool sense, timeout); Error = LastError != 0; if(transferLength > 1) diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs b/DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs index 258d40f4..86384772 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs @@ -39,7 +39,7 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Gets the underlying drive cylinder, head and index bytes for the specified SCSI LBA. + /// Gets the underlying drive cylinder, head and index bytes for the specified SCSI LBA. /// /// Buffer. /// Sense buffer. @@ -53,7 +53,7 @@ namespace DiscImageChef.Devices } /// - /// Gets the underlying drive cylinder, head and index bytes for the specified SCSI LBA. + /// Gets the underlying drive cylinder, head and index bytes for the specified SCSI LBA. /// /// Buffer. /// Sense buffer. @@ -84,7 +84,7 @@ namespace DiscImageChef.Devices } /// - /// Sets the error threshold + /// Sets the error threshold /// /// true, if set error threshold was adapteced, false otherwise. /// Threshold. 0 to disable error reporting. @@ -97,7 +97,7 @@ namespace DiscImageChef.Devices } /// - /// Sets the error threshold + /// Sets the error threshold /// /// true, if set error threshold was adapteced, false otherwise. /// Threshold. 0 to disable error reporting. @@ -127,7 +127,7 @@ namespace DiscImageChef.Devices } /// - /// Requests the usage, seek and error counters, and resets them + /// Requests the usage, seek and error counters, and resets them /// /// Buffer. /// Sense buffer. @@ -140,7 +140,7 @@ namespace DiscImageChef.Devices } /// - /// Requests the usage, seek and error counters, and resets them + /// Requests the usage, seek and error counters, and resets them /// /// Buffer. /// Sense buffer. @@ -168,7 +168,7 @@ namespace DiscImageChef.Devices } /// - /// Fills the Adaptec controller RAM with 1K bytes of data + /// Fills the Adaptec controller RAM with 1K bytes of data /// /// Data to fill the buffer with. /// Sense buffer. @@ -194,7 +194,7 @@ namespace DiscImageChef.Devices } /// - /// Reads 1K bytes of data from the Adaptec controller RAM + /// Reads 1K bytes of data from the Adaptec controller RAM /// /// Buffer. /// Sense buffer. diff --git a/DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs b/DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs index 3427e888..0848645e 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs @@ -37,7 +37,7 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Gets the underlying drive cylinder, head and index bytes for the specified SCSI LBA. + /// Gets the underlying drive cylinder, head and index bytes for the specified SCSI LBA. /// /// Buffer. /// Sense buffer. @@ -67,7 +67,7 @@ namespace DiscImageChef.Devices } /// - /// Gets the underlying drive cylinder, head and index bytes for the specified SCSI LBA. + /// Gets the underlying drive cylinder, head and index bytes for the specified SCSI LBA. /// /// Sense buffer. /// Logical Block Address, starting from 1. @@ -79,7 +79,7 @@ namespace DiscImageChef.Devices } /// - /// Positions the tape at the specified block address + /// Positions the tape at the specified block address /// /// Sense buffer. /// If set to true, return from the command immediately. diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Certance.cs b/DiscImageChef.Devices/Device/ScsiCommands/Certance.cs index c9f38b29..6959ef96 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Certance.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Certance.cs @@ -39,7 +39,7 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Parks the load arm in preparation for transport + /// Parks the load arm in preparation for transport /// /// Sense buffer. /// Timeout. @@ -50,7 +50,7 @@ namespace DiscImageChef.Devices } /// - /// Unparks the load arm prior to operation + /// Unparks the load arm prior to operation /// /// Sense buffer. /// Timeout. @@ -61,7 +61,7 @@ namespace DiscImageChef.Devices } /// - /// Parks the load arm in preparation for transport or unparks it prior to operation + /// Parks the load arm in preparation for transport or unparks it prior to operation /// /// Sense buffer. /// If set to true, parks the load arm diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs b/DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs index 7bc45690..c5ebd459 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs @@ -62,11 +62,9 @@ namespace DiscImageChef.Devices if(mode != FujitsuDisplayModes.Half) if(!ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) && - !ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes)) - displayLen = true; + !ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes)) displayLen = true; else if(!ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) && - ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes)) - halfMsg = true; + ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes)) halfMsg = true; buffer[0] = (byte)((byte)mode << 5); if(displayLen) buffer[0] += 0x10; diff --git a/DiscImageChef.Devices/Device/ScsiCommands/HL-DT-ST.cs b/DiscImageChef.Devices/Device/ScsiCommands/HL-DT-ST.cs index 51915969..fb4d7570 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/HL-DT-ST.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/HL-DT-ST.cs @@ -37,9 +37,9 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Reads a "raw" sector from DVD on HL-DT-ST drives. + /// Reads a "raw" sector from DVD on HL-DT-ST drives. /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the HL-DT-ST READ DVD (RAW) response will be stored /// Sense buffer. /// Timeout in seconds. diff --git a/DiscImageChef.Devices/Device/ScsiCommands/HP.cs b/DiscImageChef.Devices/Device/ScsiCommands/HP.cs index 9671709e..18a23de7 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/HP.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/HP.cs @@ -37,9 +37,9 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Sends the HP READ LONG vendor command + /// Sends the HP READ LONG vendor command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ LONG response will be stored /// Sense buffer. /// If set to true address contain two's complement offset from last read address. @@ -56,9 +56,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the HP READ LONG vendor command + /// Sends the HP READ LONG vendor command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ LONG response will be stored /// Sense buffer. /// If set to true address contain two's complement offset from last read address. @@ -66,7 +66,10 @@ namespace DiscImageChef.Devices /// How many blocks/bytes to read. /// How many bytes per block. /// If set to true address contain physical block address. - /// If set to true is a count of secors to read. Otherwise it will be ignored + /// + /// If set to true is a count of secors to read. Otherwise + /// it will be ignored + /// /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. public bool HpReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Kreon.cs b/DiscImageChef.Devices/Device/ScsiCommands/Kreon.cs index 2a80a29e..09ccf67c 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Kreon.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Kreon.cs @@ -38,9 +38,9 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Sets the drive to the xtreme unlocked state + /// Sets the drive to the xtreme unlocked state /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Sense buffer. /// Timeout. /// Duration. @@ -65,9 +65,9 @@ namespace DiscImageChef.Devices } /// - /// Sets the drive to the locked state. + /// Sets the drive to the locked state. /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Sense buffer. /// Timeout. /// Duration. @@ -77,9 +77,9 @@ namespace DiscImageChef.Devices } /// - /// Sets the drive to the xtreme unlocked state + /// Sets the drive to the xtreme unlocked state /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Sense buffer. /// Timeout. /// Duration. @@ -89,9 +89,9 @@ namespace DiscImageChef.Devices } /// - /// Sets the drive to the wxripper unlocked state + /// Sets the drive to the wxripper unlocked state /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Sense buffer. /// Timeout. /// Duration. @@ -101,9 +101,9 @@ namespace DiscImageChef.Devices } /// - /// Sets the drive to the specified lock state + /// Sets the drive to the specified lock state /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Sense buffer. /// Timeout. /// Duration. @@ -130,9 +130,9 @@ namespace DiscImageChef.Devices } /// - /// Gets a list of supported features + /// Gets a list of supported features /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Sense buffer. /// Timeout. /// Duration. @@ -205,9 +205,9 @@ namespace DiscImageChef.Devices } /// - /// Gets the SS sector. + /// Gets the SS sector. /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Sense buffer. /// Timeout. /// Duration. diff --git a/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs b/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs index 73ad2245..428887ba 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs @@ -38,9 +38,9 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Sends the MMC GET CONFIGURATION command for all Features + /// Sends the MMC GET CONFIGURATION command for all Features /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI GET CONFIGURATION response will be stored /// Sense buffer. /// Timeout in seconds. @@ -52,9 +52,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the MMC GET CONFIGURATION command for all Features starting with specified one + /// Sends the MMC GET CONFIGURATION command for all Features starting with specified one /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI GET CONFIGURATION response will be stored /// Sense buffer. /// Feature number where the feature list should start from @@ -68,15 +68,15 @@ namespace DiscImageChef.Devices } /// - /// Sends the MMC GET CONFIGURATION command + /// Sends the MMC GET CONFIGURATION command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI GET CONFIGURATION response will be stored /// Sense buffer. /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. /// Starting Feature number. - /// Return type, . + /// Return type, . public bool GetConfiguration(out byte[] buffer, out byte[] senseBuffer, ushort startingFeatureNumber, MmcGetConfigurationRt rt, uint timeout, out double duration) { @@ -114,9 +114,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the MMC READ DISC STRUCTURE command + /// Sends the MMC READ DISC STRUCTURE command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ DISC STRUCTURE response will be stored /// Sense buffer. /// Medium type for requested disc structure @@ -168,9 +168,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the MMC READ TOC/PMA/ATIP command to get formatted TOC from disc, in MM:SS:FF format + /// Sends the MMC READ TOC/PMA/ATIP command to get formatted TOC from disc, in MM:SS:FF format /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ TOC/PMA/ATIP response will be stored /// Sense buffer. /// Start TOC from this track @@ -182,9 +182,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the MMC READ TOC/PMA/ATIP command to get formatted TOC from disc + /// Sends the MMC READ TOC/PMA/ATIP command to get formatted TOC from disc /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ TOC/PMA/ATIP response will be stored /// Sense buffer. /// If true, request data in MM:SS:FF units, otherwise, in blocks @@ -198,9 +198,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the MMC READ TOC/PMA/ATIP command to get multi-session information, in MM:SS:FF format + /// Sends the MMC READ TOC/PMA/ATIP command to get multi-session information, in MM:SS:FF format /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ TOC/PMA/ATIP response will be stored /// Sense buffer. /// Timeout in seconds. @@ -211,9 +211,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the MMC READ TOC/PMA/ATIP command to get multi-session information + /// Sends the MMC READ TOC/PMA/ATIP command to get multi-session information /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ TOC/PMA/ATIP response will be stored /// Sense buffer. /// If true, request data in MM:SS:FF units, otherwise, in blocks @@ -226,9 +226,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the MMC READ TOC/PMA/ATIP command to get raw TOC subchannels + /// Sends the MMC READ TOC/PMA/ATIP command to get raw TOC subchannels /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ TOC/PMA/ATIP response will be stored /// Sense buffer. /// Session which TOC to get @@ -241,9 +241,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the MMC READ TOC/PMA/ATIP command to get PMA + /// Sends the MMC READ TOC/PMA/ATIP command to get PMA /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ TOC/PMA/ATIP response will be stored /// Sense buffer. /// Timeout in seconds. @@ -254,9 +254,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the MMC READ TOC/PMA/ATIP command to get ATIP + /// Sends the MMC READ TOC/PMA/ATIP command to get ATIP /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ TOC/PMA/ATIP response will be stored /// Sense buffer. /// Timeout in seconds. @@ -267,9 +267,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the MMC READ TOC/PMA/ATIP command to get Lead-In CD-TEXT + /// Sends the MMC READ TOC/PMA/ATIP command to get Lead-In CD-TEXT /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ TOC/PMA/ATIP response will be stored /// Sense buffer. /// Timeout in seconds. @@ -280,9 +280,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the MMC READ TOC/PMA/ATIP command + /// Sends the MMC READ TOC/PMA/ATIP command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ TOC/PMA/ATIP response will be stored /// Sense buffer. /// If true, request data in MM:SS:FF units, otherwise, in blocks @@ -331,9 +331,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the MMC READ DISC INFORMATION command + /// Sends the MMC READ DISC INFORMATION command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ DISC INFORMATION response will be stored /// Sense buffer. /// Timeout in seconds. @@ -345,9 +345,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the MMC READ DISC INFORMATION command + /// Sends the MMC READ DISC INFORMATION command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ DISC INFORMATION response will be stored /// Sense buffer. /// Which disc information to read @@ -379,9 +379,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the MMC READ CD command + /// Sends the MMC READ CD command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the MMC READ CD response will be stored /// Sense buffer. /// Timeout in seconds. @@ -436,9 +436,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the MMC READ CD MSF command + /// Sends the MMC READ CD MSF command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the MMC READ CD MSF response will be stored /// Sense buffer. /// Timeout in seconds. diff --git a/DiscImageChef.Devices/Device/ScsiCommands/NEC.cs b/DiscImageChef.Devices/Device/ScsiCommands/NEC.cs index ede0c4c4..ac07612c 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/NEC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/NEC.cs @@ -37,9 +37,9 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Sends the NEC READ CD-DA command + /// Sends the NEC READ CD-DA command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the NEC READ CD-DA response will be stored /// Sense buffer. /// Timeout in seconds. diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs b/DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs index a234e22f..8bd5f137 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs @@ -37,9 +37,9 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Sends the Pioneer READ CD-DA command + /// Sends the Pioneer READ CD-DA command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the Pioneer READ CD-DA response will be stored /// Sense buffer. /// Timeout in seconds. @@ -77,9 +77,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the Pioneer READ CD-DA MSF command + /// Sends the Pioneer READ CD-DA MSF command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the Pioneer READ CD-DA MSF response will be stored /// Sense buffer. /// Timeout in seconds. @@ -116,14 +116,17 @@ namespace DiscImageChef.Devices } /// - /// Sends the Pioneer READ CD-XA command + /// Sends the Pioneer READ CD-XA command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the Pioneer READ CD-XA response will be stored /// Sense buffer. /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. - /// If set to true, returns all sector data with 294 bytes of error flags. Superseedes + /// + /// If set to true, returns all sector data with 294 bytes of error flags. Superseedes + /// + /// /// If set to true, returns all 2352 bytes of sector data. /// Start block address. /// How many blocks to read. diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs b/DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs index 7410dd82..509ba059 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs @@ -37,9 +37,9 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Sends the Plasmon READ LONG vendor command + /// Sends the Plasmon READ LONG vendor command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the Plasmon READ LONG response will be stored /// Sense buffer. /// If set to true address contain two's complement offset from last read address. @@ -56,9 +56,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the Plasmon READ LONG vendor command + /// Sends the Plasmon READ LONG vendor command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the Plasmon READ LONG response will be stored /// Sense buffer. /// If set to true address contain two's complement offset from last read address. @@ -66,7 +66,10 @@ namespace DiscImageChef.Devices /// How many blocks/bytes to read. /// How many bytes per block. /// If set to true address contain physical block address. - /// If set to true is a count of secors to read. Otherwise it will be ignored + /// + /// If set to true is a count of secors to read. Otherwise + /// it will be ignored + /// /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. public bool PlasmonReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, @@ -78,9 +81,9 @@ namespace DiscImageChef.Devices } /// - /// Retrieves the logical or physical block address for the specified + /// Retrieves the logical or physical block address for the specified /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the block address will be stored /// Sense buffer. /// PBA/LBA to read. diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs b/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs index efafd094..0df88908 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs @@ -38,9 +38,9 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Sends the Plextor READ CD-DA command + /// Sends the Plextor READ CD-DA command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the Plextor READ CD-DA response will be stored /// Sense buffer. /// Timeout in seconds. @@ -79,9 +79,9 @@ namespace DiscImageChef.Devices } /// - /// Reads a "raw" sector from DVD on Plextor drives. Does it reading drive's cache. + /// Reads a "raw" sector from DVD on Plextor drives. Does it reading drive's cache. /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the Plextor READ DVD (RAW) response will be stored /// Sense buffer. /// Timeout in seconds. @@ -114,7 +114,7 @@ namespace DiscImageChef.Devices } /// - /// Reads the statistics EEPROM from Plextor CD recorders + /// Reads the statistics EEPROM from Plextor CD recorders /// /// true, if EEPROM is correctly read, false otherwise. /// Buffer. @@ -140,7 +140,7 @@ namespace DiscImageChef.Devices } /// - /// Reads the statistics EEPROM from Plextor PX-708 and PX-712 recorders + /// Reads the statistics EEPROM from Plextor PX-708 and PX-712 recorders /// /// true, if EEPROM is correctly read, false otherwise. /// Buffer. @@ -166,7 +166,7 @@ namespace DiscImageChef.Devices } /// - /// Reads a block from the statistics EEPROM from Plextor DVD recorders + /// Reads a block from the statistics EEPROM from Plextor DVD recorders /// /// true, if EEPROM is correctly read, false otherwise. /// Buffer. @@ -198,7 +198,7 @@ namespace DiscImageChef.Devices } /// - /// Gets speeds set by Plextor PoweRec + /// Gets speeds set by Plextor PoweRec /// /// true, if speeds were got correctly, false otherwise. /// Sense buffer. @@ -238,7 +238,7 @@ namespace DiscImageChef.Devices } /// - /// Gets the Plextor PoweRec status + /// Gets the Plextor PoweRec status /// /// true, if PoweRec is supported, false otherwise. /// Sense buffer. @@ -276,7 +276,7 @@ namespace DiscImageChef.Devices } /// - /// Gets the Plextor SilentMode status + /// Gets the Plextor SilentMode status /// /// true, if SilentMode is supported, false otherwise. /// Buffer. @@ -305,7 +305,7 @@ namespace DiscImageChef.Devices } /// - /// Gets the Plextor GigaRec status + /// Gets the Plextor GigaRec status /// /// true, if GigaRec is supported, false otherwise. /// Buffer. @@ -333,7 +333,7 @@ namespace DiscImageChef.Devices } /// - /// Gets the Plextor VariRec status + /// Gets the Plextor VariRec status /// /// true, if VariRec is supported, false otherwise. /// Buffer. @@ -366,7 +366,7 @@ namespace DiscImageChef.Devices } /// - /// Gets the Plextor SecuRec status + /// Gets the Plextor SecuRec status /// /// true, if SecuRec is supported, false otherwise. /// Buffer. @@ -393,7 +393,7 @@ namespace DiscImageChef.Devices } /// - /// Gets the Plextor SpeedRead status + /// Gets the Plextor SpeedRead status /// /// true, if SpeedRead is supported, false otherwise. /// Buffer. @@ -421,7 +421,7 @@ namespace DiscImageChef.Devices } /// - /// Gets the Plextor CD-R and multi-session hiding status + /// Gets the Plextor CD-R and multi-session hiding status /// /// true, if CD-R and multi-session hiding is supported, false otherwise. /// Buffer. @@ -449,7 +449,7 @@ namespace DiscImageChef.Devices } /// - /// Gets the Plextor DVD+ book bitsetting status + /// Gets the Plextor DVD+ book bitsetting status /// /// true, if DVD+ book bitsetting is supported, false otherwise. /// Buffer. @@ -482,7 +482,7 @@ namespace DiscImageChef.Devices } /// - /// Gets the Plextor DVD+ test writing status + /// Gets the Plextor DVD+ test writing status /// /// true, if DVD+ test writing is supported, false otherwise. /// Buffer. diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SBC.cs b/DiscImageChef.Devices/Device/ScsiCommands/SBC.cs index 24a000f3..c13bedfb 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/SBC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/SBC.cs @@ -38,9 +38,9 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Sends the SBC READ (6) command + /// Sends the SBC READ (6) command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ response will be stored /// Sense buffer. /// Timeout in seconds. @@ -54,9 +54,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SBC READ (6) command + /// Sends the SBC READ (6) command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ response will be stored /// Sense buffer. /// Timeout in seconds. @@ -89,17 +89,23 @@ namespace DiscImageChef.Devices } /// - /// Sends the SBC READ (10) command + /// Sends the SBC READ (10) command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ response will be stored /// Sense buffer. /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. /// Instructs the drive how to check for protection information on the medium. - /// If set to true requested blocks shall be assigned the lowest retention priority on cache fetch/retain. + /// + /// If set to true requested blocks shall be assigned the lowest retention priority on cache + /// fetch/retain. + /// /// If set to true requested blocks MUST bu read from medium and not the cache. - /// If set to true requested blocks will be returned from non-volatile cache. If they're not present they shall be stored there. + /// + /// If set to true requested blocks will be returned from non-volatile cache. If they're not + /// present they shall be stored there. + /// /// Starting block. /// Block size in bytes. /// Group number where attributes associated with this command should be collected. @@ -138,17 +144,23 @@ namespace DiscImageChef.Devices } /// - /// Sends the SBC READ (12) command + /// Sends the SBC READ (12) command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ response will be stored /// Sense buffer. /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. /// Instructs the drive how to check for protection information on the medium. - /// If set to true requested blocks shall be assigned the lowest retention priority on cache fetch/retain. + /// + /// If set to true requested blocks shall be assigned the lowest retention priority on cache + /// fetch/retain. + /// /// If set to true requested blocks MUST bu read from medium and not the cache. - /// If set to true requested blocks will be returned from non-volatile cache. If they're not present they shall be stored there. + /// + /// If set to true requested blocks will be returned from non-volatile cache. If they're not + /// present they shall be stored there. + /// /// Starting block. /// Block size in bytes. /// Group number where attributes associated with this command should be collected. @@ -191,17 +203,23 @@ namespace DiscImageChef.Devices } /// - /// Sends the SBC READ (16) command + /// Sends the SBC READ (16) command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ response will be stored /// Sense buffer. /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. /// Instructs the drive how to check for protection information on the medium. - /// If set to true requested blocks shall be assigned the lowest retention priority on cache fetch/retain. + /// + /// If set to true requested blocks shall be assigned the lowest retention priority on cache + /// fetch/retain. + /// /// If set to true requested blocks MUST bu read from medium and not the cache. - /// If set to true requested blocks will be returned from non-volatile cache. If they're not present they shall be stored there. + /// + /// If set to true requested blocks will be returned from non-volatile cache. If they're not + /// present they shall be stored there. + /// /// Starting block. /// Block size in bytes. /// Group number where attributes associated with this command should be collected. @@ -247,17 +265,20 @@ namespace DiscImageChef.Devices } /// - /// Sends the SBC READ LONG (10) command + /// Sends the SBC READ LONG (10) command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ LONG response will be stored /// Sense buffer. /// Timeout in seconds. - /// + /// /// Duration in milliseconds it took for the device to execute the command. /// If set to true ask the drive to try to correct errors in the sector. /// LBA to read. - /// How many bytes to read. If the number is not exactly the drive's size, the command will fail and incidate a delta of the size in SENSE. + /// + /// How many bytes to read. If the number is not exactly the drive's size, the command will + /// fail and incidate a delta of the size in SENSE. + /// public bool ReadLong10(out byte[] buffer, out byte[] senseBuffer, bool correct, bool relAddr, uint lba, ushort transferBytes, uint timeout, out double duration) { @@ -286,16 +307,19 @@ namespace DiscImageChef.Devices } /// - /// Sends the SBC READ LONG (16) command + /// Sends the SBC READ LONG (16) command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ LONG response will be stored /// Sense buffer. /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. /// If set to true ask the drive to try to correct errors in the sector. /// LBA to read. - /// How many bytes to read. If the number is not exactly the drive's size, the command will fail and incidate a delta of the size in SENSE. + /// + /// How many bytes to read. If the number is not exactly the drive's size, the command will + /// fail and incidate a delta of the size in SENSE. + /// public bool ReadLong16(out byte[] buffer, out byte[] senseBuffer, bool correct, ulong lba, uint transferBytes, uint timeout, out double duration) { @@ -329,7 +353,7 @@ namespace DiscImageChef.Devices } /// - /// Moves the device reading element to the specified block address + /// Moves the device reading element to the specified block address /// /// Sense buffer. /// LBA. @@ -356,7 +380,7 @@ namespace DiscImageChef.Devices } /// - /// Moves the device reading element to the specified block address + /// Moves the device reading element to the specified block address /// /// Sense buffer. /// LBA. diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SMC.cs b/DiscImageChef.Devices/Device/ScsiCommands/SMC.cs index d712b54c..85b1f557 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/SMC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/SMC.cs @@ -37,11 +37,11 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Reads an attribute from the medium auxiliary memory, or reports which elements in the changer contain one + /// Reads an attribute from the medium auxiliary memory, or reports which elements in the changer contain one /// /// Buffer. /// Sense buffer. - /// What to do, . + /// What to do, . /// Element address. /// Element type. /// Volume number. @@ -79,8 +79,7 @@ namespace DiscImageChef.Devices if(sense) return true; - uint attrLen = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3] + - 4); + uint attrLen = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3] + 4); buffer = new byte[attrLen]; cdb[10] = (byte)((buffer.Length & 0xFF000000) >> 24); cdb[11] = (byte)((buffer.Length & 0xFF0000) >> 16); diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SPC.cs b/DiscImageChef.Devices/Device/ScsiCommands/SPC.cs index 3ccbd32c..4908468c 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/SPC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/SPC.cs @@ -41,9 +41,9 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Sends the SPC INQUIRY command to the device using default device timeout. + /// Sends the SPC INQUIRY command to the device using default device timeout. /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI INQUIRY response will be stored /// Sense buffer. public bool ScsiInquiry(out byte[] buffer, out byte[] senseBuffer) @@ -52,9 +52,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC INQUIRY command to the device using default device timeout. + /// Sends the SPC INQUIRY command to the device using default device timeout. /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI INQUIRY response will be stored /// Sense buffer. /// Duration in milliseconds it took for the device to execute the command. @@ -64,9 +64,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC INQUIRY command to the device. + /// Sends the SPC INQUIRY command to the device. /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI INQUIRY response will be stored /// Sense buffer. /// Timeout in seconds. @@ -76,9 +76,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC INQUIRY command to the device. + /// Sends the SPC INQUIRY command to the device. /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI INQUIRY response will be stored /// Sense buffer. /// Timeout in seconds. @@ -111,9 +111,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC INQUIRY command to the device with an Extended Vital Product Data page using default device timeout. + /// Sends the SPC INQUIRY command to the device with an Extended Vital Product Data page using default device timeout. /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI INQUIRY response will be stored /// Sense buffer. /// The Extended Vital Product Data @@ -123,9 +123,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC INQUIRY command to the device with an Extended Vital Product Data page using default device timeout. + /// Sends the SPC INQUIRY command to the device with an Extended Vital Product Data page using default device timeout. /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI INQUIRY response will be stored /// Sense buffer. /// Duration in milliseconds it took for the device to execute the command. @@ -136,9 +136,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC INQUIRY command to the device with an Extended Vital Product Data page. + /// Sends the SPC INQUIRY command to the device with an Extended Vital Product Data page. /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI INQUIRY response will be stored /// Sense buffer. /// Timeout in seconds. @@ -149,9 +149,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC INQUIRY command to the device with an Extended Vital Product Data page. + /// Sends the SPC INQUIRY command to the device with an Extended Vital Product Data page. /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI INQUIRY response will be stored /// Sense buffer. /// Timeout in seconds. @@ -188,7 +188,7 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC TEST UNIT READY command to the device + /// Sends the SPC TEST UNIT READY command to the device /// /// true, if unit is NOT ready, false otherwise. /// Sense buffer. @@ -210,9 +210,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC MODE SENSE(6) command to the device as introduced in SCSI-1 + /// Sends the SPC MODE SENSE(6) command to the device as introduced in SCSI-1 /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI MODE SENSE(6) response will be stored /// Sense buffer. /// Timeout in seconds. @@ -224,9 +224,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC MODE SENSE(6) command to the device as introduced in SCSI-2 + /// Sends the SPC MODE SENSE(6) command to the device as introduced in SCSI-2 /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI MODE SENSE(6) response will be stored /// Sense buffer. /// Timeout in seconds. @@ -241,9 +241,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC MODE SENSE(6) command to the device as introduced in SCSI-3 SPC-3 + /// Sends the SPC MODE SENSE(6) command to the device as introduced in SCSI-3 SPC-3 /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI MODE SENSE(6) response will be stored /// Sense buffer. /// Timeout in seconds. @@ -289,9 +289,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC MODE SENSE(10) command to the device as introduced in SCSI-2 + /// Sends the SPC MODE SENSE(10) command to the device as introduced in SCSI-2 /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI MODE SENSE(10) response will be stored /// Sense buffer. /// Timeout in seconds. @@ -307,9 +307,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC MODE SENSE(10) command to the device as introduced in SCSI-3 SPC-2 + /// Sends the SPC MODE SENSE(10) command to the device as introduced in SCSI-3 SPC-2 /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI MODE SENSE(10) response will be stored /// Sense buffer. /// Timeout in seconds. @@ -326,9 +326,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC MODE SENSE(10) command to the device as introduced in SCSI-3 SPC-3 + /// Sends the SPC MODE SENSE(10) command to the device as introduced in SCSI-3 SPC-3 /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI MODE SENSE(10) response will be stored /// Sense buffer. /// Timeout in seconds. @@ -378,9 +378,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC PREVENT ALLOW MEDIUM REMOVAL command to prevent medium removal + /// Sends the SPC PREVENT ALLOW MEDIUM REMOVAL command to prevent medium removal /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Sense buffer. /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. @@ -390,9 +390,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC PREVENT ALLOW MEDIUM REMOVAL command to allow medium removal + /// Sends the SPC PREVENT ALLOW MEDIUM REMOVAL command to allow medium removal /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Sense buffer. /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. @@ -402,9 +402,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC PREVENT ALLOW MEDIUM REMOVAL command + /// Sends the SPC PREVENT ALLOW MEDIUM REMOVAL command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Sense buffer. /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. @@ -420,9 +420,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC PREVENT ALLOW MEDIUM REMOVAL command + /// Sends the SPC PREVENT ALLOW MEDIUM REMOVAL command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Sense buffer. /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. @@ -447,9 +447,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC READ CAPACITY command + /// Sends the SPC READ CAPACITY command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ CAPACITY response will be stored /// Sense buffer. /// Timeout in seconds. @@ -460,13 +460,13 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC READ CAPACITY command + /// Sends the SPC READ CAPACITY command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ CAPACITY response will be stored /// Sense buffer. - /// Indicates that is relative to current medium position - /// Address where information is requested from, only valid if is set + /// Indicates that is relative to current medium position + /// Address where information is requested from, only valid if is set /// If set, it is requesting partial media capacity /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. @@ -500,9 +500,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC READ CAPACITY(16) command + /// Sends the SPC READ CAPACITY(16) command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ CAPACITY(16) response will be stored /// Sense buffer. /// Timeout in seconds. @@ -513,12 +513,12 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC READ CAPACITY(16) command + /// Sends the SPC READ CAPACITY(16) command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ CAPACITY(16) response will be stored /// Sense buffer. - /// Address where information is requested from, only valid if is set + /// Address where information is requested from, only valid if is set /// If set, it is requesting partial media capacity /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. @@ -561,9 +561,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC READ MEDIA SERIAL NUMBER command + /// Sends the SPC READ MEDIA SERIAL NUMBER command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ MEDIA SERIAL NUMBER response will be stored /// Sense buffer. /// Timeout in seconds. @@ -587,8 +587,7 @@ namespace DiscImageChef.Devices if(sense) return true; - uint strctLength = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + - buffer[3] + 4); + uint strctLength = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3] + 4); buffer = new byte[strctLength]; cdb[6] = (byte)((buffer.Length & 0xFF000000) >> 24); cdb[7] = (byte)((buffer.Length & 0xFF0000) >> 16); @@ -606,11 +605,11 @@ namespace DiscImageChef.Devices } /// - /// Reads an attribute from the medium auxiliary memory + /// Reads an attribute from the medium auxiliary memory /// /// Buffer. /// Sense buffer. - /// What to do, . + /// What to do, . /// Partition number. /// First attribute identifier. /// If set to true device can return cached data. @@ -624,11 +623,11 @@ namespace DiscImageChef.Devices } /// - /// Reads an attribute from the medium auxiliary memory + /// Reads an attribute from the medium auxiliary memory /// /// Buffer. /// Sense buffer. - /// What to do, . + /// What to do, . /// First attribute identifier. /// If set to true device can return cached data. /// Timeout. @@ -641,11 +640,11 @@ namespace DiscImageChef.Devices } /// - /// Reads an attribute from the medium auxiliary memory + /// Reads an attribute from the medium auxiliary memory /// /// Buffer. /// Sense buffer. - /// What to do, . + /// What to do, . /// Partition number. /// First attribute identifier. /// Timeout. @@ -658,11 +657,11 @@ namespace DiscImageChef.Devices } /// - /// Reads an attribute from the medium auxiliary memory + /// Reads an attribute from the medium auxiliary memory /// /// Buffer. /// Sense buffer. - /// What to do, . + /// What to do, . /// First attribute identifier. /// Timeout. /// Duration. @@ -674,11 +673,11 @@ namespace DiscImageChef.Devices } /// - /// Reads an attribute from the medium auxiliary memory + /// Reads an attribute from the medium auxiliary memory /// /// Buffer. /// Sense buffer. - /// What to do, . + /// What to do, . /// Volume number. /// Partition number. /// First attribute identifier. @@ -692,11 +691,11 @@ namespace DiscImageChef.Devices } /// - /// Reads an attribute from the medium auxiliary memory + /// Reads an attribute from the medium auxiliary memory /// /// Buffer. /// Sense buffer. - /// What to do, . + /// What to do, . /// Volume number. /// Partition number. /// First attribute identifier. @@ -711,9 +710,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC MODE SELECT(6) command + /// Sends the SPC MODE SELECT(6) command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer with the data to be sent to the device /// Sense buffer. /// Set to save pages between resets. @@ -730,8 +729,7 @@ namespace DiscImageChef.Devices { if(PlatformId != PlatformID.Win32NT && PlatformId != PlatformID.Win32S && PlatformId != PlatformID.Win32Windows && PlatformId != PlatformID.WinCE && - PlatformId != PlatformID.WindowsPhone && - PlatformId != PlatformID.Xbox) LastError = 75; + PlatformId != PlatformID.WindowsPhone && PlatformId != PlatformID.Xbox) LastError = 75; else LastError = 111; Error = true; duration = 0; @@ -755,9 +753,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SPC MODE SELECT(10) command + /// Sends the SPC MODE SELECT(10) command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer with the data to be sent to the device /// Set to save pages between resets. /// Sense buffer. @@ -774,8 +772,7 @@ namespace DiscImageChef.Devices { if(PlatformId != PlatformID.Win32NT && PlatformId != PlatformID.Win32S && PlatformId != PlatformID.Win32Windows && PlatformId != PlatformID.WinCE && - PlatformId != PlatformID.WindowsPhone && - PlatformId != PlatformID.Xbox) LastError = 75; + PlatformId != PlatformID.WindowsPhone && PlatformId != PlatformID.Xbox) LastError = 75; else LastError = 111; Error = true; duration = 0; diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SSC.cs b/DiscImageChef.Devices/Device/ScsiCommands/SSC.cs index 8b3ad2f3..3da645be 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/SSC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/SSC.cs @@ -38,7 +38,7 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Prepares the medium for reading + /// Prepares the medium for reading /// /// true, if load was successful, false otherwise. /// Sense buffer. @@ -50,7 +50,7 @@ namespace DiscImageChef.Devices } /// - /// Prepares the medium for ejection + /// Prepares the medium for ejection /// /// true, if unload was successful, false otherwise. /// Sense buffer. @@ -62,7 +62,7 @@ namespace DiscImageChef.Devices } /// - /// Prepares the medium for reading or ejection + /// Prepares the medium for reading or ejection /// /// true, if load/unload was successful, false otherwise. /// Sense buffer. @@ -70,7 +70,10 @@ namespace DiscImageChef.Devices /// If set to true load the medium for reading. /// If set to true retense the tape. /// If set to true move the medium to the EOT mark. - /// If set to true and is also set to true, moves the medium to the drive but does not prepare it for reading. + /// + /// If set to true and is also set to true, moves the medium to + /// the drive but does not prepare it for reading. + /// /// Timeout. /// Duration. public bool LoadUnload(out byte[] senseBuffer, bool immediate, bool load, bool retense, bool endOfTape, @@ -97,7 +100,7 @@ namespace DiscImageChef.Devices } /// - /// Positions the medium to the specified block in the current partition + /// Positions the medium to the specified block in the current partition /// /// Sense buffer. /// Logical block address. @@ -109,7 +112,7 @@ namespace DiscImageChef.Devices } /// - /// Positions the medium to the specified block in the specified partition + /// Positions the medium to the specified block in the specified partition /// /// Sense buffer. /// Partition to position to. @@ -122,7 +125,7 @@ namespace DiscImageChef.Devices } /// - /// Positions the medium to the specified block in the current partition + /// Positions the medium to the specified block in the current partition /// /// Sense buffer. /// If set to true, return from the command immediately. @@ -135,7 +138,7 @@ namespace DiscImageChef.Devices } /// - /// Positions the medium to the specified block in the specified partition + /// Positions the medium to the specified block in the specified partition /// /// Sense buffer. /// If set to true, return from the command immediately. @@ -150,7 +153,7 @@ namespace DiscImageChef.Devices } /// - /// Positions the medium to the specified object identifier + /// Positions the medium to the specified object identifier /// /// Sense buffer. /// If set to true, return from the command immediately. @@ -187,7 +190,7 @@ namespace DiscImageChef.Devices } /// - /// Positions the medium to the specified block in the current partition + /// Positions the medium to the specified block in the current partition /// /// Sense buffer. /// Logical block address. @@ -200,7 +203,7 @@ namespace DiscImageChef.Devices } /// - /// Positions the medium to the specified block in the specified partition + /// Positions the medium to the specified block in the specified partition /// /// Sense buffer. /// Partition to position to. @@ -214,7 +217,7 @@ namespace DiscImageChef.Devices } /// - /// Positions the medium to the specified block in the current partition + /// Positions the medium to the specified block in the current partition /// /// Sense buffer. /// If set to true, return from the command immediately. @@ -228,7 +231,7 @@ namespace DiscImageChef.Devices } /// - /// Positions the medium to the specified block in the specified partition + /// Positions the medium to the specified block in the specified partition /// /// Sense buffer. /// If set to true, return from the command immediately. @@ -244,7 +247,7 @@ namespace DiscImageChef.Devices } /// - /// Positions the medium to the specified object identifier + /// Positions the medium to the specified object identifier /// /// Sense buffer. /// If set to true, return from the command immediately. @@ -303,7 +306,7 @@ namespace DiscImageChef.Devices }*/ /// - /// Reads the specified number of bytes or of blocks from the medium + /// Reads the specified number of bytes or of blocks from the medium /// /// Buffer. /// Sense buffer. @@ -319,13 +322,19 @@ namespace DiscImageChef.Devices } /// - /// Reads the specified number of bytes or of blocks from the medium + /// Reads the specified number of bytes or of blocks from the medium /// /// Buffer. /// Sense buffer. - /// If set to true suppress the incorrect-length indication. Cannot be set while is set also. - /// If set to true indicates how many blocks to read of a fixed size. - /// Transfer length in blocks or bytes depending of status. + /// + /// If set to true suppress the incorrect-length indication. Cannot be set while + /// is set also. + /// + /// + /// If set to true indicates how many blocks to read of a + /// fixed size. + /// + /// Transfer length in blocks or bytes depending of status. /// Block size in bytes. /// Timeout. /// Duration. @@ -353,7 +362,7 @@ namespace DiscImageChef.Devices } /// - /// Reads a number of fixed-length blocks starting at specified object + /// Reads a number of fixed-length blocks starting at specified object /// /// Buffer. /// Sense buffer. @@ -371,7 +380,7 @@ namespace DiscImageChef.Devices } /// - /// Reads a number of fixed-length blocks starting at specified block from the specified partition + /// Reads a number of fixed-length blocks starting at specified block from the specified partition /// /// Buffer. /// Sense buffer. @@ -390,7 +399,7 @@ namespace DiscImageChef.Devices } /// - /// Reads a number of fixed-length blocks starting at specified object + /// Reads a number of fixed-length blocks starting at specified object /// /// Buffer. /// Sense buffer. @@ -407,7 +416,7 @@ namespace DiscImageChef.Devices } /// - /// Reads a number of fixed-length blocks starting at specified block from the specified partition + /// Reads a number of fixed-length blocks starting at specified block from the specified partition /// /// Buffer. /// Sense buffer. @@ -425,15 +434,21 @@ namespace DiscImageChef.Devices } /// - /// Reads a number of bytes or objects starting at specified object from the specified partition + /// Reads a number of bytes or objects starting at specified object from the specified partition /// /// Buffer. /// Sense buffer. - /// If set to true suppress the incorrect-length indication. Cannot be set while is set also. - /// If set to true indicates how many blocks to read of a fixed size. + /// + /// If set to true suppress the incorrect-length indication. Cannot be set while + /// is set also. + /// + /// + /// If set to true indicates how many blocks to read of a + /// fixed size. + /// /// Partition to read object from. /// Object identifier. - /// Transfer length in blocks or bytes depending of status. + /// Transfer length in blocks or bytes depending of status. /// Object size in bytes. /// Timeout. /// Duration. @@ -471,7 +486,7 @@ namespace DiscImageChef.Devices } /// - /// Requests the drive the maximum and minimum block size + /// Requests the drive the maximum and minimum block size /// /// Buffer. /// Sense buffer. @@ -495,7 +510,7 @@ namespace DiscImageChef.Devices } /// - /// Reports current reading/writing elements position on the medium + /// Reports current reading/writing elements position on the medium /// /// Buffer. /// Sense buffer. @@ -507,7 +522,7 @@ namespace DiscImageChef.Devices } /// - /// Reports current reading/writing elements position on the medium using 32 bytes response + /// Reports current reading/writing elements position on the medium using 32 bytes response /// /// Buffer. /// Sense buffer. @@ -519,7 +534,7 @@ namespace DiscImageChef.Devices } /// - /// Reports current reading/writing elements position on the medium + /// Reports current reading/writing elements position on the medium /// /// Buffer. /// Sense buffer. @@ -540,7 +555,7 @@ namespace DiscImageChef.Devices } /// - /// Reports current reading/writing elements position on the medium + /// Reports current reading/writing elements position on the medium /// /// Buffer. /// Sense buffer. @@ -591,7 +606,7 @@ namespace DiscImageChef.Devices } /// - /// Reads the specified number of blocks from the medium, backwards + /// Reads the specified number of blocks from the medium, backwards /// /// Buffer. /// Sense buffer. @@ -607,7 +622,7 @@ namespace DiscImageChef.Devices } /// - /// Reads the specified number of bytes or of blocks from the medium, backwards + /// Reads the specified number of bytes or of blocks from the medium, backwards /// /// Buffer. /// Sense buffer. @@ -624,14 +639,20 @@ namespace DiscImageChef.Devices } /// - /// Reads the specified number of bytes or of blocks from the medium, backwards + /// Reads the specified number of bytes or of blocks from the medium, backwards /// /// Buffer. /// Sense buffer. /// If set to true drive should un-reverse the blocks and bytes - /// If set to true suppress the incorrect-length indication. Cannot be set while is set also. - /// If set to true indicates how many blocks to read of a fixed size. - /// Transfer length in blocks or bytes depending of status. + /// + /// If set to true suppress the incorrect-length indication. Cannot be set while + /// is set also. + /// + /// + /// If set to true indicates how many blocks to read of a + /// fixed size. + /// + /// Transfer length in blocks or bytes depending of status. /// Block size in bytes. /// Timeout. /// Duration. @@ -660,7 +681,7 @@ namespace DiscImageChef.Devices } /// - /// Reads a number of fixed-length blocks starting at specified object, backwards + /// Reads a number of fixed-length blocks starting at specified object, backwards /// /// Buffer. /// Sense buffer. @@ -678,7 +699,7 @@ namespace DiscImageChef.Devices } /// - /// Reads a number of fixed-length blocks starting at specified block from the specified partition, backwards + /// Reads a number of fixed-length blocks starting at specified block from the specified partition, backwards /// /// Buffer. /// Sense buffer. @@ -697,7 +718,7 @@ namespace DiscImageChef.Devices } /// - /// Reads a number of fixed-length blocks starting at specified object, backwards + /// Reads a number of fixed-length blocks starting at specified object, backwards /// /// Buffer. /// Sense buffer. @@ -714,7 +735,7 @@ namespace DiscImageChef.Devices } /// - /// Reads a number of fixed-length blocks starting at specified block from the specified partition, backwards + /// Reads a number of fixed-length blocks starting at specified block from the specified partition, backwards /// /// Buffer. /// Sense buffer. @@ -732,16 +753,22 @@ namespace DiscImageChef.Devices } /// - /// Reads a number of bytes or objects starting at specified object from the specified partition, backwards + /// Reads a number of bytes or objects starting at specified object from the specified partition, backwards /// /// Buffer. /// Sense buffer. /// If set to true drive should un-reverse the blocks and bytes - /// If set to true suppress the incorrect-length indication. Cannot be set while is set also. - /// If set to true indicates how many blocks to read of a fixed size. + /// + /// If set to true suppress the incorrect-length indication. Cannot be set while + /// is set also. + /// + /// + /// If set to true indicates how many blocks to read of a + /// fixed size. + /// /// Partition to read object from. /// Object identifier. - /// Transfer length in blocks or bytes depending of status. + /// Transfer length in blocks or bytes depending of status. /// Object size in bytes. /// Timeout. /// Duration. @@ -781,7 +808,7 @@ namespace DiscImageChef.Devices } /// - /// Reads the specified number of blocks from the device's buffer + /// Reads the specified number of blocks from the device's buffer /// /// Buffer. /// Sense buffer. @@ -797,7 +824,7 @@ namespace DiscImageChef.Devices } /// - /// Reads the specified number of bytes or of blocks from the device's buffer + /// Reads the specified number of bytes or of blocks from the device's buffer /// /// Buffer. /// Sense buffer. @@ -814,13 +841,19 @@ namespace DiscImageChef.Devices } /// - /// Reads the specified number of bytes or of blocks from the device's buffer + /// Reads the specified number of bytes or of blocks from the device's buffer /// /// Buffer. /// Sense buffer. - /// If set to true suppress the incorrect-length indication. Cannot be set while is set also. - /// If set to true indicates how many blocks to read of a fixed size. - /// Transfer length in blocks or bytes depending of status. + /// + /// If set to true suppress the incorrect-length indication. Cannot be set while + /// is set also. + /// + /// + /// If set to true indicates how many blocks to read of a + /// fixed size. + /// + /// Transfer length in blocks or bytes depending of status. /// Block size in bytes. /// Timeout. /// Duration. @@ -848,7 +881,7 @@ namespace DiscImageChef.Devices } /// - /// Requests the device to return descriptors for supported densities or medium types + /// Requests the device to return descriptors for supported densities or medium types /// /// Buffer. /// Sense buffer. @@ -860,7 +893,7 @@ namespace DiscImageChef.Devices } /// - /// Requests the device to return descriptors for supported densities or medium types + /// Requests the device to return descriptors for supported densities or medium types /// /// Buffer. /// Sense buffer. @@ -874,7 +907,7 @@ namespace DiscImageChef.Devices } /// - /// Requests the device to return descriptors for supported densities or medium types + /// Requests the device to return descriptors for supported densities or medium types /// /// Buffer. /// Sense buffer. @@ -917,7 +950,7 @@ namespace DiscImageChef.Devices } /// - /// Positions the reading/writing element to the beginning of current partition + /// Positions the reading/writing element to the beginning of current partition /// /// Sense buffer. /// Timeout. @@ -928,7 +961,7 @@ namespace DiscImageChef.Devices } /// - /// Positions the reading/writing element to the beginning of current partition + /// Positions the reading/writing element to the beginning of current partition /// /// Sense buffer. /// If set to true return from the command immediately. @@ -953,7 +986,7 @@ namespace DiscImageChef.Devices } /// - /// Selects the specified track + /// Selects the specified track /// /// true, if select was tracked, false otherwise. /// Sense buffer. diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SyQuest.cs b/DiscImageChef.Devices/Device/ScsiCommands/SyQuest.cs index 7a9ae70c..c652d78f 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/SyQuest.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/SyQuest.cs @@ -37,9 +37,9 @@ namespace DiscImageChef.Devices public partial class Device { /// - /// Sends the SyQuest READ (6) command + /// Sends the SyQuest READ (6) command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ response will be stored /// Sense buffer. /// Timeout in seconds. @@ -53,9 +53,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SyQuest READ LONG (6) command + /// Sends the SyQuest READ LONG (6) command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ response will be stored /// Sense buffer. /// Timeout in seconds. @@ -69,9 +69,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SyQuest READ (6) command + /// Sends the SyQuest READ (6) command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ response will be stored /// Sense buffer. /// Timeout in seconds. @@ -120,7 +120,7 @@ namespace DiscImageChef.Devices } /// - /// Requests the usage, seek and error counters, and resets them + /// Requests the usage, seek and error counters, and resets them /// /// Buffer. /// Sense buffer. @@ -133,9 +133,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SyQuest READ LONG (10) command + /// Sends the SyQuest READ LONG (10) command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ response will be stored /// Sense buffer. /// Timeout in seconds. @@ -149,9 +149,9 @@ namespace DiscImageChef.Devices } /// - /// Sends the SyQuest READ (10) command + /// Sends the SyQuest READ (10) command /// - /// true if the command failed and contains the sense buffer. + /// true if the command failed and contains the sense buffer. /// Buffer where the SCSI READ response will be stored /// Sense buffer. /// Timeout in seconds. diff --git a/DiscImageChef.Devices/Device/Variables.cs b/DiscImageChef.Devices/Device/Variables.cs index dd31aa00..3bf146cb 100644 --- a/DiscImageChef.Devices/Device/Variables.cs +++ b/DiscImageChef.Devices/Device/Variables.cs @@ -51,184 +51,169 @@ namespace DiscImageChef.Devices readonly byte[] cachedOcr; /// - /// Gets the Platform ID for this device + /// Gets the Platform ID for this device /// /// The Platform ID public PlatformID PlatformId { get; } /// - /// Gets the file handle representing this device + /// Gets the file handle representing this device /// /// The file handle public object FileHandle { get; } /// - /// Gets or sets the standard timeout for commands sent to this device + /// Gets or sets the standard timeout for commands sent to this device /// /// The timeout in seconds public uint Timeout { get; } /// - /// Gets a value indicating whether this is in error. + /// Gets a value indicating whether this is in error. /// /// true if error; otherwise, false. public bool Error { get; private set; } /// - /// Gets the last error number. + /// Gets the last error number. /// /// The last error. public int LastError { get; private set; } /// - /// Gets the device type. + /// Gets the device type. /// /// The device type. public DeviceType Type { get; } /// - /// Gets the device's manufacturer + /// Gets the device's manufacturer /// /// The manufacturer. public string Manufacturer { get; } /// - /// Gets the device model + /// Gets the device model /// /// The model. public string Model { get; } /// - /// Gets the device's revision. + /// Gets the device's revision. /// /// The revision. public string Revision { get; } /// - /// Gets the device's serial number. + /// Gets the device's serial number. /// /// The serial number. public string Serial { get; } /// - /// Gets the device's SCSI peripheral device type + /// Gets the device's SCSI peripheral device type /// /// The SCSI peripheral device type. public PeripheralDeviceTypes ScsiType { get; } /// - /// Gets a value indicating whether this device's media is removable. + /// Gets a value indicating whether this device's media is removable. /// /// true if this device's media is removable; otherwise, false. public bool IsRemovable { get; } /// - /// Gets a value indicating whether this device is attached via USB. + /// Gets a value indicating whether this device is attached via USB. /// /// true if this device is attached via USB; otherwise, false. public bool IsUsb { get; } /// - /// Gets the USB vendor ID. + /// Gets the USB vendor ID. /// /// The USB vendor ID. - public ushort UsbVendorId - { - get => usbVendor; - } + public ushort UsbVendorId => usbVendor; /// - /// Gets the USB product ID. + /// Gets the USB product ID. /// /// The USB product ID. - public ushort UsbProductId - { - get => usbProduct; - } + public ushort UsbProductId => usbProduct; /// - /// Gets the USB descriptors. + /// Gets the USB descriptors. /// /// The USB descriptors. public byte[] UsbDescriptors { get; } /// - /// Gets the USB manufacturer string. + /// Gets the USB manufacturer string. /// /// The USB manufacturer string. public string UsbManufacturerString { get; } /// - /// Gets the USB product string. + /// Gets the USB product string. /// /// The USB product string. public string UsbProductString { get; } /// - /// Gets the USB serial string. + /// Gets the USB serial string. /// /// The USB serial string. public string UsbSerialString { get; } /// - /// Gets a value indicating whether this device is attached via FireWire. + /// Gets a value indicating whether this device is attached via FireWire. /// /// true if this device is attached via FireWire; otherwise, false. public bool IsFireWire { get; } /// - /// Gets the FireWire GUID + /// Gets the FireWire GUID /// /// The FireWire GUID. - public ulong FireWireGuid - { - get => firewireGuid; - } + public ulong FireWireGuid => firewireGuid; /// - /// Gets the FireWire model number + /// Gets the FireWire model number /// /// The FireWire model. - public uint FireWireModel - { - get => firewireModel; - } + public uint FireWireModel => firewireModel; /// - /// Gets the FireWire model name. + /// Gets the FireWire model name. /// /// The FireWire model name. public string FireWireModelName { get; } /// - /// Gets the FireWire vendor number. + /// Gets the FireWire vendor number. /// /// The FireWire vendor number. - public uint FireWireVendor - { - get => firewireVendor; - } + public uint FireWireVendor => firewireVendor; /// - /// Gets the FireWire vendor name. + /// Gets the FireWire vendor name. /// /// The FireWire vendor name. public string FireWireVendorName { get; } /// - /// Gets a value indicating whether this device is a CompactFlash device. + /// Gets a value indicating whether this device is a CompactFlash device. /// /// true if this device is a CompactFlash device; otherwise, false. public bool IsCompactFlash { get; } /// - /// Gets a value indicating whether this device is a PCMCIA device. + /// Gets a value indicating whether this device is a PCMCIA device. /// /// true if this device is a PCMCIA device; otherwise, false. public bool IsPcmcia { get; } /// - /// Contains the PCMCIA CIS if applicable + /// Contains the PCMCIA CIS if applicable /// public byte[] Cis { get; } } diff --git a/DiscImageChef.Devices/Enums.cs b/DiscImageChef.Devices/Enums.cs index b18ad1dc..4d7dae87 100644 --- a/DiscImageChef.Devices/Enums.cs +++ b/DiscImageChef.Devices/Enums.cs @@ -31,6 +31,7 @@ // ****************************************************************************/ using System; + // ReSharper disable MemberCanBeInternal // ReSharper disable InconsistentNaming @@ -49,615 +50,618 @@ namespace DiscImageChef.Devices #region ATA Commands /// - /// All known ATA commands + /// All known ATA commands /// public enum AtaCommands : byte { #region Commands defined on Western Digital WD1000 Winchester Disk Controller /// - /// Formats a track + /// Formats a track /// FormatTrack = 0x50, /// - /// Reads sectors + /// Reads sectors /// ReadOld = 0x20, /// - /// Reads sectors using DMA + /// Reads sectors using DMA /// ReadDmaOld = 0x28, /// - /// Calibrates the position of the heads - /// Includes all commands from 0x10 to 0x1F + /// Calibrates the position of the heads + /// Includes all commands from 0x10 to 0x1F /// Restore = 0x10, /// - /// Seeks to a certain cylinder + /// Seeks to a certain cylinder /// Seek = 0x70, /// - /// Writes sectors + /// Writes sectors /// WriteOld = 0x30, #endregion Commands defined on Western Digital WD1000 Winchester Disk Controller #region Commands defined on ATA rev. 4c /// - /// Acknowledges media change + /// Acknowledges media change /// AckMediaChange = 0xDB, /// - /// Sends vendor-specific information that may be required in order to pass diagnostics + /// Sends vendor-specific information that may be required in order to pass diagnostics /// PostBoot = 0xDC, /// - /// Prepares a removable drive to respond to boot + /// Prepares a removable drive to respond to boot /// PreBoot = 0xDD, /// - /// Checks drive power mode + /// Checks drive power mode /// CheckPowerMode = 0xE5, /// - /// Checks drive power mode + /// Checks drive power mode /// CheckPowerModeAlternate = 0x98, /// - /// Locks the door of the drive + /// Locks the door of the drive /// DoorLock = 0xDE, /// - /// Unlocks the door of the drive + /// Unlocks the door of the drive /// DoorUnLock = 0xDF, /// - /// Executes internal drive diagnostics + /// Executes internal drive diagnostics /// ExecuteDriveDiagnostic = 0x90, /// - /// Gets a sector containing drive identification and capabilities + /// Gets a sector containing drive identification and capabilities /// IdentifyDrive = 0xEC, /// - /// Requests the drive to enter idle status + /// Requests the drive to enter idle status /// Idle = 0xE3, /// - /// Requests the drive to enter idle status + /// Requests the drive to enter idle status /// IdleAlternate = 0x97, /// - /// Requests the drive to enter idle status immediately + /// Requests the drive to enter idle status immediately /// IdleImmediate = 0xE1, /// - /// Requests the drive to enter idle status immediately + /// Requests the drive to enter idle status immediately /// IdleImmediateAlternate = 0x95, /// - /// Changes heads and sectors per cylinder for the drive + /// Changes heads and sectors per cylinder for the drive /// InitializeDriveParameters = 0x91, /// - /// Does nothing + /// Does nothing /// Nop = 0x00, /// - /// Reads sectors using PIO transfer + /// Reads sectors using PIO transfer /// Read = 0x21, /// - /// Reads the content of the drive's buffer + /// Reads the content of the drive's buffer /// ReadBuffer = 0xE4, /// - /// Reads sectors using DMA transfer + /// Reads sectors using DMA transfer /// ReadDma = 0xC9, /// - /// Reads sectors using DMA transfer, retrying on error + /// Reads sectors using DMA transfer, retrying on error /// ReadDmaRetry = 0xC8, /// - /// Reads a sector including ECC bytes without checking them + /// Reads a sector including ECC bytes without checking them /// ReadLong = 0x23, /// - /// Reads a sector including ECC bytes without checking them, retrying on error + /// Reads a sector including ECC bytes without checking them, retrying on error /// ReadLongRetry = 0x22, /// - /// Reads multiple sectors generating interrupts at block transfers + /// Reads multiple sectors generating interrupts at block transfers /// ReadMultiple = 0xC4, /// - /// Reads sectors using PIO transfer, retrying on error + /// Reads sectors using PIO transfer, retrying on error /// ReadRetry = 0x20, /// - /// Verifies sectors readability without transferring them + /// Verifies sectors readability without transferring them /// ReadVerify = 0x41, /// - /// Verifies sectors readability without transferring them, retrying on error + /// Verifies sectors readability without transferring them, retrying on error /// ReadVerifyRetry = 0x40, /// - /// Moves the heads to cylinder 0 + /// Moves the heads to cylinder 0 /// Recalibrate = Restore, /// - /// Sets drive parameters + /// Sets drive parameters /// SetFeatures = 0xEF, /// - /// Enables and and sets the block length for these commands + /// Enables and and sets the block length for these commands /// SetMultipleMode = 0xC6, /// - /// Causes the drive to stop and sleep until a hardware or software reset + /// Causes the drive to stop and sleep until a hardware or software reset /// Sleep = 0xE6, /// - /// Causes the drive to stop and sleep until a hardware or software reset + /// Causes the drive to stop and sleep until a hardware or software reset /// SleepAlternate = 0x99, /// - /// Sets the drive to enter Standby mode + /// Sets the drive to enter Standby mode /// Standby = 0xE2, /// - /// Sets the drive to enter Standby mode + /// Sets the drive to enter Standby mode /// StandbyAlternate = 0x96, /// - /// Sets the drive to enter Standby mode, immediately + /// Sets the drive to enter Standby mode, immediately /// StandbyImmediate = 0xE0, /// - /// Sets the drive to enter Standby mode, immediately + /// Sets the drive to enter Standby mode, immediately /// StandbyImmediateAlternate = 0x94, /// - /// Writes sectors using PIO transfer + /// Writes sectors using PIO transfer /// Write = 0x31, /// - /// Writes data to the drive's sector buffer + /// Writes data to the drive's sector buffer /// WriteBuffer = 0xE8, /// - /// Writes sectors using DMA transfer + /// Writes sectors using DMA transfer /// WriteDma = 0xCB, /// - /// Writes sectors using DMA transfer, retrying on error + /// Writes sectors using DMA transfer, retrying on error /// WriteDmaRetry = 0xCA, /// - /// Writes sectors with custom ECC + /// Writes sectors with custom ECC /// WriteLong = 0x33, /// - /// Writes sectors with custom ECC, retrying on error + /// Writes sectors with custom ECC, retrying on error /// WriteLongRetry = 0x32, /// - /// Writes several sectors at once setting interrupts on end of block + /// Writes several sectors at once setting interrupts on end of block /// WriteMultiple = 0xC5, /// - /// Writes the same data to several sector + /// Writes the same data to several sector /// WriteSame = 0xE9, /// - /// Writes sectors using PIO transfer, retrying on error + /// Writes sectors using PIO transfer, retrying on error /// WriteRetry = 0x30, /// - /// Writes sectors verifying them immediately after write + /// Writes sectors verifying them immediately after write /// WriteVerify = 0x3C, /// - /// Unknown vendor command + /// Unknown vendor command /// Vendor_8X = 0x80, /// - /// Unknown vendor command + /// Unknown vendor command /// Vendor_9A = 0x9A, /// - /// Unknown vendor command + /// Unknown vendor command /// VendorC0 = 0xC0, /// - /// Unknown vendor command + /// Unknown vendor command /// VendorC1 = 0xC1, /// - /// Unknown vendor command + /// Unknown vendor command /// VendorC2 = 0xC2, /// - /// Unknown vendor command + /// Unknown vendor command /// VendorC3 = 0xC3, /// - /// Unknown vendor command + /// Unknown vendor command /// VendorF0 = 0xF0, /// - /// Unknown vendor command + /// Unknown vendor command /// VendorF1 = 0xF1, /// - /// Unknown vendor command + /// Unknown vendor command /// VendorF2 = 0xF2, /// - /// Unknown vendor command + /// Unknown vendor command /// VendorF3 = 0xF3, /// - /// Unknown vendor command + /// Unknown vendor command /// VendorF4 = 0xF4, /// - /// Unknown vendor command + /// Unknown vendor command /// VendorF5 = 0xF5, /// - /// Unknown vendor command + /// Unknown vendor command /// VendorF6 = 0xF6, /// - /// Unknown vendor command + /// Unknown vendor command /// VendorF7 = 0xF7, /// - /// Unknown vendor command + /// Unknown vendor command /// VendorF8 = 0xF8, /// - /// Unknown vendor command + /// Unknown vendor command /// VendorF9 = 0xF9, /// - /// Unknown vendor command + /// Unknown vendor command /// VendorFa = 0xFA, /// - /// Unknown vendor command + /// Unknown vendor command /// VendorFb = 0xFB, /// - /// Unknown vendor command + /// Unknown vendor command /// VendorFc = 0xFC, /// - /// Unknown vendor command + /// Unknown vendor command /// VendorFd = 0xFD, /// - /// Unknown vendor command + /// Unknown vendor command /// VendorFe = 0xFE, /// - /// Unknown vendor command + /// Unknown vendor command /// VendorFf = 0xFF, #endregion Commands defined on ATA rev. 4c #region Commands defined on ATA-2 rev. 4c /// - /// Alters the device microcode + /// Alters the device microcode /// DownloadMicrocode = 0x92, /// - /// Ejects the removable medium on the device + /// Ejects the removable medium on the device /// MediaEject = 0xED, #endregion Commands defined on ATA-2 rev. 4c #region Commands defined on ATA-3 rev. 7b /// - /// Gets a sector containing drive identification and capabilities + /// Gets a sector containing drive identification and capabilities /// IdentifyDriveDma = 0xEE, /// - /// Disables the security lock + /// Disables the security lock /// SecurityDisablePassword = 0xF6, /// - /// Enables usage of command + /// Enables usage of command /// SecurityErasePrepare = 0xF3, /// - /// Erases all user data and isables the security lock + /// Erases all user data and isables the security lock /// SecurityEraseUnit = 0xF4, /// - /// Sets the security freeze lock preventing any security command from working until hardware reset + /// Sets the security freeze lock preventing any security command from working until hardware reset /// SecurityFreezeLock = 0xF5, /// - /// Sets the device user or master password + /// Sets the device user or master password /// SecuritySetPassword = 0xF1, /// - /// Unlocks device + /// Unlocks device /// SecurityUnlock = 0xF2, /// - /// SMART operations + /// SMART operations /// Smart = 0xB0, #endregion Commands defined on ATA-3 rev. 7b #region Commands defined on CompactFlash Specification /// - /// Pre-erases and conditions data sectors + /// Pre-erases and conditions data sectors /// EraseSectors = 0xC0, /// - /// Requests extended error information + /// Requests extended error information /// RequestSense = 0x03, /// - /// Provides a way to determine the exact number of times a sector has been erases and programmed + /// Provides a way to determine the exact number of times a sector has been erases and programmed /// TranslateSector = 0x87, /// - /// For CompactFlash cards that do not support security mode, this commands is equal to - /// For those that do, this command is equal to + /// For CompactFlash cards that do not support security mode, this commands is equal to + /// For those that do, this command is equal to /// WearLevel = 0xF5, /// - /// Writes a block of sectors without erasing them previously + /// Writes a block of sectors without erasing them previously /// WriteMultipleWithoutErase = 0xCD, /// - /// Writes sectors without erasing them previously + /// Writes sectors without erasing them previously /// WriteWithoutErase = 0x38, #endregion Commands defined on CompactFlash Specification #region Commands defined on ATA/ATAPI-4 rev. 18 /// - /// Resets a device + /// Resets a device /// DeviceReset = 0x08, /// - /// Requests the device to flush the write cache and write it to the media + /// Requests the device to flush the write cache and write it to the media /// FlushCache = 0xE7, /// - /// Gets media status + /// Gets media status /// GetMediaStatus = 0xDA, /// - /// Gets a sector containing drive identification and capabilities, for ATA devices + /// Gets a sector containing drive identification and capabilities, for ATA devices /// IdentifyDevice = IdentifyDrive, /// - /// Gets a sector containing drive identification and capabilities, for ATAPI devices + /// Gets a sector containing drive identification and capabilities, for ATAPI devices /// IdentifyPacketDevice = 0xA1, /// - /// Locks the media on the device + /// Locks the media on the device /// MediaLock = DoorLock, /// - /// Unlocks the media on the device + /// Unlocks the media on the device /// MediaUnLock = DoorUnLock, /// - /// Sends a command packet + /// Sends a command packet /// Packet = 0xA0, /// - /// Queues a read of sectors + /// Queues a read of sectors /// ReadDmaQueued = 0xC7, /// - /// Returns the native maximum address in factory default condition + /// Returns the native maximum address in factory default condition /// ReadNativeMaxAddress = 0xF8, /// - /// Used to provide data transfer and/or status of a previous command (queue or packet) + /// Used to provide data transfer and/or status of a previous command (queue or packet) /// Service = 0xA2, /// - /// Redefines the maximum user-accessible address space + /// Redefines the maximum user-accessible address space /// SetMaxAddress = 0xF9, /// - /// Queues a write of sectors + /// Queues a write of sectors /// WriteDmaQueued = 0xCC, #endregion Commands defined on ATA/ATAPI-4 rev. 18 #region Commands defined on ATA/ATAPI-6 rev. 3b /// - /// Determines if the device supports the Media Card Pass Through Command feature set + /// Determines if the device supports the Media Card Pass Through Command feature set /// CheckMediaCardType = 0xD1, /// - /// Device Configuration Overlay feature set + /// Device Configuration Overlay feature set /// DevideConfiguration = 0xB1, /// - /// Requests the device to flush the write cache and write it to the media (48-bit) + /// Requests the device to flush the write cache and write it to the media (48-bit) /// FlushCacheExt = 0xEA, /// - /// Reads sectors using DMA transfer, retrying on error (48-bit) + /// Reads sectors using DMA transfer, retrying on error (48-bit) /// ReadDmaExt = 0x25, - /// (48-bit) - /// Queues a read of sectors + /// + /// (48-bit) + /// Queues a read of sectors /// ReadDmaQueuedExt = 0x26, /// - /// Reads sectors using PIO transfer, retrying on error (48-bit) + /// Reads sectors using PIO transfer, retrying on error (48-bit) /// ReadExt = 0x24, /// - /// Returns the indicated log to the host (48-bit) + /// Returns the indicated log to the host (48-bit) /// ReadLogExt = 0x2F, /// - /// Reads multiple sectors generating interrupts at block transfers (48-bit) + /// Reads multiple sectors generating interrupts at block transfers (48-bit) /// ReadMultipleExt = 0x29, /// - /// Returns the native maximum address in factory default condition (48-bit) + /// Returns the native maximum address in factory default condition (48-bit) /// ReadNativeMaxAddressExt = 0x27, /// - /// Verifies sectors readability without transferring them, retrying on error (48-bit) + /// Verifies sectors readability without transferring them, retrying on error (48-bit) /// ReadVerifyExt = 0x42, /// - /// Sends a SET MAX subcommand, + /// Sends a SET MAX subcommand, /// SetMaxCommands = 0xF9, /// - /// Redefines the maximum user-accessible address space (48-bit) + /// Redefines the maximum user-accessible address space (48-bit) /// SetMaxAddressExt = 0x37, /// - /// Writes sectors using DMA transfer, retrying on error (48-bit) + /// Writes sectors using DMA transfer, retrying on error (48-bit) /// WriteDmaExt = 0x35, /// - /// Queues a write of sectors (48-bit) + /// Queues a write of sectors (48-bit) /// WriteDmaQueuedExt = 0x36, /// - /// Writes sectors using PIO transfer, retrying on error (48-bit) + /// Writes sectors using PIO transfer, retrying on error (48-bit) /// WriteExt = 0x34, /// - /// Writes data to the indicated log (48-bit) + /// Writes data to the indicated log (48-bit) /// WriteLogExt = 0x3F, /// - /// Writes several sectors at once setting interrupts on end of block (48-bit) + /// Writes several sectors at once setting interrupts on end of block (48-bit) /// WriteMultipleExt = 0x39, #endregion Commands defined on ATA/ATAPI-6 rev. 3b #region Commands defined on ATA/ATAPI-7 rev. 4b /// - /// Configurates the operating parameters for a stream + /// Configurates the operating parameters for a stream /// ConfigureStream = 0x51, /// - /// Reads data on an alloted time using DMA + /// Reads data on an alloted time using DMA /// ReadStreamDmaExt = 0x2A, /// - /// Reads data on an alloted time using PIO + /// Reads data on an alloted time using PIO /// ReadStreamExt = 0x2B, /// - /// Writes data on an alloted time using DMA + /// Writes data on an alloted time using DMA /// WriteStreamDmaExt = 0x3A, /// - /// Writes data on an alloted time using PIO + /// Writes data on an alloted time using PIO /// WriteStreamExt = 0x3B, #endregion Commands defined on ATA/ATAPI-7 rev. 4b #region Commands defined on ATA/ATAPI-8 rev. 3f /// - /// Sends a Non Volatile Cache subcommand. + /// Sends a Non Volatile Cache subcommand. /// NonVolatileCacheCommand = 0xB6, /// - /// Retrieves security protocol information or the results from commands + /// Retrieves security protocol information or the results from commands /// TrustedReceive = 0x5C, /// - /// Retrieves security protocol information or the results from commands, using DMA transfers + /// Retrieves security protocol information or the results from commands, using DMA + /// transfers /// TrustedReceiveDma = 0x5D, /// - /// Sends one or more Security Protocol commands + /// Sends one or more Security Protocol commands /// TrustedSend = 0x5E, /// - /// Sends one or more Security Protocol commands, using DMA transfers + /// Sends one or more Security Protocol commands, using DMA transfers /// TrustedSendDma = 0x5F, /// - /// Writes sectors using DMA transfer, retrying on error (48-bit), not returning until the operation is complete + /// Writes sectors using DMA transfer, retrying on error (48-bit), not returning until the operation is complete /// WriteDmaFuaExt = 0x3D, /// - /// Queues a write of sectors (48-bit), not returning until the operation is complete + /// Queues a write of sectors (48-bit), not returning until the operation is complete /// WriteDmaQueuedFuaExt = 0x3E, /// - /// Writes several sectors at once setting interrupts on end of block (48-bit), not returning until the operation is complete + /// Writes several sectors at once setting interrupts on end of block (48-bit), not returning until the operation is + /// complete /// WriteMultipleFuaExt = 0xCE, /// - /// Writes a sector that will give an uncorrectable error on any read operation + /// Writes a sector that will give an uncorrectable error on any read operation /// WriteUncorrectableExt = 0x45, #endregion Commands defined on ATA/ATAPI-8 rev. 3f #region Commands defined on ATA/ATAPI Command Set 2 (ACS-2) rev. 2 /// - /// Provides information for device optimization - /// In SSDs, this contains trimming + /// Provides information for device optimization + /// In SSDs, this contains trimming /// DataSetManagement = 0x06, /// - /// Alters the device microcode, using DMA transfers + /// Alters the device microcode, using DMA transfers /// DownloadMicrocodeDma = 0x93, /// - /// Reads the content of the drive's buffer, using DMA transfers + /// Reads the content of the drive's buffer, using DMA transfers /// ReadBufferDma = 0xE9, /// - /// Reads sectors using NCQ + /// Reads sectors using NCQ /// ReadFpDmaQueued = 0x60, /// - /// Returns the indicated log to the host (48-bit) + /// Returns the indicated log to the host (48-bit) /// ReadLogDmaExt = 0x47, /// - /// Requests SPC-4 style error data + /// Requests SPC-4 style error data /// RequestSenseDataExt = 0x0B, SanitizeCommands = 0xB4, /// - /// Executes a Security Protocol command that does not require a transfer of data + /// Executes a Security Protocol command that does not require a transfer of data /// TrustedNonData = 0x5B, /// - /// Writes data to the drive's sector buffer, using DMA transfers + /// Writes data to the drive's sector buffer, using DMA transfers /// WriteBufferDma = 0xE8, /// - /// Writes sectors using NCQ + /// Writes sectors using NCQ /// WriteFpDmaQueued = 0x61, #endregion Commands defined on ATA/ATAPI Command Set 2 (ACS-2) rev. 2 #region Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 5 /// - /// Sends + /// Sends /// NcqQueueManagement = 0x63, /// - /// Sets the device date and time + /// Sets the device date and time /// SetDateAndTimeExt = 0x77, #endregion Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 5 @@ -670,59 +674,59 @@ namespace DiscImageChef.Devices #region ATA SMART SubCommands /// - /// All known ATA SMART sub-commands + /// All known ATA SMART sub-commands /// public enum AtaSmartSubCommands : byte { #region Commands defined on ATA-3 rev. 7b /// - /// Disables all SMART capabilities + /// Disables all SMART capabilities /// Disable = 0xD9, /// - /// Enables/disables SMART attribute autosaving + /// Enables/disables SMART attribute autosaving /// EnableDisableAttributeAutosave = 0xD2, /// - /// Enables all SMART capabilities + /// Enables all SMART capabilities /// Enable = 0xD8, /// - /// Returns the device's SMART attributes thresholds + /// Returns the device's SMART attributes thresholds /// ReadAttributeThresholds = 0xD1, /// - /// Returns the device's SMART attributes values + /// Returns the device's SMART attributes values /// ReadAttributeValues = 0xD0, /// - /// Communicates device reliability status + /// Communicates device reliability status /// ReturnStatus = 0xDA, /// - /// Saves any attribute values immediately + /// Saves any attribute values immediately /// SaveAttributeValues = 0xD3, #endregion Commands defined on ATA-3 rev. 7b #region Commands defined on ATA/ATAPI-4 rev. 18 /// - /// Causes the device to immediately initiate a SMART data collection and saves it to the device + /// Causes the device to immediately initiate a SMART data collection and saves it to the device /// ExecuteOfflineImmediate = 0xD4, /// - /// Returns the device's SMART attributes values + /// Returns the device's SMART attributes values /// ReadData = ReadAttributeValues, #endregion Commands defined on ATA/ATAPI-4 rev. 18 #region Commands defined on ATA/ATAPI-5 rev. 3 /// - /// Returns the indicated log to the host + /// Returns the indicated log to the host /// ReadLog = 0xD5, /// - /// Writes data to the indicated log + /// Writes data to the indicated log /// WriteLog = 0xD6 #endregion Commands defined on ATA/ATAPI-5 rev. 3 @@ -731,25 +735,25 @@ namespace DiscImageChef.Devices #region ATA Device Configuration Overlay SubCommands /// - /// All known ATA DEVICE CONFIGURATION sub-commands + /// All known ATA DEVICE CONFIGURATION sub-commands /// public enum AtaDeviceConfigurationSubCommands : byte { #region Commands defined on ATA/ATAPI-6 rev. 3b /// - /// Disables any change made by + /// Disables any change made by /// Restore = 0xC0, /// - /// Prevents any from working until a power down cycle. + /// Prevents any from working until a power down cycle. /// FreezeLock = 0xC1, /// - /// Indicates the selectable commands, modes, and feature sets the device supports + /// Indicates the selectable commands, modes, and feature sets the device supports /// Identify = 0xC2, /// - /// Modifies the commands, modes and features sets the device will obey to + /// Modifies the commands, modes and features sets the device will obey to /// Set = 0xC3 #endregion Commands defined on ATA/ATAPI-6 rev. 3b @@ -758,29 +762,30 @@ namespace DiscImageChef.Devices #region ATA SET MAX SubCommands /// - /// All known ATA SET MAX sub-commands + /// All known ATA SET MAX sub-commands /// public enum AtaSetMaxSubCommands : byte { #region Commands defined on ATA/ATAPI-6 rev. 3b /// - /// Redefines the maximum user-accessible address space + /// Redefines the maximum user-accessible address space /// Address = 0x00, /// - /// Disables any other until power cycle + /// Disables any other until power cycle /// FreezeLock = 0x04, /// - /// Disables any other except and until power cycle + /// Disables any other except and + /// until power cycle /// Lock = 0x02, /// - /// Sets the device password + /// Sets the device password /// SetPassword = 0x01, /// - /// Disables + /// Disables /// UnLock = 0x03, #endregion Commands defined on ATA/ATAPI-6 rev. 3b @@ -789,38 +794,38 @@ namespace DiscImageChef.Devices #region ATA Non Volatile Cache SubCommands /// - /// All known ATA NV CACHE sub-commands + /// All known ATA NV CACHE sub-commands /// public enum AtaNonVolatileCacheSubCommands : byte { #region Commands defined on ATA/ATAPI-8 rev. 3f /// - /// Adds the specified LBA to the Non Volatile Cache + /// Adds the specified LBA to the Non Volatile Cache /// AddLbaToNvCache = 0x10, /// - /// Ensures there is enough free space in the Non Volatile Cache + /// Ensures there is enough free space in the Non Volatile Cache /// FlushNvCache = 0x14, /// - /// Requests a list of LBAs actually stored in the Non Volatile Cache + /// Requests a list of LBAs actually stored in the Non Volatile Cache /// QueryNvCachePinnedSet = 0x12, /// - /// Requests a list of LBAs accessed but not in the Non Volatile Cache + /// Requests a list of LBAs accessed but not in the Non Volatile Cache /// QueryNvCacheMisses = 0x13, /// - /// Removes the specified LBA from the Non Volatile Cache Pinned Set + /// Removes the specified LBA from the Non Volatile Cache Pinned Set /// RemoveLbaFromNvCache = 0x11, /// - /// Disables the Non Volatile Cache Power Mode - /// + /// Disables the Non Volatile Cache Power Mode + /// /// ReturnFromNvCachePowerMode = 0x01, /// - /// Enables the Non Volatile Cache Power Mode, so the device tries to serve all accesses from the Non Volatile Cache + /// Enables the Non Volatile Cache Power Mode, so the device tries to serve all accesses from the Non Volatile Cache /// SetNvCachePowerMode = 0x00 #endregion Commands defined on ATA/ATAPI-8 rev. 3f @@ -829,36 +834,36 @@ namespace DiscImageChef.Devices #region ATA Sanitize SubCommands /// - /// All known ATA SANITIZE sub-commands + /// All known ATA SANITIZE sub-commands /// public enum AtaSanitizeSubCommands : ushort { #region Commands defined on ATA/ATAPI Command Set 2 (ACS-2) rev. 2 /// - /// Causes a block erase on all user data + /// Causes a block erase on all user data /// BlockEraseExt = 0x0012, /// - /// Changes the internal encryption keys. Renders user data unusable + /// Changes the internal encryption keys. Renders user data unusable /// CryptoScrambleExt = 0x0011, /// - /// Fills user data with specified pattern + /// Fills user data with specified pattern /// OverwriteExt = 0x0014, /// - /// Disables all except + /// Disables all except /// FreezeLockExt = 0x0020, /// - /// Gets the status of the sanitizing + /// Gets the status of the sanitizing /// Status = 0x0000, #endregion Commands defined on ATA/ATAPI Command Set 2 (ACS-2) rev. 2 #region Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 5 /// - /// Disables the command + /// Disables the command /// AntiFreezeLockExt = 0x0040 #endregion Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 5 @@ -867,17 +872,17 @@ namespace DiscImageChef.Devices #region ATA NCQ Queue Management SubCommands /// - /// All known ATA NCQ QUEUE MANAGEMENT sub-commands + /// All known ATA NCQ QUEUE MANAGEMENT sub-commands /// public enum AtaNcqQueueManagementSubcommands : byte { #region Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 5 /// - /// Aborts pending NCQ commands + /// Aborts pending NCQ commands /// AbortNcqQueue = 0x00, /// - /// Controls how NCQ Streaming commands are processed by the device + /// Controls how NCQ Streaming commands are processed by the device /// DeadlineHandling = 0x01, #endregion Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 5 @@ -885,11 +890,11 @@ namespace DiscImageChef.Devices #endregion ATA NCQ Queue Management SubCommands /// - /// 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 - /// Commands 0xA0 to 0xBF are 12-byte + /// 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 + /// Commands 0xA0 to 0xBF are 12-byte /// #region SASI Commands @@ -897,451 +902,451 @@ namespace DiscImageChef.Devices { #region SASI Class 0 commands /// - /// Returns zero status if requested unit is on and ready. - /// SASI rev. 0a + /// Returns zero status if requested unit is on and ready. + /// SASI rev. 0a /// TestUnitReady = 0x00, /// - /// Sets the unit to a specific known state. - /// SASI rev. 0a + /// Sets the unit to a specific known state. + /// SASI rev. 0a /// RezeroUnit = 0x01, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// RequestSyndrome = 0x02, /// - /// Returns unit sense. - /// SASI rev. 0a + /// Returns unit sense. + /// SASI rev. 0a /// RequestSense = 0x03, /// - /// Formats the entire media. - /// SASI rev. 0a + /// Formats the entire media. + /// SASI rev. 0a /// FormatUnit = 0x04, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// CheckTrackFormat = 0x05, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// FormatTrack = 0x06, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// FormatBadTrack = 0x06, /// - /// Reads a block from the device. - /// SASI rev. 0a + /// Reads a block from the device. + /// SASI rev. 0a /// Read = 0x08, /// - /// SASI rev. 0a - /// Unknown + /// SASI rev. 0a + /// Unknown /// WriteProtectSector = 0x09, /// - /// Writes a block to the device. - /// SASI rev. 0a + /// Writes a block to the device. + /// SASI rev. 0a /// Write = 0x0A, /// - /// Moves the device reading mechanism to the specified block. - /// SASI rev. 0a + /// Moves the device reading mechanism to the specified block. + /// SASI rev. 0a /// Seek = 0x0B, /// - /// Found on a vendor source code + /// Found on a vendor source code /// InitDriveCharacteristics = 0x0C, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// VerifyRestore = 0x0D, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// AssignAlternateDiskTrack = 0x0E, /// - /// Writes a File Mark on the device. - /// SASI rev. 0c + /// Writes a File Mark on the device. + /// SASI rev. 0c /// WriteFileMark = 0x0F, /// - /// Reserves the device for use by the iniator. - /// SASI rev. 0a + /// Reserves the device for use by the iniator. + /// SASI rev. 0a /// ReserveUnitOld = 0x12, /// - /// Gets information about a device - /// ANSI X3T9.3 No. 185 (SASI) + /// Gets information about a device + /// ANSI X3T9.3 No. 185 (SASI) /// Inquiry = 0x12, /// - /// Release the device from the reservation. - /// SASI rev. 0a + /// Release the device from the reservation. + /// SASI rev. 0a /// ReleaseUnitOld = 0x13, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// WriteProtectDrive = 0x14, /// - /// Writes and verifies blocks to the device. - /// SASI rev. 0c + /// Writes and verifies blocks to the device. + /// SASI rev. 0c /// WriteAndVerifyOld = 0x14, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// ReleaseWriteProtect = 0x15, /// - /// Verifies blocks. - /// SASI rev. 0c + /// Verifies blocks. + /// SASI rev. 0c /// VerifyOld = 0x15, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// ReadNoSeek = 0x16, /// - /// Gets the number of blocks in device. - /// SASI rev. 0c + /// Gets the number of blocks in device. + /// SASI rev. 0c /// ReadCapacityOld = 0x16, /// - /// Reserves the device for use by the iniator. - /// ANSI X3T9.3 No. 185 (SASI) + /// Reserves the device for use by the iniator. + /// ANSI X3T9.3 No. 185 (SASI) /// ReserveUnit = 0x16, /// - /// Release the device from the reservation. - /// ANSI X3T9.3 No. 185 (SASI) + /// Release the device from the reservation. + /// ANSI X3T9.3 No. 185 (SASI) /// ReleaseUnit = 0x17, /// - /// Searches data on blocks - /// SASI rev. 0a + /// Searches data on blocks + /// SASI rev. 0a /// SearchDataEqualOld = 0x17, /// - /// Searches data on blocks using major than or equal comparison - /// SASI rev. 0a + /// Searches data on blocks using major than or equal comparison + /// SASI rev. 0a /// SearchDataHighOld = 0x18, /// - /// Searches data on blocks using minor than or equal comparison - /// SASI rev. 0a + /// Searches data on blocks using minor than or equal comparison + /// SASI rev. 0a /// SearchDataLowOld = 0x19, /// - /// Reads analysis data from a device - /// SASI rev. 0a + /// Reads analysis data from a device + /// SASI rev. 0a /// ReadDiagnosticOld = 0x1A, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// VerifyData = 0x1B, /// - /// Requests a device to run a diagnostic - /// SASI rev. 0c + /// Requests a device to run a diagnostic + /// SASI rev. 0c /// WriteDiagnosticOld = 0x1B, /// - /// Requests the data after completion of a - /// ANSI X3T9.3 No. 185 (SASI) + /// Requests the data after completion of a + /// ANSI X3T9.3 No. 185 (SASI) /// ReadDiagnostic = 0x1C, /// - /// Requests the device to perform diagnostics - /// ANSI X3T9.3 No. 185 (SASI) + /// Requests the device to perform diagnostics + /// ANSI X3T9.3 No. 185 (SASI) /// WriteDiagnostic = 0x1D, /// - /// Gets information about a device - /// SASI rev. 0c + /// Gets information about a device + /// SASI rev. 0c /// InquiryOld = 0x1F, #endregion SASI Class 0 commands #region SASI Class 1 commands /// - /// SASI rev. 0a - /// Unknown + /// SASI rev. 0a + /// Unknown /// Copy = 0x20, /// - /// SASI rev. 0a - /// Unknown + /// SASI rev. 0a + /// Unknown /// Restore = 0x21, /// - /// SASI rev. 0a - /// Unknown + /// SASI rev. 0a + /// Unknown /// Backup = 0x22, /// - /// SASI rev. 0a - /// Unknown + /// SASI rev. 0a + /// Unknown /// SetBlockLimitsOlder = 0x26, /// - /// Sets write or read limits from a specified block - /// SASI rev. 0c + /// Sets write or read limits from a specified block + /// SASI rev. 0c /// SetBlockLimitsOld = 0x28, /// - /// Reads blocks from device - /// ANSI X3T9.3 No. 185 (SASI) + /// Reads blocks from device + /// ANSI X3T9.3 No. 185 (SASI) /// ExtendedAddressRead = 0x28, /// - /// Writes blocks to the device - /// ANSI X3T9.3 No. 185 (SASI) + /// Writes blocks to the device + /// ANSI X3T9.3 No. 185 (SASI) /// ExtendedAddressWrite = 0x2A, /// - /// Writes blocks to the device and then verifies them - /// ANSI X3T9.3 No. 185 (SASI) + /// Writes blocks to the device and then verifies them + /// ANSI X3T9.3 No. 185 (SASI) /// WriteAndVerify = 0x2E, /// - /// Verifies blocks on the device - /// ANSI X3T9.3 No. 185 (SASI) + /// Verifies blocks on the device + /// ANSI X3T9.3 No. 185 (SASI) /// Verify = 0x2F, /// - /// Searches data on blocks - /// ANSI X3T9.3 No. 185 (SASI) + /// Searches data on blocks + /// ANSI X3T9.3 No. 185 (SASI) /// SearchDataEqual = 0x31, /// - /// Searches data on blocks using major than or equal comparison - /// ANSI X3T9.3 No. 185 (SASI) + /// Searches data on blocks using major than or equal comparison + /// ANSI X3T9.3 No. 185 (SASI) /// SearchDataHigh = 0x30, /// - /// Searches data on blocks using minor than or equal comparison - /// ANSI X3T9.3 No. 185 (SASI) + /// Searches data on blocks using minor than or equal comparison + /// ANSI X3T9.3 No. 185 (SASI) /// SearchDataLow = 0x32, #endregion SASI Class 1 commands #region SASI Class 2 commands /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// Load = 0x40, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// Unload = 0x41, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// Rewind = 0x42, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// SpaceForward = 0x43, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// SpaceForwardFileMark = 0x44, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// SpaceReverse = 0x45, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// SpaceReverseFileMark = 0x46, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// TrackSelect = 0x47, /// - /// Reads blocks from device - /// SASI rev. 0a + /// Reads blocks from device + /// SASI rev. 0a /// Read8 = 0x48, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// ReadVerify = 0x49, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// ReadDiagnosticClass2 = 0x4A, /// - /// Writes blocks to device - /// SASI rev. 0a + /// Writes blocks to device + /// SASI rev. 0a /// Write8 = 0x4B, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// WriteFileMarkClass2 = 0x4C, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// WriteExtended = 0x4D, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// WriteExtendedFileMark = 0x4E, /// - /// Unknown - /// SASI rev. 0a + /// Unknown + /// SASI rev. 0a /// WriteErase = 0x4F, /// - /// Writes and verifies blocks to the device. - /// SASI rev. 0c + /// Writes and verifies blocks to the device. + /// SASI rev. 0c /// WriteVerify8 = 0x54, /// - /// Verifies blocks. - /// SASI rev. 0c + /// Verifies blocks. + /// SASI rev. 0c /// Verify8 = 0x55, /// - /// Searches data on blocks using major than or equal comparison - /// SASI rev. 0c + /// Searches data on blocks using major than or equal comparison + /// SASI rev. 0c /// SearchDataHigh8 = 0x57, /// - /// Searches data on blocks - /// SASI rev. 0c + /// Searches data on blocks + /// SASI rev. 0c /// SearchDataEqual8 = 0x58, /// - /// Searches data on blocks using minor than or equal comparison - /// SASI rev. 0c + /// Searches data on blocks using minor than or equal comparison + /// SASI rev. 0c /// SearchDataLow8 = 0x59, #endregion SASI Class 2 commands #region SASI Class 3 commands /// - /// SASI rev. 0a + /// SASI rev. 0a /// Skip = 0x60, /// - /// SASI rev. 0a + /// SASI rev. 0a /// Space = 0x61, /// - /// SASI rev. 0a + /// SASI rev. 0a /// Return = 0x62, /// - /// SASI rev. 0a + /// SASI rev. 0a /// Tab = 0x63, /// - /// SASI rev. 0a + /// SASI rev. 0a /// ReadControl = 0x64, /// - /// SASI rev. 0a + /// SASI rev. 0a /// Write3 = 0x65, /// - /// SASI rev. 0a + /// SASI rev. 0a /// WriteControl = 0x66, #endregion SASI Class 3 commands #region SASI Class 5 commands /// - /// Gets the number of blocks in device. - /// ANSI X3T9.3 No. 185 (SASI) + /// Gets the number of blocks in device. + /// ANSI X3T9.3 No. 185 (SASI) /// ReadCapacity = 0xA5, /// - /// Sets write or read limits from a specified block - /// ANSI X3T9.3 No. 185 (SASI) + /// Sets write or read limits from a specified block + /// ANSI X3T9.3 No. 185 (SASI) /// SetBlockLimits = 0xA9, #endregion SASI Class 5 commands #region SASI Class 6 commands /// - /// SASI rev. 0a + /// SASI rev. 0a /// DefineFloppyDiskTrackFormat = 0xC0, /// - /// Unknown vendor command in X68000 + /// Unknown vendor command in X68000 /// Specify = 0xC2, /// - /// SASI rev. 0a + /// SASI rev. 0a /// FormatDriveErrorMap = 0xC4, /// - /// SASI rev. 0a + /// SASI rev. 0a /// ReadErrorMap = 0xC5, /// - /// SASI rev. 0a + /// SASI rev. 0a /// ReadDriveType = 0xC6, #endregion SASI Class 6 commands #region SASI Class 7 commands /// - /// SASI rev. 0a + /// SASI rev. 0a /// RamDiagnostic = 0xE0, /// - /// SASI rev. 0a + /// SASI rev. 0a /// WriteEcc = 0xE1, /// - /// SASI rev. 0a + /// SASI rev. 0a /// ReadId = 0xE2, /// - /// SASI rev. 0a + /// SASI rev. 0a /// DriveDiagnostic = 0xE3, /// - /// Found on a vendor source code + /// Found on a vendor source code /// ControllerDiagnostic = 0xE4, /// - /// Found on a vendor document + /// Found on a vendor document /// ReadLong = 0xE5, /// - /// Found on a vendor document + /// Found on a vendor document /// WriteLong = 0xE6 #endregion SASI Class 7 commands @@ -1350,1042 +1355,1043 @@ namespace DiscImageChef.Devices #region SCSI Commands /// - /// All known SCSI and ATAPI commands + /// All known SCSI and ATAPI commands /// public enum ScsiCommands : byte { #region SCSI Primary Commands (SPC) /// - /// Commands used to obtain information about the access controls that are active - /// SPC-4 rev. 16 + /// Commands used to obtain information about the access controls that are active + /// SPC-4 rev. 16 /// AccessControlIn = 0x86, /// - /// Commands used to limit or grant access to LUNs - /// SPC-4 rev. 16 + /// Commands used to limit or grant access to LUNs + /// SPC-4 rev. 16 /// AccessControlOut = 0x87, /// - /// Modifies the operating definition of the device with respect to commmands. - /// SCSI-2 X3T9.2/375R rev. 10l + /// Modifies the operating definition of the device with respect to commmands. + /// SCSI-2 X3T9.2/375R rev. 10l /// ChangeDefinition = 0x40, /// - /// Compares data between two devices - /// ECMA-111 (SCSI-1) + /// Compares data between two devices + /// ECMA-111 (SCSI-1) /// Compare = 0x39, /// - /// Copies data between two devices - /// ECMA-111 (SCSI-1) + /// Copies data between two devices + /// ECMA-111 (SCSI-1) /// Copy = 0x18, /// - /// Copies data between two devices and verifies the copy is correct. - /// ECMA-111 (SCSI-1) + /// Copies data between two devices and verifies the copy is correct. + /// ECMA-111 (SCSI-1) /// CopyAndVerify = 0x3A, /// - /// Copies data between two devices - /// SPC-2 rev. 20 + /// Copies data between two devices + /// SPC-2 rev. 20 /// ExtendedCopy = 0x83, /// - /// Requests information about the device - /// ECMA-111 (SCSI-1) + /// Requests information about the device + /// ECMA-111 (SCSI-1) /// Inquiry = SasiCommands.Inquiry, /// - /// Manages device statistics - /// SCSI-2 X3T9.2/375R rev. 10l + /// Manages device statistics + /// SCSI-2 X3T9.2/375R rev. 10l /// LogSelect = 0x4C, /// - /// Gets device statistics - /// SCSI-2 X3T9.2/375R rev. 10l + /// Gets device statistics + /// SCSI-2 X3T9.2/375R rev. 10l /// LogSense = 0x4D, /// - /// Retrieves management protocol information - /// SPC-2 rev. 20 + /// Retrieves management protocol information + /// SPC-2 rev. 20 /// ManagementProtocolIn = 0xA3, /// - /// Transfers management protocol information - /// SPC-2 rev. 20 + /// Transfers management protocol information + /// SPC-2 rev. 20 /// ManagementProtocolOut = 0xA4, /// - /// Sets device parameters - /// ECMA-111 (SCSI-1) + /// Sets device parameters + /// ECMA-111 (SCSI-1) /// ModeSelect = 0x15, /// - /// Sets device parameters - /// SCSI-2 X3T9.2/375R rev. 10l + /// Sets device parameters + /// SCSI-2 X3T9.2/375R rev. 10l /// ModeSelect10 = 0x55, /// - /// Gets device parameters - /// ECMA-111 (SCSI-1) + /// Gets device parameters + /// ECMA-111 (SCSI-1) /// ModeSense = 0x1A, /// - /// Gets device parameters - /// SCSI-2 X3T9.2/375R rev. 10l + /// Gets device parameters + /// SCSI-2 X3T9.2/375R rev. 10l /// ModeSense10 = 0x5A, /// - /// Obtains information about persistent reservations and reservation keys - /// SPC-1 rev. 10 + /// Obtains information about persistent reservations and reservation keys + /// SPC-1 rev. 10 /// PersistentReserveIn = 0x5E, /// - /// Reserves a LUN or an extent within a LUN for exclusive or shared use - /// SPC-1 rev. 10 + /// Reserves a LUN or an extent within a LUN for exclusive or shared use + /// SPC-1 rev. 10 /// PersistentReserveOut = 0x5F, /// - /// Requests the device to disable or enable the removal of the medium inside it - /// ECMA-111 (SCSI-1) + /// Requests the device to disable or enable the removal of the medium inside it + /// ECMA-111 (SCSI-1) /// PreventAllowMediumRemoval = 0x1E, /// - /// Reads attribute values from medium auxiliary memory - /// SPC-3 rev. 21b + /// Reads attribute values from medium auxiliary memory + /// SPC-3 rev. 21b /// ReadAttribute = 0x8C, /// - /// Reads the device buffer - /// SCSI-2 X3T9.2/375R rev. 10l + /// Reads the device buffer + /// SCSI-2 X3T9.2/375R rev. 10l /// ReadBuffer = 0x3C, /// - /// Reads the media serial number - /// SPC-3 rev. 21b + /// Reads the media serial number + /// SPC-3 rev. 21b /// ReadSerialNumber = 0xAB, /// - /// Receives information about a previous or current - /// SPC-2 rev. 20 + /// Receives information about a previous or current + /// SPC-2 rev. 20 /// ReceiveCopyResults = 0x84, /// - /// Requests the data after completion of a - /// ECMA-111 (SCSI-1) + /// Requests the data after completion of a + /// ECMA-111 (SCSI-1) /// ReceiveDiagnostic = SasiCommands.ReadDiagnostic, /// - /// Releases a previously reserved LUN or extents - /// ECMA-111 (SCSI-1) + /// Releases a previously reserved LUN or extents + /// ECMA-111 (SCSI-1) /// Release = SasiCommands.ReleaseUnit, /// - /// Releases a previously reserved LUN or extents - /// SPC-1 rev. 10 + /// Releases a previously reserved LUN or extents + /// SPC-1 rev. 10 /// Release10 = 0x57, /// - /// Requests the LUNs that are present on the device - /// SPC-1 rev. 10 + /// Requests the LUNs that are present on the device + /// SPC-1 rev. 10 /// ReportLuns = 0xA0, /// - /// Requests the device's sense - /// ECMA-111 (SCSI-1) + /// Requests the device's sense + /// ECMA-111 (SCSI-1) /// RequestSense = SasiCommands.RequestSense, /// - /// Reserves a LUN or extent - /// ECMA-111 (SCSI-1) + /// Reserves a LUN or extent + /// ECMA-111 (SCSI-1) /// Reserve = SasiCommands.ReserveUnit, /// - /// Reserves a LUN or extent - /// SPC-1 rev. 10 + /// Reserves a LUN or extent + /// SPC-1 rev. 10 /// Reserve10 = 0x56, /// - /// Retrieves security protocol information - /// SPC-4 rev. 16 + /// Retrieves security protocol information + /// SPC-4 rev. 16 /// SecurityProtocolIn = 0xA2, /// - /// Transfers security protocol information - /// SPC-4 rev. 16 + /// Transfers security protocol information + /// SPC-4 rev. 16 /// SecurityProtocolOut = 0xB5, /// - /// Requests the device to perform diagnostics - /// ECMA-111 (SCSI-1) + /// Requests the device to perform diagnostics + /// ECMA-111 (SCSI-1) /// SendDiagnostic = SasiCommands.WriteDiagnostic, /// - /// Extended commands - /// SPC-4 + /// Extended commands + /// SPC-4 /// ServiceActionIn = 0x9E, /// - /// Extended commands - /// SPC-4 + /// Extended commands + /// SPC-4 /// ServiceActionOut = 0x9F, /// - /// Checks if a LUN is ready to access its medium - /// ECMA-111 (SCSI-1) + /// Checks if a LUN is ready to access its medium + /// ECMA-111 (SCSI-1) /// TestUnitReady = SasiCommands.TestUnitReady, /// - /// Writes attribute values to medium auxiliary memory - /// SPC-3 rev. 21b + /// Writes attribute values to medium auxiliary memory + /// SPC-3 rev. 21b /// WriteAttribute = 0x8D, /// - /// Writes to the device's buffer - /// SCSI-2 X3T9.2/375R rev. 10l + /// Writes to the device's buffer + /// SCSI-2 X3T9.2/375R rev. 10l /// WriteBuffer = 0x3B, #endregion SCSI Primary Commands (SPC) #region SCSI Block Commands (SBC) /// - /// Compares blocks with sent data, and if equal, writes those block to device, atomically - /// SBC-3 rev. 25 + /// Compares blocks with sent data, and if equal, writes those block to device, atomically + /// SBC-3 rev. 25 /// CompareAndWrite = 0x89, /// - /// Formats the medium into addressable logical blocks - /// ECMA-111 (SCSI-1) + /// Formats the medium into addressable logical blocks + /// ECMA-111 (SCSI-1) /// FormatUnit = SasiCommands.FormatUnit, /// - /// Locks blocks from eviction of device's cache - /// SCSI-2 X3T9.2/375R rev. 10l + /// Locks blocks from eviction of device's cache + /// SCSI-2 X3T9.2/375R rev. 10l /// LockUnlockCache = 0x36, /// - /// Locks blocks from eviction of device's cache - /// SBC-2 rev. 4 + /// Locks blocks from eviction of device's cache + /// SBC-2 rev. 4 /// LockUnlockCache16 = 0x92, /// - /// Requests the device to perform the following uninterrupted series of actions: - /// 1.- Read the specified blocks - /// 2.- Transfer blocks from the data out buffer - /// 3.- Perform an OR operation between the read blocks and the buffer - /// 4.- Write the buffer to the blocks - /// SBC-3 rev. 16 + /// Requests the device to perform the following uninterrupted series of actions: + /// 1.- Read the specified blocks + /// 2.- Transfer blocks from the data out buffer + /// 3.- Perform an OR operation between the read blocks and the buffer + /// 4.- Write the buffer to the blocks + /// SBC-3 rev. 16 /// OrWrite = 0x8B, /// - /// Transfers requested blocks to devices' cache - /// SCSI-2 X3T9.2/375R rev. 10l + /// Transfers requested blocks to devices' cache + /// SCSI-2 X3T9.2/375R rev. 10l /// PreFetch = 0x34, /// - /// Transfers requested blocks to devices' cache - /// SBC-3 rev. 16 + /// Transfers requested blocks to devices' cache + /// SBC-3 rev. 16 /// PreFetch16 = 0x90, /// - /// Reads blocks from device - /// ECMA-111 (SCSI-1) + /// Reads blocks from device + /// ECMA-111 (SCSI-1) /// Read = SasiCommands.Read, /// - /// Reads blocks from device - /// ECMA-111 (SCSI-1) + /// Reads blocks from device + /// ECMA-111 (SCSI-1) /// Read10 = SasiCommands.ExtendedAddressRead, /// - /// Reads blocks from device - /// SBC-2 rev. 4 + /// Reads blocks from device + /// SBC-2 rev. 4 /// Read16 = 0x88, /// - /// Gets device capacity - /// ECMA-111 (SCSI-1) + /// Gets device capacity + /// ECMA-111 (SCSI-1) /// ReadCapacity = 0x25, /// - /// Gets device's defect data - /// SCSI-2 X3T9.2/375R rev. 10l + /// Gets device's defect data + /// SCSI-2 X3T9.2/375R rev. 10l /// ReadDefectData = 0x37, /// - /// Reads blocks from device in a vendor-specific way that should include the ECC alongside the data - /// SCSI-2 X3T9.2/375R rev. 10l + /// Reads blocks from device in a vendor-specific way that should include the ECC alongside the data + /// SCSI-2 X3T9.2/375R rev. 10l /// ReadLong = 0x3E, /// - /// Requests the device to reassign the defective blocks to another area of the medium - /// ECMA-111 (SCSI-1) + /// Requests the device to reassign the defective blocks to another area of the medium + /// ECMA-111 (SCSI-1) /// ReassignBlocks = 0x07, /// - /// Requests the target write to the medium the XOR data generated from the specified source devices - /// SBC-1 rev. 8c + /// Requests the target write to the medium the XOR data generated from the specified source devices + /// SBC-1 rev. 8c /// Rebuild = 0x81, /// - /// Requests the target write to the buffer the XOR data from its own medium and the specified source devices - /// SBC-1 rev. 8c + /// Requests the target write to the buffer the XOR data from its own medium and the specified source devices + /// SBC-1 rev. 8c /// Regenerate = 0x82, /// - /// Requests the device to set the LUN in a vendor specific state - /// ECMA-111 (SCSI-1) + /// Requests the device to set the LUN in a vendor specific state + /// ECMA-111 (SCSI-1) /// RezeroUnit = SasiCommands.RezeroUnit, /// - /// Searches data on blocks - /// ECMA-111 (SCSI-1) + /// Searches data on blocks + /// ECMA-111 (SCSI-1) /// SearchDataEqual = SasiCommands.SearchDataEqual, /// - /// Searches data on blocks using major than or equal comparison - /// ECMA-111 (SCSI-1) + /// Searches data on blocks using major than or equal comparison + /// ECMA-111 (SCSI-1) /// SearchDataHigh = SasiCommands.SearchDataHigh, /// - /// Searches data on blocks using minor than or equal comparison - /// ECMA-111 (SCSI-1) + /// Searches data on blocks using minor than or equal comparison + /// ECMA-111 (SCSI-1) /// SearchDataLow = SasiCommands.SearchDataLow, /// - /// Requests the device to seek to a specified blocks - /// ECMA-111 (SCSI-1) + /// Requests the device to seek to a specified blocks + /// ECMA-111 (SCSI-1) /// Seek = SasiCommands.Seek, /// - /// Requests the device to seek to a specified blocks - /// ECMA-111 (SCSI-1) + /// Requests the device to seek to a specified blocks + /// ECMA-111 (SCSI-1) /// Seek10 = 0x2B, /// - /// Defines the range within which subsequent linked commands may operate - /// ECMA-111 (SCSI-1) + /// Defines the range within which subsequent linked commands may operate + /// ECMA-111 (SCSI-1) /// SetLimits = 0x33, /// - /// Requests the device to enable or disable the LUN for media access operations - /// ECMA-111 (SCSI-1) + /// Requests the device to enable or disable the LUN for media access operations + /// ECMA-111 (SCSI-1) /// StartStopUnit = 0x1B, /// - /// Ensures that the blocks in the cache are written to the medium - /// SCSI-2 X3T9.2/375R rev. 10l + /// Ensures that the blocks in the cache are written to the medium + /// SCSI-2 X3T9.2/375R rev. 10l /// SynchronizeCache = 0x35, /// - /// Ensures that the blocks in the cache are written to the medium - /// SBC-2 rev. 4 + /// Ensures that the blocks in the cache are written to the medium + /// SBC-2 rev. 4 /// SynchronizeCache16 = 0x91, /// - /// Unmaps one or more LBAs - /// In SSDs, this is trimming - /// SBC-3 rev. 25 + /// Unmaps one or more LBAs + /// In SSDs, this is trimming + /// SBC-3 rev. 25 /// Unmap = 0x42, /// - /// Verifies blocks on the device - /// ECMA-111 (SCSI-1) + /// Verifies blocks on the device + /// ECMA-111 (SCSI-1) /// Verify10 = SasiCommands.Verify, /// - /// Verifies blocks on the device - /// SBC-2 rev. 4 + /// Verifies blocks on the device + /// SBC-2 rev. 4 /// Verify16 = 0x8F, /// - /// Writes blocks to the device - /// ECMA-111 (SCSI-1) + /// Writes blocks to the device + /// ECMA-111 (SCSI-1) /// Write = SasiCommands.Write, /// - /// Writes blocks to the device - /// ECMA-111 (SCSI-1) + /// Writes blocks to the device + /// ECMA-111 (SCSI-1) /// Write10 = SasiCommands.ExtendedAddressWrite, /// - /// Writes blocks to the device - /// SBC-2 rev. 4 + /// Writes blocks to the device + /// SBC-2 rev. 4 /// Write16 = 0x8A, /// - /// Writes blocks to the device and then verifies them - /// ECMA-111 (SCSI-1) + /// Writes blocks to the device and then verifies them + /// ECMA-111 (SCSI-1) /// WriteAndVerify = SasiCommands.WriteAndVerify, /// - /// Writes blocks to the device and then verifies them - /// SBC-2 rev. 4 + /// Writes blocks to the device and then verifies them + /// SBC-2 rev. 4 /// WriteAndVerify16 = 0x8E, /// - /// Writes blocks to the device with a vendor specified format that shall include the ECC alongside the data - /// SCSI-2 X3T9.2/375R rev. 10l + /// Writes blocks to the device with a vendor specified format that shall include the ECC alongside the data + /// SCSI-2 X3T9.2/375R rev. 10l /// WriteLong = 0x3F, /// - /// Writes a single block several times - /// SCSI-2 X3T9.2/375R rev. 10l + /// Writes a single block several times + /// SCSI-2 X3T9.2/375R rev. 10l /// WriteSame = 0x41, /// - /// Writes a single block several times - /// SBC-2 rev. 4 + /// Writes a single block several times + /// SBC-2 rev. 4 /// WriteSame16 = 0x93, /// - /// Requets XOR data generated by an or command - /// SBC-1 rev. 8c + /// Requets XOR data generated by an or command + /// SBC-1 rev. 8c /// XdRead = 0x52, /// - /// XORs the data sent with data on the medium and stores it until an is issued - /// SBC-1 rev. 8c + /// XORs the data sent with data on the medium and stores it until an is issued + /// SBC-1 rev. 8c /// XdWrite = 0x50, /// - /// XORs the data sent with data on the medium and stores it until an is issued - /// SBC-1 rev. 8c + /// XORs the data sent with data on the medium and stores it until an is issued + /// SBC-1 rev. 8c /// XdWrite16 = 0x80, /// - /// Requets the target to XOR the sent data with the data on the medium and return the results + /// Requets the target to XOR the sent data with the data on the medium and return the results /// XdWriteRead = 0x53, /// - /// Requests the target to XOR the data transferred with the data on the medium and writes it to the medium - /// SBC-1 rev. 8c + /// Requests the target to XOR the data transferred with the data on the medium and writes it to the medium + /// SBC-1 rev. 8c /// XpWrite = 0x51, #endregion SCSI Block Commands (SBC) #region SCSI Streaming Commands (SSC) /// - /// Prepares the medium for use by the LUN - /// SSC-1 rev. 22 + /// Prepares the medium for use by the LUN + /// SSC-1 rev. 22 /// FormatMedium = 0x04, /// - /// Erases part of all of the medium from the current position - /// ECMA-111 (SCSI-1) + /// Erases part of all of the medium from the current position + /// ECMA-111 (SCSI-1) /// Erase = 0x19, /// - /// Enables or disables the LUN for further operations - /// ECMA-111 (SCSI-1) + /// Enables or disables the LUN for further operations + /// ECMA-111 (SCSI-1) /// LoadUnload = 0x1B, /// - /// Positions the LUN to a specified block in a specified partition - /// SCSI-2 X3T9.2/375R rev. 10l + /// Positions the LUN to a specified block in a specified partition + /// SCSI-2 X3T9.2/375R rev. 10l /// Locate = 0x2B, /// - /// Positions the LUN to a specified block in a specified partition - /// SSC-2 rev. 09 + /// Positions the LUN to a specified block in a specified partition + /// SSC-2 rev. 09 /// Locate16 = 0x92, /// - /// Requests the block length limits capability - /// ECMA-111 (SCSI-1) + /// Requests the block length limits capability + /// ECMA-111 (SCSI-1) /// ReadBlockLimits = 0x05, /// - /// Reads the current position - /// SCSI-2 X3T9.2/375R rev. 10l + /// Reads the current position + /// SCSI-2 X3T9.2/375R rev. 10l /// ReadPosition = 0x34, /// - /// Reads blocks from the device, in reverse order - /// ECMA-111 (SCSI-1) + /// Reads blocks from the device, in reverse order + /// ECMA-111 (SCSI-1) /// ReadReverse = 0x0F, /// - /// Retrieves data from the device buffer that has not been successfully written to the medium (or printed) - /// ECMA-111 (SCSI-1) + /// Retrieves data from the device buffer that has not been successfully written to the medium (or printed) + /// ECMA-111 (SCSI-1) /// RecoverBufferedData = 0x14, /// - /// Requests information regarding the supported densities for the logical unit - /// SSC-1 rev. 22 + /// Requests information regarding the supported densities for the logical unit + /// SSC-1 rev. 22 /// ReportDensitySupport = 0x44, /// - /// Seeks the medium to the beginning of partition in current partition - /// ECMA-111 (SCSI-1) + /// Seeks the medium to the beginning of partition in current partition + /// ECMA-111 (SCSI-1) /// Rewind = 0x01, /// - /// A variety of positioning functions - /// ECMA-111 (SCSI-1) + /// A variety of positioning functions + /// ECMA-111 (SCSI-1) /// Space = 0x11, /// - /// A variety of positioning functions - /// SSC-2 rev. 09 + /// A variety of positioning functions + /// SSC-2 rev. 09 /// Space16 = 0x91, /// - /// Selects the specified track - /// ECMA-111 (SCSI-1) + /// Selects the specified track + /// ECMA-111 (SCSI-1) /// TrackSelect = 0x0B, /// - /// Verifies one or more blocks from the next one - /// ECMA-111 (SCSI-1) + /// Verifies one or more blocks from the next one + /// ECMA-111 (SCSI-1) /// Verify = 0x13, /// - /// Writes the specified number of filemarks or setmarks in the current position - /// ECMA-111 (SCSI-1) + /// Writes the specified number of filemarks or setmarks in the current position + /// ECMA-111 (SCSI-1) /// WriteFileMarks = 0x10, #endregion SCSI Streaming Commands (SSC) #region SCSI Streaming Commands for Printers (SSC) /// - /// Assures that the data in the buffer has been printed, or, for other devices, written to media - /// ECMA-111 (SCSI-1) + /// Assures that the data in the buffer has been printed, or, for other devices, written to media + /// ECMA-111 (SCSI-1) /// FlushBuffer = 0x10, /// - /// Specifies forms or fronts - /// ECMA-111 (SCSI-1) + /// Specifies forms or fronts + /// ECMA-111 (SCSI-1) /// Format = 0x04, /// - /// Transfers data to be printed - /// ECMA-111 (SCSI-1) + /// Transfers data to be printed + /// ECMA-111 (SCSI-1) /// Print = 0x0A, /// - /// Transfers data to be printed with a slew value - /// ECMA-111 (SCSI-1) + /// Transfers data to be printed with a slew value + /// ECMA-111 (SCSI-1) /// SlewAndPrint = 0x0B, /// - /// Halts printing - /// ECMA-111 (SCSI-1) + /// Halts printing + /// ECMA-111 (SCSI-1) /// StopPrint = 0x1B, /// - /// Assures that the data in the buffer has been printed, or, for other devices, written to media - /// SCSI-2 X3T9.2/375R rev. 10l + /// Assures that the data in the buffer has been printed, or, for other devices, written to media + /// SCSI-2 X3T9.2/375R rev. 10l /// SynchronizeBuffer = FlushBuffer, #endregion SCSI Streaming Commands for Printers (SSC) #region SCSI Processor Commands /// - /// Transfers data from the device - /// ECMA-111 (SCSI-1) + /// Transfers data from the device + /// ECMA-111 (SCSI-1) /// Receive = 0x08, /// - /// Sends data to the device - /// ECMA-111 (SCSI-1) + /// Sends data to the device + /// ECMA-111 (SCSI-1) /// Send = 0x0A, #endregion SCSI Processor Commands #region SCSI Multimedia Commands (MMC) /// - /// Erases any part of a CD-RW - /// MMC-1 rev. 9 + /// Erases any part of a CD-RW + /// MMC-1 rev. 9 /// Blank = 0xA1, /// - /// Closes a track or session - /// MMC-1 rev. 9 + /// Closes a track or session + /// MMC-1 rev. 9 /// CloseTrackSession = 0x5B, /// - /// Gets information about the overall capabilities of the device and the current capabilities of the device - /// MMC-2 rev. 11a + /// Gets information about the overall capabilities of the device and the current capabilities of the device + /// MMC-2 rev. 11a /// GetConfiguration = 0x46, /// - /// Requests the LUN to report events and statuses - /// MMC-2 rev. 11a + /// Requests the LUN to report events and statuses + /// MMC-2 rev. 11a /// GetEventStatusNotification = 0x4A, /// - /// Provides a mehotd to profile the performance of the drive - /// MMC-2 rev. 11a + /// Provides a mehotd to profile the performance of the drive + /// MMC-2 rev. 11a /// GetPerformance = 0xAC, /// - /// Requests the device changer to load or unload a disc - /// MMC-1 rev. 9 + /// Requests the device changer to load or unload a disc + /// MMC-1 rev. 9 /// LoadUnloadCd = 0xA6, /// - /// Requests the device changer to load or unload a disc - /// MMC-2 rev. 11a + /// Requests the device changer to load or unload a disc + /// MMC-2 rev. 11a /// LoadUnloadMedium = 0xA6, /// - /// Requests information about the current status of the CD device, including any changer mechanism - /// MMC-1 rev. 9 + /// Requests information about the current status of the CD device, including any changer mechanism + /// MMC-1 rev. 9 /// MechanicalStatus = 0xBD, /// - /// Requests the device to start or stop an audio play operation - /// SCSI-2 X3T9.2/375R rev. 10l + /// Requests the device to start or stop an audio play operation + /// SCSI-2 X3T9.2/375R rev. 10l /// PauseResume = 0x4B, /// - /// Begins an audio playback - /// SCSI-2 X3T9.2/375R rev. 10l + /// Begins an audio playback + /// SCSI-2 X3T9.2/375R rev. 10l /// PlayAudio = 0x45, /// - /// Begins an audio playback - /// SCSI-2 X3T9.2/375R rev. 10l + /// Begins an audio playback + /// SCSI-2 X3T9.2/375R rev. 10l /// PlayAudio12 = 0xA5, /// - /// Begins an audio playback using MSF addressing - /// SCSI-2 X3T9.2/375R rev. 10l + /// Begins an audio playback using MSF addressing + /// SCSI-2 X3T9.2/375R rev. 10l /// PlayAudioMsf = 0x47, /// - /// Begins an audio playback from the specified index of the specified track - /// SCSI-2 X3T9.2/375R rev. 10l + /// Begins an audio playback from the specified index of the specified track + /// SCSI-2 X3T9.2/375R rev. 10l /// PlayAudioTrackIndex = 0x48, /// - /// Begins an audio playback from the position relative of a track - /// SCSI-2 X3T9.2/375R rev. 10l + /// Begins an audio playback from the position relative of a track + /// SCSI-2 X3T9.2/375R rev. 10l /// PlayTrackRelative = 0x49, /// - /// Begins an audio playback from the position relative of a track - /// SCSI-2 X3T9.2/375R rev. 10l + /// Begins an audio playback from the position relative of a track + /// SCSI-2 X3T9.2/375R rev. 10l /// PlayTrackRelative12 = 0xA9, /// - /// Reports the total and blank area of the device buffer - /// MMC-1 rev. 9 + /// Reports the total and blank area of the device buffer + /// MMC-1 rev. 9 /// ReadBufferCapacity = 0x5C, /// - /// Reads a block from a CD with any of the requested CD data streams - /// MMC-1 rev. 9 + /// Reads a block from a CD with any of the requested CD data streams + /// MMC-1 rev. 9 /// ReadCd = 0xBE, /// - /// Reads a block from a CD with any of the requested CD data streams using MSF addressing - /// MMC-1 rev. 9 + /// Reads a block from a CD with any of the requested CD data streams using MSF addressing + /// MMC-1 rev. 9 /// ReadCdMsf = 0xB9, /// - /// Returns the recorded size of the CD - /// MMC-1 rev. 9 + /// Returns the recorded size of the CD + /// MMC-1 rev. 9 /// ReadCdRecordedCapacity = 0x25, /// - /// Gets informationn about all discs: CD-ROM, CD-R and CD-RW - /// MMC-1 rev. 9 + /// Gets informationn about all discs: CD-ROM, CD-R and CD-RW + /// MMC-1 rev. 9 /// ReadDiscInformation = 0x51, /// - /// Reads areas from the DVD or BD media - /// MMC-5 rev. 2c + /// Reads areas from the DVD or BD media + /// MMC-5 rev. 2c /// ReadDiscStructure = 0xAD, /// - /// Reads areas from the DVD media - /// MMC-2 rev. 11a + /// Reads areas from the DVD media + /// MMC-2 rev. 11a /// ReadDvdStructure = 0xAD, /// - /// Requests a list of the possible format capacities for an installed random-writable media - /// MMC-2 rev. 11a + /// Requests a list of the possible format capacities for an installed random-writable media + /// MMC-2 rev. 11a /// ReadFormatCapacities = 0x23, /// - /// Reads the data block header of the specified CD-ROM block - /// SCSI-2 X3T9.2/375R rev. 10l + /// Reads the data block header of the specified CD-ROM block + /// SCSI-2 X3T9.2/375R rev. 10l /// ReadHeader = 0x44, /// - /// Reads the mastering information from a Master CD. - /// MMC-1 rev. 9 + /// Reads the mastering information from a Master CD. + /// MMC-1 rev. 9 /// ReadMasterCue = 0x59, /// - /// Requests the Q subchannel and the current audio playback status - /// SCSI-2 X3T9.2/375R rev. 10l + /// Requests the Q subchannel and the current audio playback status + /// SCSI-2 X3T9.2/375R rev. 10l /// ReadSubChannel = 0x42, /// - /// Requests the medium TOC, PMA or ATIP from the device - /// SCSI-2 X3T9.2/375R rev. 10l + /// Requests the medium TOC, PMA or ATIP from the device + /// SCSI-2 X3T9.2/375R rev. 10l /// ReadTocPmaAtip = 0x43, /// - /// Gets information about a track regardless of its status - /// MMC-1 rev. 9 + /// Gets information about a track regardless of its status + /// MMC-1 rev. 9 /// ReadTrackInformation = 0x52, /// - /// Repairs an incomplete ECC block at the end of an RZone - /// Mt. Fuji ver. 7 rev. 1.21 + /// Repairs an incomplete ECC block at the end of an RZone + /// Mt. Fuji ver. 7 rev. 1.21 /// RepairRZone = 0x58, /// - /// Repairs an incomplete packet at the end of a packet writing track - /// MMC-1 rev. 9 + /// Repairs an incomplete packet at the end of a packet writing track + /// MMC-1 rev. 9 /// RepairTrack = 0x58, /// - /// Requests the start of the authentication process and provides data necessary for authentication and for generating a Bus Key - /// MMC-2 rev. 11a + /// Requests the start of the authentication process and provides data necessary for authentication and for generating + /// a Bus Key + /// MMC-2 rev. 11a /// ReportKey = 0xA4, /// - /// Reserves disc space for a track - /// MMC-1 rev. 9 + /// Reserves disc space for a track + /// MMC-1 rev. 9 /// ReserveTrack = 0x53, /// - /// Fast-forwards or fast-reverses the audio playback to the specified block. Stops if it encounters a data track - /// MMC-1 rev. 9 + /// Fast-forwards or fast-reverses the audio playback to the specified block. Stops if it encounters a data track + /// MMC-1 rev. 9 /// ScanMmc = 0xBA, /// - /// Sends a cue sheet for session-at-once recording - /// MMC-1 rev. 9 + /// Sends a cue sheet for session-at-once recording + /// MMC-1 rev. 9 /// SendCueSheet = 0x5D, /// - /// Transfer a DVD or BD structure for media writing - /// MMC-5 rev. 2c + /// Transfer a DVD or BD structure for media writing + /// MMC-5 rev. 2c /// SendDiscStructure = 0xAD, /// - /// Transfer a DVD structure for media writing - /// MMC-2 rev. 11a + /// Transfer a DVD structure for media writing + /// MMC-2 rev. 11a /// SendDvdStructure = 0xAD, /// - /// Requests the LUN to process an event - /// MMC-2 rev. 11a + /// Requests the LUN to process an event + /// MMC-2 rev. 11a /// SendEvent = 0xA2, /// - /// Provides data necessary for authentication and for generating a Bus Key - /// MMC-2 rev. 11a + /// Provides data necessary for authentication and for generating a Bus Key + /// MMC-2 rev. 11a /// SendKey = 0xA3, /// - /// Restores the Optimum Power Calibration values to the drive for a specific disc - /// MMC-1 rev. 9 + /// Restores the Optimum Power Calibration values to the drive for a specific disc + /// MMC-1 rev. 9 /// SendOpcInformation = 0x54, /// - /// Sets the spindle speed to be used while reading/writing data to a CD - /// MMC-1 rev. 9 + /// Sets the spindle speed to be used while reading/writing data to a CD + /// MMC-1 rev. 9 /// SetCdRomSpeed = 0xBB, /// - /// Requests the LUN to perform read ahead caching operations from the specified block - /// MMC-2 rev. 11a + /// Requests the LUN to perform read ahead caching operations from the specified block + /// MMC-2 rev. 11a /// SetReadAhead = 0xA7, /// - /// Indicates the LUN to try to achieve a specified performance - /// MMC-2 rev. 11a + /// Indicates the LUN to try to achieve a specified performance + /// MMC-2 rev. 11a /// SetStreaming = 0xB6, /// - /// Stops a scan and continues audio playback from current scanning position - /// MMC-1 rev. 9 + /// Stops a scan and continues audio playback from current scanning position + /// MMC-1 rev. 9 /// StopPlayScan = 0x4E, #endregion SCSI Multimedia Commands (MMC) #region SCSI Scanner Commands /// - /// Gets information about the data buffer - /// SCSI-2 X3T9.2/375R rev. 10l + /// Gets information about the data buffer + /// SCSI-2 X3T9.2/375R rev. 10l /// GetDataBufferStatus = 0x34, /// - /// Gets information about previously defined windows - /// SCSI-2 X3T9.2/375R rev. 10l + /// Gets information about previously defined windows + /// SCSI-2 X3T9.2/375R rev. 10l /// GetWindow = 0x25, /// - /// Provides positioning functions - /// SCSI-2 X3T9.2/375R rev. 10l + /// Provides positioning functions + /// SCSI-2 X3T9.2/375R rev. 10l /// ObjectPosition = 0x31, /// - /// Begins a scan operation - /// SCSI-2 X3T9.2/375R rev. 10l + /// Begins a scan operation + /// SCSI-2 X3T9.2/375R rev. 10l /// Scan = 0x1B, /// - /// Specifies one or more windows within the device's scanning range - /// SCSI-2 X3T9.2/375R rev. 10l + /// Specifies one or more windows within the device's scanning range + /// SCSI-2 X3T9.2/375R rev. 10l /// SetWindow = 0x24, /// - /// Sends data to the device - /// SCSI-2 X3T9.2/375R rev. 10l + /// Sends data to the device + /// SCSI-2 X3T9.2/375R rev. 10l /// Send10 = 0x2A, #endregion SCSI Scanner Commands #region SCSI Block Commands for Optical Media (SBC) /// - /// Erases the specified number of blocks + /// Erases the specified number of blocks /// Erase10 = 0x2C, /// - /// Erases the specified number of blocks + /// Erases the specified number of blocks /// Erase12 = 0xAC, /// - /// Searches the medium for a contiguos set of written or blank blocks + /// Searches the medium for a contiguos set of written or blank blocks /// MediumScan = 0x38, /// - /// Reads blocks from device - /// SCSI-2 X3T9.2/375R rev. 10l + /// Reads blocks from device + /// SCSI-2 X3T9.2/375R rev. 10l /// Read12 = 0xA8, /// - /// Gets medium's defect data - /// SCSI-2 X3T9.2/375R rev. 10l + /// Gets medium's defect data + /// SCSI-2 X3T9.2/375R rev. 10l /// ReadDefectData12 = 0xB7, /// - /// Gets the maxium generation address for the specified block + /// Gets the maxium generation address for the specified block /// ReadGeneration = 0x29, /// - /// Reads a specified generation of a specified block + /// Reads a specified generation of a specified block /// ReadUpdatedBlock = 0x2D, /// - /// Searches data on blocks - /// SCSI-2 X3T9.2/375R rev. 10l + /// Searches data on blocks + /// SCSI-2 X3T9.2/375R rev. 10l /// SearchDataEqual12 = 0xB1, /// - /// Searches data on blocks using major than or equal comparison - /// SCSI-2 X3T9.2/375R rev. 10l + /// Searches data on blocks using major than or equal comparison + /// SCSI-2 X3T9.2/375R rev. 10l /// SearchDataHigh12 = 0xB0, /// - /// Searches data on blocks using minor than or equal comparison - /// SCSI-2 X3T9.2/375R rev. 10l + /// Searches data on blocks using minor than or equal comparison + /// SCSI-2 X3T9.2/375R rev. 10l /// SearchDataLow12 = 0xB2, /// - /// Defines the range within which subsequent linked commands may operate - /// SCSI-2 X3T9.2/375R rev. 10l + /// Defines the range within which subsequent linked commands may operate + /// SCSI-2 X3T9.2/375R rev. 10l /// SetLimits12 = 0xB3, /// - /// Replaces a block with data + /// Replaces a block with data /// UpdateBlock = 0x3D, /// - /// Verifies blocks on the device - /// SCSI-2 X3T9.2/375R rev. 10l + /// Verifies blocks on the device + /// SCSI-2 X3T9.2/375R rev. 10l /// Verify12 = 0xAF, /// - /// Writes blocks to the device - /// SCSI-2 X3T9.2/375R rev. 10l + /// Writes blocks to the device + /// SCSI-2 X3T9.2/375R rev. 10l /// Write12 = 0xAA, /// - /// Writes blocks to the device and then verifies them - /// SCSI-2 X3T9.2/375R rev. 10l + /// Writes blocks to the device and then verifies them + /// SCSI-2 X3T9.2/375R rev. 10l /// WriteAndVerify12 = 0xAE, #endregion SCSI Block Commands for Optical Media (SBC) #region SCSI Medium Changer Commands (SMC) /// - /// Provides a means to exchange the medium in the source element with the medium at destination element - /// SCSI-2 X3T9.2/375R rev. 10l + /// Provides a means to exchange the medium in the source element with the medium at destination element + /// SCSI-2 X3T9.2/375R rev. 10l /// ExchangeMedium = 0xA6, /// - /// Checks all elements for medium and any other relevant status - /// SCSI-2 X3T9.2/375R rev. 10l + /// Checks all elements for medium and any other relevant status + /// SCSI-2 X3T9.2/375R rev. 10l /// InitializeElementStatus = 0x07, /// - /// Checks all elements for medium and any other relevant status in the specified range of elements - /// SMC-2 rev. 7 + /// Checks all elements for medium and any other relevant status in the specified range of elements + /// SMC-2 rev. 7 /// InitializeElementStatusWithRange = 0x37, /// - /// Moves a medium from an element to another - /// SCSI-2 X3T9.2/375R rev. 10l + /// Moves a medium from an element to another + /// SCSI-2 X3T9.2/375R rev. 10l /// MoveMedium = 0xA5, /// - /// Moves a medium that's currently attached to another element - /// SPC-1 rev. 10 + /// Moves a medium that's currently attached to another element + /// SPC-1 rev. 10 /// MoveMediumAttached = 0xA7, /// - /// Provides a method to change the open/closed state of the specified import/export element - /// SMC-3 rev. 12 + /// Provides a method to change the open/closed state of the specified import/export element + /// SMC-3 rev. 12 /// OpenCloseImportExportElement = 0x1B, /// - /// Positions the transport element in front of the destination element - /// SCSI-2 X3T9.2/375R rev. 10l + /// Positions the transport element in front of the destination element + /// SCSI-2 X3T9.2/375R rev. 10l /// PositionToElement = 0x2B, /// - /// Requests the status of the elements - /// SCSI-2 X3T9.2/375R rev. 10l + /// Requests the status of the elements + /// SCSI-2 X3T9.2/375R rev. 10l /// ReadElementStatus = 0xB8, /// - /// Requests the status of the attached element - /// SPC-1 rev. 10 + /// Requests the status of the attached element + /// SPC-1 rev. 10 /// ReadElementStatusAttached = 0xB4, /// - /// Releases a reserved LUN - /// SCSI-2 X3T9.2/375R rev. 10l + /// Releases a reserved LUN + /// SCSI-2 X3T9.2/375R rev. 10l /// ReleaseElement = 0x17, /// - /// Releases a reserved LUN - /// SMC-1 rev. 10a + /// Releases a reserved LUN + /// SMC-1 rev. 10a /// ReleaseElement10 = 0x57, /// - /// Requests information regarding the supported volume types for the device - /// SMC-3 rev. 12 + /// Requests information regarding the supported volume types for the device + /// SMC-3 rev. 12 /// ReportVolumeTypesSupported = 0x44, /// - /// Gets the results of - /// SCSI-2 X3T9.2/375R rev. 10l + /// Gets the results of + /// SCSI-2 X3T9.2/375R rev. 10l /// RequestVolumeElementAddress = 0xB5, /// - /// Reserves a LUN - /// SCSI-2 X3T9.2/375R rev. 10l + /// Reserves a LUN + /// SCSI-2 X3T9.2/375R rev. 10l /// ReserveElement = 0x16, /// - /// Reserves a LUN - /// SMC-1 rev. 10a + /// Reserves a LUN + /// SMC-1 rev. 10a /// ReserveElement10 = 0x56, /// - /// Transfers a volume tag template to be searched or new volume tag information for one or more elements - /// SCSI-2 X3T9.2/375R rev. 10l + /// Transfers a volume tag template to be searched or new volume tag information for one or more elements + /// SCSI-2 X3T9.2/375R rev. 10l /// SendVolumeTag = 0xB6, #endregion SCSI Medium Changer Commands (SMC) #region SCSI Communication Commands /// - /// Gets data from the device - /// SCSI-2 X3T9.2/375R rev. 10l + /// Gets data from the device + /// SCSI-2 X3T9.2/375R rev. 10l /// GetMessage = 0x08, /// - /// Gets data from the device - /// SCSI-2 X3T9.2/375R rev. 10l + /// Gets data from the device + /// SCSI-2 X3T9.2/375R rev. 10l /// GetMessage10 = 0x28, /// - /// Gets data from the device - /// SCSI-2 X3T9.2/375R rev. 10l + /// Gets data from the device + /// SCSI-2 X3T9.2/375R rev. 10l /// GetMessage12 = 0xA8, /// - /// Sends data to the device - /// SCSI-2 X3T9.2/375R rev. 10l + /// Sends data to the device + /// SCSI-2 X3T9.2/375R rev. 10l /// SendMessage = 0x0A, /// - /// Sends data to the device - /// SCSI-2 X3T9.2/375R rev. 10l + /// Sends data to the device + /// SCSI-2 X3T9.2/375R rev. 10l /// SendMessage10 = 0x2A, /// - /// Sends data to the device - /// SCSI-2 X3T9.2/375R rev. 10l + /// Sends data to the device + /// SCSI-2 X3T9.2/375R rev. 10l /// SendMessage12 = 0xAA, #endregion SCSI Communication Commands #region SCSI Controller Commands /// - /// Commands that get information about redundancy groups - /// SCC-2 rev. 4 + /// Commands that get information about redundancy groups + /// SCC-2 rev. 4 /// RedundancyGroupIn = 0xBA, /// - /// Commands that set information about redundancy groups - /// SCC-2 rev. 4 + /// Commands that set information about redundancy groups + /// SCC-2 rev. 4 /// RedundancyGroupOut = 0xBB, /// - /// Commands that get information about volume sets - /// SCC-2 rev. 4 + /// Commands that get information about volume sets + /// SCC-2 rev. 4 /// VolumeSetIn = 0xBE, /// - /// Commands that set information about volume sets - /// SCC-2 rev. 4 + /// Commands that set information about volume sets + /// SCC-2 rev. 4 /// VolumeSetOut = 0xBF, #endregion SCSI Controller Commands #region Pioneer CD-ROM SCSI-2 Command Set /// - /// Scans for a block playing a block on each track cross + /// Scans for a block playing a block on each track cross /// AudioScan = 0xCD, /// - /// Requests the drive the status from the previous WriteCDP command. + /// Requests the drive the status from the previous WriteCDP command. /// ReadCdp = 0xE4, /// - /// Requests status from the drive + /// Requests status from the drive /// ReadDriveStatus = 0xE0, /// - /// Reads CD-DA data and/or subcode data + /// Reads CD-DA data and/or subcode data /// ReadCdDa = 0xD8, /// - /// Reads CD-DA data and/or subcode data using MSF addressing + /// Reads CD-DA data and/or subcode data using MSF addressing /// ReadCdDaMsf = 0xD9, /// - /// Reads CD-XA data + /// Reads CD-XA data /// ReadCdXa = 0xDB, /// - /// Reads all subcode data + /// Reads all subcode data /// ReadAllSubCode = 0xDF, /// - /// Sets the spindle speed to be used while reading/writing data to a CD + /// Sets the spindle speed to be used while reading/writing data to a CD /// SetCdSpeed = 0xDA, WriteCdp = 0xE3, @@ -2393,14 +2399,14 @@ namespace DiscImageChef.Devices #region ATA Command Pass-Through /// - /// Sends a 24-bit ATA command to the device - /// Clashes with - /// ATA CPT rev. 8a + /// Sends a 24-bit ATA command to the device + /// Clashes with + /// ATA CPT rev. 8a /// AtaPassThrough = 0xA1, /// - /// Sends a 48-bit ATA command to the device - /// ATA CPT rev. 8a + /// Sends a 48-bit ATA command to the device + /// ATA CPT rev. 8a /// AtaPassThrough16 = 0x85, #endregion ATA Command Pass-Through @@ -2415,11 +2421,11 @@ namespace DiscImageChef.Devices #region SCSI Zoned Block Commands /// - /// ZBC commands with host->device information + /// ZBC commands with host->device information /// ZbcOut = 0x94, /// - /// ZBC commands with device->host information + /// ZBC commands with device->host information /// ZbcIn = 0x95, #endregion @@ -2442,201 +2448,201 @@ namespace DiscImageChef.Devices #region SEGA Packet Interface (all are 12-byte CDB) /// - /// Verifies that the device can be accessed - /// Sega SPI ver. 1.30 + /// Verifies that the device can be accessed + /// Sega SPI ver. 1.30 /// SegaTestUnit = TestUnitReady, /// - /// Gets current CD status - /// Sega SPI ver. 1.30 + /// Gets current CD status + /// Sega SPI ver. 1.30 /// SegaRequestStatus = 0x10, /// - /// Gets CD block mode info - /// Sega SPI ver. 1.30 + /// Gets CD block mode info + /// Sega SPI ver. 1.30 /// SegaRequestMode = 0x11, /// - /// Sets CD block mode - /// Sega SPI ver. 1.30 + /// Sets CD block mode + /// Sega SPI ver. 1.30 /// SegaSetMode = 0x12, /// - /// Requests device error info - /// Sega SPI ver. 1.30 + /// Requests device error info + /// Sega SPI ver. 1.30 /// SegaRequestError = 0x13, /// - /// Gets disc TOC - /// Sega SPI ver. 1.30 + /// Gets disc TOC + /// Sega SPI ver. 1.30 /// SegaGetToc = 0x14, /// - /// Gets specified session data - /// Sega SPI ver. 1.30 + /// Gets specified session data + /// Sega SPI ver. 1.30 /// SegaRequestSession = 0x15, /// - /// Stops the drive and opens the drive tray, or, on manual trays, stays busy until it is opened - /// Sega SPI ver. 1.30 + /// Stops the drive and opens the drive tray, or, on manual trays, stays busy until it is opened + /// Sega SPI ver. 1.30 /// SegaOpenTray = 0x16, /// - /// Starts audio playback - /// Sega SPI ver. 1.30 + /// Starts audio playback + /// Sega SPI ver. 1.30 /// SegaPlayCd = 0x20, /// - /// Moves drive pickup to specified block - /// Sega SPI ver. 1.30 + /// Moves drive pickup to specified block + /// Sega SPI ver. 1.30 /// SegaSeek = 0x21, /// - /// Fast-forwards or fast-reverses until Lead-In or Lead-Out arrive, or until another command is issued - /// Sega SPI ver. 1.30 + /// Fast-forwards or fast-reverses until Lead-In or Lead-Out arrive, or until another command is issued + /// Sega SPI ver. 1.30 /// SegaScan = 0x22, /// - /// Reads blocks from the disc - /// Sega SPI ver. 1.30 + /// Reads blocks from the disc + /// Sega SPI ver. 1.30 /// SegaRead = 0x30, /// - /// Reads blocks from the disc seeking to another position at end - /// Sega SPI ver. 1.30 + /// Reads blocks from the disc seeking to another position at end + /// Sega SPI ver. 1.30 /// SegaRead2 = 0x31, /// - /// Reads disc subcode - /// Sega SPI ver. 1.30 + /// Reads disc subcode + /// Sega SPI ver. 1.30 /// SegaGetSubcode = 0x40, #endregion SEGA Packet Interface (all are 12-byte CDB) /// - /// Variable sized Command Description Block - /// SPC-4 rev. 16 + /// Variable sized Command Description Block + /// SPC-4 rev. 16 /// VariableSizedCdb = 0x7F, #region Plextor vendor commands /// - /// Sends extended commands (like SpeedRead) to Plextor drives + /// Sends extended commands (like SpeedRead) to Plextor drives /// PlextorExtend = 0xE9, /// - /// Command for Plextor PoweRec + /// Command for Plextor PoweRec /// PlextorPoweRec = 0xEB, /// - /// Sends extended commands (like PoweRec) to Plextor drives + /// Sends extended commands (like PoweRec) to Plextor drives /// PlextorExtend2 = 0xED, /// - /// Resets Plextor drives + /// Resets Plextor drives /// PlextorReset = 0xEE, /// - /// Reads drive statistics from Plextor drives EEPROM + /// Reads drive statistics from Plextor drives EEPROM /// PlextorReadEeprom = 0xF1, #endregion Plextor vendor commands #region HL-DT-ST vendor commands /// - /// Sends debugging commands to HL-DT-ST DVD drives + /// Sends debugging commands to HL-DT-ST DVD drives /// HlDtStVendor = 0xE7, #endregion HL-DT-ST vendor commands #region NEC vendor commands /// - /// Reads CD-DA data + /// Reads CD-DA data /// NecReadCdDa = 0xD4, #endregion NEC vendor commands #region Adaptec vendor commands /// - /// Translates a SCSI LBA to a drive's CHS + /// Translates a SCSI LBA to a drive's CHS /// AdaptecTranslate = 0x0F, /// - /// Configures Adaptec controller error threshold + /// Configures Adaptec controller error threshold /// AdaptecSetErrorThreshold = 0x10, /// - /// Reads and resets error and statistical counters + /// Reads and resets error and statistical counters /// AdaptecReadCounters = 0x11, /// - /// Writes to controller's RAM + /// Writes to controller's RAM /// AdaptecWriteBuffer = 0x13, /// - /// Reads controller's RAM + /// Reads controller's RAM /// AdaptecReadBuffer = 0x14, #endregion Adaptec vendor commands #region Archive Corp. vendor commands /// - /// Gets current position's block address + /// Gets current position's block address /// ArchiveRequestBlockAddress = 0x02, /// - /// Seeks to specified block address + /// Seeks to specified block address /// ArchiveSeekBlock = 0x0C, #endregion Archive Corp. vendor commands #region Certance vendor commands /// - /// Parks the load arm in preparation for transport + /// Parks the load arm in preparation for transport /// CertanceParkUnpark = 0x06, #endregion Certance vendor commands #region Fujitsu vendor commands /// - /// Used to check the controller's data and control path + /// Used to check the controller's data and control path /// FujitsuLoopWriteToRead = 0xC1, /// - /// Used to display a message on the operator panel + /// Used to display a message on the operator panel /// FujitsuDisplay = 0xCF, #endregion Fujitsu vendor commands #region M-Systems vendor commands /// - /// Securely erases all flash blocks, including defective, spared and unused + /// Securely erases all flash blocks, including defective, spared and unused /// MSystemsSecurityErase = 0xFF, /// - /// Securely erases all flash blocks, including defective, spared and unused + /// Securely erases all flash blocks, including defective, spared and unused /// MSystemsSecurityEraseOld = 0xDF, #endregion M-Systems vendor commands #region Plasmon vendor commands /// - /// Retrieves sector address + /// Retrieves sector address /// PlasmonReadSectorLocation = 0xE6, /// - /// Makes a Compliant WORM block completely unreadable + /// Makes a Compliant WORM block completely unreadable /// PlasmonShred = 0xEE, #endregion Plasmon vendor commands #region Kreon vendor commands /// - /// Most Kreon commands start with this + /// Most Kreon commands start with this /// KreonCommand = 0xFF, /// - /// Kreon extract Security Sectors command start with this + /// Kreon extract Security Sectors command start with this /// KreonSsCommand = 0xAD #endregion Kreon vendor commands @@ -2644,28 +2650,28 @@ namespace DiscImageChef.Devices #endregion SCSI Commands /// - /// SCSI command transfer direction + /// SCSI command transfer direction /// public enum ScsiDirection { /// - /// No data transfer happens + /// No data transfer happens /// None, /// - /// From host to device + /// From host to device /// Out, /// - /// From device to host + /// From device to host /// In, /// - /// Bidirectional device/host + /// Bidirectional device/host /// Bidirectional, /// - /// Unspecified + /// Unspecified /// Unspecified } @@ -2674,130 +2680,130 @@ namespace DiscImageChef.Devices public enum AtaProtocol : byte { /// - /// Requests a device hard reset (pin 1) + /// Requests a device hard reset (pin 1) /// HardReset = 0, /// - /// Requests a device soft reset (COMRESET issue) + /// Requests a device soft reset (COMRESET issue) /// SoftReset = 1, /// - /// No data is to be transfered + /// No data is to be transfered /// NonData = 3, /// - /// Requests a device->host transfer using PIO + /// Requests a device->host transfer using PIO /// PioIn = 4, /// - /// Requests a host->device transfer using PIO + /// Requests a host->device transfer using PIO /// PioOut = 5, /// - /// Requests a DMA transfer + /// Requests a DMA transfer /// Dma = 6, /// - /// Requests to queue a DMA transfer + /// Requests to queue a DMA transfer /// DmaQueued = 7, /// - /// Requests device diagnostics + /// Requests device diagnostics /// DeviceDiagnostic = 8, /// - /// Requets device reset + /// Requets device reset /// DeviceReset = 9, /// - /// Requests a device->host transfer using UltraDMA + /// Requests a device->host transfer using UltraDMA /// UDmaIn = 10, /// - /// Requests a host->device transfer using UltraDMA + /// Requests a host->device transfer using UltraDMA /// UDmaOut = 11, /// - /// Unknown Serial ATA + /// Unknown Serial ATA /// FpDma = 12, /// - /// Requests the Extended ATA Status Return Descriptor + /// Requests the Extended ATA Status Return Descriptor /// ReturnResponse = 15 } /// - /// Indicates the STL which ATA register contains the length of data to - /// be transfered + /// Indicates the STL which ATA register contains the length of data to + /// be transfered /// public enum AtaTransferRegister : byte { /// - /// There is no transfer + /// There is no transfer /// NoTransfer = 0, /// - /// FEATURE register contains the data length + /// FEATURE register contains the data length /// Feature = 1, /// - /// SECTOR_COUNT register contains the data length + /// SECTOR_COUNT register contains the data length /// SectorCount = 2, /// - /// The STPSIU contains the data length + /// The STPSIU contains the data length /// Sptsiu = 3 } #endregion SCSI's ATA Command Pass-Through /// - /// ZBC sub-commands, mask 0x1F + /// ZBC sub-commands, mask 0x1F /// public enum ZbcSubCommands : byte { /// - /// Returns list with zones of specified types + /// Returns list with zones of specified types /// ReportZones = 0x00, /// - /// Closes a zone + /// Closes a zone /// CloseZone = 0x01, /// - /// Finishes a zone + /// Finishes a zone /// FinishZone = 0x02, /// - /// Opens a zone + /// Opens a zone /// OpenZone = 0x03, /// - /// Resets zone's write pointer to zone start + /// Resets zone's write pointer to zone start /// ResetWritePointer = 0x04 } /// - /// MODE SENSE page control, mask 0xC0 + /// MODE SENSE page control, mask 0xC0 /// public enum ScsiModeSensePageControl : byte { /// - /// Current values + /// Current values /// Current = 0x00, /// - /// Changeable values + /// Changeable values /// Changeable = 0x40, /// - /// Default values + /// Default values /// Default = 0x80, /// - /// Saved values + /// Saved values /// Saved = 0xC0 } @@ -2805,19 +2811,19 @@ namespace DiscImageChef.Devices public enum ScsiPreventAllowMode : byte { /// - /// Allows medium removal from data transport and from medium changer + /// Allows medium removal from data transport and from medium changer /// Allow = 0x00, /// - /// Prevents medium removal from data transport but allows it from medium changer + /// Prevents medium removal from data transport but allows it from medium changer /// Prevent = 0x01, /// - /// Allows medium removal from data transport but prevents it from medium changer + /// Allows medium removal from data transport but prevents it from medium changer /// PreventChanger = 0x02, /// - /// Prevents medium removal from both data transport and medium changer + /// Prevents medium removal from both data transport and medium changer /// PreventAll = 0x03 } @@ -2825,15 +2831,15 @@ namespace DiscImageChef.Devices public enum MmcGetConfigurationRt : byte { /// - /// Drive shall return the Feature Header and all Feature Descriptors + /// Drive shall return the Feature Header and all Feature Descriptors /// All = 0x00, /// - /// Drive shall return the Feature Header and current Feature Descriptors + /// Drive shall return the Feature Header and current Feature Descriptors /// Current = 0x01, /// - /// Drive shall return only the Feature Header with the chosen Feature Descriptor + /// Drive shall return only the Feature Header with the chosen Feature Descriptor /// Single = 0x02, Reserved = 0x03 @@ -2842,11 +2848,11 @@ namespace DiscImageChef.Devices public enum MmcDiscStructureMediaType : byte { /// - /// Disc Structures for DVD and HD DVD + /// Disc Structures for DVD and HD DVD /// Dvd = 0x00, /// - /// Disc Structures for BD + /// Disc Structures for BD /// Bd = 0x01 } @@ -2856,187 +2862,187 @@ namespace DiscImageChef.Devices // Generic Format Codes /// - /// AACS Volume Identifier + /// AACS Volume Identifier /// AacsVolId = 0x80, /// - /// AACS Pre-recorded Media Serial Number + /// AACS Pre-recorded Media Serial Number /// AacsMediaSerial = 0x81, /// - /// AACS Media Identifier + /// AACS Media Identifier /// AacsMediaId = 0x82, /// - /// AACS Lead-in Media Key Block + /// AACS Lead-in Media Key Block /// Aacsmkb = 0x83, /// - /// AACS Data Keys + /// AACS Data Keys /// AacsDataKeys = 0x84, /// - /// AACS LBA extents + /// AACS LBA extents /// AacslbaExtents = 0x85, /// - /// CPRM Media Key Block specified by AACS + /// CPRM Media Key Block specified by AACS /// Aacsmkbcprm = 0x86, /// - /// Recognized format layers + /// Recognized format layers /// RecognizedFormatLayers = 0x90, /// - /// Write protection status + /// Write protection status /// WriteProtectionStatus = 0xC0, /// - /// READ/SEND DISC STRUCTURE capability list + /// READ/SEND DISC STRUCTURE capability list /// CapabilityList = 0xFF, // DVD Disc Structures /// - /// DVD Lead-in Physical Information + /// DVD Lead-in Physical Information /// PhysicalInformation = 0x00, /// - /// DVD Lead-in Copyright Information + /// DVD Lead-in Copyright Information /// CopyrightInformation = 0x01, /// - /// CSS/CPPM Disc key + /// CSS/CPPM Disc key /// DiscKey = 0x02, /// - /// DVD Burst Cutting Area + /// DVD Burst Cutting Area /// BurstCuttingArea = 0x03, /// - /// DVD Lead-in Disc Manufacturing Information + /// DVD Lead-in Disc Manufacturing Information /// DiscManufacturingInformation = 0x04, /// - /// DVD Copyright Information from specified sector + /// DVD Copyright Information from specified sector /// SectorCopyrightInformation = 0x05, /// - /// CSS/CPPM Media Identifier + /// CSS/CPPM Media Identifier /// MediaIdentifier = 0x06, /// - /// CSS/CPPM Media Key Block + /// CSS/CPPM Media Key Block /// MediaKeyBlock = 0x07, /// - /// DDS from DVD-RAM + /// DDS from DVD-RAM /// DvdramDds = 0x08, /// - /// DVD-RAM Medium Status + /// DVD-RAM Medium Status /// DvdramMediumStatus = 0x09, /// - /// DVD-RAM Spare Area Information + /// DVD-RAM Spare Area Information /// DvdramSpareAreaInformation = 0x0A, /// - /// DVD-RAM Recording Type Information + /// DVD-RAM Recording Type Information /// DvdramRecordingType = 0x0B, /// - /// DVD-R/-RW RMD in last Border-out + /// DVD-R/-RW RMD in last Border-out /// LastBorderOutRmd = 0x0C, /// - /// Specified RMD from last recorded Border-out + /// Specified RMD from last recorded Border-out /// SpecifiedRmd = 0x0D, /// - /// DVD-R/-RW Lead-in pre-recorded information + /// DVD-R/-RW Lead-in pre-recorded information /// PreRecordedInfo = 0x0E, /// - /// DVD-R/-RW Media Identifier + /// DVD-R/-RW Media Identifier /// DvdrMediaIdentifier = 0x0F, /// - /// DVD-R/-RW Physical Format Information + /// DVD-R/-RW Physical Format Information /// DvdrPhysicalInformation = 0x10, /// - /// ADIP + /// ADIP /// Adip = 0x11, /// - /// HD DVD Lead-in Copyright Protection Information + /// HD DVD Lead-in Copyright Protection Information /// HddvdCopyrightInformation = 0x12, /// - /// AACS Lead-in Copyright Data Section + /// AACS Lead-in Copyright Data Section /// DvdAacs = 0x15, /// - /// HD DVD-R Medium Status + /// HD DVD-R Medium Status /// HddvdrMediumStatus = 0x19, /// - /// HD DVD-R Last recorded RMD in the latest RMZ + /// HD DVD-R Last recorded RMD in the latest RMZ /// HddvdrLastRmd = 0x1A, /// - /// DVD+/-R DL and DVD-Download DL layer capacity + /// DVD+/-R DL and DVD-Download DL layer capacity /// DvdrLayerCapacity = 0x20, /// - /// DVD-R DL Middle Zone start address + /// DVD-R DL Middle Zone start address /// MiddleZoneStart = 0x21, /// - /// DVD-R DL Jump Interval Size + /// DVD-R DL Jump Interval Size /// JumpIntervalSize = 0x22, /// - /// DVD-R DL Start LBA of the manual layer jump + /// DVD-R DL Start LBA of the manual layer jump /// ManualLayerJumpStartLba = 0x23, /// - /// DVD-R DL Remapping information of the specified Anchor Point + /// DVD-R DL Remapping information of the specified Anchor Point /// RemapAnchorPoint = 0x24, /// - /// Disc Control Block + /// Disc Control Block /// Dcb = 0x30, // BD Disc Structures /// - /// Blu-ray Disc Information + /// Blu-ray Disc Information /// DiscInformation = 0x00, /// - /// Blu-ray Burst Cutting Area + /// Blu-ray Burst Cutting Area /// BdBurstCuttingArea = 0x03, /// - /// Blu-ray DDS + /// Blu-ray DDS /// BdDds = 0x08, /// - /// Blu-ray Cartridge Status + /// Blu-ray Cartridge Status /// CartridgeStatus = 0x09, /// - /// Blu-ray Spare Area Information + /// Blu-ray Spare Area Information /// BdSpareAreaInformation = 0x0A, /// - /// Unmodified DFL + /// Unmodified DFL /// RawDfl = 0x12, /// - /// Physical Access Control + /// Physical Access Control /// Pac = 0x30 } @@ -3046,31 +3052,31 @@ namespace DiscImageChef.Devices // SERVICE ACTION IN /// - /// Requests parameter data describing provisioning status for the specified LBA - /// SBC-3 rev. 25 + /// Requests parameter data describing provisioning status for the specified LBA + /// SBC-3 rev. 25 /// GetLbaStatus = 0x12, /// - /// Gets device capacity - /// SBC-2 rev. 4 + /// Gets device capacity + /// SBC-2 rev. 4 /// ReadCapacity16 = 0x10, /// - /// Reads blocks from device in a vendor-specific way that should include the ECC alongside the data - /// SBC-2 rev. 4 + /// Reads blocks from device in a vendor-specific way that should include the ECC alongside the data + /// SBC-2 rev. 4 /// ReadLong16 = 0x11, /// - /// Requests information indicating the user data segments on the ports and LUNs to access them - /// SBC-3 rev. 25 + /// Requests information indicating the user data segments on the ports and LUNs to access them + /// SBC-3 rev. 25 /// ReportReferrals = 0x13, // SERVICE ACTION OUT /// - /// Writes blocks to the device with a vendor specified format that shall include the ECC alongside the data - /// SBC-2 rev. 4 + /// Writes blocks to the device with a vendor specified format that shall include the ECC alongside the data + /// SBC-2 rev. 4 /// WriteLong16 = ReadLong16 } @@ -3078,15 +3084,15 @@ namespace DiscImageChef.Devices public enum MmcDiscInformationDataTypes : byte { /// - /// Standard Disc Information + /// Standard Disc Information /// DiscInformation = 0x00, /// - /// Track Resources Information + /// Track Resources Information /// TrackResources = 0x01, /// - /// POW Resources Information + /// POW Resources Information /// PowResources = 0x02 } @@ -3094,27 +3100,27 @@ namespace DiscImageChef.Devices public enum MmcSectorTypes : byte { /// - /// No checking of data type is performed + /// No checking of data type is performed /// AllTypes = 0x00, /// - /// Only CD-DA sectors shall be returned + /// Only CD-DA sectors shall be returned /// Cdda = 0x01, /// - /// Only Mode 1 sectors shall be returned + /// Only Mode 1 sectors shall be returned /// Mode1 = 0x02, /// - /// Only Mode 2 formless sectors shall be returned + /// Only Mode 2 formless sectors shall be returned /// Mode2 = 0x03, /// - /// Only Mode 2 Form 1 sectors shall be returned + /// Only Mode 2 Form 1 sectors shall be returned /// Mode2Form1 = 0x04, /// - /// Only Mode 2 Form 2 sectors shall be returned + /// Only Mode 2 Form 2 sectors shall be returned /// Mode2Form2 = 0x05 } @@ -3122,19 +3128,19 @@ namespace DiscImageChef.Devices public enum MmcHeaderCodes : byte { /// - /// No header information shall be returned + /// No header information shall be returned /// None = 0x00, /// - /// Only the four byte header shall be returned + /// Only the four byte header shall be returned /// HeaderOnly = 0x01, /// - /// Only the mode 2 form x subheader shall be returned + /// Only the mode 2 form x subheader shall be returned /// SubHeaderOnly = 0x02, /// - /// Return both header and subheader + /// Return both header and subheader /// AllHeaders = 0x03 } @@ -3142,15 +3148,15 @@ namespace DiscImageChef.Devices public enum MmcErrorField : byte { /// - /// No error information is returned + /// No error information is returned /// None = 0x00, /// - /// The C2 pointer bits will be included + /// The C2 pointer bits will be included /// C2Pointers = 0x01, /// - /// The C2 pointer bits will be included as well as the block error byte with a padding byte + /// The C2 pointer bits will be included as well as the block error byte with a padding byte /// C2PointersAndBlock = 0x02 } @@ -3158,19 +3164,19 @@ namespace DiscImageChef.Devices public enum MmcSubchannel : byte { /// - /// No subchannel shall be returned + /// No subchannel shall be returned /// None = 0x00, /// - /// The raw P to W subchannel data shall be transferred + /// The raw P to W subchannel data shall be transferred /// Raw = 0x01, /// - /// Q data shall be transferred + /// Q data shall be transferred /// Q16 = 0x02, /// - /// De-interleaved and error-corrected R to W subchannel data shall be transferred + /// De-interleaved and error-corrected R to W subchannel data shall be transferred /// Rw = 0x04 } @@ -3178,19 +3184,19 @@ namespace DiscImageChef.Devices public enum PioneerSubchannel : byte { /// - /// No subchannel shall be returned + /// No subchannel shall be returned /// None = 0x00, /// - /// Q data shall be transferred + /// Q data shall be transferred /// Q16 = 0x01, /// - /// The raw P to W subchannel data shall be transferred + /// The raw P to W subchannel data shall be transferred /// All = 0x02, /// - /// The raw P to W subchannel data shall be transferred WITHOUT user data + /// The raw P to W subchannel data shall be transferred WITHOUT user data /// Only = 0x03 } @@ -3198,23 +3204,23 @@ namespace DiscImageChef.Devices public enum PlextorSubchannel : byte { /// - /// No subchannel shall be returned + /// No subchannel shall be returned /// None = 0x00, /// - /// Q data shall be transferred + /// Q data shall be transferred /// Q16 = 0x01, /// - /// The packed and corrected P to W subchannel data shall be transferred + /// The packed and corrected P to W subchannel data shall be transferred /// Pack = 0x02, /// - /// The raw P to W subchannel data shall be transferred + /// The raw P to W subchannel data shall be transferred /// All = 0x03, /// - /// The raw P to W subchannel data, plus C2 error data shall be transferred + /// The raw P to W subchannel data, plus C2 error data shall be transferred /// RawC2 = 0x08 } @@ -3222,61 +3228,61 @@ namespace DiscImageChef.Devices public enum PlextorSubCommands : byte { /// - /// Gets Plextor mode + /// Gets Plextor mode /// GetMode = 0x00, /// - /// Sets Plextor mode + /// Sets Plextor mode /// SetMode = 0x10, /// - /// Plextor force single session or hide CD-R + /// Plextor force single session or hide CD-R /// SessionHide = 0x01, /// - /// Plextor VariRec + /// Plextor VariRec /// VariRec = 0x02, /// - /// Plextor GigaRec + /// Plextor GigaRec /// GigaRec = 0x04, /// - /// Plextor accoustic management (disc related) + /// Plextor accoustic management (disc related) /// SilentDisc = 0x06, /// - /// Plextor accoustic management (tra related) + /// Plextor accoustic management (tra related) /// SilentTray = 0x07, /// - /// Plextor accoustic management + /// Plextor accoustic management /// Silent = 0x08, /// - /// Plextor test write DVD+ + /// Plextor test write DVD+ /// TestWriteDvdPlus = 0x21, /// - /// Plextor book setting + /// Plextor book setting /// BitSet = 0x22, /// - /// Plextor SecuRec + /// Plextor SecuRec /// SecuRec = 0xD5, /// - /// Book setting for DVD+R + /// Book setting for DVD+R /// BitSetR = 0x0A, /// - /// Book setting for DVD+R DL + /// Book setting for DVD+R DL /// BitSetRdl = 0x0E, /// - /// Plextor SpeedRead + /// Plextor SpeedRead /// SpeedRead = 0xBB } @@ -3284,19 +3290,19 @@ namespace DiscImageChef.Devices public enum SscLogicalIdTypes : byte { /// - /// Logical object identifier + /// Logical object identifier /// ObjectId = 0, /// - /// Logical file identifier + /// Logical file identifier /// FileId = 1, /// - /// Logical set identifier + /// Logical set identifier /// SetId = 2, /// - /// Reserved + /// Reserved /// Reserved = 3 } @@ -3304,39 +3310,39 @@ namespace DiscImageChef.Devices public enum SscPositionForms : byte { /// - /// 20 bytes using logical block addresses + /// 20 bytes using logical block addresses /// Short = 0, /// - /// 20 bytes using vendor-specified values + /// 20 bytes using vendor-specified values /// VendorShort = 1, /// - /// Equivalent to on SSC-1 + /// Equivalent to on SSC-1 /// OldLong = 2, /// - /// Invalid: Equivalent to LONG + BT on SSC-1 + /// Invalid: Equivalent to LONG + BT on SSC-1 /// OldLongVendor = 3, /// - /// Invalid: Equivalent to TCLP on SSC-1 + /// Invalid: Equivalent to TCLP on SSC-1 /// OldTclp = 4, /// - /// Invalid: Equivalent to TCLP + BT on SSC-1 + /// Invalid: Equivalent to TCLP + BT on SSC-1 /// OldTclpVendor = 5, /// - /// 32 bytes + /// 32 bytes /// Long = 6, /// - /// Invalid: Equivalent to TCLP + LONG + BT on SSC-1 + /// Invalid: Equivalent to TCLP + LONG + BT on SSC-1 /// OldLongTclpVendor = 7, /// - /// From 28 bytes to allocation length + /// From 28 bytes to allocation length /// Extended = 8 } @@ -3344,27 +3350,27 @@ namespace DiscImageChef.Devices public enum ScsiAttributeAction : byte { /// - /// Return attribute values + /// Return attribute values /// Values = 0, /// - /// Return a list of available attributes + /// Return a list of available attributes /// List = 1, /// - /// Returns a list of known logical volume numbers + /// Returns a list of known logical volume numbers /// VolumeList = 2, /// - /// Returns a list of known partition numbers + /// Returns a list of known partition numbers /// PartitionList = 3, /// - /// Returns a list of elements containing volumes with MAM + /// Returns a list of elements containing volumes with MAM /// ElementList = 4, /// - /// Returns a list of supported attribute identifiers + /// Returns a list of supported attribute identifiers /// Supported = 5 } @@ -3372,23 +3378,23 @@ namespace DiscImageChef.Devices public enum FujitsuDisplayModes : byte { /// - /// Message is displayed until next tape operation starts + /// Message is displayed until next tape operation starts /// Idle = 0, /// - /// Message is displayed only if a cartridge is inserted, until its removal + /// Message is displayed only if a cartridge is inserted, until its removal /// Cart = 1, /// - /// Message is only displayed when drive is ready + /// Message is only displayed when drive is ready /// Ready = 2, /// - /// Cancels current display + /// Cancels current display /// Cancel = 3, /// - /// Message is displayed only if a cartridge is inserted. When removed, only second half of the message is displayed. + /// Message is displayed only if a cartridge is inserted. When removed, only second half of the message is displayed. /// Half = 7 } @@ -3397,19 +3403,19 @@ namespace DiscImageChef.Devices public enum SscSpaceCodes : byte { /// - /// Logical blocks + /// Logical blocks /// LogicalBlock = 0, /// - /// Filemarks + /// Filemarks /// Filemark = 1, /// - /// Sequential filemarks + /// Sequential filemarks /// SequentialFilemark = 2, /// - /// End-of-data + /// End-of-data /// EndOfData = 3, Obsolete1 = 4, @@ -3417,85 +3423,86 @@ namespace DiscImageChef.Devices } /// - /// MMC / SecureDigital commands + /// MMC / SecureDigital commands /// public enum MmcCommands : byte { #region Class 1 MMC Commands (Basic and read-stream) /// - /// Resets device to idle (BC) + /// Resets device to idle (BC) /// GoIdle = 0, /// - /// Resets the device to pre-idle (BC) + /// Resets the device to pre-idle (BC) /// GoPreIdleState = 0, /// - /// Initiate alternative boot operation + /// Initiate alternative boot operation /// BootInitiation = 0, /// - /// Asks device in idle state to send their operation conditions in response (BCR, R3) + /// Asks device in idle state to send their operation conditions in response (BCR, R3) /// SendOpCond = 1, /// - /// Asks device to send their CID numbers (BCR, R2) + /// Asks device to send their CID numbers (BCR, R2) /// AllSendCid = 2, /// - /// Assigns a relative address to the device (AC, R1) + /// Assigns a relative address to the device (AC, R1) /// SetRelativeAddress = 3, /// - /// Programs the DSR of the device (BC) + /// Programs the DSR of the device (BC) /// SetDsr = 4, /// - /// Toggles the device between sleep and standby (AC, R1b) + /// Toggles the device between sleep and standby (AC, R1b) /// SleepAwake = 5, /// - /// Switches device mode of operation (AC, R1b) + /// Switches device mode of operation (AC, R1b) /// Switch = 6, /// - /// Toggles a device between the stand-by and transfer stats or between the programming and disconnect states (AC, R1b) + /// Toggles a device between the stand-by and transfer stats or between the programming and disconnect states (AC, R1b) /// SelectCard = 7, /// - /// Asks device to send its extended card-specific data (ExtCSD) (ADTC, R1) + /// Asks device to send its extended card-specific data (ExtCSD) (ADTC, R1) /// SendExtCsd = 8, /// - /// Asks device to send its card-specific data (CSD) (AC, R2) + /// Asks device to send its card-specific data (CSD) (AC, R2) /// SendCsd = 9, /// - /// Asks device to send its card identification (CID) (AC, R2) + /// Asks device to send its card identification (CID) (AC, R2) /// SendCid = 10, /// - /// Reads data stream from device, starting at given address, until a follows (ADTC, R1) + /// Reads data stream from device, starting at given address, until a follows (ADTC, + /// R1) /// [Obsolete] ReadDatUntilStop = 11, /// - /// Terminates a read/write stream/multiple block operation (AC, R1 / R1b) + /// Terminates a read/write stream/multiple block operation (AC, R1 / R1b) /// StopTransmission = 12, /// - /// Asks device to send its status register (AC, R1) + /// Asks device to send its status register (AC, R1) /// SendStatus = 13, /// - /// The host reads the reversed bus testing data pattern from a device (ADTC, R1) + /// The host reads the reversed bus testing data pattern from a device (ADTC, R1) /// BusTestRead = 14, /// - /// Sets the card to inactive state (AC) + /// Sets the card to inactive state (AC) /// GoInactiveState = 15, /// - /// The host sends the bus testing data pattern to a device (ADTC, R1) + /// The host sends the bus testing data pattern to a device (ADTC, R1) /// BusTestWrite = 19, SpiReadOcr = 58, @@ -3504,227 +3511,229 @@ namespace DiscImageChef.Devices #region Class 2 MMC Commands (Block-oriented read) /// - /// Sets the block length in bytes (AC, R1) + /// Sets the block length in bytes (AC, R1) /// SetBlocklen = 16, /// - /// Reads a block (ADTC, R1) + /// Reads a block (ADTC, R1) /// ReadSingleBlock = 17, /// - /// Transfers data blocks from card to host until interrupted (ADTC, R1) + /// Transfers data blocks from card to host until interrupted (ADTC, R1) /// ReadMultipleBlock = 18, /// - /// 128 blocks of tuning pattern is sent for HS200 optimal sampling point detection (ADTC, R1) + /// 128 blocks of tuning pattern is sent for HS200 optimal sampling point detection (ADTC, R1) /// SendTuningBlockHs200 = 21, #endregion Class 2 MMC Commands (Block-oriented read) #region Class 3 MMC Commands (Stream write) /// - /// Writes data stream from host until a follows (ADTC, R1) + /// Writes data stream from host until a follows (ADTC, R1) /// [Obsolete] WriteDatUntilStop = 20, #endregion Class 3 MMC Commands (Stream write) #region Class 4 MMC Commands (Block-oriented write) /// - /// Defines the number of blocks which are going to be transferred in the immediately succeeding multiple block command (AC, R1) + /// Defines the number of blocks which are going to be transferred in the immediately succeeding multiple block command + /// (AC, R1) /// SetBlockCount = 23, /// - /// Writes a block (ADTC, R1) + /// Writes a block (ADTC, R1) /// WriteBlock = 24, /// - /// Continuosly writes blocks until interrupted (ADTC, R1) + /// Continuosly writes blocks until interrupted (ADTC, R1) /// WriteMultipleBlock = 25, /// - /// Programs the Card Information register (ADTC, R1) + /// Programs the Card Information register (ADTC, R1) /// ProgramCid = 26, /// - /// Programs the programmable bits of the CSD (ADTC, R1) + /// Programs the programmable bits of the CSD (ADTC, R1) /// ProgramCsd = 27, /// - /// Sets the real time clock according to information in block (ADTC, R1) + /// Sets the real time clock according to information in block (ADTC, R1) /// SetTime = 49, #endregion Class 4 MMC Commands (Block-oriented write) #region Class 5 MMC Commands (Erase) /// - /// Sets the address of the first erase group (AC, R1) + /// Sets the address of the first erase group (AC, R1) /// EraseGroupStart = 35, /// - /// Sets the address of the last erase group (AC, R1) + /// Sets the address of the last erase group (AC, R1) /// EraseGroupEnd = 36, /// - /// Erases previously selected write blocks (AC, R1b) + /// Erases previously selected write blocks (AC, R1b) /// Erase = 38, #endregion Class 5 MMC Commands (Erase) #region Class 6 MMC Commands (Block-oriented write protection) /// - /// Sets the write protection bit (AC, R1b) + /// Sets the write protection bit (AC, R1b) /// SetWriteProtect = 28, /// - /// Clears the write protection bit (AC, R1b) + /// Clears the write protection bit (AC, R1b) /// ClearWriteProtect = 29, /// - /// Asks the device to send the status of the write protection bit (ADTC, R1) + /// Asks the device to send the status of the write protection bit (ADTC, R1) /// SendWriteProtect = 30, /// - /// Sends the type of write protection that is set for the different write protection groups (ADTC, R1) + /// Sends the type of write protection that is set for the different write protection groups (ADTC, R1) /// SentWriteProtectType = 31, #endregion Class 6 MMC Commands (Block-oriented write protection) #region Class 7 MMC Commands (Lock) /// - /// Used to set/reset the password or lock/unlock the card (ADTC, R1b) + /// Used to set/reset the password or lock/unlock the card (ADTC, R1b) /// LockUnlock = 42, #endregion Class 7 MMC Commands (Lock) #region Class 8 MMC Commands (Application-specific) /// - /// Indicates the card that the next command is an application specific command (AC, R1) + /// Indicates the card that the next command is an application specific command (AC, R1) /// ApplicationCommand = 55, /// - /// Transfers a data block to/from the card for general purpose / application specific commands (ADTC, R1b) + /// Transfers a data block to/from the card for general purpose / application specific commands (ADTC, R1b) /// GenericCommand = 56, #endregion Class 8 MMC Commands (Application-specific) #region Class 9 MMC Commands (I/O mode) /// - /// Used to write and read 8 bit data field, used to access application dependent registers not defined in MMC standard (AC, R4) + /// Used to write and read 8 bit data field, used to access application dependent registers not defined in MMC standard + /// (AC, R4) /// FastIo = 39, /// - /// Sets the system into interrupt mode (BCR, R5) + /// Sets the system into interrupt mode (BCR, R5) /// GoIrqState = 40, #endregion Class 9 MMC Commands (I/O mode) #region Class 10 MMC Commands (Security Protocols) /// - /// Reads data blocks (ADTC, R1) + /// Reads data blocks (ADTC, R1) /// ProtocolRead = 53, /// - /// Writes data blocks (ADTC, R1) + /// Writes data blocks (ADTC, R1) /// ProtocolWrite = 54, #endregion Class 10 MMC Commands (Security Protocols) #region Class 11 MMC Commands (Command Queue) /// - /// Defines data direction, priority, task ID and block count of queued task (AC, R1) + /// Defines data direction, priority, task ID and block count of queued task (AC, R1) /// QueuedTaskParameters = 44, /// - /// Defines the block address of queued task (AC, R1) + /// Defines the block address of queued task (AC, R1) /// QueuedTaskAddress = 45, /// - /// Executes the task queue for reading (ADTC, R1) + /// Executes the task queue for reading (ADTC, R1) /// ExecuteTaskRead = 46, /// - /// Executes the task queue for writing (ADTC, R1) + /// Executes the task queue for writing (ADTC, R1) /// ExecuteTaskWrite = 47, /// - /// Manages queues and tasks (AC, R1b) + /// Manages queues and tasks (AC, R1b) /// CmdQTaskManagement = 48, #endregion Class 11 MMC Commands (Command Queue) #region Class 1 SecureDigital Commands (Basic) /// - /// Sends SD interface condition (BCR, R7) + /// Sends SD interface condition (BCR, R7) /// SendInterfaceCondition = 8, /// - /// Switch to 1.8V bus signaling level (AC, R1) + /// Switch to 1.8V bus signaling level (AC, R1) /// VoltageSwitch = 11, #endregion Class 1 SecureDigital Commands (Basic) #region Class 2 SecureDigital Commands (Block-oriented read) /// - /// 64 bytes of tuning pattern is sent for SDR50 and SDR104 optinal sampling point detection (ADTC, R1) + /// 64 bytes of tuning pattern is sent for SDR50 and SDR104 optinal sampling point detection (ADTC, R1) /// SendTuningBlock = 19, /// - /// Speed class control command (AC, R1b) + /// Speed class control command (AC, R1b) /// SpeedClassControl = 20, #endregion Class 2 SecureDigital Commands (Block-oriented read) #region Class 11 SecureDigital Commands (Function Extension) /// - /// Single block read type (ADTC, R1) + /// Single block read type (ADTC, R1) /// ReadExtraSingle = 48, /// - /// Single block write type (ADTC, R1) + /// Single block write type (ADTC, R1) /// WriteExtraSingle = 49, /// - /// Multiple block read type (ADTC, R1) + /// Multiple block read type (ADTC, R1) /// ReadExtraMulti = 58, /// - /// Multiple block write type (ADTC, R1) + /// Multiple block write type (ADTC, R1) /// WriteExtraMulti = 59, #endregion Class 11 SecureDigital Commands (Function Extension) } /// - /// SecureDigital application-specific commands + /// SecureDigital application-specific commands /// public enum SecureDigitalCommands : byte { /// - /// Defines the data bus width to be used for data transfer (AC, R1) + /// Defines the data bus width to be used for data transfer (AC, R1) /// SetBusWidth = 6, /// - /// Sends the SD status register (ADTC, R1) + /// Sends the SD status register (ADTC, R1) /// SendStatus = 13, /// - /// Send the number of the written write blocks (ADTC, R1) + /// Send the number of the written write blocks (ADTC, R1) /// SendNumWriteBlocks = 22, /// - /// Set the number of write blocks to be pre-erased before writing (AC, R1) + /// Set the number of write blocks to be pre-erased before writing (AC, R1) /// SetWriteBlockEraseCount = 23, /// - /// Sends host capacity support information and asks the card to send its operating condition register (BCR, R3) + /// Sends host capacity support information and asks the card to send its operating condition register (BCR, R3) /// SendOperatingCondition = 41, /// - /// Connects/Disconnects the 50 kOhm pull-up resistor on CD/DAT3 pin of card (AC, R1) + /// Connects/Disconnects the 50 kOhm pull-up resistor on CD/DAT3 pin of card (AC, R1) /// SetClearCardDetect = 42, /// - /// Reads the SD Configuration Register SCR (ADTC, R1) + /// Reads the SD Configuration Register SCR (ADTC, R1) /// SendScr = 51 } @@ -3768,43 +3777,43 @@ namespace DiscImageChef.Devices public enum KreonFeatures { /// - /// Drive can set the xtreme unlock state with Xbox 360 discs + /// Drive can set the xtreme unlock state with Xbox 360 discs /// XtremeUnlock360, /// - /// Drive can set the wxripper unlock state with Xbox 360 discs + /// Drive can set the wxripper unlock state with Xbox 360 discs /// WxripperUnlock360, /// - /// Drive can read and decrypt the SS from Xbox 360 discs + /// Drive can read and decrypt the SS from Xbox 360 discs /// DecryptSs360, /// - /// Drive has full challenge response capabilities with Xbox 360 discs + /// Drive has full challenge response capabilities with Xbox 360 discs /// ChallengeResponse360, /// - /// Drive can set the xtreme unlock state with Xbox discs + /// Drive can set the xtreme unlock state with Xbox discs /// XtremeUnlock, /// - /// Drive can set the wxripper unlock state with Xbox discs + /// Drive can set the wxripper unlock state with Xbox discs /// WxripperUnlock, /// - /// Drive can read and decrypt the SS from Xbox discs + /// Drive can read and decrypt the SS from Xbox discs /// DecryptSs, /// - /// Drive has full challenge response capabilities with Xbox discs + /// Drive has full challenge response capabilities with Xbox discs /// ChallengeResponse, /// - /// Drive supports the locked state + /// Drive supports the locked state /// Lock, /// - /// Drive supports skipping read errors + /// Drive supports skipping read errors /// ErrorSkipping } diff --git a/DiscImageChef.Devices/FreeBSD/Command.cs b/DiscImageChef.Devices/FreeBSD/Command.cs index a4b8a619..f5fa1c09 100644 --- a/DiscImageChef.Devices/FreeBSD/Command.cs +++ b/DiscImageChef.Devices/FreeBSD/Command.cs @@ -46,7 +46,7 @@ namespace DiscImageChef.Devices.FreeBSD const int CAM_MAX_CDBLEN = 16; /// - /// Sends a SCSI command (64-bit arch) + /// Sends a SCSI command (64-bit arch) /// /// 0 if no error occurred, otherwise, errno /// CAM device @@ -56,7 +56,10 @@ namespace DiscImageChef.Devices.FreeBSD /// Timeout in seconds /// SCSI command transfer direction /// Time it took to execute the command in milliseconds - /// True if SCSI error returned non-OK status and contains SCSI sense + /// + /// True if SCSI error returned non-OK status and contains SCSI + /// sense + /// internal static int SendScsiCommand64(IntPtr dev, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, CcbFlags direction, out double duration, out bool sense) { @@ -151,7 +154,7 @@ namespace DiscImageChef.Devices.FreeBSD } /// - /// Sends a SCSI command (32-bit arch) + /// Sends a SCSI command (32-bit arch) /// /// 0 if no error occurred, otherwise, errno /// CAM device @@ -161,7 +164,10 @@ namespace DiscImageChef.Devices.FreeBSD /// Timeout in seconds /// SCSI command transfer direction /// Time it took to execute the command in milliseconds - /// True if SCSI error returned non-OK status and contains SCSI sense + /// + /// True if SCSI error returned non-OK status and contains SCSI + /// sense + /// internal static int SendScsiCommand(IntPtr dev, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, CcbFlags direction, out double duration, out bool sense) { @@ -256,7 +262,7 @@ namespace DiscImageChef.Devices.FreeBSD } /// - /// Converts ATA protocol to CAM flags + /// Converts ATA protocol to CAM flags /// /// ATA protocol /// CAM flags @@ -279,7 +285,7 @@ namespace DiscImageChef.Devices.FreeBSD } /// - /// Sends an ATA command in CHS mode + /// Sends an ATA command in CHS mode /// /// 0 if no error occurred, otherwise, errno /// CAM device @@ -377,7 +383,7 @@ namespace DiscImageChef.Devices.FreeBSD } /// - /// Sends an ATA command in 28-bit LBA mode + /// Sends an ATA command in 28-bit LBA mode /// /// 0 if no error occurred, otherwise, errno /// CAM device @@ -475,7 +481,7 @@ namespace DiscImageChef.Devices.FreeBSD } /// - /// Sends an ATA command in 48-bit mode + /// Sends an ATA command in 48-bit mode /// /// 0 if no error occurred, otherwise, errno /// CAM device diff --git a/DiscImageChef.Devices/FreeBSD/Enums.cs b/DiscImageChef.Devices/FreeBSD/Enums.cs index 7f371557..b7d33024 100644 --- a/DiscImageChef.Devices/FreeBSD/Enums.cs +++ b/DiscImageChef.Devices/FreeBSD/Enums.cs @@ -39,80 +39,80 @@ namespace DiscImageChef.Devices.FreeBSD enum FileFlags { /// - /// O_RDONLY - /// + /// O_RDONLY + /// ReadOnly = 0x00000000, /// - /// O_WRONLY - /// + /// O_WRONLY + /// WriteOnly = 0x00000001, /// - /// O_RDWR - /// + /// O_RDWR + /// ReadWrite = 0x00000002, /// - /// O_NONBLOCK - /// + /// O_NONBLOCK + /// NonBlocking = 0x00000004, /// - /// O_APPEND - /// + /// O_APPEND + /// Append = 0x00000008, /// - /// O_SHLOCK - /// + /// O_SHLOCK + /// SharedLock = 0x00000010, /// - /// O_EXLOCK - /// + /// O_EXLOCK + /// ExclusiveLock = 0x00000020, /// - /// O_ASYNC - /// + /// O_ASYNC + /// Async = 0x00000040, /// - /// O_FSYNC - /// + /// O_FSYNC + /// SyncWrites = 0x00000080, /// - /// O_NOFOLLOW - /// + /// O_NOFOLLOW + /// NoFollowSymlink = 0x00000100, /// - /// O_CREAT - /// + /// O_CREAT + /// OpenOrCreate = 0x00000200, /// - /// O_TRUNC - /// + /// O_TRUNC + /// Truncate = 0x00000400, /// - /// O_EXCL - /// + /// O_EXCL + /// CreateNew = 0x00000800, /// - /// O_NOCTTY - /// + /// O_NOCTTY + /// NoControlTty = 0x00008000, /// - /// O_DIRECT - /// + /// O_DIRECT + /// Direct = 0x00010000, /// - /// O_DIRECTORY - /// + /// O_DIRECTORY + /// Directory = 0x00020000, /// - /// O_EXEC - /// + /// O_EXEC + /// Execute = 0x00040000, /// - /// O_TTY_INIT - /// + /// O_TTY_INIT + /// InitializeTty = 0x00080000, /// - /// O_CLOEXEC - /// + /// O_CLOEXEC + /// CloseOnExec = 0x00100000 } @@ -120,24 +120,24 @@ namespace DiscImageChef.Devices.FreeBSD enum CamAtaIoFlags : byte { /// - /// 48-bit command - /// + /// 48-bit command + /// ExtendedCommand = 0x01, /// - /// FPDMA command - /// + /// FPDMA command + /// Fpdma = 0x02, /// - /// Control, not a command - /// + /// Control, not a command + /// Control = 0x04, /// - /// Needs result - /// + /// Needs result + /// NeedResult = 0x08, /// - /// DMA command - /// + /// DMA command + /// Dma = 0x10 } @@ -314,37 +314,37 @@ namespace DiscImageChef.Devices.FreeBSD ProtoUnspecified, /// - /// Small Computer System Interface + /// Small Computer System Interface /// ProtoScsi, /// - /// AT Attachment + /// AT Attachment /// ProtoAta, /// - /// AT Attachment Packetized Interface + /// AT Attachment Packetized Interface /// ProtoAtapi, /// - /// SATA Port Multiplier + /// SATA Port Multiplier /// ProtoSatapm, /// - /// SATA Enclosure Management Bridge + /// SATA Enclosure Management Bridge /// ProtoSemb, /// - /// NVMe + /// NVMe /// ProtoNvme, /// - /// MMC, SD, SDIO + /// MMC, SD, SDIO /// ProtoMmcsd } @@ -391,170 +391,170 @@ namespace DiscImageChef.Devices.FreeBSD enum CcbFlags : uint { /// - /// The CDB field is a pointer + /// The CDB field is a pointer /// CamCdbPointer = 0x00000001, /// - /// SIM queue actions are enabled + /// SIM queue actions are enabled /// CamQueueEnable = 0x00000002, /// - /// CCB contains a linked CDB + /// CCB contains a linked CDB /// CamCdbLinked = 0x00000004, /// - /// Perform transport negotiation with this command. + /// Perform transport negotiation with this command. /// CamNegotiate = 0x00000008, /// - /// Data type with physical addrs + /// Data type with physical addrs /// CamDataIsphys = 0x00000010, /// - /// Disable autosense feature + /// Disable autosense feature /// CamDisAutosense = 0x00000020, /// - /// Data direction (00:IN/OUT) + /// Data direction (00:IN/OUT) /// CamDirBoth = 0x00000000, /// - /// Data direction (01:DATA IN) + /// Data direction (01:DATA IN) /// CamDirIn = 0x00000040, /// - /// Data direction (10:DATA OUT) + /// Data direction (10:DATA OUT) /// CamDirOut = 0x00000080, /// - /// Data direction (11:no data) + /// Data direction (11:no data) /// CamDirNone = 0x000000C0, /// - /// Data type (000:Virtual) + /// Data type (000:Virtual) /// CamDataVaddr = 0x00000000, /// - /// Data type (001:Physical) + /// Data type (001:Physical) /// CamDataPaddr = 0x00000010, /// - /// Data type (010:sglist) + /// Data type (010:sglist) /// CamDataSg = 0x00040000, /// - /// Data type (011:sglist phys) + /// Data type (011:sglist phys) /// CamDataSgPaddr = 0x00040010, /// - /// Data type (100:bio) + /// Data type (100:bio) /// CamDataBio = 0x00200000, /// - /// Use Soft reset alternative + /// Use Soft reset alternative /// CamSoftRstOp = 0x00000100, /// - /// Flush resid bytes on complete + /// Flush resid bytes on complete /// CamEngSync = 0x00000200, /// - /// Disable DEV Q freezing + /// Disable DEV Q freezing /// CamDevQfrzdis = 0x00000400, /// - /// Freeze DEV Q on execution + /// Freeze DEV Q on execution /// CamDevQfreeze = 0x00000800, /// - /// Command takes a lot of power + /// Command takes a lot of power /// CamHighPower = 0x00001000, /// - /// Sense data is a pointer + /// Sense data is a pointer /// CamSensePtr = 0x00002000, /// - /// Sense pointer is physical addr + /// Sense pointer is physical addr /// CamSensePhys = 0x00004000, /// - /// Use the tag action in this ccb + /// Use the tag action in this ccb /// CamTagActionValid = 0x00008000, /// - /// Pass driver does err. recovery + /// Pass driver does err. recovery /// CamPassErrRecover = 0x00010000, /// - /// Disable disconnect + /// Disable disconnect /// CamDisDisconnect = 0x00020000, /// - /// Message buffer ptr is physical + /// Message buffer ptr is physical /// CamMsgBufPhys = 0x00080000, /// - /// Autosense data ptr is physical + /// Autosense data ptr is physical /// CamSnsBufPhys = 0x00100000, /// - /// CDB poiner is physical + /// CDB poiner is physical /// CamCdbPhys = 0x00400000, /// - /// SG list is for the HBA engine + /// SG list is for the HBA engine /// CamEngSglist = 0x00800000, /* Phase cognizant mode flags */ /// - /// Disable autosave/restore ptrs + /// Disable autosave/restore ptrs /// CamDisAutosrp = 0x01000000, /// - /// Disable auto disconnect + /// Disable auto disconnect /// CamDisAutodisc = 0x02000000, /// - /// Target CCB available + /// Target CCB available /// CamTgtCcbAvail = 0x04000000, /// - /// The SIM runs in phase mode + /// The SIM runs in phase mode /// CamTgtPhaseMode = 0x08000000, /// - /// Message buffer valid + /// Message buffer valid /// CamMsgbValid = 0x10000000, /// - /// Status buffer valid + /// Status buffer valid /// CamStatusValid = 0x20000000, /// - /// Data buffer valid + /// Data buffer valid /// CamDatabValid = 0x40000000, /* Host target Mode flags */ /// - /// Send sense data with status + /// Send sense data with status /// CamSendSense = 0x08000000, /// - /// Terminate I/O Message sup. + /// Terminate I/O Message sup. /// CamTermIo = 0x10000000, /// - /// Disconnects are mandatory + /// Disconnects are mandatory /// CamDisconnect = 0x20000000, /// - /// Send status after data phase + /// Send status after data phase /// CamSendStatus = 0x40000000, /// - /// Call callback without lock. + /// Call callback without lock. /// CamUnlocked = 0x80000000 } @@ -642,7 +642,11 @@ namespace DiscImageChef.Devices.FreeBSD /// Request was too large for this host CamReqTooBig = 0x1a, - /// This request should be requeued to preserve transaction ordering. This typically occurs when the SIM recognizes an error that should freeze the queue and must place additional requests for the target at the sim level back into the XPT queue. + /// + /// This request should be requeued to preserve transaction ordering. This typically occurs when the SIM + /// recognizes an error that should freeze the queue and must place additional requests for the target at the sim level + /// back into the XPT queue. + /// CamRequeueReq = 0x1b, /// ATA error, look at error code in CCB diff --git a/DiscImageChef.Devices/FreeBSD/ListDevices.cs b/DiscImageChef.Devices/FreeBSD/ListDevices.cs index e5ab42f6..12294369 100644 --- a/DiscImageChef.Devices/FreeBSD/ListDevices.cs +++ b/DiscImageChef.Devices/FreeBSD/ListDevices.cs @@ -44,7 +44,7 @@ namespace DiscImageChef.Devices.FreeBSD static class ListDevices { /// - /// Gets a list of all known storage devices on FreeBSD + /// Gets a list of all known storage devices on FreeBSD /// /// List of devices internal static DeviceInfo[] GetList() diff --git a/DiscImageChef.Devices/FreeBSD/Structs.cs b/DiscImageChef.Devices/FreeBSD/Structs.cs index 436e8a8d..db36aeba 100644 --- a/DiscImageChef.Devices/FreeBSD/Structs.cs +++ b/DiscImageChef.Devices/FreeBSD/Structs.cs @@ -37,13 +37,17 @@ using System.Runtime.InteropServices; using lun_id_t = System.UInt32; using path_id_t = System.UInt32; using target_id_t = System.UInt32; + +// ReSharper disable BuiltInTypeReferenceStyle + #pragma warning disable 649 #pragma warning disable 169 namespace DiscImageChef.Devices.FreeBSD { [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct AtaCmd + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct AtaCmd { public CamAtaIoFlags flags; public byte command; @@ -62,7 +66,8 @@ namespace DiscImageChef.Devices.FreeBSD } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct AtaRes + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct AtaRes { public CamAtaIoFlags flags; public byte status; @@ -79,55 +84,61 @@ namespace DiscImageChef.Devices.FreeBSD } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct CamPinfo + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct CamPinfo { public uint priority; public uint generation; public int index; } - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct ListEntry + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct ListEntry { /// - /// LIST_ENTRY(ccb_hdr)=le->*le_next + /// LIST_ENTRY(ccb_hdr)=le->*le_next /// public IntPtr LeNext; /// - /// LIST_ENTRY(ccb_hdr)=le->**le_prev + /// LIST_ENTRY(ccb_hdr)=le->**le_prev /// public IntPtr LePrev; } - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct SlistEntry + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct SlistEntry { /// - /// SLIST_ENTRY(ccb_hdr)=sle->*sle_next + /// SLIST_ENTRY(ccb_hdr)=sle->*sle_next /// public IntPtr SleNext; } - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct TailqEntry + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct TailqEntry { /// - /// TAILQ_ENTRY(ccb_hdr)=tqe->*tqe_next + /// TAILQ_ENTRY(ccb_hdr)=tqe->*tqe_next /// public IntPtr TqeNext; /// - /// TAILQ_ENTRY(ccb_hdr)=tqe->**tqe_prev + /// TAILQ_ENTRY(ccb_hdr)=tqe->**tqe_prev /// public IntPtr TqePrev; } - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct StailqEntry + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct StailqEntry { /// - /// STAILQ_ENTRY(ccb_hdr)=stqe->*stqe_next + /// STAILQ_ENTRY(ccb_hdr)=stqe->*stqe_next /// public IntPtr StqeNext; } [StructLayout(LayoutKind.Explicit)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct CamqEntry + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct CamqEntry { [FieldOffset(0)] public ListEntry le; [FieldOffset(0)] public SlistEntry sle; @@ -136,7 +147,8 @@ namespace DiscImageChef.Devices.FreeBSD } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct Timeval + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct Timeval { public long tv_sec; /// long @@ -144,7 +156,8 @@ namespace DiscImageChef.Devices.FreeBSD } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct CcbQosArea + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct CcbQosArea { public Timeval etime; public UIntPtr sim_data; @@ -152,7 +165,8 @@ namespace DiscImageChef.Devices.FreeBSD } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct CcbHdr + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct CcbHdr { public CamPinfo pinfo; public CamqEntry xpt_links; @@ -176,7 +190,8 @@ namespace DiscImageChef.Devices.FreeBSD } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct ScsiSenseData + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct ScsiSenseData { const int SSD_FULL_SIZE = 252; public byte error_code; @@ -184,10 +199,11 @@ namespace DiscImageChef.Devices.FreeBSD } /// - /// SCSI I/O Request CCB used for the XPT_SCSI_IO and XPT_CONT_TARGET_IO function codes. + /// SCSI I/O Request CCB used for the XPT_SCSI_IO and XPT_CONT_TARGET_IO function codes. /// [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct CcbScsiio + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct CcbScsiio { public CcbHdr ccb_h; /// Ptr for next CCB for action @@ -213,7 +229,7 @@ namespace DiscImageChef.Devices.FreeBSD /// Transfer residual length: 2's comp public int resid; /// - /// Area for the CDB send, or pointer to the CDB bytes to send + /// Area for the CDB send, or pointer to the CDB bytes to send /// const int IOCDBLEN = 16; [MarshalAs(UnmanagedType.ByValArray, SizeConst = IOCDBLEN)] public byte[] cdb_bytes; @@ -221,7 +237,10 @@ namespace DiscImageChef.Devices.FreeBSD public IntPtr msg_ptr; /// Number of bytes for the Message public short msg_len; - /// What to do for tag queueing. The tag action should be either the define below (to send a non-tagged transaction) or one of the defined scsi tag messages from scsi_message.h. + /// + /// What to do for tag queueing. The tag action should be either the define below (to send a non-tagged + /// transaction) or one of the defined scsi tag messages from scsi_message.h. + /// public byte tag_action; /// tag id from initator (target mode) public uint tag_id; @@ -230,10 +249,11 @@ namespace DiscImageChef.Devices.FreeBSD } /// - /// SCSI I/O Request CCB used for the XPT_SCSI_IO and XPT_CONT_TARGET_IO function codes. + /// SCSI I/O Request CCB used for the XPT_SCSI_IO and XPT_CONT_TARGET_IO function codes. /// [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct CcbScsiio64 + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct CcbScsiio64 { public CcbHdr ccb_h; /// Ptr for next CCB for action @@ -260,7 +280,7 @@ namespace DiscImageChef.Devices.FreeBSD public int resid; public uint alignment; /// - /// Area for the CDB send, or pointer to the CDB bytes to send + /// Area for the CDB send, or pointer to the CDB bytes to send /// const int IOCDBLEN = 16; [MarshalAs(UnmanagedType.ByValArray, SizeConst = IOCDBLEN)] public byte[] cdb_bytes; @@ -268,7 +288,10 @@ namespace DiscImageChef.Devices.FreeBSD public IntPtr msg_ptr; /// Number of bytes for the Message public short msg_len; - /// What to do for tag queueing. The tag action should be either the define below (to send a non-tagged transaction) or one of the defined scsi tag messages from scsi_message.h. + /// + /// What to do for tag queueing. The tag action should be either the define below (to send a non-tagged + /// transaction) or one of the defined scsi tag messages from scsi_message.h. + /// public byte tag_action; /// tag id from initator (target mode) public uint tag_id; @@ -277,10 +300,11 @@ namespace DiscImageChef.Devices.FreeBSD } /// - /// ATA I/O Request CCB used for the XPT_ATA_IO function code. + /// ATA I/O Request CCB used for the XPT_ATA_IO function code. /// [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct CcbAtaio + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct CcbAtaio { public CcbHdr ccb_h; /// Ptr for next CCB for action @@ -302,137 +326,140 @@ namespace DiscImageChef.Devices.FreeBSD } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct NvmeCommand + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct NvmeCommand { ushort opc_fuse_rsvd1; /// - /// command identifier + /// command identifier /// public ushort cid; /// - /// namespace identifier + /// namespace identifier /// public uint nsid; /// - /// reserved + /// reserved /// public uint rsvd2; /// - /// reserved + /// reserved /// public uint rsvd3; /// - /// metadata pointer + /// metadata pointer /// public ulong mptr; /// - /// prp entry 1 + /// prp entry 1 /// public ulong prp1; /// - /// prp entry 2 + /// prp entry 2 /// public ulong prp2; /// - /// command-specific + /// command-specific /// public uint cdw10; /// - /// command-specific + /// command-specific /// public uint cdw11; /// - /// command-specific + /// command-specific /// public uint cdw12; /// - /// command-specific + /// command-specific /// public uint cdw13; /// - /// command-specific + /// command-specific /// public uint cdw14; /// - /// command-specific + /// command-specific /// public uint cdw15; /// - /// opcode + /// opcode /// public byte Opc => (byte)((opc_fuse_rsvd1 & 0xFF00) >> 8); /// - /// fused operation + /// fused operation /// public byte Fuse => (byte)((opc_fuse_rsvd1 & 0xC0) >> 6); /// - /// reserved + /// reserved /// public byte Rsvd1 => (byte)(opc_fuse_rsvd1 & 0x3F); } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct NvmeStatus + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct NvmeStatus { ushort status; /// - /// phase tag + /// phase tag /// public byte P => (byte)((status & 0x8000) >> 15); /// - /// status code + /// status code /// public byte Sc => (byte)((status & 0x7F80) >> 7); /// - /// status code type + /// status code type /// public byte Sct => (byte)((status & 0x70) >> 4); /// - /// reserved + /// reserved /// public byte Rsvd2 => (byte)((status & 0xC) >> 15); /// - /// more + /// more /// public byte M => (byte)((status & 0x2) >> 1); /// - /// do not retry + /// do not retry /// public byte Dnr => (byte)(status & 0x1); } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct NvmeCompletion + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct NvmeCompletion { /// - /// command-specific + /// command-specific /// public uint cdw0; /// - /// reserved + /// reserved /// public uint rsvd1; /// - /// submission queue head pointer + /// submission queue head pointer /// public ushort sqhd; /// - /// submission queue identifier + /// submission queue identifier /// public ushort sqid; /// - /// command identifier + /// command identifier /// public ushort cid; @@ -440,10 +467,11 @@ namespace DiscImageChef.Devices.FreeBSD } /// - /// NVMe I/O Request CCB used for the XPT_NVME_IO and XPT_NVME_ADMIN function codes. + /// NVMe I/O Request CCB used for the XPT_NVME_IO and XPT_NVME_ADMIN function codes. /// [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct CcbNvmeio + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct CcbNvmeio { public CcbHdr ccb_h; /// Ptr for next CCB for action @@ -463,7 +491,8 @@ namespace DiscImageChef.Devices.FreeBSD } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct PeriphMatchPattern + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct PeriphMatchPattern { const int DEV_IDLEN = 16; @@ -476,14 +505,16 @@ namespace DiscImageChef.Devices.FreeBSD } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct DeviceIdMatchPattern + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct DeviceIdMatchPattern { public byte id_len; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] id; } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct ScsiStaticInquiryPattern + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct ScsiStaticInquiryPattern { const int SID_VENDOR_SIZE = 8; const int SID_PRODUCT_SIZE = 16; @@ -496,24 +527,27 @@ namespace DiscImageChef.Devices.FreeBSD } [StructLayout(LayoutKind.Explicit)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct DeviceMatchPatternData + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct DeviceMatchPatternData { [FieldOffset(0)] public ScsiStaticInquiryPattern inq_pat; [FieldOffset(0)] public DeviceIdMatchPattern devid_pat; } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct DeviceMatchPattern + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct DeviceMatchPattern { - public path_id_t path_id; - public target_id_t target_id; - public lun_id_t target_lun; + public uint path_id; + public uint target_id; + public uint target_lun; public DevPatternFlags flags; public DeviceMatchPatternData data; } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct BusMatchPattern + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct BusMatchPattern { const int DEV_IDLEN = 16; @@ -525,7 +559,8 @@ namespace DiscImageChef.Devices.FreeBSD } [StructLayout(LayoutKind.Explicit)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct MatchPattern + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct MatchPattern { [FieldOffset(0)] public PeriphMatchPattern periph_pattern; [FieldOffset(0)] public DeviceMatchPattern device_pattern; @@ -533,14 +568,16 @@ namespace DiscImageChef.Devices.FreeBSD } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct DevMatchPattern + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct DevMatchPattern { public DevMatchType type; public MatchPattern pattern; } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct PeriphMatchResult + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct PeriphMatchResult { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] periph_name; public uint unit_number; @@ -550,7 +587,8 @@ namespace DiscImageChef.Devices.FreeBSD } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct MmcCid + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct MmcCid { public uint mid; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] pnm; @@ -563,45 +601,46 @@ namespace DiscImageChef.Devices.FreeBSD } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct MmcParams + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct MmcParams { /// - /// Card model + /// Card model /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 40)] public byte[] model; /// - /// Card OCR + /// Card OCR /// public uint card_ocr; /// - /// OCR of the IO portion of the card + /// OCR of the IO portion of the card /// public uint io_ocr; /// - /// Card CID -- raw + /// Card CID -- raw /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public uint[] card_cid; /// - /// Card CID -- parsed + /// Card CID -- parsed /// public MmcCid cid; /// - /// Card CSD -- raw + /// Card CSD -- raw /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public uint[] card_csd; /// - /// Card RCA + /// Card RCA /// public ushort card_rca; /// - /// What kind of card is it + /// What kind of card is it /// public MmcCardFeatures card_features; @@ -609,7 +648,8 @@ namespace DiscImageChef.Devices.FreeBSD } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct DeviceMatchResult + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct DeviceMatchResult { public path_id_t path_id; public target_id_t target_id; @@ -622,7 +662,8 @@ namespace DiscImageChef.Devices.FreeBSD } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct BusMatchResult + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct BusMatchResult { public path_id_t path_id; const int DEV_IDLEN = 16; @@ -632,7 +673,8 @@ namespace DiscImageChef.Devices.FreeBSD } [StructLayout(LayoutKind.Explicit)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct MatchResult + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct MatchResult { [FieldOffset(0)] public PeriphMatchResult periph_result; [FieldOffset(0)] public DeviceMatchResult device_result; @@ -640,14 +682,16 @@ namespace DiscImageChef.Devices.FreeBSD } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct DevMatchResult + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct DevMatchResult { public DevMatchType type; public MatchResult result; } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct CcbDmCookie + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct CcbDmCookie { public IntPtr bus; public IntPtr target; @@ -657,7 +701,8 @@ namespace DiscImageChef.Devices.FreeBSD } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct CcbDevPosition + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct CcbDevPosition { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public CamGenerations[] generations; DevPosType position_type; @@ -665,7 +710,8 @@ namespace DiscImageChef.Devices.FreeBSD } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct CcbDevMatch + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct CcbDevMatch { public CcbHdr ccb_h; CcbDevMatchStatus status; @@ -673,7 +719,7 @@ namespace DiscImageChef.Devices.FreeBSD public uint pattern_buf_len; /// - /// dev_match_pattern* + /// dev_match_pattern* /// public IntPtr patterns; @@ -681,7 +727,7 @@ namespace DiscImageChef.Devices.FreeBSD public uint match_buf_len; /// - /// dev_match_result* + /// dev_match_result* /// public IntPtr matches; @@ -689,104 +735,105 @@ namespace DiscImageChef.Devices.FreeBSD } [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] - [SuppressMessage("ReSharper", "BuiltInTypeReferenceStyle")] struct CamDevice { const int MAXPATHLEN = 1024; const int DEV_IDLEN = 16; const int SIM_IDLEN = 16; /// - /// Pathname of the device given by the user. This may be null if the user states the device name and unit number separately. + /// Pathname of the device given by the user. This may be null if the user states the device name and unit number + /// separately. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAXPATHLEN)] public byte[] DevicePath; /// - /// Device name given by the user. + /// Device name given by the user. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN + 1)] public byte[] GivenDevName; /// - /// Unit number given by the user. + /// Unit number given by the user. /// public uint GivenUnitNumber; /// - /// Name of the device, e.g. 'pass' + /// Name of the device, e.g. 'pass' /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN + 1)] public byte[] DeviceName; /// - /// Unit number of the passthrough device associated with this particular device. + /// Unit number of the passthrough device associated with this particular device. /// public uint DevUnitNum; /// - /// Controller name, e.g. 'ahc' + /// Controller name, e.g. 'ahc' /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = SIM_IDLEN + 1)] public byte[] SimName; /// - /// Controller unit number + /// Controller unit number /// public uint SimUnitNumber; /// - /// Controller bus number + /// Controller bus number /// public uint BusId; /// - /// Logical Unit Number + /// Logical Unit Number /// public lun_id_t TargetLun; /// - /// Target ID + /// Target ID /// public target_id_t TargetId; /// - /// System SCSI bus number + /// System SCSI bus number /// public path_id_t PathId; /// - /// type of peripheral device + /// type of peripheral device /// public ushort PdType; /// - /// SCSI Inquiry data + /// SCSI Inquiry data /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] InqData; /// - /// device serial number + /// device serial number /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 252)] public byte[] SerialNum; /// - /// length of the serial number + /// length of the serial number /// public byte SerialNumLen; /// - /// Negotiated sync period + /// Negotiated sync period /// public byte SyncPeriod; /// - /// Negotiated sync offset + /// Negotiated sync offset /// public byte SyncOffset; /// - /// Negotiated bus width + /// Negotiated bus width /// public byte BusWidth; /// - /// file descriptor for device + /// file descriptor for device /// public int Fd; } [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct CcbGetdev + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + struct CcbGetdev { public CcbHdr ccb_h; public CamProto protocol; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] inq_data; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public byte[] ident_data; /// - /// device serial number + /// device serial number /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 252)] public byte[] serial_num; public byte inq_flags; /// - /// length of the serial number + /// length of the serial number /// public byte serial_num_len; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public IntPtr[] padding; diff --git a/DiscImageChef.Devices/Linux/Command.cs b/DiscImageChef.Devices/Linux/Command.cs index 988df1da..15517feb 100644 --- a/DiscImageChef.Devices/Linux/Command.cs +++ b/DiscImageChef.Devices/Linux/Command.cs @@ -42,7 +42,7 @@ namespace DiscImageChef.Devices.Linux static class Command { /// - /// Sends a SCSI command + /// Sends a SCSI command /// /// 0 if no error occurred, otherwise, errno /// File handle @@ -52,7 +52,10 @@ namespace DiscImageChef.Devices.Linux /// Timeout in seconds /// SCSI command transfer direction /// Time it took to execute the command in milliseconds - /// True if SCSI error returned non-OK status and contains SCSI sense + /// + /// True if SCSI error returned non-OK status and contains SCSI + /// sense + /// internal static int SendScsiCommand(int fd, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, ScsiIoctlDirection direction, out double duration, out bool sense) { @@ -102,7 +105,7 @@ namespace DiscImageChef.Devices.Linux } /// - /// Converts ATA protocol to SG_IO direction + /// Converts ATA protocol to SG_IO direction /// /// ATA protocol /// SG_IO direction @@ -125,7 +128,7 @@ namespace DiscImageChef.Devices.Linux } /// - /// Sends an ATA command in CHS mode + /// Sends an ATA command in CHS mode /// /// 0 if no error occurred, otherwise, errno /// File handle @@ -200,7 +203,7 @@ namespace DiscImageChef.Devices.Linux } /// - /// Sends an ATA command in 28-bit LBA mode + /// Sends an ATA command in 28-bit LBA mode /// /// 0 if no error occurred, otherwise, errno /// File handle @@ -275,7 +278,7 @@ namespace DiscImageChef.Devices.Linux } /// - /// Sends an ATA command in 48-bit LBA mode + /// Sends an ATA command in 48-bit LBA mode /// /// 0 if no error occurred, otherwise, errno /// File handle @@ -358,7 +361,7 @@ namespace DiscImageChef.Devices.Linux } /// - /// Sends a MMC/SD command + /// Sends a MMC/SD command /// /// The result of the command. /// File handle @@ -423,7 +426,7 @@ namespace DiscImageChef.Devices.Linux } /// - /// Reads the contents of a symbolic link + /// Reads the contents of a symbolic link /// /// Path to the symbolic link /// Contents of the symbolic link diff --git a/DiscImageChef.Devices/Linux/Enums.cs b/DiscImageChef.Devices/Linux/Enums.cs index 1723b367..b796e743 100644 --- a/DiscImageChef.Devices/Linux/Enums.cs +++ b/DiscImageChef.Devices/Linux/Enums.cs @@ -39,103 +39,103 @@ namespace DiscImageChef.Devices.Linux enum FileFlags { /// - /// O_RDONLY + /// O_RDONLY /// Readonly = 00000000, /// - /// O_WRONLY + /// O_WRONLY /// Writeonly = 00000001, /// - /// O_RDWR + /// O_RDWR /// ReadWrite = 00000002, /// - /// O_CREAT + /// O_CREAT /// OpenOrCreate = 00000100, /// - /// O_EXCL + /// O_EXCL /// CreateNew = 00000200, /// - /// O_NOCTTY + /// O_NOCTTY /// NoControlTty = 00000400, /// - /// O_TRUNC + /// O_TRUNC /// Truncate = 00001000, /// - /// O_APPEND + /// O_APPEND /// Append = 00002000, /// - /// O_NONBLOCK + /// O_NONBLOCK /// NonBlocking = 00004000, /// - /// O_DSYNC + /// O_DSYNC /// Synchronous = 00010000, /// - /// O_ASYNC + /// O_ASYNC /// Async = 00020000, /// - /// O_DIRECT + /// O_DIRECT /// Direct = 00040000, /// - /// O_LARGEFILE + /// O_LARGEFILE /// LargeFile = 00100000, /// - /// O_DIRECTORY + /// O_DIRECTORY /// Directory = 00200000, /// - /// O_NOFOLLOW + /// O_NOFOLLOW /// NoFollowSymlink = 00400000, /// - /// O_NOATIME + /// O_NOATIME /// NoAccessTime = 01000000, /// - /// O_CLOEXEC + /// O_CLOEXEC /// CloseOnExec = 02000000 } /// - /// Direction of SCSI transfer + /// Direction of SCSI transfer /// enum ScsiIoctlDirection { /// - /// No data transfer happens - /// SG_DXFER_NONE + /// No data transfer happens + /// SG_DXFER_NONE /// None = -1, /// - /// From host to device - /// SG_DXFER_TO_DEV + /// From host to device + /// SG_DXFER_TO_DEV /// Out = -2, /// - /// From device to host - /// SG_DXFER_FROM_DEV + /// From device to host + /// SG_DXFER_FROM_DEV /// In = -3, /// - /// Bidirectional device/host - /// SG_DXFER_TO_FROM_DEV + /// Bidirectional device/host + /// SG_DXFER_TO_FROM_DEV /// Unspecified = -4, /// - /// Unspecified - /// SG_DXFER_UNKNOWN + /// Unspecified + /// SG_DXFER_UNKNOWN /// Unknown = -5 } @@ -153,32 +153,32 @@ namespace DiscImageChef.Devices.Linux enum SgInfo : uint { /// - /// Mask to check OK + /// Mask to check OK /// OkMask = 0x01, /// - /// No sense or driver noise + /// No sense or driver noise /// Ok = 0x00, /// - /// Check Condition + /// Check Condition /// CheckCondition = 0x01, /// - /// Direct I/O mask + /// Direct I/O mask /// DirectIoMask = 0x06, /// - /// Transfer via kernel buffers (or no transfer) + /// Transfer via kernel buffers (or no transfer) /// IndirectIo = 0x00, /// - /// Direct I/O performed + /// Direct I/O performed /// DirectIo = 0x02, /// - /// Partial direct and partial indirect I/O + /// Partial direct and partial indirect I/O /// MixedIo = 0x04 } diff --git a/DiscImageChef.Devices/Linux/ListDevices.cs b/DiscImageChef.Devices/Linux/ListDevices.cs index 01e158be..62e3ccfd 100644 --- a/DiscImageChef.Devices/Linux/ListDevices.cs +++ b/DiscImageChef.Devices/Linux/ListDevices.cs @@ -41,7 +41,7 @@ namespace DiscImageChef.Devices.Linux const string PATH_SYS_DEVBLOCK = "/sys/block/"; /// - /// Gets a list of all known storage devices on Linux + /// Gets a list of all known storage devices on Linux /// /// List of devices internal static DeviceInfo[] GetList() @@ -65,8 +65,8 @@ namespace DiscImageChef.Devices.Linux if(hasUdev) { - IntPtr udevDev = Extern.udev_device_new_from_subsystem_sysname(udev, "block", - Path.GetFileName(sysdevs[i])); + IntPtr udevDev = + Extern.udev_device_new_from_subsystem_sysname(udev, "block", Path.GetFileName(sysdevs[i])); devices[i].Vendor = Extern.udev_device_get_property_value(udevDev, "ID_VENDOR"); devices[i].Model = Extern.udev_device_get_property_value(udevDev, "ID_MODEL"); if(!string.IsNullOrEmpty(devices[i].Model)) devices[i].Model = devices[i].Model.Replace('_', ' '); diff --git a/DiscImageChef.Devices/Linux/Structs.cs b/DiscImageChef.Devices/Linux/Structs.cs index 26319635..de1396dc 100644 --- a/DiscImageChef.Devices/Linux/Structs.cs +++ b/DiscImageChef.Devices/Linux/Structs.cs @@ -42,7 +42,7 @@ namespace DiscImageChef.Devices.Linux struct SgIoHdrT { /// - /// Always 'S' for SG v3 + /// Always 'S' for SG v3 /// public int interface_id; /* [i] 'S' (required) */ public ScsiIoctlDirection dxfer_direction; /* [i] */ @@ -73,54 +73,54 @@ namespace DiscImageChef.Devices.Linux struct MmcIocCmd { /// - /// Implies direction of data. true = write, false = read + /// Implies direction of data. true = write, false = read /// public bool write_flag; /// - /// Application-specific command. true = precede with CMD55 + /// Application-specific command. true = precede with CMD55 /// public bool is_ascmd; public uint opcode; public uint arg; /// - /// CMD response + /// CMD response /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public uint[] response; public MmcFlags flags; public uint blksz; public uint blocks; /// - /// Sleep at least useconds, and at most - /// useconds *after* issuing command.Needed for - /// some read commands for which cards have no other way of indicating - /// they're ready for the next command (i.e. there is no equivalent of - /// a "busy" indicator for read operations). + /// Sleep at least useconds, and at most + /// useconds *after* issuing command.Needed for + /// some read commands for which cards have no other way of indicating + /// they're ready for the next command (i.e. there is no equivalent of + /// a "busy" indicator for read operations). /// public uint postsleep_min_us; /// - /// Sleep at least useconds, and at most - /// useconds *after* issuing command.Needed for - /// some read commands for which cards have no other way of indicating - /// they're ready for the next command (i.e. there is no equivalent of - /// a "busy" indicator for read operations). + /// Sleep at least useconds, and at most + /// useconds *after* issuing command.Needed for + /// some read commands for which cards have no other way of indicating + /// they're ready for the next command (i.e. there is no equivalent of + /// a "busy" indicator for read operations). /// public uint postsleep_max_us; /// - /// Override driver-computed timeouts. + /// Override driver-computed timeouts. /// public uint data_timeout_ns; /// - /// Override driver-computed timeouts. + /// Override driver-computed timeouts. /// public uint cmd_timeout_ms; /// - /// For 64-bit machines , wants to - /// be 8-byte aligned.Make sure this struct is the same size when - /// built for 32-bit. + /// For 64-bit machines , wants to + /// be 8-byte aligned.Make sure this struct is the same size when + /// built for 32-bit. /// public uint __pad; /// - /// DAT buffer + /// DAT buffer /// public ulong data_ptr; } diff --git a/DiscImageChef.Devices/Windows/Command.cs b/DiscImageChef.Devices/Windows/Command.cs index 260a10ea..1f701873 100644 --- a/DiscImageChef.Devices/Windows/Command.cs +++ b/DiscImageChef.Devices/Windows/Command.cs @@ -44,7 +44,7 @@ namespace DiscImageChef.Devices.Windows static class Command { /// - /// Sends a SCSI command + /// Sends a SCSI command /// /// 0 if no error occurred, otherwise, errno /// File handle @@ -54,7 +54,10 @@ namespace DiscImageChef.Devices.Windows /// Timeout in seconds /// SCSI command transfer direction /// Time it took to execute the command in milliseconds - /// True if SCSI error returned non-OK status and contains SCSI sense + /// + /// True if SCSI error returned non-OK status and contains SCSI + /// sense + /// internal static int SendScsiCommand(SafeFileHandle fd, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, ScsiIoctlDirection direction, out double duration, out bool sense) @@ -111,7 +114,7 @@ namespace DiscImageChef.Devices.Windows } /// - /// Sends an ATA command in CHS mode + /// Sends an ATA command in CHS mode /// /// 0 if no error occurred, otherwise, errno /// File handle @@ -157,13 +160,16 @@ namespace DiscImageChef.Devices.Windows dataBuffer = new byte[64 * 512] }; - switch(protocol) { + switch(protocol) + { case AtaProtocol.PioIn: case AtaProtocol.UDmaIn: - case AtaProtocol.Dma: aptdBuf.aptd.AtaFlags = AtaFlags.DataIn; + case AtaProtocol.Dma: + aptdBuf.aptd.AtaFlags = AtaFlags.DataIn; break; case AtaProtocol.PioOut: - case AtaProtocol.UDmaOut: aptdBuf.aptd.AtaFlags = AtaFlags.DataOut; + case AtaProtocol.UDmaOut: + aptdBuf.aptd.AtaFlags = AtaFlags.DataOut; break; } @@ -212,7 +218,7 @@ namespace DiscImageChef.Devices.Windows } /// - /// Sends an ATA command in 28-bit LBA mode + /// Sends an ATA command in 28-bit LBA mode /// /// 0 if no error occurred, otherwise, errno /// File handle @@ -258,13 +264,16 @@ namespace DiscImageChef.Devices.Windows dataBuffer = new byte[64 * 512] }; - switch(protocol) { + switch(protocol) + { case AtaProtocol.PioIn: case AtaProtocol.UDmaIn: - case AtaProtocol.Dma: aptdBuf.aptd.AtaFlags = AtaFlags.DataIn; + case AtaProtocol.Dma: + aptdBuf.aptd.AtaFlags = AtaFlags.DataIn; break; case AtaProtocol.PioOut: - case AtaProtocol.UDmaOut: aptdBuf.aptd.AtaFlags = AtaFlags.DataOut; + case AtaProtocol.UDmaOut: + aptdBuf.aptd.AtaFlags = AtaFlags.DataOut; break; } @@ -313,7 +322,7 @@ namespace DiscImageChef.Devices.Windows } /// - /// Sends an ATA command in 48-bit LBA mode + /// Sends an ATA command in 48-bit LBA mode /// /// 0 if no error occurred, otherwise, errno /// File handle @@ -367,13 +376,16 @@ namespace DiscImageChef.Devices.Windows dataBuffer = new byte[64 * 512] }; - switch(protocol) { + switch(protocol) + { case AtaProtocol.PioIn: case AtaProtocol.UDmaIn: - case AtaProtocol.Dma: aptdBuf.aptd.AtaFlags = AtaFlags.DataIn; + case AtaProtocol.Dma: + aptdBuf.aptd.AtaFlags = AtaFlags.DataIn; break; case AtaProtocol.PioOut: - case AtaProtocol.UDmaOut: aptdBuf.aptd.AtaFlags = AtaFlags.DataOut; + case AtaProtocol.UDmaOut: + aptdBuf.aptd.AtaFlags = AtaFlags.DataOut; break; } @@ -426,7 +438,7 @@ namespace DiscImageChef.Devices.Windows } /// - /// Sends an ATA command in CHS mode using undocumented Windows XP ioctl + /// Sends an ATA command in CHS mode using undocumented Windows XP ioctl /// /// 0 if no error occurred, otherwise, errno /// File handle @@ -495,7 +507,7 @@ namespace DiscImageChef.Devices.Windows } /// - /// Sends an ATA command in 28-bit LBA mode using undocumented Windows XP ioctl + /// Sends an ATA command in 28-bit LBA mode using undocumented Windows XP ioctl /// /// 0 if no error occurred, otherwise, errno /// File handle @@ -564,7 +576,7 @@ namespace DiscImageChef.Devices.Windows } /// - /// Gets the device number for a specified handle + /// Gets the device number for a specified handle /// /// Device handle /// Device number @@ -580,7 +592,7 @@ namespace DiscImageChef.Devices.Windows } /// - /// Gets the internal device path for a specified handle + /// Gets the internal device path for a specified handle /// /// Device handle /// Device path @@ -658,7 +670,7 @@ namespace DiscImageChef.Devices.Windows } /// - /// Returns true if the specified handle is controlled by a SFFDISK (aka SDHCI) driver + /// Returns true if the specified handle is controlled by a SFFDISK (aka SDHCI) driver /// /// Device handle /// true if SDHCI, false otherwise @@ -672,7 +684,7 @@ namespace DiscImageChef.Devices.Windows } /// - /// Sends a MMC/SD command + /// Sends a MMC/SD command /// /// The result of the command. /// File handle @@ -722,7 +734,7 @@ namespace DiscImageChef.Devices.Windows if(flags.HasFlag(MmcFlags.ResponseR6)) commandDescriptor.responseType = SdResponseType.R6; byte[] commandB = new byte[commandData.size + commandData.protocolArgumentSize + - commandData.deviceDataBufferSize]; + commandData.deviceDataBufferSize]; IntPtr hBuf = Marshal.AllocHGlobal(commandB.Length); Marshal.StructureToPtr(commandData, hBuf, true); IntPtr descriptorOffset = new IntPtr(hBuf.ToInt32() + commandData.size); @@ -732,9 +744,8 @@ namespace DiscImageChef.Devices.Windows int error = 0; DateTime start = DateTime.Now; - sense = !Extern.DeviceIoControl(fd, WindowsIoctl.IoctlSffdiskDeviceCommand, commandB, - (uint)commandB.Length, commandB, (uint)commandB.Length, - out _, IntPtr.Zero); + sense = !Extern.DeviceIoControl(fd, WindowsIoctl.IoctlSffdiskDeviceCommand, commandB, (uint)commandB.Length, + commandB, (uint)commandB.Length, out _, IntPtr.Zero); DateTime end = DateTime.Now; if(sense) error = Marshal.GetLastWin32Error(); diff --git a/DiscImageChef.Devices/Windows/Enums.cs b/DiscImageChef.Devices/Windows/Enums.cs index a3a7b714..92077cb7 100644 --- a/DiscImageChef.Devices/Windows/Enums.cs +++ b/DiscImageChef.Devices/Windows/Enums.cs @@ -40,142 +40,142 @@ namespace DiscImageChef.Devices.Windows enum FileAttributes : uint { /// - /// FILE_ATTRIBUTE_ARCHIVE + /// FILE_ATTRIBUTE_ARCHIVE /// Archive = 0x20, /// - /// FILE_ATTRIBUTE_COMPRESSED + /// FILE_ATTRIBUTE_COMPRESSED /// Compressed = 0x800, /// - /// FILE_ATTRIBUTE_DEVICE + /// FILE_ATTRIBUTE_DEVICE /// Device = 0x40, /// - /// FILE_ATTRIBUTE_DIRECTORY + /// FILE_ATTRIBUTE_DIRECTORY /// Directory = 0x10, /// - /// FILE_ATTRIBUTE_ENCRYPTED + /// FILE_ATTRIBUTE_ENCRYPTED /// Encrypted = 0x4000, /// - /// FILE_ATTRIBUTE_HIDDEN + /// FILE_ATTRIBUTE_HIDDEN /// Hidden = 0x02, /// - /// FILE_ATTRIBUTE_INTEGRITY_STREAM + /// FILE_ATTRIBUTE_INTEGRITY_STREAM /// IntegrityStream = 0x8000, /// - /// FILE_ATTRIBUTE_NORMAL + /// FILE_ATTRIBUTE_NORMAL /// Normal = 0x80, /// - /// FILE_ATTRIBUTE_NOT_CONTENT_INDEXED + /// FILE_ATTRIBUTE_NOT_CONTENT_INDEXED /// NotContentIndexed = 0x2000, /// - /// FILE_ATTRIBUTE_NO_SCRUB_DATA + /// FILE_ATTRIBUTE_NO_SCRUB_DATA /// NoScrubData = 0x20000, /// - /// FILE_ATTRIBUTE_OFFLINE + /// FILE_ATTRIBUTE_OFFLINE /// Offline = 0x1000, /// - /// FILE_ATTRIBUTE_READONLY + /// FILE_ATTRIBUTE_READONLY /// Readonly = 0x01, /// - /// FILE_ATTRIBUTE_REPARSE_POINT + /// FILE_ATTRIBUTE_REPARSE_POINT /// ReparsePoint = 0x400, /// - /// FILE_ATTRIBUTE_SPARSE_FILE + /// FILE_ATTRIBUTE_SPARSE_FILE /// SparseFile = 0x200, /// - /// FILE_ATTRIBUTE_SYSTEM + /// FILE_ATTRIBUTE_SYSTEM /// System = 0x04, /// - /// FILE_ATTRIBUTE_TEMPORARY + /// FILE_ATTRIBUTE_TEMPORARY /// Temporary = 0x100, /// - /// FILE_ATTRIBUTE_VIRTUAL + /// FILE_ATTRIBUTE_VIRTUAL /// Virtual = 0x10000, /// - /// FILE_FLAG_BACKUP_SEMANTICS + /// FILE_FLAG_BACKUP_SEMANTICS /// BackupSemantics = 0x02000000, /// - /// FILE_FLAG_DELETE_ON_CLOSE + /// FILE_FLAG_DELETE_ON_CLOSE /// DeleteOnClose = 0x04000000, /// - /// FILE_FLAG_NO_BUFFERING + /// FILE_FLAG_NO_BUFFERING /// NoBuffering = 0x20000000, /// - /// FILE_FLAG_OPEN_NO_RECALL + /// FILE_FLAG_OPEN_NO_RECALL /// OpenNoRecall = 0x00100000, /// - /// FILE_FLAG_OPEN_REPARSE_POINT + /// FILE_FLAG_OPEN_REPARSE_POINT /// OpenReparsePoint = 0x00200000, /// - /// FILE_FLAG_OVERLAPPED + /// FILE_FLAG_OVERLAPPED /// Overlapped = 0x40000000, /// - /// FILE_FLAG_POSIX_SEMANTICS + /// FILE_FLAG_POSIX_SEMANTICS /// PosixSemantics = 0x0100000, /// - /// FILE_FLAG_RANDOM_ACCESS + /// FILE_FLAG_RANDOM_ACCESS /// RandomAccess = 0x10000000, /// - /// FILE_FLAG_SESSION_AWARE + /// FILE_FLAG_SESSION_AWARE /// SessionAware = 0x00800000, /// - /// FILE_FLAG_SEQUENTIAL_SCAN + /// FILE_FLAG_SEQUENTIAL_SCAN /// SequentialScan = 0x08000000, /// - /// FILE_FLAG_WRITE_THROUGH + /// FILE_FLAG_WRITE_THROUGH /// WriteThrough = 0x80000000 } @@ -184,75 +184,75 @@ namespace DiscImageChef.Devices.Windows enum FileAccess : uint { /// - /// FILE_READ_DATA + /// FILE_READ_DATA /// ReadData = 0x0001, /// - /// FILE_LIST_DIRECTORY + /// FILE_LIST_DIRECTORY /// ListDirectory = ReadData, /// - /// FILE_WRITE_DATA + /// FILE_WRITE_DATA /// WriteData = 0x0002, /// - /// FILE_ADD_FILE + /// FILE_ADD_FILE /// AddFile = WriteData, /// - /// FILE_APPEND_DATA + /// FILE_APPEND_DATA /// AppendData = 0x0004, /// - /// FILE_ADD_SUBDIRECTORY + /// FILE_ADD_SUBDIRECTORY /// AddSubdirectory = AppendData, /// - /// FILE_CREATE_PIPE_INSTANCE + /// FILE_CREATE_PIPE_INSTANCE /// CreatePipeInstance = AppendData, /// - /// FILE_READ_EA + /// FILE_READ_EA /// ReadEa = 0x0008, /// - /// FILE_WRITE_EA + /// FILE_WRITE_EA /// WriteEa = 0x0010, /// - /// FILE_EXECUTE + /// FILE_EXECUTE /// Execute = 0x0020, /// - /// FILE_TRAVERSE + /// FILE_TRAVERSE /// Traverse = Execute, /// - /// FILE_DELETE_CHILD + /// FILE_DELETE_CHILD /// DeleteChild = 0x0040, /// - /// FILE_READ_ATTRIBUTES + /// FILE_READ_ATTRIBUTES /// ReadAttributes = 0x0080, /// - /// FILE_WRITE_ATTRIBUTES + /// FILE_WRITE_ATTRIBUTES /// WriteAttributes = 0x0100, /// - /// GENERIC_READ + /// GENERIC_READ /// GenericRead = 0x80000000, /// - /// GENERIC_WRITE + /// GENERIC_WRITE /// GenericWrite = 0x40000000, /// - /// GENERIC_EXECUTE + /// GENERIC_EXECUTE /// GenericExecute = 0x20000000, /// - /// GENERIC_ALL + /// GENERIC_ALL /// GenericAll = 0x10000000 } @@ -261,19 +261,19 @@ namespace DiscImageChef.Devices.Windows enum FileShare : uint { /// - /// FILE_SHARE_NONE + /// FILE_SHARE_NONE /// None = 0x00, /// - /// FILE_SHARE_READ + /// FILE_SHARE_READ /// Read = 0x01, /// - /// FILE_SHARE_WRITE + /// FILE_SHARE_WRITE /// Write = 0x02, /// - /// FILE_SHARE_DELETE + /// FILE_SHARE_DELETE /// Delete = 0x03 } @@ -282,45 +282,45 @@ namespace DiscImageChef.Devices.Windows enum FileMode : uint { /// - /// NEW + /// NEW /// New = 0x01, /// - /// CREATE_ALWAYS + /// CREATE_ALWAYS /// CreateAlways = 0x02, /// - /// OPEN_EXISTING + /// OPEN_EXISTING /// OpenExisting = 0x03, /// - /// OPEN_ALWAYS + /// OPEN_ALWAYS /// OpenAlways = 0x04, /// - /// TRUNCATE_EXISTING + /// TRUNCATE_EXISTING /// TruncateExisting = 0x05 } /// - /// Direction of SCSI transfer + /// Direction of SCSI transfer /// enum ScsiIoctlDirection : byte { /// - /// From host to device - /// SCSI_IOCTL_DATA_OUT + /// From host to device + /// SCSI_IOCTL_DATA_OUT /// Out = 0, /// - /// From device to host - /// SCSI_IOCTL_DATA_IN + /// From device to host + /// SCSI_IOCTL_DATA_IN /// In = 1, /// - /// Unspecified direction, or bidirectional, or no data - /// SCSI_IOCTL_DATA_UNSPECIFIED + /// Unspecified direction, or bidirectional, or no data + /// SCSI_IOCTL_DATA_UNSPECIFIED /// Unspecified = 2 } @@ -330,15 +330,15 @@ namespace DiscImageChef.Devices.Windows IoctlAtaPassThrough = 0x4D02C, IoctlAtaPassThroughDirect = 0x4D030, /// - /// ScsiPassThrough + /// ScsiPassThrough /// IoctlScsiPassThrough = 0x4D004, /// - /// ScsiPassThroughDirect + /// ScsiPassThroughDirect /// IoctlScsiPassThroughDirect = 0x4D014, /// - /// ScsiGetAddress + /// ScsiGetAddress /// IoctlScsiGetAddress = 0x41018, IoctlStorageQueryProperty = 0x2D1400, @@ -352,27 +352,27 @@ namespace DiscImageChef.Devices.Windows enum AtaFlags : ushort { /// - /// ATA_FLAGS_DRDY_REQUIRED + /// ATA_FLAGS_DRDY_REQUIRED /// DrdyRequired = 0x01, /// - /// ATA_FLAGS_DATA_IN + /// ATA_FLAGS_DATA_IN /// DataIn = 0x02, /// - /// ATA_FLAGS_DATA_OUT + /// ATA_FLAGS_DATA_OUT /// DataOut = 0x04, /// - /// ATA_FLAGS_48BIT_COMMAND + /// ATA_FLAGS_48BIT_COMMAND /// ExtendedCommand = 0x08, /// - /// ATA_FLAGS_USE_DMA + /// ATA_FLAGS_USE_DMA /// Dma = 0x10, /// - /// ATA_FLAGS_NO_MULTIPLE + /// ATA_FLAGS_NO_MULTIPLE /// NoMultiple = 0x20 } @@ -430,23 +430,23 @@ namespace DiscImageChef.Devices.Windows enum DeviceGetClassFlags : uint { /// - /// DIGCF_DEFAULT + /// DIGCF_DEFAULT /// Default = 0x01, /// - /// DIGCF_PRESENT + /// DIGCF_PRESENT /// Present = 0x02, /// - /// DIGCF_ALLCLASSES + /// DIGCF_ALLCLASSES /// AllClasses = 0x04, /// - /// DIGCF_PROFILE + /// DIGCF_PROFILE /// Profile = 0x08, /// - /// DIGCF_DEVICEINTERFACE + /// DIGCF_DEVICEINTERFACE /// DeviceInterface = 0x10 } diff --git a/DiscImageChef.Devices/Windows/ListDevices.cs b/DiscImageChef.Devices/Windows/ListDevices.cs index b0fec0bf..e01dda07 100644 --- a/DiscImageChef.Devices/Windows/ListDevices.cs +++ b/DiscImageChef.Devices/Windows/ListDevices.cs @@ -44,7 +44,7 @@ namespace DiscImageChef.Devices.Windows static class ListDevices { /// - /// Converts a hex dump string to the ASCII string it represents + /// Converts a hex dump string to the ASCII string it represents /// /// Hex dump /// Decoded string @@ -53,13 +53,14 @@ namespace DiscImageChef.Devices.Windows StringBuilder result = new StringBuilder(); const string HEXTABLE = "0123456789abcdef"; - for(int i = 0; i < hex.Length / 2; i++) result.Append((char)(16 * HEXTABLE.IndexOf(hex[2 * i]) + HEXTABLE.IndexOf(hex[2 * i + 1]))); + for(int i = 0; i < hex.Length / 2; i++) + result.Append((char)(16 * HEXTABLE.IndexOf(hex[2 * i]) + HEXTABLE.IndexOf(hex[2 * i + 1]))); return result.ToString(); } /// - /// Gets a list of all known storage devices on Windows + /// Gets a list of all known storage devices on Windows /// /// List of devices [SuppressMessage("ReSharper", "RedundantCatchClause")] @@ -159,12 +160,11 @@ namespace DiscImageChef.Devices.Windows if(descriptor.SerialNumberOffset > 0) { info.Serial = - StringHandlers.CToString(descriptorB, Encoding.ASCII, - start: descriptor.SerialNumberOffset); + StringHandlers.CToString(descriptorB, Encoding.ASCII, start: descriptor.SerialNumberOffset); // fix any serial numbers that are returned as hex-strings - if(Array.TrueForAll(info.Serial.ToCharArray(), c => "0123456789abcdef".IndexOf(c) >= 0) - && info.Serial.Length == 40) info.Serial = HexStringToString(info.Serial).Trim(); + if(Array.TrueForAll(info.Serial.ToCharArray(), c => "0123456789abcdef".IndexOf(c) >= 0) && + info.Serial.Length == 40) info.Serial = HexStringToString(info.Serial).Trim(); } if(string.IsNullOrEmpty(info.Vendor) || info.Vendor == "ATA") diff --git a/DiscImageChef.Devices/Windows/Structs.cs b/DiscImageChef.Devices/Windows/Structs.cs index 2fd4b514..9348332f 100644 --- a/DiscImageChef.Devices/Windows/Structs.cs +++ b/DiscImageChef.Devices/Windows/Structs.cs @@ -68,51 +68,51 @@ namespace DiscImageChef.Devices.Windows struct AtaPassThroughDirect { /// - /// Length in bytes of this structure + /// Length in bytes of this structure /// public ushort Length; /// - /// Indicates transfer direction and kind of operation + /// Indicates transfer direction and kind of operation /// [MarshalAs(UnmanagedType.U2)] public AtaFlags AtaFlags; /// - /// Indicates IDE port or bus, set by driver + /// Indicates IDE port or bus, set by driver /// public byte PathId; /// - /// Indicates target device on bus, set by driver + /// Indicates target device on bus, set by driver /// public byte TargetId; /// - /// Indicates logical unit number of device, set by driver + /// Indicates logical unit number of device, set by driver /// public byte Lun; /// - /// Reserved + /// Reserved /// public byte ReservedAsUchar; /// - /// Data transfer length in bytes + /// Data transfer length in bytes /// public uint DataTransferLength; /// - /// Timeout value in seconds + /// Timeout value in seconds /// public uint TimeOutValue; /// - /// Reserved + /// Reserved /// public uint ReservedAsUlong; /// - /// Pointer to data buffer relative to start of this structure + /// Pointer to data buffer relative to start of this structure /// public IntPtr DataBuffer; /// - /// Previous ATA registers, for LBA48 + /// Previous ATA registers, for LBA48 /// public AtaTaskFile PreviousTaskFile; /// - /// ATA registers + /// ATA registers /// public AtaTaskFile CurrentTaskFile; } @@ -185,15 +185,15 @@ namespace DiscImageChef.Devices.Windows struct IdePassThroughDirect { /// - /// ATA registers + /// ATA registers /// public AtaTaskFile CurrentTaskFile; /// - /// Size of data buffer + /// Size of data buffer /// public uint DataBufferSize; /// - /// Data buffer + /// Data buffer /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public byte[] DataBuffer; } diff --git a/DiscImageChef.Devices/Windows/Usb.cs b/DiscImageChef.Devices/Windows/Usb.cs index 957e0947..d55e8f82 100644 --- a/DiscImageChef.Devices/Windows/Usb.cs +++ b/DiscImageChef.Devices/Windows/Usb.cs @@ -42,10 +42,716 @@ namespace DiscImageChef.Devices.Windows { // TODO: Even after cleaning, refactoring and xml-documenting, this code needs some love /// - /// Implements functions for getting and accesing information from the USB bus + /// Implements functions for getting and accesing information from the USB bus /// static partial class Usb { + /// + /// Return a list of USB Host Controllers + /// + /// List of USB Host Controllers + static IEnumerable GetHostControllers() + { + List hostList = new List(); + Guid hostGuid = new Guid(GUID_DEVINTERFACE_HUBCONTROLLER); + + // We start at the "root" of the device tree and look for all + // devices that match the interface GUID of a Hub Controller + IntPtr h = SetupDiGetClassDevs(ref hostGuid, 0, IntPtr.Zero, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE); + if(h.ToInt32() == INVALID_HANDLE_VALUE) return new ReadOnlyCollection(hostList); + + IntPtr ptrBuf = Marshal.AllocHGlobal(BUFFER_SIZE); + bool success; + int i = 0; + do + { + UsbController host = new UsbController {ControllerIndex = i}; + + // create a Device Interface Data structure + SpDeviceInterfaceData dia = new SpDeviceInterfaceData(); + dia.cbSize = Marshal.SizeOf(dia); + + // start the enumeration + success = SetupDiEnumDeviceInterfaces(h, IntPtr.Zero, ref hostGuid, i, ref dia); + if(success) + { + // build a DevInfo Data structure + SpDevinfoData da = new SpDevinfoData(); + da.cbSize = Marshal.SizeOf(da); + + // build a Device Interface Detail Data structure + SpDeviceInterfaceDetailData didd = + new SpDeviceInterfaceDetailData {cbSize = 4 + Marshal.SystemDefaultCharSize}; + // trust me :) + + // now we can get some more detailed information + int nRequiredSize = 0; + const int N_BYTES = BUFFER_SIZE; + if(SetupDiGetDeviceInterfaceDetail(h, ref dia, ref didd, N_BYTES, ref nRequiredSize, ref da)) + { + host.ControllerDevicePath = didd.DevicePath; + + // get the Device Description and DriverKeyName + int requiredSize = 0; + int regType = REG_SZ; + + if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DEVICEDESC, ref regType, ptrBuf, + BUFFER_SIZE, ref requiredSize)) + host.ControllerDeviceDesc = Marshal.PtrToStringAuto(ptrBuf); + if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DRIVER, ref regType, ptrBuf, BUFFER_SIZE, + ref requiredSize)) + host.ControllerDriverKeyName = Marshal.PtrToStringAuto(ptrBuf); + } + hostList.Add(host); + } + i++; + } + while(success); + + Marshal.FreeHGlobal(ptrBuf); + SetupDiDestroyDeviceInfoList(h); + + // convert it into a Collection + return new ReadOnlyCollection(hostList); + } + + /// + /// private function for finding a USB device's Description + /// + /// Device driver key name + /// USB device description + static string GetDescriptionByKeyName(string driverKeyName) + { + string ans = ""; + const string DEV_ENUM = REGSTR_KEY_USB; + + // Use the "enumerator form" of the SetupDiGetClassDevs API + // to generate a list of all USB devices + IntPtr h = SetupDiGetClassDevs(0, DEV_ENUM, IntPtr.Zero, DIGCF_PRESENT | DIGCF_ALLCLASSES); + if(h.ToInt32() == INVALID_HANDLE_VALUE) return ans; + + IntPtr ptrBuf = Marshal.AllocHGlobal(BUFFER_SIZE); + + bool success; + int i = 0; + do + { + // create a Device Interface Data structure + SpDevinfoData da = new SpDevinfoData(); + da.cbSize = Marshal.SizeOf(da); + + // start the enumeration + success = SetupDiEnumDeviceInfo(h, i, ref da); + if(success) + { + int requiredSize = 0; + int regType = REG_SZ; + string keyName = ""; + + if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DRIVER, ref regType, ptrBuf, BUFFER_SIZE, + ref requiredSize)) keyName = Marshal.PtrToStringAuto(ptrBuf); + + // is it a match? + if(keyName == driverKeyName) + { + if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DEVICEDESC, ref regType, ptrBuf, + BUFFER_SIZE, ref requiredSize)) + ans = Marshal.PtrToStringAuto(ptrBuf); + break; + } + } + + i++; + } + while(success); + + Marshal.FreeHGlobal(ptrBuf); + SetupDiDestroyDeviceInfoList(h); + + return ans; + } + + /// + /// private function for finding a USB device's Instance ID + /// + /// Device driver key name + /// Device instance ID + static string GetInstanceIdByKeyName(string driverKeyName) + { + string ans = ""; + const string DEV_ENUM = REGSTR_KEY_USB; + + // Use the "enumerator form" of the SetupDiGetClassDevs API + // to generate a list of all USB devices + IntPtr h = SetupDiGetClassDevs(0, DEV_ENUM, IntPtr.Zero, DIGCF_PRESENT | DIGCF_ALLCLASSES); + if(h.ToInt32() == INVALID_HANDLE_VALUE) return ans; + + IntPtr ptrBuf = Marshal.AllocHGlobal(BUFFER_SIZE); + + bool success; + int i = 0; + do + { + // create a Device Interface Data structure + SpDevinfoData da = new SpDevinfoData(); + da.cbSize = Marshal.SizeOf(da); + + // start the enumeration + success = SetupDiEnumDeviceInfo(h, i, ref da); + if(success) + { + int requiredSize = 0; + int regType = REG_SZ; + + string keyName = ""; + if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DRIVER, ref regType, ptrBuf, BUFFER_SIZE, + ref requiredSize)) keyName = Marshal.PtrToStringAuto(ptrBuf); + + // is it a match? + if(keyName == driverKeyName) + { + const int N_BYTES = BUFFER_SIZE; + StringBuilder sb = new StringBuilder(N_BYTES); + SetupDiGetDeviceInstanceId(h, ref da, sb, N_BYTES, out requiredSize); + ans = sb.ToString(); + break; + } + } + + i++; + } + while(success); + + Marshal.FreeHGlobal(ptrBuf); + SetupDiDestroyDeviceInfoList(h); + + return ans; + } + + /// + /// Represents a USB Host Controller + /// + class UsbController + { + internal string ControllerDriverKeyName, ControllerDevicePath, ControllerDeviceDesc; + internal int ControllerIndex; + + /// + /// A simple default constructor + /// + internal UsbController() + { + ControllerIndex = 0; + ControllerDevicePath = ""; + ControllerDeviceDesc = ""; + ControllerDriverKeyName = ""; + } + + /// Return the index of the instance + internal int Index => ControllerIndex; + + /// + /// Return the Device Path, such as "\\?\pci#ven_10de&dev_005a&subsys_815a1043&rev_a2#3&267a616a&0& + /// 58#{3abf6f2d-71c4-462a-8a92-1e6861e6af27}" + /// + internal string DevicePath => ControllerDevicePath; + + /// The DriverKeyName may be useful as a search key + internal string DriverKeyName => ControllerDriverKeyName; + + /// Return the Friendly Name, such as "VIA USB Enhanced Host Controller" + internal string Name => ControllerDeviceDesc; + + /// Return Root Hub for this Controller + internal UsbHub GetRootHub() + { + IntPtr h, h2; + UsbHub root = new UsbHub {HubIsRootHub = true, HubDeviceDesc = "Root Hub"}; + + // Open a handle to the Host Controller + h = CreateFile(ControllerDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, + IntPtr.Zero); + if(h.ToInt32() == INVALID_HANDLE_VALUE) return root; + + UsbRootHubName hubName = new UsbRootHubName(); + int nBytes = Marshal.SizeOf(hubName); + IntPtr ptrHubName = Marshal.AllocHGlobal(nBytes); + + // get the Hub Name + if(DeviceIoControl(h, IOCTL_USB_GET_ROOT_HUB_NAME, ptrHubName, nBytes, ptrHubName, nBytes, out _, + IntPtr.Zero)) + { + hubName = (UsbRootHubName)Marshal.PtrToStructure(ptrHubName, typeof(UsbRootHubName)); + root.HubDevicePath = @"\\.\" + hubName.RootHubName; + } + + // TODO: Get DriverKeyName for Root Hub + + // Now let's open the Hub (based upon the HubName we got above) + h2 = CreateFile(root.HubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, + IntPtr.Zero); + if(h2.ToInt32() != INVALID_HANDLE_VALUE) + { + UsbNodeInformation nodeInfo = new UsbNodeInformation {NodeType = (int)UsbHubNode.UsbHub}; + nBytes = Marshal.SizeOf(nodeInfo); + IntPtr ptrNodeInfo = Marshal.AllocHGlobal(nBytes); + Marshal.StructureToPtr(nodeInfo, ptrNodeInfo, true); + + // get the Hub Information + if(DeviceIoControl(h2, IOCTL_USB_GET_NODE_INFORMATION, ptrNodeInfo, nBytes, ptrNodeInfo, nBytes, + out _, IntPtr.Zero)) + { + nodeInfo = (UsbNodeInformation)Marshal.PtrToStructure(ptrNodeInfo, typeof(UsbNodeInformation)); + root.HubIsBusPowered = Convert.ToBoolean(nodeInfo.HubInformation.HubIsBusPowered); + root.HubPortCount = nodeInfo.HubInformation.HubDescriptor.bNumberOfPorts; + } + Marshal.FreeHGlobal(ptrNodeInfo); + CloseHandle(h2); + } + + Marshal.FreeHGlobal(ptrHubName); + CloseHandle(h); + return root; + } + } + + /// The Hub class + internal class UsbHub + { + internal string HubDriverKey, HubDevicePath, HubDeviceDesc; + internal bool HubIsBusPowered, HubIsRootHub; + internal string HubManufacturer, HubProduct, HubSerialNumber, HubInstanceId; + internal int HubPortCount; + + /// a simple default constructor + internal UsbHub() + { + HubPortCount = 0; + HubDevicePath = ""; + HubDeviceDesc = ""; + HubDriverKey = ""; + HubIsBusPowered = false; + HubIsRootHub = false; + HubManufacturer = ""; + HubProduct = ""; + HubSerialNumber = ""; + HubInstanceId = ""; + } + + /// return Port Count + internal int PortCount => HubPortCount; + + /// + /// return the Device Path, such as "\\?\pci#ven_10de&dev_005a&subsys_815a1043&rev_a2#3&267a616a&0& + /// 58#{3abf6f2d-71c4-462a-8a92-1e6861e6af27}" + /// + internal string DevicePath => HubDevicePath; + + /// The DriverKey may be useful as a search key + internal string DriverKey => HubDriverKey; + + /// return the Friendly Name, such as "VIA USB Enhanced Host Controller" + internal string Name => HubDeviceDesc; + + /// the device path of this device + internal string InstanceId => HubInstanceId; + + /// is is this a self-powered hub? + internal bool IsBusPowered => HubIsBusPowered; + + /// is this a root hub? + internal bool IsRootHub => HubIsRootHub; + + internal string Manufacturer => HubManufacturer; + + internal string Product => HubProduct; + + internal string SerialNumber => HubSerialNumber; + + /// + /// return a list of the down stream ports + /// + /// List of downstream ports + internal IEnumerable GetPorts() + { + List portList = new List(); + + // Open a handle to the Hub device + IntPtr h = CreateFile(HubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, + IntPtr.Zero); + if(h.ToInt32() == INVALID_HANDLE_VALUE) return new ReadOnlyCollection(portList); + + int nBytes = Marshal.SizeOf(typeof(UsbNodeConnectionInformationEx)); + IntPtr ptrNodeConnection = Marshal.AllocHGlobal(nBytes); + + // loop thru all of the ports on the hub + // BTW: Ports are numbered starting at 1 + for(int i = 1; i <= HubPortCount; i++) + { + UsbNodeConnectionInformationEx nodeConnection = + new UsbNodeConnectionInformationEx {ConnectionIndex = i}; + Marshal.StructureToPtr(nodeConnection, ptrNodeConnection, true); + + if(!DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX, ptrNodeConnection, nBytes, + ptrNodeConnection, nBytes, out _, IntPtr.Zero)) continue; + + nodeConnection = + (UsbNodeConnectionInformationEx)Marshal.PtrToStructure(ptrNodeConnection, + typeof(UsbNodeConnectionInformationEx)); + + // load up the USBPort class + UsbPort port = new UsbPort + { + PortPortNumber = i, + PortHubDevicePath = HubDevicePath, + PortStatus = ((UsbConnectionStatus)nodeConnection.ConnectionStatus).ToString(), + PortSpeed = ((UsbDeviceSpeed)nodeConnection.Speed).ToString(), + PortIsDeviceConnected = + nodeConnection.ConnectionStatus == (int)UsbConnectionStatus.DeviceConnected, + PortIsHub = Convert.ToBoolean(nodeConnection.DeviceIsHub), + PortDeviceDescriptor = nodeConnection.DeviceDescriptor + }; + + // add it to the list + portList.Add(port); + } + + Marshal.FreeHGlobal(ptrNodeConnection); + CloseHandle(h); + // convert it into a Collection + return new ReadOnlyCollection(portList); + } + } + + /// + /// Represents an USB port + /// + internal class UsbPort + { + internal UsbDeviceDescriptor PortDeviceDescriptor; + internal bool PortIsHub, PortIsDeviceConnected; + internal int PortPortNumber; + internal string PortStatus, PortHubDevicePath, PortSpeed; + + /// a simple default constructor + internal UsbPort() + { + PortPortNumber = 0; + PortStatus = ""; + PortHubDevicePath = ""; + PortSpeed = ""; + PortIsHub = false; + PortIsDeviceConnected = false; + } + + /// return Port Index of the Hub + internal int PortNumber => PortPortNumber; + + /// return the Device Path of the Hub + internal string HubDevicePath => PortHubDevicePath; + + /// the status (see USB_CONNECTION_STATUS above) + internal string Status => PortStatus; + + /// the speed of the connection (see USB_DEVICE_SPEED above) + internal string Speed => PortSpeed; + + /// is this a downstream external hub? + internal bool IsHub => PortIsHub; + + /// is anybody home? + internal bool IsDeviceConnected => PortIsDeviceConnected; + + /// + /// return a down stream external hub + /// + /// Downstream external hub + internal UsbDevice GetDevice() + { + if(!PortIsDeviceConnected) return null; + + // Copy over some values from the Port class + // Ya know, I've given some thought about making Device a derived class... + UsbDevice device = new UsbDevice + { + DevicePortNumber = PortPortNumber, + DeviceHubDevicePath = PortHubDevicePath, + DeviceDescriptor = PortDeviceDescriptor + }; + + // Open a handle to the Hub device + IntPtr h = CreateFile(PortHubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, + IntPtr.Zero); + if(h.ToInt32() == INVALID_HANDLE_VALUE) return device; + + int nBytesReturned; + int nBytes = BUFFER_SIZE; + // We use this to zero fill a buffer + string nullString = new string((char)0, BUFFER_SIZE / Marshal.SystemDefaultCharSize); + + // The iManufacturer, iProduct and iSerialNumber entries in the + // Device Descriptor are really just indexes. So, we have to + // request a String Descriptor to get the values for those strings. + + if(PortDeviceDescriptor.iManufacturer > 0) + { + // build a request for string descriptor + UsbDescriptorRequest request = new UsbDescriptorRequest + { + ConnectionIndex = PortPortNumber, + SetupPacket = + { + // Language Code + wIndex = 0x409, + wValue = (short)((USB_STRING_DESCRIPTOR_TYPE << 8) + PortDeviceDescriptor.iManufacturer) + } + }; + request.SetupPacket.wLength = (short)(nBytes - Marshal.SizeOf(request)); + // Geez, I wish C# had a Marshal.MemSet() method + IntPtr ptrRequest = Marshal.StringToHGlobalAuto(nullString); + Marshal.StructureToPtr(request, ptrRequest, true); + + // Use an IOCTL call to request the String Descriptor + if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, ptrRequest, + nBytes, out nBytesReturned, IntPtr.Zero)) + { + // The location of the string descriptor is immediately after + // the Request structure. Because this location is not "covered" + // by the structure allocation, we're forced to zero out this + // chunk of memory by using the StringToHGlobalAuto() hack above + IntPtr ptrStringDesc = new IntPtr(ptrRequest.ToInt32() + Marshal.SizeOf(request)); + UsbStringDescriptor stringDesc = + (UsbStringDescriptor)Marshal.PtrToStructure(ptrStringDesc, typeof(UsbStringDescriptor)); + device.DeviceManufacturer = stringDesc.bString; + } + Marshal.FreeHGlobal(ptrRequest); + } + if(PortDeviceDescriptor.iProduct > 0) + { + // build a request for string descriptor + UsbDescriptorRequest request = new UsbDescriptorRequest + { + ConnectionIndex = PortPortNumber, + SetupPacket = + { + // Language Code + wIndex = 0x409, + wValue = (short)((USB_STRING_DESCRIPTOR_TYPE << 8) + PortDeviceDescriptor.iProduct) + } + }; + request.SetupPacket.wLength = (short)(nBytes - Marshal.SizeOf(request)); + // Geez, I wish C# had a Marshal.MemSet() method + IntPtr ptrRequest = Marshal.StringToHGlobalAuto(nullString); + Marshal.StructureToPtr(request, ptrRequest, true); + + // Use an IOCTL call to request the String Descriptor + if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, ptrRequest, + nBytes, out nBytesReturned, IntPtr.Zero)) + { + // the location of the string descriptor is immediately after the Request structure + IntPtr ptrStringDesc = new IntPtr(ptrRequest.ToInt32() + Marshal.SizeOf(request)); + UsbStringDescriptor stringDesc = + (UsbStringDescriptor)Marshal.PtrToStructure(ptrStringDesc, typeof(UsbStringDescriptor)); + device.DeviceProduct = stringDesc.bString; + } + Marshal.FreeHGlobal(ptrRequest); + } + if(PortDeviceDescriptor.iSerialNumber > 0) + { + // build a request for string descriptor + UsbDescriptorRequest request = new UsbDescriptorRequest + { + ConnectionIndex = PortPortNumber, + SetupPacket = + { + // Language Code + wIndex = 0x409, + wValue = (short)((USB_STRING_DESCRIPTOR_TYPE << 8) + PortDeviceDescriptor.iSerialNumber) + } + }; + request.SetupPacket.wLength = (short)(nBytes - Marshal.SizeOf(request)); + // Geez, I wish C# had a Marshal.MemSet() method + IntPtr ptrRequest = Marshal.StringToHGlobalAuto(nullString); + Marshal.StructureToPtr(request, ptrRequest, true); + + // Use an IOCTL call to request the String Descriptor + if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, ptrRequest, + nBytes, out nBytesReturned, IntPtr.Zero)) + { + // the location of the string descriptor is immediately after the Request structure + IntPtr ptrStringDesc = new IntPtr(ptrRequest.ToInt32() + Marshal.SizeOf(request)); + UsbStringDescriptor stringDesc = + (UsbStringDescriptor)Marshal.PtrToStructure(ptrStringDesc, typeof(UsbStringDescriptor)); + device.DeviceSerialNumber = stringDesc.bString; + } + Marshal.FreeHGlobal(ptrRequest); + } + + // build a request for configuration descriptor + UsbDescriptorRequest dcrRequest = new UsbDescriptorRequest + { + ConnectionIndex = PortPortNumber, + SetupPacket = {wIndex = 0, wValue = USB_CONFIGURATION_DESCRIPTOR_TYPE << 8} + }; + dcrRequest.SetupPacket.wLength = (short)(nBytes - Marshal.SizeOf(dcrRequest)); + // Geez, I wish C# had a Marshal.MemSet() method + IntPtr dcrPtrRequest = Marshal.StringToHGlobalAuto(nullString); + Marshal.StructureToPtr(dcrRequest, dcrPtrRequest, true); + + // Use an IOCTL call to request the String Descriptor + if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, dcrPtrRequest, nBytes, + dcrPtrRequest, nBytes, out nBytesReturned, IntPtr.Zero)) + { + IntPtr ptrStringDesc = new IntPtr(dcrPtrRequest.ToInt32() + Marshal.SizeOf(dcrRequest)); + device.BinaryDeviceDescriptors = new byte[nBytesReturned]; + Marshal.Copy(ptrStringDesc, device.BinaryDeviceDescriptors, 0, nBytesReturned); + } + Marshal.FreeHGlobal(dcrPtrRequest); + + // Get the Driver Key Name (usefull in locating a device) + UsbNodeConnectionDriverkeyName driverKey = + new UsbNodeConnectionDriverkeyName {ConnectionIndex = PortPortNumber}; + nBytes = Marshal.SizeOf(driverKey); + IntPtr ptrDriverKey = Marshal.AllocHGlobal(nBytes); + Marshal.StructureToPtr(driverKey, ptrDriverKey, true); + + // Use an IOCTL call to request the Driver Key Name + if(DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME, ptrDriverKey, nBytes, ptrDriverKey, + nBytes, out nBytesReturned, IntPtr.Zero)) + { + driverKey = (UsbNodeConnectionDriverkeyName)Marshal.PtrToStructure(ptrDriverKey, + typeof( + UsbNodeConnectionDriverkeyName + )); + device.DeviceDriverKey = driverKey.DriverKeyName; + + // use the DriverKeyName to get the Device Description and Instance ID + device.DeviceName = GetDescriptionByKeyName(device.DeviceDriverKey); + device.DeviceInstanceId = GetInstanceIdByKeyName(device.DeviceDriverKey); + } + Marshal.FreeHGlobal(ptrDriverKey); + CloseHandle(h); + return device; + } + + /// + /// return a down stream external hub + /// + /// Downstream external hub + internal UsbHub GetHub() + { + if(!PortIsHub) return null; + + UsbHub hub = new UsbHub(); + IntPtr h, h2; + hub.HubIsRootHub = false; + hub.HubDeviceDesc = "External Hub"; + + // Open a handle to the Host Controller + h = CreateFile(PortHubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, + IntPtr.Zero); + if(h.ToInt32() == INVALID_HANDLE_VALUE) return hub; + // Get the DevicePath for downstream hub + UsbNodeConnectionName nodeName = new UsbNodeConnectionName {ConnectionIndex = PortPortNumber}; + int nBytes = Marshal.SizeOf(nodeName); + IntPtr ptrNodeName = Marshal.AllocHGlobal(nBytes); + Marshal.StructureToPtr(nodeName, ptrNodeName, true); + + // Use an IOCTL call to request the Node Name + if(DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_NAME, ptrNodeName, nBytes, ptrNodeName, nBytes, + out _, IntPtr.Zero)) + { + nodeName = (UsbNodeConnectionName)Marshal.PtrToStructure(ptrNodeName, + typeof(UsbNodeConnectionName)); + hub.HubDevicePath = @"\\.\" + nodeName.NodeName; + } + + // Now let's open the Hub (based upon the HubName we got above) + h2 = CreateFile(hub.HubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, + IntPtr.Zero); + if(h2.ToInt32() != INVALID_HANDLE_VALUE) + { + UsbNodeInformation nodeInfo = new UsbNodeInformation {NodeType = (int)UsbHubNode.UsbHub}; + nBytes = Marshal.SizeOf(nodeInfo); + IntPtr ptrNodeInfo = Marshal.AllocHGlobal(nBytes); + Marshal.StructureToPtr(nodeInfo, ptrNodeInfo, true); + + // get the Hub Information + if(DeviceIoControl(h2, IOCTL_USB_GET_NODE_INFORMATION, ptrNodeInfo, nBytes, ptrNodeInfo, nBytes, + out _, IntPtr.Zero)) + { + nodeInfo = (UsbNodeInformation)Marshal.PtrToStructure(ptrNodeInfo, typeof(UsbNodeInformation)); + hub.HubIsBusPowered = Convert.ToBoolean(nodeInfo.HubInformation.HubIsBusPowered); + hub.HubPortCount = nodeInfo.HubInformation.HubDescriptor.bNumberOfPorts; + } + Marshal.FreeHGlobal(ptrNodeInfo); + CloseHandle(h2); + } + + // Fill in the missing Manufacture, Product, and SerialNumber values + // values by just creating a Device instance and copying the values + UsbDevice device = GetDevice(); + hub.HubInstanceId = device.DeviceInstanceId; + hub.HubManufacturer = device.Manufacturer; + hub.HubProduct = device.Product; + hub.HubSerialNumber = device.SerialNumber; + hub.HubDriverKey = device.DriverKey; + + Marshal.FreeHGlobal(ptrNodeName); + CloseHandle(h); + return hub; + } + } + + /// + /// Represents an USB device + /// + internal class UsbDevice + { + internal byte[] BinaryDeviceDescriptors; + internal UsbDeviceDescriptor DeviceDescriptor; + internal string DeviceDriverKey, DeviceHubDevicePath, DeviceInstanceId, DeviceName; + internal string DeviceManufacturer, DeviceProduct, DeviceSerialNumber; + internal int DevicePortNumber; + + /// a simple default constructor + internal UsbDevice() + { + DevicePortNumber = 0; + DeviceHubDevicePath = ""; + DeviceDriverKey = ""; + DeviceManufacturer = ""; + DeviceProduct = "Unknown USB Device"; + DeviceSerialNumber = ""; + DeviceName = ""; + DeviceInstanceId = ""; + BinaryDeviceDescriptors = null; + } + + /// return Port Index of the Hub + internal int PortNumber => DevicePortNumber; + + /// return the Device Path of the Hub (the parent device) + internal string HubDevicePath => DeviceHubDevicePath; + + /// useful as a search key + internal string DriverKey => DeviceDriverKey; + + /// the device path of this device + internal string InstanceId => DeviceInstanceId; + + /// the friendly name + internal string Name => DeviceName; + + internal string Manufacturer => DeviceManufacturer; + + internal string Product => DeviceProduct; + + internal string SerialNumber => DeviceSerialNumber; + + internal byte[] BinaryDescriptors => BinaryDeviceDescriptors; + } + #region "API Region" // ********************** Constants ************************ @@ -269,8 +975,7 @@ namespace DiscImageChef.Devices.Windows [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)] static extern bool SetupDiGetDeviceInterfaceDetail(IntPtr deviceInfoSet, ref SpDeviceInterfaceData deviceInterfaceData, - ref SpDeviceInterfaceDetailData - deviceInterfaceDetailData, + ref SpDeviceInterfaceDetailData deviceInterfaceDetailData, int deviceInterfaceDetailDataSize, ref int requiredSize, ref SpDevinfoData deviceInfoData); @@ -305,711 +1010,5 @@ namespace DiscImageChef.Devices.Windows [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] static extern bool CloseHandle(IntPtr hObject); #endregion - - /// - /// Return a list of USB Host Controllers - /// - /// List of USB Host Controllers - static IEnumerable GetHostControllers() - { - List hostList = new List(); - Guid hostGuid = new Guid(GUID_DEVINTERFACE_HUBCONTROLLER); - - // We start at the "root" of the device tree and look for all - // devices that match the interface GUID of a Hub Controller - IntPtr h = SetupDiGetClassDevs(ref hostGuid, 0, IntPtr.Zero, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE); - if(h.ToInt32() == INVALID_HANDLE_VALUE) - return new ReadOnlyCollection(hostList); - - IntPtr ptrBuf = Marshal.AllocHGlobal(BUFFER_SIZE); - bool success; - int i = 0; - do - { - UsbController host = new UsbController {ControllerIndex = i}; - - // create a Device Interface Data structure - SpDeviceInterfaceData dia = new SpDeviceInterfaceData(); - dia.cbSize = Marshal.SizeOf(dia); - - // start the enumeration - success = SetupDiEnumDeviceInterfaces(h, IntPtr.Zero, ref hostGuid, i, ref dia); - if(success) - { - // build a DevInfo Data structure - SpDevinfoData da = new SpDevinfoData(); - da.cbSize = Marshal.SizeOf(da); - - // build a Device Interface Detail Data structure - SpDeviceInterfaceDetailData didd = - new SpDeviceInterfaceDetailData {cbSize = 4 + Marshal.SystemDefaultCharSize}; - // trust me :) - - // now we can get some more detailed information - int nRequiredSize = 0; - const int N_BYTES = BUFFER_SIZE; - if(SetupDiGetDeviceInterfaceDetail(h, ref dia, ref didd, N_BYTES, ref nRequiredSize, ref da)) - { - host.ControllerDevicePath = didd.DevicePath; - - // get the Device Description and DriverKeyName - int requiredSize = 0; - int regType = REG_SZ; - - if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DEVICEDESC, ref regType, ptrBuf, - BUFFER_SIZE, ref requiredSize)) host.ControllerDeviceDesc = Marshal.PtrToStringAuto(ptrBuf); - if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DRIVER, ref regType, ptrBuf, - BUFFER_SIZE, ref requiredSize)) host.ControllerDriverKeyName = Marshal.PtrToStringAuto(ptrBuf); - } - hostList.Add(host); - } - i++; - } - while(success); - - Marshal.FreeHGlobal(ptrBuf); - SetupDiDestroyDeviceInfoList(h); - - // convert it into a Collection - return new ReadOnlyCollection(hostList); - } - - /// - /// Represents a USB Host Controller - /// - class UsbController - { - internal int ControllerIndex; - internal string ControllerDriverKeyName, ControllerDevicePath, ControllerDeviceDesc; - - /// - /// A simple default constructor - /// - internal UsbController() - { - ControllerIndex = 0; - ControllerDevicePath = ""; - ControllerDeviceDesc = ""; - ControllerDriverKeyName = ""; - } - - /// Return the index of the instance - internal int Index => ControllerIndex; - - /// Return the Device Path, such as "\\?\pci#ven_10de&dev_005a&subsys_815a1043&rev_a2#3&267a616a&0&58#{3abf6f2d-71c4-462a-8a92-1e6861e6af27}" - internal string DevicePath => ControllerDevicePath; - - /// The DriverKeyName may be useful as a search key - internal string DriverKeyName => ControllerDriverKeyName; - - /// Return the Friendly Name, such as "VIA USB Enhanced Host Controller" - internal string Name => ControllerDeviceDesc; - - /// Return Root Hub for this Controller - internal UsbHub GetRootHub() - { - IntPtr h, h2; - UsbHub root = new UsbHub {HubIsRootHub = true, HubDeviceDesc = "Root Hub"}; - - // Open a handle to the Host Controller - h = CreateFile(ControllerDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, - IntPtr.Zero); - if(h.ToInt32() == INVALID_HANDLE_VALUE) return root; - - UsbRootHubName hubName = new UsbRootHubName(); - int nBytes = Marshal.SizeOf(hubName); - IntPtr ptrHubName = Marshal.AllocHGlobal(nBytes); - - // get the Hub Name - if(DeviceIoControl(h, IOCTL_USB_GET_ROOT_HUB_NAME, ptrHubName, nBytes, ptrHubName, nBytes, - out _, IntPtr.Zero)) - { - hubName = (UsbRootHubName)Marshal.PtrToStructure(ptrHubName, typeof(UsbRootHubName)); - root.HubDevicePath = @"\\.\" + hubName.RootHubName; - } - - // TODO: Get DriverKeyName for Root Hub - - // Now let's open the Hub (based upon the HubName we got above) - h2 = CreateFile(root.HubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, - IntPtr.Zero); - if(h2.ToInt32() != INVALID_HANDLE_VALUE) - { - UsbNodeInformation nodeInfo = new UsbNodeInformation {NodeType = (int)UsbHubNode.UsbHub}; - nBytes = Marshal.SizeOf(nodeInfo); - IntPtr ptrNodeInfo = Marshal.AllocHGlobal(nBytes); - Marshal.StructureToPtr(nodeInfo, ptrNodeInfo, true); - - // get the Hub Information - if(DeviceIoControl(h2, IOCTL_USB_GET_NODE_INFORMATION, ptrNodeInfo, nBytes, ptrNodeInfo, nBytes, - out _, IntPtr.Zero)) - { - nodeInfo = (UsbNodeInformation)Marshal.PtrToStructure(ptrNodeInfo, - typeof(UsbNodeInformation)); - root.HubIsBusPowered = Convert.ToBoolean(nodeInfo.HubInformation.HubIsBusPowered); - root.HubPortCount = nodeInfo.HubInformation.HubDescriptor.bNumberOfPorts; - } - Marshal.FreeHGlobal(ptrNodeInfo); - CloseHandle(h2); - } - - Marshal.FreeHGlobal(ptrHubName); - CloseHandle(h); - return root; - } - } - - /// The Hub class - internal class UsbHub - { - internal int HubPortCount; - internal string HubDriverKey, HubDevicePath, HubDeviceDesc; - internal string HubManufacturer, HubProduct, HubSerialNumber, HubInstanceId; - internal bool HubIsBusPowered, HubIsRootHub; - - /// a simple default constructor - internal UsbHub() - { - HubPortCount = 0; - HubDevicePath = ""; - HubDeviceDesc = ""; - HubDriverKey = ""; - HubIsBusPowered = false; - HubIsRootHub = false; - HubManufacturer = ""; - HubProduct = ""; - HubSerialNumber = ""; - HubInstanceId = ""; - } - - /// return Port Count - internal int PortCount => HubPortCount; - - /// return the Device Path, such as "\\?\pci#ven_10de&dev_005a&subsys_815a1043&rev_a2#3&267a616a&0&58#{3abf6f2d-71c4-462a-8a92-1e6861e6af27}" - internal string DevicePath => HubDevicePath; - - /// The DriverKey may be useful as a search key - internal string DriverKey => HubDriverKey; - - /// return the Friendly Name, such as "VIA USB Enhanced Host Controller" - internal string Name => HubDeviceDesc; - - /// the device path of this device - internal string InstanceId => HubInstanceId; - - /// is is this a self-powered hub? - internal bool IsBusPowered => HubIsBusPowered; - - /// is this a root hub? - internal bool IsRootHub => HubIsRootHub; - - internal string Manufacturer => HubManufacturer; - - internal string Product => HubProduct; - - internal string SerialNumber => HubSerialNumber; - - /// - /// return a list of the down stream ports - /// - /// List of downstream ports - internal IEnumerable GetPorts() - { - List portList = new List(); - - // Open a handle to the Hub device - IntPtr h = CreateFile(HubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, - IntPtr.Zero); - if(h.ToInt32() == INVALID_HANDLE_VALUE) - return new ReadOnlyCollection(portList); - - int nBytes = Marshal.SizeOf(typeof(UsbNodeConnectionInformationEx)); - IntPtr ptrNodeConnection = Marshal.AllocHGlobal(nBytes); - - // loop thru all of the ports on the hub - // BTW: Ports are numbered starting at 1 - for(int i = 1; i <= HubPortCount; i++) - { - UsbNodeConnectionInformationEx nodeConnection = - new UsbNodeConnectionInformationEx {ConnectionIndex = i}; - Marshal.StructureToPtr(nodeConnection, ptrNodeConnection, true); - - if(!DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX, ptrNodeConnection, nBytes, - ptrNodeConnection, nBytes, out _, IntPtr.Zero)) continue; - - nodeConnection = - (UsbNodeConnectionInformationEx)Marshal.PtrToStructure(ptrNodeConnection, - typeof( - UsbNodeConnectionInformationEx - )); - - // load up the USBPort class - UsbPort port = new UsbPort - { - PortPortNumber = i, - PortHubDevicePath = HubDevicePath, - PortStatus = ((UsbConnectionStatus)nodeConnection.ConnectionStatus).ToString(), - PortSpeed = ((UsbDeviceSpeed)nodeConnection.Speed).ToString(), - PortIsDeviceConnected = - nodeConnection.ConnectionStatus == (int)UsbConnectionStatus.DeviceConnected, - PortIsHub = Convert.ToBoolean(nodeConnection.DeviceIsHub), - PortDeviceDescriptor = nodeConnection.DeviceDescriptor - }; - - // add it to the list - portList.Add(port); - } - - Marshal.FreeHGlobal(ptrNodeConnection); - CloseHandle(h); - // convert it into a Collection - return new ReadOnlyCollection(portList); - } - } - - /// - /// Represents an USB port - /// - internal class UsbPort - { - internal int PortPortNumber; - internal string PortStatus, PortHubDevicePath, PortSpeed; - internal bool PortIsHub, PortIsDeviceConnected; - internal UsbDeviceDescriptor PortDeviceDescriptor; - - /// a simple default constructor - internal UsbPort() - { - PortPortNumber = 0; - PortStatus = ""; - PortHubDevicePath = ""; - PortSpeed = ""; - PortIsHub = false; - PortIsDeviceConnected = false; - } - - /// return Port Index of the Hub - internal int PortNumber => PortPortNumber; - - /// return the Device Path of the Hub - internal string HubDevicePath => PortHubDevicePath; - - /// the status (see USB_CONNECTION_STATUS above) - internal string Status => PortStatus; - - /// the speed of the connection (see USB_DEVICE_SPEED above) - internal string Speed => PortSpeed; - - /// is this a downstream external hub? - internal bool IsHub => PortIsHub; - - /// is anybody home? - internal bool IsDeviceConnected => PortIsDeviceConnected; - - /// - /// return a down stream external hub - /// - /// Downstream external hub - internal UsbDevice GetDevice() - { - if(!PortIsDeviceConnected) return null; - - // Copy over some values from the Port class - // Ya know, I've given some thought about making Device a derived class... - UsbDevice device = new UsbDevice - { - DevicePortNumber = PortPortNumber, - DeviceHubDevicePath = PortHubDevicePath, - DeviceDescriptor = PortDeviceDescriptor - }; - - // Open a handle to the Hub device - IntPtr h = CreateFile(PortHubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, - IntPtr.Zero); - if(h.ToInt32() == INVALID_HANDLE_VALUE) return device; - - int nBytesReturned; - int nBytes = BUFFER_SIZE; - // We use this to zero fill a buffer - string nullString = new string((char)0, BUFFER_SIZE / Marshal.SystemDefaultCharSize); - - // The iManufacturer, iProduct and iSerialNumber entries in the - // Device Descriptor are really just indexes. So, we have to - // request a String Descriptor to get the values for those strings. - - if(PortDeviceDescriptor.iManufacturer > 0) - { - // build a request for string descriptor - UsbDescriptorRequest request = new UsbDescriptorRequest - { - ConnectionIndex = PortPortNumber, - SetupPacket = - { - // Language Code - wIndex = 0x409, - wValue = (short)((USB_STRING_DESCRIPTOR_TYPE << 8) + PortDeviceDescriptor.iManufacturer) - } - }; - request.SetupPacket.wLength = (short)(nBytes - Marshal.SizeOf(request)); - // Geez, I wish C# had a Marshal.MemSet() method - IntPtr ptrRequest = Marshal.StringToHGlobalAuto(nullString); - Marshal.StructureToPtr(request, ptrRequest, true); - - // Use an IOCTL call to request the String Descriptor - if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, - ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero)) - { - // The location of the string descriptor is immediately after - // the Request structure. Because this location is not "covered" - // by the structure allocation, we're forced to zero out this - // chunk of memory by using the StringToHGlobalAuto() hack above - IntPtr ptrStringDesc = new IntPtr(ptrRequest.ToInt32() + Marshal.SizeOf(request)); - UsbStringDescriptor stringDesc = - (UsbStringDescriptor)Marshal.PtrToStructure(ptrStringDesc, - typeof(UsbStringDescriptor)); - device.DeviceManufacturer = stringDesc.bString; - } - Marshal.FreeHGlobal(ptrRequest); - } - if(PortDeviceDescriptor.iProduct > 0) - { - // build a request for string descriptor - UsbDescriptorRequest request = new UsbDescriptorRequest - { - ConnectionIndex = PortPortNumber, - SetupPacket = - { - // Language Code - wIndex = 0x409, - wValue = (short)((USB_STRING_DESCRIPTOR_TYPE << 8) + PortDeviceDescriptor.iProduct) - } - }; - request.SetupPacket.wLength = (short)(nBytes - Marshal.SizeOf(request)); - // Geez, I wish C# had a Marshal.MemSet() method - IntPtr ptrRequest = Marshal.StringToHGlobalAuto(nullString); - Marshal.StructureToPtr(request, ptrRequest, true); - - // Use an IOCTL call to request the String Descriptor - if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, - ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero)) - { - // the location of the string descriptor is immediately after the Request structure - IntPtr ptrStringDesc = new IntPtr(ptrRequest.ToInt32() + Marshal.SizeOf(request)); - UsbStringDescriptor stringDesc = - (UsbStringDescriptor)Marshal.PtrToStructure(ptrStringDesc, - typeof(UsbStringDescriptor)); - device.DeviceProduct = stringDesc.bString; - } - Marshal.FreeHGlobal(ptrRequest); - } - if(PortDeviceDescriptor.iSerialNumber > 0) - { - // build a request for string descriptor - UsbDescriptorRequest request = new UsbDescriptorRequest - { - ConnectionIndex = PortPortNumber, - SetupPacket = - { - // Language Code - wIndex = 0x409, - wValue = (short)((USB_STRING_DESCRIPTOR_TYPE << 8) + PortDeviceDescriptor.iSerialNumber) - } - }; - request.SetupPacket.wLength = (short)(nBytes - Marshal.SizeOf(request)); - // Geez, I wish C# had a Marshal.MemSet() method - IntPtr ptrRequest = Marshal.StringToHGlobalAuto(nullString); - Marshal.StructureToPtr(request, ptrRequest, true); - - // Use an IOCTL call to request the String Descriptor - if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, - ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero)) - { - // the location of the string descriptor is immediately after the Request structure - IntPtr ptrStringDesc = new IntPtr(ptrRequest.ToInt32() + Marshal.SizeOf(request)); - UsbStringDescriptor stringDesc = - (UsbStringDescriptor)Marshal.PtrToStructure(ptrStringDesc, - typeof(UsbStringDescriptor)); - device.DeviceSerialNumber = stringDesc.bString; - } - Marshal.FreeHGlobal(ptrRequest); - } - - // build a request for configuration descriptor - UsbDescriptorRequest dcrRequest = new UsbDescriptorRequest - { - ConnectionIndex = PortPortNumber, - SetupPacket = {wIndex = 0, wValue = USB_CONFIGURATION_DESCRIPTOR_TYPE << 8} - }; - dcrRequest.SetupPacket.wLength = (short)(nBytes - Marshal.SizeOf(dcrRequest)); - // Geez, I wish C# had a Marshal.MemSet() method - IntPtr dcrPtrRequest = Marshal.StringToHGlobalAuto(nullString); - Marshal.StructureToPtr(dcrRequest, dcrPtrRequest, true); - - // Use an IOCTL call to request the String Descriptor - if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, dcrPtrRequest, nBytes, - dcrPtrRequest, nBytes, out nBytesReturned, IntPtr.Zero)) - { - IntPtr ptrStringDesc = new IntPtr(dcrPtrRequest.ToInt32() + Marshal.SizeOf(dcrRequest)); - device.BinaryDeviceDescriptors = new byte[nBytesReturned]; - Marshal.Copy(ptrStringDesc, device.BinaryDeviceDescriptors, 0, nBytesReturned); - } - Marshal.FreeHGlobal(dcrPtrRequest); - - // Get the Driver Key Name (usefull in locating a device) - UsbNodeConnectionDriverkeyName driverKey = - new UsbNodeConnectionDriverkeyName {ConnectionIndex = PortPortNumber}; - nBytes = Marshal.SizeOf(driverKey); - IntPtr ptrDriverKey = Marshal.AllocHGlobal(nBytes); - Marshal.StructureToPtr(driverKey, ptrDriverKey, true); - - // Use an IOCTL call to request the Driver Key Name - if(DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME, ptrDriverKey, nBytes, - ptrDriverKey, nBytes, out nBytesReturned, IntPtr.Zero)) - { - driverKey = (UsbNodeConnectionDriverkeyName)Marshal.PtrToStructure(ptrDriverKey, - typeof( - UsbNodeConnectionDriverkeyName - )); - device.DeviceDriverKey = driverKey.DriverKeyName; - - // use the DriverKeyName to get the Device Description and Instance ID - device.DeviceName = GetDescriptionByKeyName(device.DeviceDriverKey); - device.DeviceInstanceId = GetInstanceIdByKeyName(device.DeviceDriverKey); - } - Marshal.FreeHGlobal(ptrDriverKey); - CloseHandle(h); - return device; - } - - /// - /// return a down stream external hub - /// - /// Downstream external hub - internal UsbHub GetHub() - { - if(!PortIsHub) return null; - - UsbHub hub = new UsbHub(); - IntPtr h, h2; - hub.HubIsRootHub = false; - hub.HubDeviceDesc = "External Hub"; - - // Open a handle to the Host Controller - h = CreateFile(PortHubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, - IntPtr.Zero); - if(h.ToInt32() == INVALID_HANDLE_VALUE) return hub; - // Get the DevicePath for downstream hub - UsbNodeConnectionName nodeName = new UsbNodeConnectionName {ConnectionIndex = PortPortNumber}; - int nBytes = Marshal.SizeOf(nodeName); - IntPtr ptrNodeName = Marshal.AllocHGlobal(nBytes); - Marshal.StructureToPtr(nodeName, ptrNodeName, true); - - // Use an IOCTL call to request the Node Name - if(DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_NAME, ptrNodeName, nBytes, ptrNodeName, nBytes, - out _, IntPtr.Zero)) - { - nodeName = (UsbNodeConnectionName)Marshal.PtrToStructure(ptrNodeName, - typeof(UsbNodeConnectionName)); - hub.HubDevicePath = @"\\.\" + nodeName.NodeName; - } - - // Now let's open the Hub (based upon the HubName we got above) - h2 = CreateFile(hub.HubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, - IntPtr.Zero); - if(h2.ToInt32() != INVALID_HANDLE_VALUE) - { - UsbNodeInformation nodeInfo = new UsbNodeInformation {NodeType = (int)UsbHubNode.UsbHub}; - nBytes = Marshal.SizeOf(nodeInfo); - IntPtr ptrNodeInfo = Marshal.AllocHGlobal(nBytes); - Marshal.StructureToPtr(nodeInfo, ptrNodeInfo, true); - - // get the Hub Information - if(DeviceIoControl(h2, IOCTL_USB_GET_NODE_INFORMATION, ptrNodeInfo, nBytes, ptrNodeInfo, nBytes, - out _, IntPtr.Zero)) - { - nodeInfo = (UsbNodeInformation)Marshal.PtrToStructure(ptrNodeInfo, - typeof(UsbNodeInformation)); - hub.HubIsBusPowered = Convert.ToBoolean(nodeInfo.HubInformation.HubIsBusPowered); - hub.HubPortCount = nodeInfo.HubInformation.HubDescriptor.bNumberOfPorts; - } - Marshal.FreeHGlobal(ptrNodeInfo); - CloseHandle(h2); - } - - // Fill in the missing Manufacture, Product, and SerialNumber values - // values by just creating a Device instance and copying the values - UsbDevice device = GetDevice(); - hub.HubInstanceId = device.DeviceInstanceId; - hub.HubManufacturer = device.Manufacturer; - hub.HubProduct = device.Product; - hub.HubSerialNumber = device.SerialNumber; - hub.HubDriverKey = device.DriverKey; - - Marshal.FreeHGlobal(ptrNodeName); - CloseHandle(h); - return hub; - } - } - - /// - /// Represents an USB device - /// - internal class UsbDevice - { - internal int DevicePortNumber; - internal string DeviceDriverKey, DeviceHubDevicePath, DeviceInstanceId, DeviceName; - internal string DeviceManufacturer, DeviceProduct, DeviceSerialNumber; - internal UsbDeviceDescriptor DeviceDescriptor; - internal byte[] BinaryDeviceDescriptors; - - /// a simple default constructor - internal UsbDevice() - { - DevicePortNumber = 0; - DeviceHubDevicePath = ""; - DeviceDriverKey = ""; - DeviceManufacturer = ""; - DeviceProduct = "Unknown USB Device"; - DeviceSerialNumber = ""; - DeviceName = ""; - DeviceInstanceId = ""; - BinaryDeviceDescriptors = null; - } - - /// return Port Index of the Hub - internal int PortNumber => DevicePortNumber; - - /// return the Device Path of the Hub (the parent device) - internal string HubDevicePath => DeviceHubDevicePath; - - /// useful as a search key - internal string DriverKey => DeviceDriverKey; - - /// the device path of this device - internal string InstanceId => DeviceInstanceId; - - /// the friendly name - internal string Name => DeviceName; - - internal string Manufacturer => DeviceManufacturer; - - internal string Product => DeviceProduct; - - internal string SerialNumber => DeviceSerialNumber; - - internal byte[] BinaryDescriptors => BinaryDeviceDescriptors; - } - - /// - /// private function for finding a USB device's Description - /// - /// Device driver key name - /// USB device description - static string GetDescriptionByKeyName(string driverKeyName) - { - string ans = ""; - const string DEV_ENUM = REGSTR_KEY_USB; - - // Use the "enumerator form" of the SetupDiGetClassDevs API - // to generate a list of all USB devices - IntPtr h = SetupDiGetClassDevs(0, DEV_ENUM, IntPtr.Zero, DIGCF_PRESENT | DIGCF_ALLCLASSES); - if(h.ToInt32() == INVALID_HANDLE_VALUE) return ans; - - IntPtr ptrBuf = Marshal.AllocHGlobal(BUFFER_SIZE); - - bool success; - int i = 0; - do - { - // create a Device Interface Data structure - SpDevinfoData da = new SpDevinfoData(); - da.cbSize = Marshal.SizeOf(da); - - // start the enumeration - success = SetupDiEnumDeviceInfo(h, i, ref da); - if(success) - { - int requiredSize = 0; - int regType = REG_SZ; - string keyName = ""; - - if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DRIVER, ref regType, ptrBuf, BUFFER_SIZE, - ref requiredSize)) keyName = Marshal.PtrToStringAuto(ptrBuf); - - // is it a match? - if(keyName == driverKeyName) - { - if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DEVICEDESC, ref regType, ptrBuf, - BUFFER_SIZE, ref requiredSize)) ans = Marshal.PtrToStringAuto(ptrBuf); - break; - } - } - - i++; - } - while(success); - - Marshal.FreeHGlobal(ptrBuf); - SetupDiDestroyDeviceInfoList(h); - - return ans; - } - - /// - /// private function for finding a USB device's Instance ID - /// - /// Device driver key name - /// Device instance ID - static string GetInstanceIdByKeyName(string driverKeyName) - { - string ans = ""; - const string DEV_ENUM = REGSTR_KEY_USB; - - // Use the "enumerator form" of the SetupDiGetClassDevs API - // to generate a list of all USB devices - IntPtr h = SetupDiGetClassDevs(0, DEV_ENUM, IntPtr.Zero, DIGCF_PRESENT | DIGCF_ALLCLASSES); - if(h.ToInt32() == INVALID_HANDLE_VALUE) return ans; - - IntPtr ptrBuf = Marshal.AllocHGlobal(BUFFER_SIZE); - - bool success; - int i = 0; - do - { - // create a Device Interface Data structure - SpDevinfoData da = new SpDevinfoData(); - da.cbSize = Marshal.SizeOf(da); - - // start the enumeration - success = SetupDiEnumDeviceInfo(h, i, ref da); - if(success) - { - int requiredSize = 0; - int regType = REG_SZ; - - string keyName = ""; - if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DRIVER, ref regType, ptrBuf, BUFFER_SIZE, - ref requiredSize)) keyName = Marshal.PtrToStringAuto(ptrBuf); - - // is it a match? - if(keyName == driverKeyName) - { - const int N_BYTES = BUFFER_SIZE; - StringBuilder sb = new StringBuilder(N_BYTES); - SetupDiGetDeviceInstanceId(h, ref da, sb, N_BYTES, out requiredSize); - ans = sb.ToString(); - break; - } - } - - i++; - } - while(success); - - Marshal.FreeHGlobal(ptrBuf); - SetupDiDestroyDeviceInfoList(h); - - return ans; - } } } \ No newline at end of file diff --git a/DiscImageChef.Devices/Windows/UsbFunctions.cs b/DiscImageChef.Devices/Windows/UsbFunctions.cs index 890212e0..d9111c16 100644 --- a/DiscImageChef.Devices/Windows/UsbFunctions.cs +++ b/DiscImageChef.Devices/Windows/UsbFunctions.cs @@ -43,12 +43,17 @@ namespace DiscImageChef.Devices.Windows // // TODO: Even after cleaning, refactoring and xml-documenting, this code needs some love /// - /// Implements functions for getting and accesing information from the USB bus + /// Implements functions for getting and accesing information from the USB bus /// static partial class Usb { + const int IOCTL_STORAGE_GET_DEVICE_NUMBER = 0x2D1080; + internal const string GuidDevinterfaceDisk = "53f56307-b6bf-11d0-94f2-00a0c91efb8b"; + internal const string GuidDevinterfaceCdrom = "53f56308-b6bf-11d0-94f2-00a0c91efb8b"; + internal const string GuidDevinterfaceFloppy = "53f56311-b6bf-11d0-94f2-00a0c91efb8b"; + /// - /// Get a list of all connected devices + /// Get a list of all connected devices /// /// List of usb devices internal static List GetConnectedDevices() @@ -61,7 +66,7 @@ namespace DiscImageChef.Devices.Windows } /// - /// private routine for enumerating a hub + /// private routine for enumerating a hub /// /// Hub /// Device list @@ -73,7 +78,7 @@ namespace DiscImageChef.Devices.Windows } /// - /// Find a device based upon it's DriverKeyName + /// Find a device based upon it's DriverKeyName /// /// DriverKeyName /// USB device @@ -91,7 +96,7 @@ namespace DiscImageChef.Devices.Windows } /// - /// Finds a device connected to a specified hub by it's DriverKeyName + /// Finds a device connected to a specified hub by it's DriverKeyName /// /// Hub /// UsbDevice @@ -113,7 +118,7 @@ namespace DiscImageChef.Devices.Windows } /// - /// Find a device based upon it's Instance ID + /// Find a device based upon it's Instance ID /// /// Device instance ID /// USB device @@ -131,7 +136,7 @@ namespace DiscImageChef.Devices.Windows } /// - /// private routine for enumerating a hub + /// private routine for enumerating a hub /// /// Hub /// USB device @@ -152,19 +157,6 @@ namespace DiscImageChef.Devices.Windows } } - const int IOCTL_STORAGE_GET_DEVICE_NUMBER = 0x2D1080; - internal const string GuidDevinterfaceDisk = "53f56307-b6bf-11d0-94f2-00a0c91efb8b"; - internal const string GuidDevinterfaceCdrom = "53f56308-b6bf-11d0-94f2-00a0c91efb8b"; - internal const string GuidDevinterfaceFloppy = "53f56311-b6bf-11d0-94f2-00a0c91efb8b"; - - [StructLayout(LayoutKind.Sequential)] - struct StorageDeviceNumber - { - internal int DeviceType; - internal int DeviceNumber; - internal int PartitionNumber; - } - [DllImport("setupapi.dll")] static extern int CM_Get_Parent(out IntPtr pdnDevInst, IntPtr dnDevInst, int ulFlags); @@ -172,7 +164,7 @@ namespace DiscImageChef.Devices.Windows static extern int CM_Get_Device_ID(IntPtr dnDevInst, IntPtr buffer, int bufferLen, int ulFlags); /// - /// Find a device based upon a Drive Letter + /// Find a device based upon a Drive Letter /// /// Drive letter /// Device GUID @@ -187,7 +179,7 @@ namespace DiscImageChef.Devices.Windows } /// - /// Find a device based upon a Drive Path + /// Find a device based upon a Drive Path /// /// Drive path /// Device GUID @@ -202,7 +194,7 @@ namespace DiscImageChef.Devices.Windows } /// - /// Find a device based upon a Device Number + /// Find a device based upon a Device Number /// /// Device Number /// Device GUID @@ -267,12 +259,13 @@ namespace DiscImageChef.Devices.Windows } // Did we find an InterfaceID of a USB device? - if(instanceId?.StartsWith("USB\\", StringComparison.Ordinal) == true) foundDevice = FindDeviceByInstanceId(instanceId); + if(instanceId?.StartsWith("USB\\", StringComparison.Ordinal) == true) + foundDevice = FindDeviceByInstanceId(instanceId); return foundDevice; } /// - /// return a unique device number for the given device path + /// return a unique device number for the given device path /// /// Device path /// Device number @@ -287,8 +280,7 @@ namespace DiscImageChef.Devices.Windows int nBytes = Marshal.SizeOf(sdn); IntPtr ptrSdn = Marshal.AllocHGlobal(nBytes); - if(DeviceIoControl(h, IOCTL_STORAGE_GET_DEVICE_NUMBER, IntPtr.Zero, 0, ptrSdn, nBytes, out _, - IntPtr.Zero)) + if(DeviceIoControl(h, IOCTL_STORAGE_GET_DEVICE_NUMBER, IntPtr.Zero, 0, ptrSdn, nBytes, out _, IntPtr.Zero)) { sdn = (StorageDeviceNumber)Marshal.PtrToStructure(ptrSdn, typeof(StorageDeviceNumber)); // just my way of combining the relevant parts of the @@ -299,5 +291,13 @@ namespace DiscImageChef.Devices.Windows CloseHandle(h); return ans; } + + [StructLayout(LayoutKind.Sequential)] + struct StorageDeviceNumber + { + internal int DeviceType; + internal int DeviceNumber; + internal int PartitionNumber; + } } } \ No newline at end of file