diff --git a/Aaru.Devices/Aaru.Devices.csproj b/Aaru.Devices/Aaru.Devices.csproj index 3440ac942..d3d4ac148 100644 --- a/Aaru.Devices/Aaru.Devices.csproj +++ b/Aaru.Devices/Aaru.Devices.csproj @@ -42,7 +42,7 @@ true - + diff --git a/Aaru.Devices/Aaru.Devices.csproj.DotSettings b/Aaru.Devices/Aaru.Devices.csproj.DotSettings index bc07063b7..9fc7c1de8 100644 --- a/Aaru.Devices/Aaru.Devices.csproj.DotSettings +++ b/Aaru.Devices/Aaru.Devices.csproj.DotSettings @@ -1,6 +1,9 @@ - + True - True - True - True - True \ No newline at end of file + True + True + True + True \ No newline at end of file diff --git a/Aaru.Devices/Device/AtaCommands/Ata28.cs b/Aaru.Devices/Device/AtaCommands/Ata28.cs index e18ad3c61..1567f5eb5 100644 --- a/Aaru.Devices/Device/AtaCommands/Ata28.cs +++ b/Aaru.Devices/Device/AtaCommands/Ata28.cs @@ -54,8 +54,8 @@ public partial class Device Command = (byte)AtaCommands.ReadBuffer }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, + ref buffer, timeout, false, out duration, out bool sense); Error = LastError != 0; @@ -80,8 +80,8 @@ public partial class Device Command = (byte)AtaCommands.ReadBufferDma }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.NoTransfer, + ref buffer, timeout, false, out duration, out bool sense); Error = LastError != 0; @@ -98,8 +98,8 @@ public partial class Device /// Timeout to wait for command execution /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, uint lba, byte count, - uint timeout, out double duration) => + public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, uint lba, byte count, + uint timeout, out double duration) => ReadDma(out buffer, out statusRegisters, true, lba, count, timeout, out duration); /// Reads sectors using 48-bit addressing and DMA transfer @@ -112,7 +112,7 @@ public partial class Device /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, bool retry, uint lba, byte count, - uint timeout, out double duration) + uint timeout, out double duration) { buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count]; @@ -128,8 +128,8 @@ public partial class Device registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount, + ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -149,8 +149,8 @@ public partial class Device /// Timeout to wait for command execution /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, uint lba, byte count, - uint timeout, out double duration) + public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, uint lba, byte count, + uint timeout, out double duration) { buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count]; @@ -166,8 +166,8 @@ public partial class Device registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, + ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -182,7 +182,7 @@ public partial class Device /// Timeout to wait for command execution /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool ReadNativeMaxAddress(out uint lba, out AtaErrorRegistersLba28 statusRegisters, uint timeout, + public bool ReadNativeMaxAddress(out uint lba, out AtaErrorRegistersLba28 statusRegisters, uint timeout, out double duration) { lba = 0; @@ -195,8 +195,8 @@ public partial class Device registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, + ref buffer, timeout, false, out duration, out bool sense); Error = LastError != 0; @@ -235,8 +235,8 @@ public partial class Device /// Timeout to wait for command execution /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool Read(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, bool retry, uint lba, byte count, - uint timeout, out double duration) + public bool Read(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, bool retry, uint lba, byte count, + uint timeout, out double duration) { buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count]; @@ -252,8 +252,8 @@ public partial class Device registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, + ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -270,8 +270,8 @@ public partial class Device /// Timeout to wait for command execution /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool ReadLong(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, uint lba, uint blockSize, - uint timeout, out double duration) => + public bool ReadLong(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, uint lba, uint blockSize, + uint timeout, out double duration) => ReadLong(out buffer, out statusRegisters, true, lba, blockSize, timeout, out duration); /// Reads a long sector using 28-bit addressing and PIO transfer, retrying on error @@ -283,8 +283,8 @@ public partial class Device /// Timeout to wait for command execution /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool ReadLong(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, bool retry, uint lba, - uint blockSize, uint timeout, out double duration) + public bool ReadLong(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, bool retry, uint lba, + uint blockSize, uint timeout, out double duration) { buffer = new byte[blockSize]; @@ -300,8 +300,8 @@ public partial class Device registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, + ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -331,8 +331,8 @@ public partial class Device registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, + ref buffer, timeout, false, out duration, out bool sense); Error = LastError != 0; diff --git a/Aaru.Devices/Device/AtaCommands/Ata48.cs b/Aaru.Devices/Device/AtaCommands/Ata48.cs index ac8df0b6f..1e88c78b7 100644 --- a/Aaru.Devices/Device/AtaCommands/Ata48.cs +++ b/Aaru.Devices/Device/AtaCommands/Ata48.cs @@ -44,7 +44,7 @@ public partial class Device /// Timeout to wait for command execution /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool GetNativeMaxAddressExt(out ulong lba, out AtaErrorRegistersLba48 statusRegisters, uint timeout, + public bool GetNativeMaxAddressExt(out ulong lba, out AtaErrorRegistersLba48 statusRegisters, uint timeout, out double duration) { lba = 0; @@ -56,8 +56,8 @@ public partial class Device Feature = 0x0000 }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, + ref buffer, timeout, false, out duration, out bool sense); Error = LastError != 0; @@ -85,8 +85,8 @@ public partial class Device /// Timeout to wait for command execution /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLba48 statusRegisters, ulong lba, ushort count, - uint timeout, out double duration) + public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLba48 statusRegisters, ulong lba, ushort count, + uint timeout, out double duration) { buffer = count == 0 ? new byte[512 * 65536] : new byte[512 * count]; @@ -104,8 +104,8 @@ public partial class Device registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount, + ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -123,8 +123,8 @@ public partial class Device /// Timeout to wait for command execution /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool ReadLog(out byte[] buffer, out AtaErrorRegistersLba48 statusRegisters, byte logAddress, - ushort pageNumber, ushort count, uint timeout, out double duration) + public bool ReadLog(out byte[] buffer, out AtaErrorRegistersLba48 statusRegisters, byte logAddress, + ushort pageNumber, ushort count, uint timeout, out double duration) { buffer = new byte[512 * count]; @@ -137,8 +137,8 @@ public partial class Device LbaLowCurrent = logAddress }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, + ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -156,8 +156,8 @@ public partial class Device /// Timeout to wait for command execution /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool ReadLogDma(out byte[] buffer, out AtaErrorRegistersLba48 statusRegisters, byte logAddress, - ushort pageNumber, ushort count, uint timeout, out double duration) + public bool ReadLogDma(out byte[] buffer, out AtaErrorRegistersLba48 statusRegisters, byte logAddress, + ushort pageNumber, ushort count, uint timeout, out double duration) { buffer = new byte[512 * count]; @@ -170,8 +170,8 @@ public partial class Device LbaLowCurrent = logAddress }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount, + ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -191,8 +191,8 @@ public partial class Device /// Timeout to wait for command execution /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersLba48 statusRegisters, ulong lba, ushort count, - uint timeout, out double duration) + public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersLba48 statusRegisters, ulong lba, ushort count, + uint timeout, out double duration) { buffer = count == 0 ? new byte[512 * 65536] : new byte[512 * count]; @@ -210,8 +210,8 @@ public partial class Device registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, + ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -226,7 +226,7 @@ public partial class Device /// Timeout to wait for command execution /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool ReadNativeMaxAddress(out ulong lba, out AtaErrorRegistersLba48 statusRegisters, uint timeout, + public bool ReadNativeMaxAddress(out ulong lba, out AtaErrorRegistersLba48 statusRegisters, uint timeout, out double duration) { lba = 0; @@ -239,8 +239,8 @@ public partial class Device registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, + ref buffer, timeout, false, out duration, out bool sense); Error = LastError != 0; @@ -268,8 +268,8 @@ public partial class Device /// Timeout to wait for command execution /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool Read(out byte[] buffer, out AtaErrorRegistersLba48 statusRegisters, ulong lba, ushort count, - uint timeout, out double duration) + public bool Read(out byte[] buffer, out AtaErrorRegistersLba48 statusRegisters, ulong lba, ushort count, + uint timeout, out double duration) { buffer = count == 0 ? new byte[512 * 65536] : new byte[512 * count]; @@ -287,8 +287,8 @@ public partial class Device registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, + ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; diff --git a/Aaru.Devices/Device/AtaCommands/AtaCHS.cs b/Aaru.Devices/Device/AtaCommands/AtaCHS.cs index 85ac0c6d0..0c94b46ed 100644 --- a/Aaru.Devices/Device/AtaCommands/AtaCHS.cs +++ b/Aaru.Devices/Device/AtaCommands/AtaCHS.cs @@ -78,8 +78,8 @@ public partial class Device SectorCount = 1 }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, + ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -99,7 +99,7 @@ public partial class Device /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise public bool ReadDma(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, ushort cylinder, byte head, - byte sector, byte count, uint timeout, out double duration) => + byte sector, byte count, uint timeout, out double duration) => ReadDma(out buffer, out statusRegisters, true, cylinder, head, sector, count, timeout, out duration); /// Reads sectors using CHS addressing and DMA transfer @@ -114,7 +114,7 @@ public partial class Device /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise public bool ReadDma(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, bool retry, ushort cylinder, - byte head, byte sector, byte count, uint timeout, out double duration) + byte head, byte sector, byte count, uint timeout, out double duration) { buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count]; @@ -128,8 +128,8 @@ public partial class Device 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); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount, + ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -152,7 +152,7 @@ public partial class Device /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, ushort cylinder, byte head, - byte sector, byte count, uint timeout, out double duration) + byte sector, byte count, uint timeout, out double duration) { buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count]; @@ -166,8 +166,8 @@ public partial class Device Sector = sector }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, + ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -187,7 +187,7 @@ public partial class Device /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise public bool Read(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, ushort cylinder, byte head, - byte sector, byte count, uint timeout, out double duration) => + byte sector, byte count, uint timeout, out double duration) => Read(out buffer, out statusRegisters, true, cylinder, head, sector, count, timeout, out duration); /// Reads sectors using CHS addressing and PIO transfer @@ -202,7 +202,7 @@ public partial class Device /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise public bool Read(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, bool retry, ushort cylinder, - byte head, byte sector, byte count, uint timeout, out double duration) + byte head, byte sector, byte count, uint timeout, out double duration) { buffer = count == 0 ? new byte[512 * 256] : new byte[512 * count]; @@ -216,8 +216,8 @@ public partial class Device Sector = sector }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, + ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -237,7 +237,7 @@ public partial class Device /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise public bool ReadLong(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, ushort cylinder, byte head, - byte sector, uint blockSize, uint timeout, out double duration) => + byte sector, uint blockSize, uint timeout, out double duration) => ReadLong(out buffer, out statusRegisters, true, cylinder, head, sector, blockSize, timeout, out duration); /// Reads a long sector using CHS addressing and PIO transfer, retrying on error @@ -252,7 +252,7 @@ public partial class Device /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise public bool ReadLong(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, bool retry, ushort cylinder, - byte head, byte sector, uint blockSize, uint timeout, out double duration) + byte head, byte sector, uint blockSize, uint timeout, out double duration) { buffer = new byte[blockSize]; @@ -266,8 +266,8 @@ public partial class Device Sector = sector }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, + ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -285,7 +285,7 @@ public partial class Device /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise public bool Seek(out AtaErrorRegistersChs statusRegisters, ushort cylinder, byte head, byte sector, uint timeout, - out double duration) + out double duration) { byte[] buffer = Array.Empty(); @@ -298,8 +298,8 @@ public partial class Device Sector = sector }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, true, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, + ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -315,7 +315,7 @@ public partial class Device /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise public bool SetFeatures(out AtaErrorRegistersChs statusRegisters, AtaFeatures feature, uint timeout, - out double duration) => + out double duration) => SetFeatures(out statusRegisters, feature, 0, 0, 0, 0, timeout, out duration); /// Enables drive features @@ -329,7 +329,7 @@ public partial class Device /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise public bool SetFeatures(out AtaErrorRegistersChs statusRegisters, AtaFeatures feature, ushort cylinder, byte head, - byte sector, byte sectorCount, uint timeout, out double duration) + byte sector, byte sectorCount, uint timeout, out double duration) { byte[] buffer = Array.Empty(); @@ -344,8 +344,8 @@ public partial class Device Feature = (byte)feature }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, true, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, + ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -368,8 +368,8 @@ public partial class Device Command = (byte)AtaCommands.DoorLock }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, true, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, + ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -392,8 +392,8 @@ public partial class Device Command = (byte)AtaCommands.DoorUnLock }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, true, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, + ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; @@ -416,8 +416,8 @@ public partial class Device Command = (byte)AtaCommands.MediaEject }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, true, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, + ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; diff --git a/Aaru.Devices/Device/AtaCommands/Atapi.cs b/Aaru.Devices/Device/AtaCommands/Atapi.cs index 492da053a..934cdc029 100644 --- a/Aaru.Devices/Device/AtaCommands/Atapi.cs +++ b/Aaru.Devices/Device/AtaCommands/Atapi.cs @@ -77,8 +77,8 @@ public partial class Device Sector = 1 }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, - ref buffer, timeout, true, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.SectorCount, + ref buffer, timeout, true, out duration, out bool sense); Error = LastError != 0; diff --git a/Aaru.Devices/Device/AtaCommands/Cfa.cs b/Aaru.Devices/Device/AtaCommands/Cfa.cs index d675f82c0..dd490fbdd 100644 --- a/Aaru.Devices/Device/AtaCommands/Cfa.cs +++ b/Aaru.Devices/Device/AtaCommands/Cfa.cs @@ -61,8 +61,8 @@ public partial class Device registers.DeviceHead += 0x40; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, + ref buffer, timeout, false, out duration, out bool sense); Error = LastError != 0; @@ -81,7 +81,7 @@ public partial class Device /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise public bool TranslateSector(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, ushort cylinder, byte head, - byte sector, uint timeout, out double duration) + byte sector, uint timeout, out double duration) { buffer = new byte[512]; @@ -94,8 +94,8 @@ public partial class Device DeviceHead = (byte)(head & 0x0F) }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, + ref buffer, timeout, false, out duration, out bool sense); Error = LastError != 0; @@ -110,7 +110,7 @@ public partial class Device /// Timeout to wait for command execution /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool RequestExtendedErrorCode(out byte errorCode, out AtaErrorRegistersLba28 statusRegisters, uint timeout, + public bool RequestExtendedErrorCode(out byte errorCode, out AtaErrorRegistersLba28 statusRegisters, uint timeout, out double duration) { byte[] buffer = Array.Empty(); @@ -120,8 +120,8 @@ public partial class Device Command = (byte)AtaCommands.RequestSense }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, + ref buffer, timeout, false, out duration, out bool sense); Error = LastError != 0; diff --git a/Aaru.Devices/Device/AtaCommands/MCPT.cs b/Aaru.Devices/Device/AtaCommands/MCPT.cs index 14a3a79bd..cbc59592e 100644 --- a/Aaru.Devices/Device/AtaCommands/MCPT.cs +++ b/Aaru.Devices/Device/AtaCommands/MCPT.cs @@ -44,7 +44,7 @@ public partial class Device /// Time it took to execute the command in milliseconds /// true if the device set an error condition, false otherwise public bool EnableMediaCardPassThrough(out AtaErrorRegistersChs statusRegisters, uint timeout, - out double duration) => + out double duration) => CheckMediaCardType(1, out statusRegisters, timeout, out duration); /// Disables media card pass through @@ -53,7 +53,7 @@ public partial class Device /// Time it took to execute the command in milliseconds /// true if the device set an error condition, false otherwise public bool DisableMediaCardPassThrough(out AtaErrorRegistersChs statusRegisters, uint timeout, - out double duration) => + out double duration) => CheckMediaCardType(0, out statusRegisters, timeout, out duration); /// Checks media card pass through @@ -62,7 +62,7 @@ public partial class Device /// Timeout in seconds /// Time it took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool CheckMediaCardType(byte feature, out AtaErrorRegistersChs statusRegisters, uint timeout, + public bool CheckMediaCardType(byte feature, out AtaErrorRegistersChs statusRegisters, uint timeout, out double duration) { byte[] buffer = Array.Empty(); @@ -73,8 +73,8 @@ public partial class Device Feature = feature }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, + ref buffer, timeout, false, out duration, out bool sense); Error = LastError != 0; diff --git a/Aaru.Devices/Device/AtaCommands/Smart.cs b/Aaru.Devices/Device/AtaCommands/Smart.cs index 9e9d05241..1e7c1bfb3 100644 --- a/Aaru.Devices/Device/AtaCommands/Smart.cs +++ b/Aaru.Devices/Device/AtaCommands/Smart.cs @@ -55,8 +55,8 @@ public partial class Device LbaMid = 0x4F }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, + ref buffer, timeout, false, out duration, out bool sense); Error = LastError != 0; @@ -71,7 +71,7 @@ public partial class Device /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise public bool SmartEnableAttributeAutosave(out AtaErrorRegistersLba28 statusRegisters, uint timeout, - out double duration) + out double duration) { byte[] buffer = Array.Empty(); @@ -84,8 +84,8 @@ public partial class Device SectorCount = 0xF1 }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, + ref buffer, timeout, false, out duration, out bool sense); Error = LastError != 0; @@ -100,7 +100,7 @@ public partial class Device /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise public bool SmartDisableAttributeAutosave(out AtaErrorRegistersLba28 statusRegisters, uint timeout, - out double duration) + out double duration) { byte[] buffer = Array.Empty(); @@ -112,8 +112,8 @@ public partial class Device LbaMid = 0x4F }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, + ref buffer, timeout, false, out duration, out bool sense); Error = LastError != 0; @@ -139,8 +139,8 @@ public partial class Device LbaMid = 0x4F }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, + ref buffer, timeout, false, out duration, out bool sense); Error = LastError != 0; @@ -156,7 +156,7 @@ public partial class Device /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise public bool SmartExecuteOffLineImmediate(out AtaErrorRegistersLba28 statusRegisters, byte subcommand, uint timeout, - out double duration) + out double duration) { byte[] buffer = Array.Empty(); @@ -169,8 +169,8 @@ public partial class Device LbaLow = subcommand }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, + ref buffer, timeout, false, out duration, out bool sense); Error = LastError != 0; @@ -198,8 +198,8 @@ public partial class Device LbaMid = 0x4F }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, + ref buffer, timeout, false, out duration, out bool sense); Error = LastError != 0; @@ -215,8 +215,8 @@ public partial class Device /// Timeout to wait for command execution /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool SmartReadLog(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, byte logAddress, - uint timeout, out double duration) + public bool SmartReadLog(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, byte logAddress, + uint timeout, out double duration) { buffer = new byte[512]; @@ -229,8 +229,8 @@ public partial class Device LbaLow = logAddress }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, + ref buffer, timeout, false, out duration, out bool sense); Error = LastError != 0; @@ -256,8 +256,8 @@ public partial class Device LbaMid = 0x4F }; - LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, - ref buffer, timeout, false, out duration, out bool sense); + LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData, AtaTransferRegister.NoTransfer, + ref buffer, timeout, false, out duration, out bool sense); Error = LastError != 0; diff --git a/Aaru.Devices/Device/Commands.cs b/Aaru.Devices/Device/Commands.cs index 68dc53fec..e889412e3 100644 --- a/Aaru.Devices/Device/Commands.cs +++ b/Aaru.Devices/Device/Commands.cs @@ -50,7 +50,7 @@ public partial class Device /// True if SCSI command returned non-OK status and contains /// SCSI sense /// - public virtual int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, + public virtual int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, ScsiDirection direction, out double duration, out bool sense) { duration = 0; @@ -75,12 +75,12 @@ public partial class Device /// Time it took to execute the command in milliseconds /// True if ATA/ATAPI command returned non-OK status public virtual int SendAtaCommand(AtaRegistersChs registers, out AtaErrorRegistersChs errorRegisters, - AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer, - uint timeout, bool transferBlocks, out double duration, out bool sense) + AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer, + uint timeout, bool transferBlocks, out double duration, out bool sense) { duration = 0; sense = true; - errorRegisters = default; + errorRegisters = default(AtaErrorRegistersChs); return -1; } @@ -103,7 +103,7 @@ public partial class Device AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, bool transferBlocks, out double duration, out bool sense) { - errorRegisters = default; + errorRegisters = default(AtaErrorRegistersLba28); duration = 0; sense = true; @@ -128,7 +128,7 @@ public partial class Device AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, bool transferBlocks, out double duration, out bool sense) { - errorRegisters = default; + errorRegisters = default(AtaErrorRegistersLba48); duration = 0; sense = true; @@ -149,9 +149,9 @@ public partial class Device /// Command argument /// Response registers /// Size of block in bytes - public virtual int SendMmcCommand(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 = 15) + public virtual int SendMmcCommand(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 = 15) { response = null; duration = 0; @@ -160,30 +160,6 @@ public partial class Device return -1; } - /// Encapsulates a single MMC command to send in a queue - [SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal")] - public class MmcSingleCommand - { - /// Command argument - public uint argument; - /// How many blocks to transfer - public uint blocks; - /// Size of block in bytes - public uint blockSize; - /// Buffer for MMC/SD command response - public byte[] buffer; - /// MMC/SD opcode - public MmcCommands command; - /// Flags indicating kind and place of response - public MmcFlags flags; - /// True if command should be preceded with CMD55 - public bool isApplication; - /// Response registers - public uint[] response; - /// True if data is sent from host to card - public bool write; - } - /// /// Concatenates a queue of commands to be send to a remote SecureDigital or MultiMediaCard attached to an SDHCI /// controller @@ -194,7 +170,7 @@ public partial class Device /// Maximum allowed time to execute a single command /// 0 if no error occurred, otherwise, errno public virtual int SendMultipleMmcCommands(MmcSingleCommand[] commands, out double duration, out bool sense, - uint timeout = 15) + uint timeout = 15) { duration = 0; sense = true; @@ -219,4 +195,33 @@ public partial class Device return false; } + +#region Nested type: MmcSingleCommand + + /// Encapsulates a single MMC command to send in a queue + [SuppressMessage("ReSharper", "InconsistentNaming")] + [SuppressMessage("ReSharper", "MemberCanBeInternal")] + public class MmcSingleCommand + { + /// Command argument + public uint argument; + /// How many blocks to transfer + public uint blocks; + /// Size of block in bytes + public uint blockSize; + /// Buffer for MMC/SD command response + public byte[] buffer; + /// MMC/SD opcode + public MmcCommands command; + /// Flags indicating kind and place of response + public MmcFlags flags; + /// True if command should be preceded with CMD55 + public bool isApplication; + /// Response registers + public uint[] response; + /// True if data is sent from host to card + public bool write; + } + +#endregion } \ No newline at end of file diff --git a/Aaru.Devices/Device/Constructor.cs b/Aaru.Devices/Device/Constructor.cs index e7ede81e2..793ac3524 100644 --- a/Aaru.Devices/Device/Constructor.cs +++ b/Aaru.Devices/Device/Constructor.cs @@ -44,10 +44,13 @@ using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry; namespace Aaru.Devices; /// Implements a device or media containing drive -[SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "UnusedMember.Global"), - SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")] +[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] +[SuppressMessage("ReSharper", "UnusedMember.Global")] +[SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")] public partial class Device { + protected Device() {} + /// Opens the device for sending direct commands /// Device path /// Sets the error if a device cannot be opened @@ -128,7 +131,7 @@ public partial class Device dev.Error = false; } - if((dev.Type != DeviceType.SCSI && dev.Type != DeviceType.ATAPI && !(dev.IsUsb || dev.IsFireWire)) || + if(dev.Type != DeviceType.SCSI && dev.Type != DeviceType.ATAPI && !(dev.IsUsb || dev.IsFireWire) || dev.Manufacturer == "ATA") { bool ataSense = dev.AtaIdentify(out byte[] ataBuf, out _); @@ -156,9 +159,11 @@ public partial class Device dev.ScsiType = PeripheralDeviceTypes.DirectAccess; if((ushort)ataid.Value.GeneralConfiguration != 0x848A) + { dev.IsRemovable |= (ataid.Value.GeneralConfiguration & Identify.GeneralConfigurationBit.Removable) == Identify.GeneralConfigurationBit.Removable; + } else dev.IsCompactFlash = true; } @@ -184,8 +189,10 @@ public partial class Device if(string.IsNullOrEmpty(dev.Serial)) dev.Serial = dev.UsbSerialString; else + { foreach(char c in dev.Serial.Where(c => !char.IsControl(c))) dev.Serial = $"{dev.Serial}{c:X2}"; + } } if(dev.IsFireWire) @@ -199,8 +206,10 @@ public partial class Device if(string.IsNullOrEmpty(dev.Serial)) dev.Serial = $"{dev._firewireGuid:X16}"; else + { foreach(char c in dev.Serial.Where(c => !char.IsControl(c))) dev.Serial = $"{dev.Serial}{c:X2}"; + } } // Some optical drives are not getting the correct serial, and IDENTIFY PACKET DEVICE is blocked without @@ -229,6 +238,4 @@ public partial class Device return dev; } - - protected Device() {} } \ No newline at end of file diff --git a/Aaru.Devices/Device/List.cs b/Aaru.Devices/Device/List.cs index 46b454c62..d32c1f677 100644 --- a/Aaru.Devices/Device/List.cs +++ b/Aaru.Devices/Device/List.cs @@ -89,7 +89,7 @@ public partial class Device /// Remote URI /// List of devices /// - public static DeviceInfo[] ListDevices(out bool isRemote, out string serverApplication, out string serverVersion, + public static DeviceInfo[] ListDevices(out bool isRemote, out string serverApplication, out string serverVersion, out string serverOperatingSystem, out string serverOperatingSystemVersion, out string serverArchitecture, string aaruRemote = null) { diff --git a/Aaru.Devices/Device/MmcCommands/MMC.cs b/Aaru.Devices/Device/MmcCommands/MMC.cs index 20d09fbc6..16cb6fcec 100644 --- a/Aaru.Devices/Device/MmcCommands/MMC.cs +++ b/Aaru.Devices/Device/MmcCommands/MMC.cs @@ -37,6 +37,8 @@ namespace Aaru.Devices; public partial class Device { + protected static bool ReadMultipleBlockCannotSetBlockCount; + /// Reads the CSD register from a SecureDigital or MultiMediaCard device /// Data buffer /// Response @@ -152,10 +154,10 @@ public partial class Device /// Timeout to wait for command execution /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool Read(out byte[] buffer, out uint[] response, uint lba, uint blockSize, ushort transferLength, - bool byteAddressed, uint timeout, out double duration) + public bool Read(out byte[] buffer, out uint[] response, uint lba, uint blockSize, ushort transferLength, + bool byteAddressed, uint timeout, out double duration) { - bool sense = true; + var sense = true; buffer = null; response = null; duration = -1; @@ -164,12 +166,16 @@ public partial class Device return ReadSingleBlock(out buffer, out response, lba, blockSize, byteAddressed, timeout, out duration); if(!ReadMultipleBlockCannotSetBlockCount) + { sense = ReadMultipleBlock(out buffer, out response, lba, blockSize, transferLength, byteAddressed, timeout, out duration); + } if(ReadMultipleBlockCannotSetBlockCount) + { return ReadMultipleUsingSingle(out buffer, out response, lba, blockSize, transferLength, byteAddressed, - timeout, out duration); + timeout, out duration); + } return sense; } @@ -183,8 +189,8 @@ public partial class Device /// Timeout to wait for command execution /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool ReadSingleBlock(out byte[] buffer, out uint[] response, uint lba, uint blockSize, bool byteAddressed, - uint timeout, out double duration) + public bool ReadSingleBlock(out byte[] buffer, out uint[] response, uint lba, uint blockSize, bool byteAddressed, + uint timeout, out double duration) { uint address; buffer = new byte[blockSize]; @@ -206,8 +212,6 @@ public partial class Device return sense; } - protected static bool ReadMultipleBlockCannotSetBlockCount; - /// Reads multiple blocks from a SecureDigital or MultiMediaCard device /// Data buffer /// Response @@ -218,8 +222,8 @@ public partial class Device /// Timeout to wait for command execution /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool ReadMultipleBlock(out byte[] buffer, out uint[] response, uint lba, uint blockSize, - ushort transferLength, bool byteAddressed, uint timeout, out double duration) + public bool ReadMultipleBlock(out byte[] buffer, out uint[] response, uint lba, uint blockSize, + ushort transferLength, bool byteAddressed, uint timeout, out double duration) { buffer = new byte[transferLength * blockSize]; uint address; @@ -238,7 +242,8 @@ public partial class Device Error = LastError != 0; AaruConsole.DebugWriteLine(MMC_MODULE_NAME, - transferLength > 1 ? Localization.READ_MULTIPLE_BLOCK_took_0_ms + transferLength > 1 + ? Localization.READ_MULTIPLE_BLOCK_took_0_ms : Localization.READ_SINGLE_BLOCK_took_0_ms, duration); return sense; @@ -258,9 +263,9 @@ public partial class Device ushort transferLength, bool byteAddressed, uint timeout, out double duration) { buffer = new byte[transferLength * blockSize]; - byte[] blockBuffer = new byte[blockSize]; + var blockBuffer = new byte[blockSize]; duration = 0; - bool sense = true; + var sense = true; response = null; for(uint i = 0; i < transferLength; i++) @@ -323,11 +328,11 @@ public partial class Device /// Timeout to wait for command execution /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool ReadWithBlockCount(out byte[] buffer, out uint[] response, uint lba, uint blockSize, - ushort transferLength, bool byteAddressed, uint timeout, out double duration) + public bool ReadWithBlockCount(out byte[] buffer, out uint[] response, uint lba, uint blockSize, + ushort transferLength, bool byteAddressed, uint timeout, out double duration) { - uint address = byteAddressed ? lba * blockSize : lba; - MmcSingleCommand[] commands = new MmcSingleCommand[3]; + uint address = byteAddressed ? lba * blockSize : lba; + var commands = new MmcSingleCommand[3]; // SET_BLOCK_COUNT commands[0] = new MmcSingleCommand diff --git a/Aaru.Devices/Device/ScsiCommands/Adaptec.cs b/Aaru.Devices/Device/ScsiCommands/Adaptec.cs index 393cafaa4..5c5019274 100644 --- a/Aaru.Devices/Device/ScsiCommands/Adaptec.cs +++ b/Aaru.Devices/Device/ScsiCommands/Adaptec.cs @@ -59,7 +59,7 @@ public partial class Device out double duration) { buffer = new byte[8]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.AdaptecTranslate; @@ -96,12 +96,12 @@ public partial class Device /// If set to true set the threshold from drive 1. /// Timeout. /// Duration. - public bool AdaptecSetErrorThreshold(byte threshold, out byte[] senseBuffer, bool drive1, uint timeout, + public bool AdaptecSetErrorThreshold(byte threshold, out byte[] senseBuffer, bool drive1, uint timeout, out double duration) { - byte[] buffer = new byte[1]; + var buffer = new byte[1]; buffer[0] = threshold; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.AdaptecSetErrorThreshold; @@ -139,7 +139,7 @@ public partial class Device out double duration) { buffer = new byte[9]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.AdaptecTranslate; @@ -166,10 +166,10 @@ public partial class Device /// Duration. public bool AdaptecWriteBuffer(byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { - byte[] oneKBuffer = new byte[1024]; + var oneKBuffer = new byte[1024]; Array.Copy(buffer, 0, oneKBuffer, 0, buffer.Length < 1024 ? buffer.Length : 1024); - byte[] cdb = new byte[6]; + var cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.AdaptecWriteBuffer; @@ -192,7 +192,7 @@ public partial class Device public bool AdaptecReadBuffer(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { buffer = new byte[1024]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.AdaptecReadBuffer; diff --git a/Aaru.Devices/Device/ScsiCommands/ArchiveCorp.cs b/Aaru.Devices/Device/ScsiCommands/ArchiveCorp.cs index 82fc1d51f..d1fc44c89 100644 --- a/Aaru.Devices/Device/ScsiCommands/ArchiveCorp.cs +++ b/Aaru.Devices/Device/ScsiCommands/ArchiveCorp.cs @@ -47,7 +47,7 @@ public partial class Device out double duration) { buffer = new byte[3]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.ArchiveRequestBlockAddress; @@ -85,7 +85,7 @@ public partial class Device out double duration) { byte[] buffer = Array.Empty(); - byte[] cdb = new byte[6]; + var cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.ArchiveSeekBlock; diff --git a/Aaru.Devices/Device/ScsiCommands/Certance.cs b/Aaru.Devices/Device/ScsiCommands/Certance.cs index c0e07d832..370a7d53b 100644 --- a/Aaru.Devices/Device/ScsiCommands/Certance.cs +++ b/Aaru.Devices/Device/ScsiCommands/Certance.cs @@ -61,7 +61,7 @@ public partial class Device public bool CertanceParkUnpark(out byte[] senseBuffer, bool park, uint timeout, out double duration) { byte[] buffer = Array.Empty(); - byte[] cdb = new byte[6]; + var cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.CertanceParkUnpark; diff --git a/Aaru.Devices/Device/ScsiCommands/Fujitsu.cs b/Aaru.Devices/Device/ScsiCommands/Fujitsu.cs index 5c8ed6523..55f278988 100644 --- a/Aaru.Devices/Device/ScsiCommands/Fujitsu.cs +++ b/Aaru.Devices/Device/ScsiCommands/Fujitsu.cs @@ -48,16 +48,16 @@ public partial class Device /// Timeout to wait for command execution /// Time the device took to execute the command in milliseconds /// true if the device set an error condition, false otherwise - public bool FujitsuDisplay(out byte[] senseBuffer, bool flash, FujitsuDisplayModes mode, string firstHalf, - string secondHalf, uint timeout, out double duration) + public bool FujitsuDisplay(out byte[] senseBuffer, bool flash, FujitsuDisplayModes mode, string firstHalf, + string secondHalf, uint timeout, out double duration) { byte[] tmp; - byte[] firstHalfBytes = new byte[8]; - byte[] secondHalfBytes = new byte[8]; - byte[] buffer = new byte[17]; - bool displayLen = false; - bool halfMsg = false; - byte[] cdb = new byte[10]; + var firstHalfBytes = new byte[8]; + var secondHalfBytes = new byte[8]; + var buffer = new byte[17]; + var displayLen = false; + var halfMsg = false; + var cdb = new byte[10]; if(!string.IsNullOrWhiteSpace(firstHalf)) { @@ -72,12 +72,14 @@ public partial class Device } if(mode != FujitsuDisplayModes.Half) + { if(!ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) && !ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes)) displayLen = true; else if(!ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) && ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes)) halfMsg = true; + } buffer[0] = (byte)((byte)mode << 5); @@ -92,7 +94,7 @@ public partial class Device buffer[0] += 0x01; // Always ASCII - Array.Copy(firstHalfBytes, 0, buffer, 1, 8); + Array.Copy(firstHalfBytes, 0, buffer, 1, 8); Array.Copy(secondHalfBytes, 0, buffer, 9, 8); cdb[0] = (byte)ScsiCommands.FujitsuDisplay; diff --git a/Aaru.Devices/Device/ScsiCommands/HL-DT-ST.cs b/Aaru.Devices/Device/ScsiCommands/HL-DT-ST.cs index b9a8989f8..b4f9d0cb3 100644 --- a/Aaru.Devices/Device/ScsiCommands/HL-DT-ST.cs +++ b/Aaru.Devices/Device/ScsiCommands/HL-DT-ST.cs @@ -48,7 +48,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[2064 * transferLength]; cdb[0] = (byte)ScsiCommands.HlDtStVendor; diff --git a/Aaru.Devices/Device/ScsiCommands/HP.cs b/Aaru.Devices/Device/ScsiCommands/HP.cs index 119283bfd..8a7b2d532 100644 --- a/Aaru.Devices/Device/ScsiCommands/HP.cs +++ b/Aaru.Devices/Device/ScsiCommands/HP.cs @@ -47,7 +47,7 @@ public partial class Device /// 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, ushort blockBytes, - bool pba, uint timeout, out double duration) => + bool pba, uint timeout, out double duration) => HpReadLong(out buffer, out senseBuffer, relAddr, address, 0, blockBytes, pba, false, timeout, out duration); /// Sends the HP READ LONG vendor command @@ -66,10 +66,10 @@ public partial class Device /// 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, ushort transferLen, - ushort blockBytes, bool pba, bool sectorCount, uint timeout, out double duration) + ushort blockBytes, bool pba, bool sectorCount, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.ReadLong; diff --git a/Aaru.Devices/Device/ScsiCommands/Kreon.cs b/Aaru.Devices/Device/ScsiCommands/Kreon.cs index 89f4a588d..50a540a75 100644 --- a/Aaru.Devices/Device/ScsiCommands/Kreon.cs +++ b/Aaru.Devices/Device/ScsiCommands/Kreon.cs @@ -45,7 +45,7 @@ public partial class Device public bool KreonDeprecatedUnlock(out byte[] senseBuffer, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; byte[] buffer = Array.Empty(); cdb[0] = (byte)ScsiCommands.KreonCommand; @@ -96,7 +96,7 @@ public partial class Device public bool KreonSetLockState(out byte[] senseBuffer, KreonLockStates state, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; byte[] buffer = Array.Empty(); cdb[0] = (byte)ScsiCommands.KreonCommand; @@ -125,8 +125,8 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[6]; - byte[] buffer = new byte[26]; + var cdb = new byte[6]; + var buffer = new byte[26]; features = 0; cdb[0] = (byte)ScsiCommands.KreonCommand; @@ -150,9 +150,9 @@ public partial class Device buffer[3] != 0xA5) return true; - for(int i = 4; i < 26; i += 2) + for(var i = 4; i < 26; i += 2) { - ushort feature = BitConverter.ToUInt16(buffer, i); + var feature = BitConverter.ToUInt16(buffer, i); if(feature == 0x0000) break; @@ -213,10 +213,10 @@ public partial class Device /// The SS sector. /// Request number. public bool KreonExtractSs(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration, - byte requestNumber = 0x00) + byte requestNumber = 0x00) { buffer = new byte[2048]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.KreonSsCommand; diff --git a/Aaru.Devices/Device/ScsiCommands/MMC.cs b/Aaru.Devices/Device/ScsiCommands/MMC.cs index 8ab39b10d..d7ee4c9ed 100644 --- a/Aaru.Devices/Device/ScsiCommands/MMC.cs +++ b/Aaru.Devices/Device/ScsiCommands/MMC.cs @@ -68,11 +68,11 @@ public partial class Device /// Duration in milliseconds it took for the device to execute the command. /// Starting Feature number. /// Return type, . - public bool GetConfiguration(out byte[] buffer, out byte[] senseBuffer, ushort startingFeatureNumber, - MmcGetConfigurationRt rt, uint timeout, out double duration) + public bool GetConfiguration(out byte[] buffer, out byte[] senseBuffer, ushort startingFeatureNumber, + MmcGetConfigurationRt rt, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; buffer = new byte[8]; cdb[0] = (byte)ScsiCommands.GetConfiguration; @@ -91,7 +91,7 @@ public partial class Device if(sense) return true; - ushort confLength = (ushort)((buffer[2] << 8) + buffer[3] + 4); + var confLength = (ushort)((buffer[2] << 8) + buffer[3] + 4); buffer = new byte[confLength]; cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[8] = (byte)(buffer.Length & 0xFF); @@ -121,12 +121,12 @@ public partial class Device /// Which disc structure are we requesting /// AGID used in medium copy protection /// Duration in milliseconds it took for the device to execute the command. - public bool ReadDiscStructure(out byte[] buffer, out byte[] senseBuffer, MmcDiscStructureMediaType mediaType, - uint address, byte layerNumber, MmcDiscStructureFormat format, byte agid, - uint timeout, out double duration) + public bool ReadDiscStructure(out byte[] buffer, out byte[] senseBuffer, MmcDiscStructureMediaType mediaType, + uint address, byte layerNumber, MmcDiscStructureFormat format, byte agid, + uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[8]; cdb[0] = (byte)ScsiCommands.ReadDiscStructure; @@ -149,19 +149,21 @@ public partial class Device if(sense) return true; - ushort strctLength = (ushort)((buffer[0] << 8) + buffer[1] + 2); + var strctLength = (ushort)((buffer[0] << 8) + buffer[1] + 2); // WORKAROUND: Some drives return incorrect length information. As these structures are fixed length just apply known length. if(mediaType == MmcDiscStructureMediaType.Bd) + { buffer = format switch - { - MmcDiscStructureFormat.DiscInformation => new byte[4100], - MmcDiscStructureFormat.BdBurstCuttingArea => new byte[68], - MmcDiscStructureFormat.BdDds => new byte[strctLength < 100 ? 100 : strctLength], - MmcDiscStructureFormat.CartridgeStatus => new byte[8], - MmcDiscStructureFormat.BdSpareAreaInformation => new byte[16], - _ => new byte[strctLength] - }; + { + MmcDiscStructureFormat.DiscInformation => new byte[4100], + MmcDiscStructureFormat.BdBurstCuttingArea => new byte[68], + MmcDiscStructureFormat.BdDds => new byte[strctLength < 100 ? 100 : strctLength], + MmcDiscStructureFormat.CartridgeStatus => new byte[8], + MmcDiscStructureFormat.BdSpareAreaInformation => new byte[16], + _ => new byte[strctLength] + }; + } else buffer = new byte[strctLength]; @@ -271,11 +273,11 @@ public partial class Device /// Track/Session number /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. - public bool ReadTocPmaAtip(out byte[] buffer, out byte[] senseBuffer, bool msf, byte format, - byte trackSessionNumber, uint timeout, out double duration) + public bool ReadTocPmaAtip(out byte[] buffer, out byte[] senseBuffer, bool msf, byte format, + byte trackSessionNumber, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; byte[] tmpBuffer = (format & 0x0F) == 5 ? new byte[32768] : new byte[1536]; @@ -294,7 +296,7 @@ public partial class Device Error = LastError != 0; - uint strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2); + var strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2); buffer = new byte[strctLength]; if(buffer.Length <= tmpBuffer.Length) @@ -343,12 +345,12 @@ public partial class Device /// Which disc information to read /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. - public bool ReadDiscInformation(out byte[] buffer, out byte[] senseBuffer, MmcDiscInformationDataTypes dataType, - uint timeout, out double duration) + public bool ReadDiscInformation(out byte[] buffer, out byte[] senseBuffer, MmcDiscInformationDataTypes dataType, + uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; - byte[] tmpBuffer = new byte[804]; + var cdb = new byte[10]; + var tmpBuffer = new byte[804]; cdb[0] = (byte)ScsiCommands.ReadDiscInformation; cdb[1] = (byte)dataType; @@ -360,7 +362,7 @@ public partial class Device Error = LastError != 0; - uint strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2); + var strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2); if(strctLength > tmpBuffer.Length) strctLength = (uint)tmpBuffer.Length; @@ -399,7 +401,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.ReadCd; cdb[1] = (byte)((byte)expectedSectorType << 2); @@ -470,7 +472,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.ReadCdMsf; cdb[1] = (byte)((byte)expectedSectorType << 2); @@ -498,7 +500,7 @@ public partial class Device cdb[10] = (byte)subchannel; - uint transferLength = (uint)(((cdb[6] - cdb[3]) * 60 * 75) + ((cdb[7] - cdb[4]) * 75) + (cdb[8] - cdb[5])); + var transferLength = (uint)((cdb[6] - cdb[3]) * 60 * 75 + (cdb[7] - cdb[4]) * 75 + (cdb[8] - cdb[5])); buffer = new byte[blockSize * transferLength]; @@ -543,7 +545,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; byte[] buffer = Array.Empty(); cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval; @@ -614,7 +616,7 @@ public partial class Device bool changeFormatLayer, bool loadEject, bool start, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; byte[] buffer = Array.Empty(); cdb[0] = (byte)ScsiCommands.StartStopUnit; @@ -663,7 +665,7 @@ public partial class Device public bool ReadMcn(out string mcn, out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; mcn = null; cdb[0] = (byte)ScsiCommands.ReadSubChannel; @@ -704,7 +706,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; isrc = null; cdb[0] = (byte)ScsiCommands.ReadSubChannel; @@ -742,11 +744,11 @@ public partial class Device /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. /// true if the command failed and contains the sense buffer. - public bool SetCdSpeed(out byte[] senseBuffer, RotationalControl rotationalControl, ushort readSpeed, - ushort writeSpeed, uint timeout, out double duration) + public bool SetCdSpeed(out byte[] senseBuffer, RotationalControl rotationalControl, ushort readSpeed, + ushort writeSpeed, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; byte[] buffer = Array.Empty(); cdb[0] = (byte)ScsiCommands.SetCdRomSpeed; @@ -778,11 +780,11 @@ public partial class Device /// Duration in milliseconds it took for the device to execute the command. /// Report information of non-closed tracks /// Type of information to retrieve - public bool ReadTrackInformation(out byte[] buffer, out byte[] senseBuffer, bool open, TrackInformationType type, - uint address, uint timeout, out double duration) + public bool ReadTrackInformation(out byte[] buffer, out byte[] senseBuffer, bool open, TrackInformationType type, + uint address, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; buffer = new byte[48]; cdb[0] = (byte)ScsiCommands.ReadTrackInformation; diff --git a/Aaru.Devices/Device/ScsiCommands/MediaTek.cs b/Aaru.Devices/Device/ScsiCommands/MediaTek.cs index c99f86e1b..5ecb48504 100644 --- a/Aaru.Devices/Device/ScsiCommands/MediaTek.cs +++ b/Aaru.Devices/Device/ScsiCommands/MediaTek.cs @@ -48,7 +48,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; buffer = new byte[length]; cdb[0] = (byte)ScsiCommands.MediaTekVendorCommand; diff --git a/Aaru.Devices/Device/ScsiCommands/MiniDisc.cs b/Aaru.Devices/Device/ScsiCommands/MiniDisc.cs index be0edf706..f9cbf4be3 100644 --- a/Aaru.Devices/Device/ScsiCommands/MiniDisc.cs +++ b/Aaru.Devices/Device/ScsiCommands/MiniDisc.cs @@ -49,7 +49,7 @@ public partial class Device { const ushort transferLength = 2336; senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.MiniDiscReadDTOC; @@ -80,7 +80,7 @@ public partial class Device { const ushort transferLength = 2336; senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.MiniDiscReadUTOC; @@ -113,7 +113,7 @@ public partial class Device { const ushort transferLength = 4; senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.MiniDiscD5; @@ -141,7 +141,7 @@ public partial class Device public bool MiniDiscStopPlaying(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.MiniDiscStopPlay; @@ -167,7 +167,7 @@ public partial class Device { const ushort transferLength = 4; senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.MiniDiscReadPosition; @@ -196,7 +196,7 @@ public partial class Device { const ushort transferLength = 8; senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.MiniDiscGetType; diff --git a/Aaru.Devices/Device/ScsiCommands/NEC.cs b/Aaru.Devices/Device/ScsiCommands/NEC.cs index 0d7c3f584..a59ff2de3 100644 --- a/Aaru.Devices/Device/ScsiCommands/NEC.cs +++ b/Aaru.Devices/Device/ScsiCommands/NEC.cs @@ -48,7 +48,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.NecReadCdDa; cdb[2] = (byte)((lba & 0xFF000000) >> 24); diff --git a/Aaru.Devices/Device/ScsiCommands/Optical.cs b/Aaru.Devices/Device/ScsiCommands/Optical.cs index 9d6651819..81a7ea09f 100644 --- a/Aaru.Devices/Device/ScsiCommands/Optical.cs +++ b/Aaru.Devices/Device/ScsiCommands/Optical.cs @@ -59,11 +59,11 @@ public partial class Device /// Number of contiguous blocks to find /// First LBA found public bool MediumScan(out byte[] senseBuffer, bool written, bool advancedScan, bool reverse, bool partial, - bool relAddr, uint lba, uint requested, uint scanLength, out uint foundLba, - out uint foundBlocks, uint timeout, out double duration) + bool relAddr, uint lba, uint requested, uint scanLength, out uint foundLba, + out uint foundBlocks, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; byte[] buffer = Array.Empty(); foundLba = 0; foundBlocks = 0; @@ -120,13 +120,15 @@ public partial class Device switch(decodedSense?.SenseKey) { - case SenseKeys.NoSense: return false; + case SenseKeys.NoSense: + return false; case SenseKeys.Equal when decodedSense.Value.Fixed?.InformationValid == true: foundBlocks = decodedSense.Value.Fixed.Value.CommandSpecific; foundLba = decodedSense.Value.Fixed.Value.Information; return false; - default: return sense; + default: + return sense; } } } \ No newline at end of file diff --git a/Aaru.Devices/Device/ScsiCommands/Pioneer.cs b/Aaru.Devices/Device/ScsiCommands/Pioneer.cs index 025d6f1ab..d41af5a7a 100644 --- a/Aaru.Devices/Device/ScsiCommands/Pioneer.cs +++ b/Aaru.Devices/Device/ScsiCommands/Pioneer.cs @@ -50,7 +50,7 @@ public partial class Device uint transferLength, PioneerSubchannel subchannel, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.ReadCdDa; cdb[2] = (byte)((lba & 0xFF000000) >> 24); @@ -88,7 +88,7 @@ public partial class Device uint blockSize, PioneerSubchannel subchannel, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.ReadCdDaMsf; cdb[3] = (byte)((startMsf & 0xFF0000) >> 16); @@ -99,7 +99,7 @@ public partial class Device cdb[9] = (byte)(endMsf & 0xFF); cdb[10] = (byte)subchannel; - uint transferLength = (uint)(((cdb[7] - cdb[3]) * 60 * 75) + ((cdb[8] - cdb[4]) * 75) + (cdb[9] - cdb[5])); + var transferLength = (uint)((cdb[7] - cdb[3]) * 60 * 75 + (cdb[8] - cdb[4]) * 75 + (cdb[9] - cdb[5])); buffer = new byte[blockSize * transferLength]; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, @@ -125,11 +125,11 @@ public partial class Device /// If set to true, returns all 2352 bytes of sector data. /// Start block address. /// How many blocks to read. - public bool PioneerReadCdXa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, - bool errorFlags, bool wholeSector, uint timeout, out double duration) + public bool PioneerReadCdXa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, + bool errorFlags, bool wholeSector, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.ReadCdXa; cdb[2] = (byte)((lba & 0xFF000000) >> 24); diff --git a/Aaru.Devices/Device/ScsiCommands/Plasmon.cs b/Aaru.Devices/Device/ScsiCommands/Plasmon.cs index c519b8d88..61360ac14 100644 --- a/Aaru.Devices/Device/ScsiCommands/Plasmon.cs +++ b/Aaru.Devices/Device/ScsiCommands/Plasmon.cs @@ -46,8 +46,8 @@ public partial class Device /// If set to true address contain physical block address. /// 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, - ushort blockBytes, bool pba, uint timeout, out double duration) => + public bool PlasmonReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, + ushort blockBytes, bool pba, uint timeout, out double duration) => HpReadLong(out buffer, out senseBuffer, relAddr, address, 0, blockBytes, pba, false, timeout, out duration); /// Sends the Plasmon READ LONG vendor command @@ -66,8 +66,8 @@ public partial class Device /// 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, - ushort transferLen, ushort blockBytes, bool pba, bool sectorCount, uint timeout, - out double duration) => HpReadLong(out buffer, out senseBuffer, relAddr, address, + ushort transferLen, ushort blockBytes, bool pba, bool sectorCount, uint timeout, + out double duration) => HpReadLong(out buffer, out senseBuffer, relAddr, address, transferLen, blockBytes, pba, sectorCount, timeout, out duration); @@ -79,11 +79,11 @@ public partial class Device /// If set to true address contain a physical block address. /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. - public bool PlasmonReadSectorLocation(out byte[] buffer, out byte[] senseBuffer, uint address, bool pba, - uint timeout, out double duration) + public bool PlasmonReadSectorLocation(out byte[] buffer, out byte[] senseBuffer, uint address, bool pba, + uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.PlasmonReadSectorLocation; cdb[2] = (byte)((address & 0xFF000000) >> 24); diff --git a/Aaru.Devices/Device/ScsiCommands/Plextor.cs b/Aaru.Devices/Device/ScsiCommands/Plextor.cs index 13c1e2b56..1aaf9f7d8 100644 --- a/Aaru.Devices/Device/ScsiCommands/Plextor.cs +++ b/Aaru.Devices/Device/ScsiCommands/Plextor.cs @@ -51,7 +51,7 @@ public partial class Device uint transferLength, PlextorSubchannel subchannel, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.ReadCdDa; cdb[2] = (byte)((lba & 0xFF000000) >> 24); @@ -87,11 +87,11 @@ public partial class Device /// Duration in milliseconds it took for the device to execute the command. /// Start block address. /// How many blocks to read. - public bool PlextorReadRawDvd(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, - uint timeout, out double duration) + public bool PlextorReadRawDvd(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, + uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; buffer = new byte[2064 * transferLength]; cdb[0] = (byte)ScsiCommands.ReadBuffer; @@ -123,7 +123,7 @@ public partial class Device { buffer = new byte[256]; senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorReadEeprom; cdb[8] = 1; @@ -148,7 +148,7 @@ public partial class Device { buffer = new byte[512]; senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorReadEeprom; cdb[8] = 2; @@ -171,12 +171,12 @@ public partial class Device /// How many bytes are in the EEPROM block /// Timeout. /// Duration. - public bool PlextorReadEepromBlock(out byte[] buffer, out byte[] senseBuffer, byte block, ushort blockSize, - uint timeout, out double duration) + public bool PlextorReadEepromBlock(out byte[] buffer, out byte[] senseBuffer, byte block, ushort blockSize, + uint timeout, out double duration) { buffer = new byte[blockSize]; senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorReadEeprom; cdb[1] = 1; @@ -203,11 +203,11 @@ public partial class Device /// Timeout. /// Duration. public bool PlextorGetSpeeds(out byte[] senseBuffer, out ushort selected, out ushort max, out ushort last, - uint timeout, out double duration) + uint timeout, out double duration) { - byte[] buf = new byte[10]; + var buf = new byte[10]; senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; selected = 0; max = 0; @@ -243,9 +243,9 @@ public partial class Device public bool PlextorGetPoweRec(out byte[] senseBuffer, out bool enabled, out ushort speed, uint timeout, out double duration) { - byte[] buf = new byte[8]; + var buf = new byte[8]; senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; enabled = false; speed = 0; @@ -280,7 +280,7 @@ public partial class Device { buffer = new byte[8]; senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorExtend; cdb[1] = (byte)PlextorSubCommands.GetMode; @@ -308,7 +308,7 @@ public partial class Device { buffer = new byte[8]; senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorExtend; cdb[1] = (byte)PlextorSubCommands.GetMode; @@ -337,7 +337,7 @@ public partial class Device { buffer = new byte[8]; senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorExtend; cdb[1] = (byte)PlextorSubCommands.GetMode; @@ -369,7 +369,7 @@ public partial class Device { buffer = new byte[8]; senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorExtend; cdb[2] = (byte)PlextorSubCommands.SecuRec; @@ -395,7 +395,7 @@ public partial class Device { buffer = new byte[8]; senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorExtend; cdb[1] = (byte)PlextorSubCommands.GetMode; @@ -422,7 +422,7 @@ public partial class Device { buffer = new byte[8]; senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorExtend; cdb[1] = (byte)PlextorSubCommands.GetMode; @@ -452,7 +452,7 @@ public partial class Device { buffer = new byte[8]; senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorExtend; cdb[1] = (byte)PlextorSubCommands.GetMode; @@ -484,7 +484,7 @@ public partial class Device { buffer = new byte[8]; senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.PlextorExtend; cdb[1] = (byte)PlextorSubCommands.GetMode; diff --git a/Aaru.Devices/Device/ScsiCommands/SBC.cs b/Aaru.Devices/Device/ScsiCommands/SBC.cs index dd22444a6..29fa56965 100644 --- a/Aaru.Devices/Device/ScsiCommands/SBC.cs +++ b/Aaru.Devices/Device/ScsiCommands/SBC.cs @@ -58,11 +58,11 @@ public partial class Device /// Starting block. /// Block size in bytes. /// How many blocks to read. - public bool Read6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, byte transferLength, - uint timeout, out double duration) + public bool Read6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, byte transferLength, + uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; cdb[0] = (byte)ScsiCommands.Read6; cdb[1] = (byte)((lba & 0x1F0000) >> 16); @@ -108,7 +108,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.Read10; cdb[1] = (byte)((rdprotect & 0x07) << 5); @@ -172,7 +172,7 @@ public partial class Device uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; cdb[0] = (byte)ScsiCommands.Read12; cdb[1] = (byte)((rdprotect & 0x07) << 5); @@ -240,7 +240,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[16]; + var cdb = new byte[16]; byte[] lbaBytes = BitConverter.GetBytes(lba); cdb[0] = (byte)ScsiCommands.Read16; @@ -297,11 +297,11 @@ public partial class Device /// 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) + public bool ReadLong10(out byte[] buffer, out byte[] senseBuffer, bool correct, bool relAddr, uint lba, + ushort transferBytes, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.ReadLong; @@ -342,11 +342,11 @@ public partial class Device /// 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) + public bool ReadLong16(out byte[] buffer, out byte[] senseBuffer, bool correct, ulong lba, uint transferBytes, + uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[16]; + var cdb = new byte[16]; byte[] lbaBytes = BitConverter.GetBytes(lba); cdb[0] = (byte)ScsiCommands.ServiceActionIn; @@ -385,7 +385,7 @@ public partial class Device public bool Seek6(out byte[] senseBuffer, uint lba, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; byte[] buffer = Array.Empty(); cdb[0] = (byte)ScsiCommands.Seek6; @@ -411,7 +411,7 @@ public partial class Device public bool Seek10(out byte[] senseBuffer, uint lba, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; byte[] buffer = Array.Empty(); cdb[0] = (byte)ScsiCommands.Seek10; diff --git a/Aaru.Devices/Device/ScsiCommands/SMC.cs b/Aaru.Devices/Device/ScsiCommands/SMC.cs index 3759c24be..e82c71d02 100644 --- a/Aaru.Devices/Device/ScsiCommands/SMC.cs +++ b/Aaru.Devices/Device/ScsiCommands/SMC.cs @@ -49,11 +49,11 @@ public partial class Device /// Timeout. /// Duration. public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, ushort element, - byte elementType, byte volume, byte partition, ushort firstAttribute, bool cache, - uint timeout, out double duration) + byte elementType, byte volume, byte partition, ushort firstAttribute, bool cache, + uint timeout, out double duration) { buffer = new byte[256]; - byte[] cdb = new byte[16]; + var cdb = new byte[16]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.ReadAttribute; @@ -81,7 +81,7 @@ public partial class Device if(sense) return true; - uint attrLen = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3] + 4); + var 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/Aaru.Devices/Device/ScsiCommands/SPC.cs b/Aaru.Devices/Device/ScsiCommands/SPC.cs index e229c23d3..008fbc016 100644 --- a/Aaru.Devices/Device/ScsiCommands/SPC.cs +++ b/Aaru.Devices/Device/ScsiCommands/SPC.cs @@ -74,10 +74,7 @@ public partial class Device buffer = new byte[36]; senseBuffer = new byte[64]; - byte[] cdb = - { - (byte)ScsiCommands.Inquiry, 0, 0, 0, 36, 0 - }; + byte[] cdb = { (byte)ScsiCommands.Inquiry, 0, 0, 0, 36, 0 }; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); @@ -87,12 +84,9 @@ public partial class Device if(sense) return true; - byte pagesLength = (byte)(buffer[4] + 5); + var pagesLength = (byte)(buffer[4] + 5); - cdb = new byte[] - { - (byte)ScsiCommands.Inquiry, 0, 0, 0, pagesLength, 0 - }; + cdb = new byte[] { (byte)ScsiCommands.Inquiry, 0, 0, 0, pagesLength, 0 }; buffer = new byte[pagesLength]; senseBuffer = new byte[64]; @@ -151,10 +145,7 @@ public partial class Device buffer = new byte[36]; senseBuffer = new byte[64]; - byte[] cdb = - { - (byte)ScsiCommands.Inquiry, 1, page, 0, 36, 0 - }; + byte[] cdb = { (byte)ScsiCommands.Inquiry, 1, page, 0, 36, 0 }; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); @@ -168,12 +159,9 @@ public partial class Device if(buffer[1] != page) return true; - byte pagesLength = (byte)(buffer[3] + 4); + var pagesLength = (byte)(buffer[3] + 4); - cdb = new byte[] - { - (byte)ScsiCommands.Inquiry, 1, page, 0, pagesLength, 0 - }; + cdb = new byte[] { (byte)ScsiCommands.Inquiry, 1, page, 0, pagesLength, 0 }; buffer = new byte[pagesLength]; senseBuffer = new byte[64]; @@ -197,10 +185,7 @@ public partial class Device { senseBuffer = new byte[64]; - byte[] cdb = - { - (byte)ScsiCommands.TestUnitReady, 0, 0, 0, 0, 0 - }; + byte[] cdb = { (byte)ScsiCommands.TestUnitReady, 0, 0, 0, 0, 0 }; byte[] buffer = Array.Empty(); @@ -232,8 +217,8 @@ public partial class Device /// If set to true device MUST not return any block descriptor. /// Page control. /// Page code. - public bool ModeSense6(out byte[] buffer, out byte[] senseBuffer, bool dbd, ScsiModeSensePageControl pageControl, - byte pageCode, uint timeout, out double duration) => + public bool ModeSense6(out byte[] buffer, out byte[] senseBuffer, bool dbd, ScsiModeSensePageControl pageControl, + byte pageCode, uint timeout, out double duration) => ModeSense6(out buffer, out senseBuffer, dbd, pageControl, pageCode, 0, timeout, out duration); /// Sends the SPC MODE SENSE(6) command to the device as introduced in SCSI-3 SPC-3 @@ -246,11 +231,11 @@ public partial class Device /// Page control. /// Page code. /// Sub-page code. - public bool ModeSense6(out byte[] buffer, out byte[] senseBuffer, bool dbd, ScsiModeSensePageControl pageControl, - byte pageCode, byte subPageCode, uint timeout, out double duration) + public bool ModeSense6(out byte[] buffer, out byte[] senseBuffer, bool dbd, ScsiModeSensePageControl pageControl, + byte pageCode, byte subPageCode, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; buffer = new byte[255]; cdb[0] = (byte)ScsiCommands.ModeSense; @@ -272,7 +257,7 @@ public partial class Device if(sense) return true; - byte modeLength = (byte)(buffer[0] + 1); + var modeLength = (byte)(buffer[0] + 1); buffer = new byte[modeLength]; cdb[4] = (byte)buffer.Length; senseBuffer = new byte[64]; @@ -296,8 +281,8 @@ public partial class Device /// If set to true device MUST not return any block descriptor. /// Page control. /// Page code. - public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool dbd, ScsiModeSensePageControl pageControl, - byte pageCode, uint timeout, out double duration) => + public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool dbd, ScsiModeSensePageControl pageControl, + byte pageCode, uint timeout, out double duration) => ModeSense10(out buffer, out senseBuffer, false, dbd, pageControl, pageCode, 0, timeout, out duration); /// Sends the SPC MODE SENSE(10) command to the device as introduced in SCSI-3 SPC-2 @@ -310,7 +295,7 @@ public partial class Device /// Page control. /// Page code. /// If set means 64-bit LBAs are accepted by the caller. - public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool llbaa, bool dbd, + public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool llbaa, bool dbd, ScsiModeSensePageControl pageControl, byte pageCode, uint timeout, out double duration) => ModeSense10(out buffer, out senseBuffer, llbaa, dbd, pageControl, pageCode, 0, timeout, out duration); @@ -325,12 +310,12 @@ public partial class Device /// Page code. /// Sub-page code. /// If set means 64-bit LBAs are accepted by the caller. - public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool llbaa, bool dbd, - ScsiModeSensePageControl pageControl, byte pageCode, byte subPageCode, uint timeout, - out double duration) + public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool llbaa, bool dbd, + ScsiModeSensePageControl pageControl, byte pageCode, byte subPageCode, uint timeout, + out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; buffer = new byte[4096]; cdb[0] = (byte)ScsiCommands.ModeSense10; @@ -356,7 +341,7 @@ public partial class Device if(sense) return true; - ushort modeLength = (ushort)((buffer[0] << 8) + buffer[1] + 2); + var modeLength = (ushort)((buffer[0] << 8) + buffer[1] + 2); buffer = new byte[modeLength]; cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[8] = (byte)(buffer.Length & 0xFF); @@ -395,8 +380,9 @@ public partial class Device /// Duration in milliseconds it took for the device to execute the command. /// true to prevent medium removal, false to allow it. public bool SpcPreventAllowMediumRemoval(out byte[] senseBuffer, bool prevent, uint timeout, out double duration) => - prevent ? SpcPreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Prevent, timeout, out duration) - : SpcPreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Allow, timeout, out duration); + prevent + ? SpcPreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Prevent, timeout, out duration) + : SpcPreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Allow, timeout, out duration); /// Sends the SPC PREVENT ALLOW MEDIUM REMOVAL command /// true if the command failed and contains the sense buffer. @@ -408,7 +394,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; byte[] buffer = Array.Empty(); cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval; @@ -442,11 +428,11 @@ public partial class Device /// If set, it is requesting partial media capacity /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. - public bool ReadCapacity(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, bool pmi, - uint timeout, out double duration) + public bool ReadCapacity(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, bool pmi, + uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; buffer = new byte[8]; cdb[0] = (byte)ScsiCommands.ReadCapacity; @@ -495,7 +481,7 @@ public partial class Device out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[16]; + var cdb = new byte[16]; buffer = new byte[32]; cdb[0] = (byte)ScsiCommands.ServiceActionIn; @@ -539,7 +525,7 @@ public partial class Device public bool ReadMediaSerialNumber(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[4]; cdb[0] = (byte)ScsiCommands.ReadSerialNumber; @@ -557,7 +543,7 @@ public partial class Device if(sense) return true; - uint strctLength = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3] + 4); + var 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); @@ -585,7 +571,7 @@ public partial class Device /// Timeout. /// Duration. public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, byte partition, - ushort firstAttribute, bool cache, uint timeout, out double duration) => + ushort firstAttribute, bool cache, uint timeout, out double duration) => ReadAttribute(out buffer, out senseBuffer, action, 0, 0, 0, partition, firstAttribute, cache, timeout, out duration); @@ -597,8 +583,8 @@ public partial class Device /// If set to true device can return cached data. /// Timeout. /// Duration. - public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, - ushort firstAttribute, bool cache, uint timeout, out double duration) => + public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, + ushort firstAttribute, bool cache, uint timeout, out double duration) => ReadAttribute(out buffer, out senseBuffer, action, 0, 0, 0, 0, firstAttribute, cache, timeout, out duration); /// Reads an attribute from the medium auxiliary memory @@ -610,7 +596,7 @@ public partial class Device /// Timeout. /// Duration. public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, byte partition, - ushort firstAttribute, uint timeout, out double duration) => + ushort firstAttribute, uint timeout, out double duration) => ReadAttribute(out buffer, out senseBuffer, action, 0, 0, 0, partition, firstAttribute, false, timeout, out duration); @@ -621,8 +607,8 @@ public partial class Device /// First attribute identifier. /// Timeout. /// Duration. - public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, - ushort firstAttribute, uint timeout, out double duration) => + public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, + ushort firstAttribute, uint timeout, out double duration) => ReadAttribute(out buffer, out senseBuffer, action, 0, 0, 0, 0, firstAttribute, false, timeout, out duration); /// Reads an attribute from the medium auxiliary memory @@ -634,8 +620,8 @@ public partial class Device /// First attribute identifier. /// Timeout. /// Duration. - public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, byte volume, - byte partition, ushort firstAttribute, uint timeout, out double duration) => + public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action, byte volume, + byte partition, ushort firstAttribute, uint timeout, out double duration) => ReadAttribute(out buffer, out senseBuffer, action, 0, 0, volume, partition, firstAttribute, false, timeout, out duration); @@ -662,7 +648,7 @@ public partial class Device /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. /// Set if page is formatted. - public bool ModeSelect(byte[] buffer, out byte[] senseBuffer, bool pageFormat, bool savePages, uint timeout, + public bool ModeSelect(byte[] buffer, out byte[] senseBuffer, bool pageFormat, bool savePages, uint timeout, out double duration) { senseBuffer = new byte[64]; @@ -686,7 +672,7 @@ public partial class Device return true; } - byte[] cdb = new byte[6]; + var cdb = new byte[6]; cdb[0] = (byte)ScsiCommands.ModeSelect; @@ -716,7 +702,7 @@ public partial class Device /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. /// Set if page is formatted. - public bool ModeSelect10(byte[] buffer, out byte[] senseBuffer, bool pageFormat, bool savePages, uint timeout, + public bool ModeSelect10(byte[] buffer, out byte[] senseBuffer, bool pageFormat, bool savePages, uint timeout, out double duration) { senseBuffer = new byte[64]; @@ -740,7 +726,7 @@ public partial class Device return true; } - byte[] cdb = new byte[10]; + var cdb = new byte[10]; cdb[0] = (byte)ScsiCommands.ModeSelect10; @@ -779,7 +765,7 @@ public partial class Device /// true if the command failed. public bool RequestSense(bool descriptor, out byte[] buffer, uint timeout, out double duration) { - byte[] cdb = new byte[6]; + var cdb = new byte[6]; buffer = new byte[252]; cdb[0] = (byte)ScsiCommands.RequestSense; diff --git a/Aaru.Devices/Device/ScsiCommands/SSC.cs b/Aaru.Devices/Device/ScsiCommands/SSC.cs index 0ba5e221f..7456e7bbf 100644 --- a/Aaru.Devices/Device/ScsiCommands/SSC.cs +++ b/Aaru.Devices/Device/ScsiCommands/SSC.cs @@ -67,10 +67,10 @@ public partial class Device /// Timeout. /// Duration. public bool LoadUnload(out byte[] senseBuffer, bool immediate, bool load, bool retense, bool endOfTape, bool hold, - uint timeout, out double duration) + uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; byte[] buffer = Array.Empty(); cdb[0] = (byte)ScsiCommands.LoadUnload; @@ -147,10 +147,10 @@ public partial class Device /// Timeout. /// Duration. public bool Locate(out byte[] senseBuffer, bool immediate, bool blockType, bool changePartition, byte partition, - uint objectId, uint timeout, out double duration) + uint objectId, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; byte[] buffer = Array.Empty(); cdb[0] = (byte)ScsiCommands.Locate; @@ -216,7 +216,7 @@ public partial class Device /// Duration. public bool Locate16(out byte[] senseBuffer, bool immediate, byte partition, ulong lba, uint timeout, out double duration) => Locate16(out senseBuffer, immediate, false, SscLogicalIdTypes.ObjectId, - false, partition, lba, timeout, out duration); + false, partition, lba, timeout, out duration); /// Positions the medium to the specified object identifier /// Sense buffer. @@ -228,11 +228,11 @@ public partial class Device /// Destination identifier. /// Timeout. /// Duration. - public bool Locate16(out byte[] senseBuffer, bool immediate, bool changePartition, SscLogicalIdTypes destType, - bool bam, byte partition, ulong identifier, uint timeout, out double duration) + public bool Locate16(out byte[] senseBuffer, bool immediate, bool changePartition, SscLogicalIdTypes destType, + bool bam, byte partition, ulong identifier, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[16]; + var cdb = new byte[16]; byte[] buffer = Array.Empty(); byte[] idBytes = BitConverter.GetBytes(identifier); @@ -310,11 +310,11 @@ public partial class Device /// Block size in bytes. /// Timeout. /// Duration. - public bool Read6(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, uint transferLen, - uint blockSize, uint timeout, out double duration) + public bool Read6(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, uint transferLen, + uint blockSize, uint timeout, out double duration) { buffer = fixedLen ? new byte[blockSize * transferLen] : new byte[transferLen]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.Read6; @@ -348,8 +348,8 @@ public partial class Device /// Object size in bytes. /// Timeout. /// Duration. - public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, ulong objectId, uint blocks, - uint blockSize, uint timeout, out double duration) => + public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, ulong objectId, uint blocks, + uint blockSize, uint timeout, out double duration) => Read16(out buffer, out senseBuffer, sili, false, 0, objectId, blocks, blockSize, timeout, out duration); /// Reads a number of fixed-length blocks starting at specified block from the specified partition @@ -362,8 +362,8 @@ public partial class Device /// Object size in bytes. /// Timeout. /// Duration. - public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, byte partition, ulong objectId, - uint blocks, uint blockSize, uint timeout, out double duration) => + public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, byte partition, ulong objectId, + uint blocks, uint blockSize, uint timeout, out double duration) => Read16(out buffer, out senseBuffer, sili, false, partition, objectId, blocks, blockSize, timeout, out duration); /// Reads a number of fixed-length blocks starting at specified object @@ -374,9 +374,9 @@ public partial class Device /// Object size in bytes. /// Timeout. /// Duration. - public bool Read16(out byte[] buffer, out byte[] senseBuffer, ulong objectId, uint blocks, uint blockSize, - uint timeout, out double duration) => Read16(out buffer, out senseBuffer, false, true, 0, - objectId, blocks, blockSize, timeout, out duration); + public bool Read16(out byte[] buffer, out byte[] senseBuffer, ulong objectId, uint blocks, uint blockSize, + uint timeout, out double duration) => Read16(out buffer, out senseBuffer, false, true, 0, + objectId, blocks, blockSize, timeout, out duration); /// Reads a number of fixed-length blocks starting at specified block from the specified partition /// Buffer. @@ -387,8 +387,8 @@ public partial class Device /// Object size in bytes. /// Timeout. /// Duration. - public bool Read16(out byte[] buffer, out byte[] senseBuffer, byte partition, ulong objectId, uint blocks, - uint blockSize, uint timeout, out double duration) => + public bool Read16(out byte[] buffer, out byte[] senseBuffer, byte partition, ulong objectId, uint blocks, + uint blockSize, uint timeout, out double duration) => Read16(out buffer, out senseBuffer, false, true, partition, objectId, blocks, blockSize, timeout, out duration); /// Reads a number of bytes or objects starting at specified object from the specified partition @@ -408,11 +408,11 @@ public partial class Device /// Object size in bytes. /// Timeout. /// Duration. - public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, byte partition, - ulong objectId, uint transferLen, uint objectSize, uint timeout, out double duration) + public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, byte partition, + ulong objectId, uint transferLen, uint objectSize, uint timeout, out double duration) { buffer = fixedLen ? new byte[objectSize * transferLen] : new byte[transferLen]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; senseBuffer = new byte[64]; byte[] idBytes = BitConverter.GetBytes(objectId); @@ -455,7 +455,7 @@ public partial class Device public bool ReadBlockLimits(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { buffer = new byte[6]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.ReadBlockLimits; @@ -494,8 +494,8 @@ public partial class Device /// Requests current logical position. /// Timeout. /// Duration. - public bool ReadPosition(out byte[] buffer, out byte[] senseBuffer, bool vendorType, bool longForm, - bool totalPosition, uint timeout, out double duration) + public bool ReadPosition(out byte[] buffer, out byte[] senseBuffer, bool vendorType, bool longForm, + bool totalPosition, uint timeout, out double duration) { byte responseForm = 0; @@ -543,7 +543,7 @@ public partial class Device break; } - byte[] cdb = new byte[10]; + var cdb = new byte[10]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.ReadPosition; @@ -573,8 +573,8 @@ public partial class Device /// Timeout. /// Duration. public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, uint blocks, uint blockSize, uint timeout, - out double duration) => ReadReverse6(out buffer, out senseBuffer, false, false, true, - blocks, blockSize, timeout, out duration); + out double duration) => ReadReverse6(out buffer, out senseBuffer, false, false, true, + blocks, blockSize, timeout, out duration); /// Reads the specified number of bytes or of blocks from the medium, backwards /// Buffer. @@ -584,8 +584,8 @@ public partial class Device /// Block size in bytes. /// Timeout. /// Duration. - public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen, uint blockSize, - uint timeout, out double duration) => + public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen, uint blockSize, + uint timeout, out double duration) => ReadReverse6(out buffer, out senseBuffer, false, sili, false, transferLen, blockSize, timeout, out duration); /// Reads the specified number of bytes or of blocks from the medium, backwards @@ -604,11 +604,11 @@ public partial class Device /// Block size in bytes. /// Timeout. /// Duration. - public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, bool byteOrder, bool sili, bool fixedLen, - uint transferLen, uint blockSize, uint timeout, out double duration) + public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, bool byteOrder, bool sili, bool fixedLen, + uint transferLen, uint blockSize, uint timeout, out double duration) { buffer = fixedLen ? new byte[blockSize * transferLen] : new byte[transferLen]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.ReadReverse; @@ -645,8 +645,8 @@ public partial class Device /// Object size in bytes. /// Timeout. /// Duration. - public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool sili, ulong objectId, uint blocks, - uint blockSize, uint timeout, out double duration) => + public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool sili, ulong objectId, uint blocks, + uint blockSize, uint timeout, out double duration) => ReadReverse16(out buffer, out senseBuffer, false, sili, false, 0, objectId, blocks, blockSize, timeout, out duration); @@ -660,8 +660,8 @@ public partial class Device /// Object size in bytes. /// Timeout. /// Duration. - public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool sili, byte partition, ulong objectId, - uint blocks, uint blockSize, uint timeout, out double duration) => + public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool sili, byte partition, ulong objectId, + uint blocks, uint blockSize, uint timeout, out double duration) => ReadReverse16(out buffer, out senseBuffer, false, sili, false, partition, objectId, blocks, blockSize, timeout, out duration); @@ -673,8 +673,8 @@ public partial class Device /// Object size in bytes. /// Timeout. /// Duration. - public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, ulong objectId, uint blocks, uint blockSize, - uint timeout, out double duration) => + public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, ulong objectId, uint blocks, uint blockSize, + uint timeout, out double duration) => ReadReverse16(out buffer, out senseBuffer, false, false, true, 0, objectId, blocks, blockSize, timeout, out duration); @@ -687,8 +687,8 @@ public partial class Device /// Object size in bytes. /// Timeout. /// Duration. - public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, byte partition, ulong objectId, uint blocks, - uint blockSize, uint timeout, out double duration) => + public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, byte partition, ulong objectId, uint blocks, + uint blockSize, uint timeout, out double duration) => ReadReverse16(out buffer, out senseBuffer, false, false, true, partition, objectId, blocks, blockSize, timeout, out duration); @@ -710,12 +710,12 @@ public partial class Device /// Object size in bytes. /// Timeout. /// Duration. - public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool byteOrder, bool sili, bool fixedLen, - byte partition, ulong objectId, uint transferLen, uint objectSize, uint timeout, + public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool byteOrder, bool sili, bool fixedLen, + byte partition, ulong objectId, uint transferLen, uint objectSize, uint timeout, out double duration) { buffer = fixedLen ? new byte[objectSize * transferLen] : new byte[transferLen]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; senseBuffer = new byte[64]; byte[] idBytes = BitConverter.GetBytes(objectId); @@ -760,8 +760,8 @@ public partial class Device /// Block size in bytes. /// Timeout. /// Duration. - public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, uint blocks, uint blockSize, - uint timeout, out double duration) => + public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, uint blocks, uint blockSize, + uint timeout, out double duration) => RecoverBufferedData(out buffer, out senseBuffer, false, true, blocks, blockSize, timeout, out duration); /// Reads the specified number of bytes or of blocks from the device's buffer @@ -772,8 +772,8 @@ public partial class Device /// Block size in bytes. /// Timeout. /// Duration. - public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen, - uint blockSize, uint timeout, out double duration) => + public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen, + uint blockSize, uint timeout, out double duration) => RecoverBufferedData(out buffer, out senseBuffer, sili, false, transferLen, blockSize, timeout, out duration); /// Reads the specified number of bytes or of blocks from the device's buffer @@ -791,11 +791,11 @@ public partial class Device /// Block size in bytes. /// Timeout. /// Duration. - public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, - uint transferLen, uint blockSize, uint timeout, out double duration) + public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, + uint transferLen, uint blockSize, uint timeout, out double duration) { buffer = fixedLen ? new byte[blockSize * transferLen] : new byte[transferLen]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.RecoverBufferedData; @@ -845,11 +845,11 @@ public partial class Device /// If set to true descriptors should apply to currently inserted media. /// Timeout. /// Duration. - public bool ReportDensitySupport(out byte[] buffer, out byte[] senseBuffer, bool mediumType, bool currentMedia, - uint timeout, out double duration) + public bool ReportDensitySupport(out byte[] buffer, out byte[] senseBuffer, bool mediumType, bool currentMedia, + uint timeout, out double duration) { buffer = new byte[256]; - byte[] cdb = new byte[10]; + var cdb = new byte[10]; senseBuffer = new byte[64]; cdb[0] = (byte)ScsiCommands.ReportDensitySupport; @@ -871,7 +871,7 @@ public partial class Device if(sense) return true; - ushort availableLength = (ushort)((buffer[0] << 8) + buffer[1] + 2); + var availableLength = (ushort)((buffer[0] << 8) + buffer[1] + 2); buffer = new byte[availableLength]; cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[8] = (byte)(buffer.Length & 0xFF); @@ -902,7 +902,7 @@ public partial class Device public bool Rewind(out byte[] senseBuffer, bool immediate, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; byte[] buffer = Array.Empty(); cdb[0] = (byte)ScsiCommands.Rewind; @@ -929,7 +929,7 @@ public partial class Device public bool TrackSelect(out byte[] senseBuffer, byte track, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; byte[] buffer = Array.Empty(); cdb[0] = (byte)ScsiCommands.TrackSelect; @@ -955,7 +955,7 @@ public partial class Device public bool Space(out byte[] senseBuffer, SscSpaceCodes code, int count, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[6]; + var cdb = new byte[6]; byte[] buffer = Array.Empty(); byte[] countB = BitConverter.GetBytes(count); diff --git a/Aaru.Devices/Device/ScsiCommands/SyQuest.cs b/Aaru.Devices/Device/ScsiCommands/SyQuest.cs index 8e0fc8373..4b02a55ce 100644 --- a/Aaru.Devices/Device/ScsiCommands/SyQuest.cs +++ b/Aaru.Devices/Device/ScsiCommands/SyQuest.cs @@ -47,7 +47,7 @@ public partial class Device /// Block size in bytes. public bool SyQuestRead6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint timeout, out double duration) => SyQuestRead6(out buffer, out senseBuffer, lba, blockSize, 1, false, - false, timeout, out duration); + false, timeout, out duration); /// Sends the SyQuest READ LONG (6) command /// true if the command failed and contains the sense buffer. @@ -73,11 +73,11 @@ public partial class Device /// Block size in bytes. /// How many blocks to read. public bool SyQuestRead6(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, byte transferLength, - bool inhibitDma, bool readLong, uint timeout, out double duration) + bool inhibitDma, bool readLong, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[6]; - bool sense; + var cdb = new byte[6]; + bool sense; cdb[0] = (byte)ScsiCommands.Read6; cdb[1] = (byte)((lba & 0x1F0000) >> 16); @@ -103,11 +103,15 @@ public partial class Device buffer = Array.Empty(); if(!inhibitDma) + { LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + } else + { LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + } Error = LastError != 0; @@ -151,8 +155,8 @@ public partial class Device ushort transferLength, bool inhibitDma, bool readLong, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[10]; - bool sense; + var cdb = new byte[10]; + bool sense; cdb[0] = (byte)ScsiCommands.Read10; cdb[2] = (byte)((lba & 0xFF000000) >> 24); @@ -180,11 +184,15 @@ public partial class Device buffer = Array.Empty(); if(!inhibitDma) + { LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + } else + { LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); + } Error = LastError != 0; diff --git a/Aaru.Devices/Device/Variables.cs b/Aaru.Devices/Device/Variables.cs index 049675c2f..1054a8f9c 100644 --- a/Aaru.Devices/Device/Variables.cs +++ b/Aaru.Devices/Device/Variables.cs @@ -38,18 +38,24 @@ namespace Aaru.Devices; public partial class Device { - private protected ushort _usbVendor; - private protected ushort _usbProduct; - private protected ulong _firewireGuid; - private protected uint _firewireModel; - private protected uint _firewireVendor; + const string ATA_MODULE_NAME = "ATA Device"; + const string SCSI_MODULE_NAME = "SCSI Device"; + const string SD_MODULE_NAME = "SecureDigital Device"; + const string MMC_MODULE_NAME = "MultiMediaCard Device"; + private protected byte[] _cachedCid; // MMC and SecureDigital, values that need to be get with card idle, something that may // not be possible to do but usually is already done by the SDHCI driver. private protected byte[] _cachedCsd; - private protected byte[] _cachedCid; - private protected byte[] _cachedScr; private protected byte[] _cachedOcr; + private protected byte[] _cachedScr; + + private protected string _devicePath; + private protected ulong _firewireGuid; + private protected uint _firewireModel; + private protected uint _firewireVendor; + private protected ushort _usbProduct; + private protected ushort _usbVendor; /// Gets the Platform ID for this device /// The Platform ID @@ -157,11 +163,4 @@ public partial class Device /// Contains the PCMCIA CIS if applicable public byte[] Cis { get; private protected set; } - - private protected string _devicePath; - - const string ATA_MODULE_NAME = "ATA Device"; - const string SCSI_MODULE_NAME = "SCSI Device"; - const string SD_MODULE_NAME = "SecureDigital Device"; - const string MMC_MODULE_NAME = "MultiMediaCard Device"; } \ No newline at end of file diff --git a/Aaru.Devices/Enums.cs b/Aaru.Devices/Enums.cs index d139d446e..85473e461 100644 --- a/Aaru.Devices/Enums.cs +++ b/Aaru.Devices/Enums.cs @@ -44,10 +44,12 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.Devices; #region ATA Commands + /// All known ATA commands public enum AtaCommands : byte { - #region Commands defined on Western Digital WD1000 Winchester Disk Controller +#region Commands defined on Western Digital WD1000 Winchester Disk Controller + /// Formats a track FormatTrack = 0x50, @@ -65,9 +67,11 @@ public enum AtaCommands : byte /// Writes sectors WriteOld = 0x30, - #endregion Commands defined on Western Digital WD1000 Winchester Disk Controller - #region Commands defined on ATA rev. 4c +#endregion Commands defined on Western Digital WD1000 Winchester Disk Controller + +#region Commands defined on ATA rev. 4c + /// Acknowledges media change AckMediaChange = 0xDB, @@ -268,17 +272,21 @@ public enum AtaCommands : byte /// Unknown vendor command VendorFf = 0xFF, - #endregion Commands defined on ATA rev. 4c - #region Commands defined on ATA-2 rev. 4c +#endregion Commands defined on ATA rev. 4c + +#region Commands defined on ATA-2 rev. 4c + /// Alters the device microcode DownloadMicrocode = 0x92, /// 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 +#endregion Commands defined on ATA-2 rev. 4c + +#region Commands defined on ATA-3 rev. 7b + /// Gets a sector containing drive identification and capabilities IdentifyDriveDma = 0xEE, @@ -302,9 +310,11 @@ public enum AtaCommands : byte /// SMART operations Smart = 0xB0, - #endregion Commands defined on ATA-3 rev. 7b - #region Commands defined on CompactFlash Specification +#endregion Commands defined on ATA-3 rev. 7b + +#region Commands defined on CompactFlash Specification + /// Pre-erases and conditions data sectors EraseSectors = 0xC0, @@ -325,9 +335,11 @@ public enum AtaCommands : byte /// Writes sectors without erasing them previously WriteWithoutErase = 0x38, - #endregion Commands defined on CompactFlash Specification - #region Commands defined on ATA/ATAPI-4 rev. 18 +#endregion Commands defined on CompactFlash Specification + +#region Commands defined on ATA/ATAPI-4 rev. 18 + /// Resets a device DeviceReset = 0x08, @@ -366,9 +378,11 @@ public enum AtaCommands : byte /// 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 +#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 CheckMediaCardType = 0xD1, @@ -419,9 +433,11 @@ public enum AtaCommands : byte /// 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 +#endregion Commands defined on ATA/ATAPI-6 rev. 3b + +#region Commands defined on ATA/ATAPI-7 rev. 4b + /// Configures the operating parameters for a stream ConfigureStream = 0x51, @@ -436,9 +452,11 @@ public enum AtaCommands : byte /// Writes data on an allotted time using PIO WriteStreamExt = 0x3B, - #endregion Commands defined on ATA/ATAPI-7 rev. 4b - #region Commands defined on ATA/ATAPI-8 rev. 3f +#endregion Commands defined on ATA/ATAPI-7 rev. 4b + +#region Commands defined on ATA/ATAPI-8 rev. 3f + /// Sends a Non Volatile Cache subcommand. NonVolatileCacheCommand = 0xB6, @@ -471,9 +489,11 @@ public enum AtaCommands : byte /// 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 +#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 DataSetManagement = 0x06, @@ -490,7 +510,8 @@ public enum AtaCommands : byte ReadLogDmaExt = 0x47, /// Requests SPC-4 style error data - RequestSenseDataExt = 0x0B, SanitizeCommands = 0xB4, + RequestSenseDataExt = 0x0B, + SanitizeCommands = 0xB4, /// Executes a Security Protocol command that does not require a transfer of data TrustedNonData = 0x5B, @@ -500,26 +521,35 @@ public enum AtaCommands : byte /// 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 +#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 NcqQueueManagement = 0x63, /// Sets the device date and time SetDateAndTimeExt = 0x77, - #endregion Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 5 - #region Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 6 +#endregion Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 5 + +#region Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 6 + NativeMaxAddress = 0x78 - #endregion Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 6 + +#endregion Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 6 } + #endregion ATA Commands + #region ATA SMART SubCommands + /// All known ATA SMART sub-commands public enum AtaSmartSubCommands : byte { - #region Commands defined on ATA-3 rev. 7b +#region Commands defined on ATA-3 rev. 7b + /// Disables all SMART capabilities Disable = 0xD9, @@ -540,30 +570,39 @@ public enum AtaSmartSubCommands : byte /// Saves any attribute values immediately SaveAttributeValues = 0xD3, - #endregion Commands defined on ATA-3 rev. 7b - #region Commands defined on ATA/ATAPI-4 rev. 18 +#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 ExecuteOfflineImmediate = 0xD4, /// 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 +#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 ReadLog = 0xD5, /// Writes data to the indicated log WriteLog = 0xD6 - #endregion Commands defined on ATA/ATAPI-5 rev. 3 + +#endregion Commands defined on ATA/ATAPI-5 rev. 3 } + #endregion ATA SMART SubCommands + #region ATA Device Configuration Overlay SubCommands + /// All known ATA DEVICE CONFIGURATION sub-commands public enum AtaDeviceConfigurationSubCommands : byte { - #region Commands defined on ATA/ATAPI-6 rev. 3b +#region Commands defined on ATA/ATAPI-6 rev. 3b + /// Disables any change made by Restore = 0xC0, @@ -575,14 +614,19 @@ public enum AtaDeviceConfigurationSubCommands : byte /// Modifies the commands, modes and features sets the device will obey to Set = 0xC3 - #endregion Commands defined on ATA/ATAPI-6 rev. 3b + +#endregion Commands defined on ATA/ATAPI-6 rev. 3b } + #endregion ATA Device Configuration Overlay SubCommands + #region ATA SET MAX SubCommands + /// All known ATA SET MAX sub-commands public enum AtaSetMaxSubCommands : byte { - #region Commands defined on ATA/ATAPI-6 rev. 3b +#region Commands defined on ATA/ATAPI-6 rev. 3b + /// Redefines the maximum user-accessible address space Address = 0x00, @@ -600,14 +644,19 @@ public enum AtaSetMaxSubCommands : byte /// Disables UnLock = 0x03, - #endregion Commands defined on ATA/ATAPI-6 rev. 3b + +#endregion Commands defined on ATA/ATAPI-6 rev. 3b } + #endregion ATA SET MAX SubCommands + #region ATA Non Volatile Cache SubCommands + /// All known ATA NV CACHE sub-commands public enum AtaNonVolatileCacheSubCommands : byte { - #region Commands defined on ATA/ATAPI-8 rev. 3f +#region Commands defined on ATA/ATAPI-8 rev. 3f + /// Adds the specified LBA to the Non Volatile Cache AddLbaToNvCache = 0x10, @@ -631,14 +680,19 @@ public enum AtaNonVolatileCacheSubCommands : byte /// Cache /// SetNvCachePowerMode = 0x00 - #endregion Commands defined on ATA/ATAPI-8 rev. 3f + +#endregion Commands defined on ATA/ATAPI-8 rev. 3f } + #endregion ATA Non Volatile Cache SubCommands + #region ATA Sanitize SubCommands + /// All known ATA SANITIZE sub-commands public enum AtaSanitizeSubCommands : ushort { - #region Commands defined on ATA/ATAPI Command Set 2 (ACS-2) rev. 2 +#region Commands defined on ATA/ATAPI Command Set 2 (ACS-2) rev. 2 + /// Causes a block erase on all user data BlockEraseExt = 0x0012, @@ -653,36 +707,48 @@ public enum AtaSanitizeSubCommands : ushort /// 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 +#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 AntiFreezeLockExt = 0x0040 - #endregion Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 5 + +#endregion Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 5 } + #endregion ATA Sanitize SubCommands + #region ATA NCQ Queue Management SubCommands + /// 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 +#region Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 5 + /// Aborts pending NCQ commands AbortNcqQueue = 0x00, /// 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 + +#endregion Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 5 } + #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 /// + #region SASI Commands + public enum SasiCommands : byte { - #region SASI Class 0 commands +#region SASI Class 0 commands + /// Returns zero status if requested unit is on and ready. SASI rev. 0a TestUnitReady = 0x00, @@ -790,9 +856,11 @@ public enum SasiCommands : byte /// Gets information about a device SASI rev. 0c InquiryOld = 0x1F, - #endregion SASI Class 0 commands - #region SASI Class 1 commands +#endregion SASI Class 0 commands + +#region SASI Class 1 commands + /// SASI rev. 0a Unknown Copy = 0x20, @@ -828,9 +896,11 @@ public enum SasiCommands : byte /// 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 +#endregion SASI Class 1 commands + +#region SASI Class 2 commands + /// Unknown SASI rev. 0a Load = 0x40, @@ -893,9 +963,11 @@ public enum SasiCommands : byte /// 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 +#endregion SASI Class 2 commands + +#region SASI Class 3 commands + /// SASI rev. 0a Skip = 0x60, @@ -916,17 +988,21 @@ public enum SasiCommands : byte /// SASI rev. 0a WriteControl = 0x66, - #endregion SASI Class 3 commands - #region SASI Class 5 commands +#endregion SASI Class 3 commands + +#region SASI Class 5 commands + /// 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) SetBlockLimits = 0xA9, - #endregion SASI Class 5 commands - #region SASI Class 6 commands +#endregion SASI Class 5 commands + +#region SASI Class 6 commands + /// SASI rev. 0a DefineFloppyDiskTrackFormat = 0xC0, @@ -941,9 +1017,11 @@ public enum SasiCommands : byte /// SASI rev. 0a ReadDriveType = 0xC6, - #endregion SASI Class 6 commands - #region SASI Class 7 commands +#endregion SASI Class 6 commands + +#region SASI Class 7 commands + /// SASI rev. 0a RamDiagnostic = 0xE0, @@ -964,14 +1042,19 @@ public enum SasiCommands : byte /// Found on a vendor document WriteLong = 0xE6 - #endregion SASI Class 7 commands + +#endregion SASI Class 7 commands } + #endregion SASI Commands + #region SCSI Commands + /// All known SCSI and ATAPI commands public enum ScsiCommands : byte { - #region SCSI Primary Commands (SPC) +#region SCSI Primary Commands (SPC) + /// Commands used to obtain information about the access controls that are active SPC-4 rev. 16 AccessControlIn = 0x86, @@ -1085,14 +1168,17 @@ public enum ScsiCommands : byte /// 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) +#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 CompareAndWrite = 0x89, /// Formats the medium into addressable logical blocks ECMA-111 (SCSI-1) - FormatUnit = SasiCommands.FormatUnit, FormatWithPreset = 0x38, + FormatUnit = SasiCommands.FormatUnit, + FormatWithPreset = 0x38, /// Locks blocks from eviction of device's cache SCSI-2 X3T9.2/375R rev. 10l LockUnlockCache = 0x36, @@ -1147,7 +1233,8 @@ public enum ScsiCommands : byte Regenerate = 0x82, /// Requests the device to set the LUN in a vendor specific state ECMA-111 (SCSI-1) - RezeroUnit = SasiCommands.RezeroUnit, Sanitize = 0x48, + RezeroUnit = SasiCommands.RezeroUnit, + Sanitize = 0x48, /// Searches data on blocks ECMA-111 (SCSI-1) SearchDataEqual = SasiCommands.SearchDataEqual, @@ -1235,9 +1322,11 @@ public enum ScsiCommands : byte /// rev. 8c /// XpWrite = 0x51, - #endregion SCSI Block Commands (SBC) - #region SCSI Streaming Commands (SSC) +#endregion SCSI Block Commands (SBC) + +#region SCSI Streaming Commands (SSC) + /// Prepares the medium for use by the LUN SSC-1 rev. 22 FormatMedium = 0x04, @@ -1288,9 +1377,11 @@ public enum ScsiCommands : byte /// 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) +#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) @@ -1314,17 +1405,21 @@ public enum ScsiCommands : byte /// X3T9.2/375R rev. 10l /// SynchronizeBuffer = FlushBuffer, - #endregion SCSI Streaming Commands for Printers (SSC) - #region SCSI Processor Commands +#endregion SCSI Streaming Commands for Printers (SSC) + +#region SCSI Processor Commands + /// Transfers data from the device ECMA-111 (SCSI-1) Receive = 0x08, /// Sends data to the device ECMA-111 (SCSI-1) Send = 0x0A, - #endregion SCSI Processor Commands - #region SCSI Multimedia Commands (MMC) +#endregion SCSI Processor Commands + +#region SCSI Multimedia Commands (MMC) + /// Erases any part of a CD-RW MMC-1 rev. 9 Blank = 0xA1, @@ -1462,9 +1557,11 @@ public enum ScsiCommands : byte /// 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 +#endregion SCSI Multimedia Commands (MMC) + +#region SCSI Scanner Commands + /// Gets information about the data buffer SCSI-2 X3T9.2/375R rev. 10l GetDataBufferStatus = 0x34, @@ -1482,9 +1579,11 @@ public enum ScsiCommands : byte /// 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) +#endregion SCSI Scanner Commands + +#region SCSI Block Commands for Optical Media (SBC) + /// Erases the specified number of blocks Erase10 = 0x2C, @@ -1529,9 +1628,11 @@ public enum ScsiCommands : byte /// 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) +#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 @@ -1585,9 +1686,11 @@ public enum ScsiCommands : byte /// X3T9.2/375R rev. 10l /// SendVolumeTag = 0xB6, - #endregion SCSI Medium Changer Commands (SMC) - #region SCSI Communication Commands +#endregion SCSI Medium Changer Commands (SMC) + +#region SCSI Communication Commands + /// Gets data from the device SCSI-2 X3T9.2/375R rev. 10l GetMessage = 0x08, @@ -1605,9 +1708,11 @@ public enum ScsiCommands : byte /// Sends data to the device SCSI-2 X3T9.2/375R rev. 10l SendMessage12 = 0xAA, - #endregion SCSI Communication Commands - #region SCSI Controller Commands +#endregion SCSI Communication Commands + +#region SCSI Controller Commands + /// Commands that get information about redundancy groups SCC-2 rev. 4 RedundancyGroupIn = 0xBA, @@ -1619,9 +1724,11 @@ public enum ScsiCommands : byte /// 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 +#endregion SCSI Controller Commands + +#region Pioneer CD-ROM SCSI-2 Command Set + /// Scans for a block playing a block on each track cross AudioScan = 0xCD, @@ -1644,39 +1751,61 @@ public enum ScsiCommands : byte ReadAllSubCode = 0xDF, /// Sets the spindle speed to be used while reading/writing data to a CD - SetCdSpeed = 0xDA, WriteCdp = 0xE3, - #endregion + SetCdSpeed = 0xDA, + WriteCdp = 0xE3, + +#endregion + +#region ATA Command Pass-Through - #region ATA Command Pass-Through /// 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 AtaPassThrough16 = 0x85, - #endregion ATA Command Pass-Through - #region 6-byte CDB aliases - ModeSelect6 = ModeSelect, ModeSense6 = ModeSense, Read6 = Read, - Seek6 = Seek, Write6 = Write, - #endregion 6-byte CDB aliases +#endregion ATA Command Pass-Through + +#region 6-byte CDB aliases + + ModeSelect6 = ModeSelect, + ModeSense6 = ModeSense, + Read6 = Read, + Seek6 = Seek, + Write6 = Write, + +#endregion 6-byte CDB aliases + +#region SCSI Zoned Block Commands - #region SCSI Zoned Block Commands /// ZBC commands with host->device information ZbcOut = 0x94, /// ZBC commands with device->host information ZbcIn = 0x95, - #endregion - #region SCSI Commands with unknown meaning, mostly vendor specific - SetCdSpeedUnk = 0xB8, WriteCdMsf = 0xA2, WriteCd = 0xAA, - ReadDefectTag = 0xB7, PlayCd = 0xBC, SpareIn = 0xBC, - SpareOut = 0xBD, WriteStream16 = 0x9A, WriteAtomic = 0x9C, - ServiceActionBidirectional = 0x9D, WriteLong2 = 0xEA, UnknownCdCommand = 0xD4, +#endregion + +#region SCSI Commands with unknown meaning, mostly vendor specific + + SetCdSpeedUnk = 0xB8, + WriteCdMsf = 0xA2, + WriteCd = 0xAA, + ReadDefectTag = 0xB7, + PlayCd = 0xBC, + SpareIn = 0xBC, + SpareOut = 0xBD, + WriteStream16 = 0x9A, + WriteAtomic = 0x9C, + ServiceActionBidirectional = 0x9D, + WriteLong2 = 0xEA, + UnknownCdCommand = 0xD4, UnknownCdCommand2 = 0xD5, - #endregion SCSI Commands with unknown meaning, mostly vendor specific - #region SEGA Packet Interface (all are 12-byte CDB) +#endregion SCSI Commands with unknown meaning, mostly vendor specific + +#region SEGA Packet Interface (all are 12-byte CDB) + /// Verifies that the device can be accessed Sega SPI ver. 1.30 SegaTestUnit = TestUnitReady, @@ -1724,12 +1853,14 @@ public enum ScsiCommands : byte /// Reads disc subcode Sega SPI ver. 1.30 SegaGetSubcode = 0x40, - #endregion SEGA Packet Interface (all are 12-byte CDB) + +#endregion SEGA Packet Interface (all are 12-byte CDB) /// Variable sized Command Description Block SPC-4 rev. 16 VariableSizedCdb = 0x7F, - #region Plextor vendor commands +#region Plextor vendor commands + /// Sends extended commands (like SpeedRead) to Plextor drives PlextorExtend = 0xE9, @@ -1744,19 +1875,25 @@ public enum ScsiCommands : byte /// Reads drive statistics from Plextor drives EEPROM PlextorReadEeprom = 0xF1, - #endregion Plextor vendor commands - #region HL-DT-ST vendor commands +#endregion Plextor vendor commands + +#region HL-DT-ST vendor commands + /// Sends debugging commands to HL-DT-ST DVD drives HlDtStVendor = 0xE7, - #endregion HL-DT-ST vendor commands - #region NEC vendor commands +#endregion HL-DT-ST vendor commands + +#region NEC vendor commands + /// Reads CD-DA data NecReadCdDa = 0xD4, - #endregion NEC vendor commands - #region Adaptec vendor commands +#endregion NEC vendor commands + +#region Adaptec vendor commands + /// Translates a SCSI LBA to a drive's CHS AdaptecTranslate = 0x0F, @@ -1771,54 +1908,68 @@ public enum ScsiCommands : byte /// Reads controller's RAM AdaptecReadBuffer = 0x14, - #endregion Adaptec vendor commands - #region Archive Corp. vendor commands +#endregion Adaptec vendor commands + +#region Archive Corp. vendor commands + /// Gets current position's block address ArchiveRequestBlockAddress = 0x02, /// Seeks to specified block address ArchiveSeekBlock = 0x0C, - #endregion Archive Corp. vendor commands - #region Certance vendor commands +#endregion Archive Corp. vendor commands + +#region Certance vendor commands + /// Parks the load arm in preparation for transport CertanceParkUnpark = 0x06, - #endregion Certance vendor commands - #region Fujitsu vendor commands +#endregion Certance vendor commands + +#region Fujitsu vendor commands + /// Used to check the controller's data and control path FujitsuLoopWriteToRead = 0xC1, /// Used to display a message on the operator panel FujitsuDisplay = 0xCF, - #endregion Fujitsu vendor commands - #region M-Systems vendor commands +#endregion Fujitsu vendor commands + +#region M-Systems vendor commands + /// Securely erases all flash blocks, including defective, spared and unused MSystemsSecurityErase = 0xFF, /// Securely erases all flash blocks, including defective, spared and unused MSystemsSecurityEraseOld = 0xDF, - #endregion M-Systems vendor commands - #region Plasmon vendor commands +#endregion M-Systems vendor commands + +#region Plasmon vendor commands + /// Retrieves sector address PlasmonReadSectorLocation = 0xE6, /// Makes a Compliant WORM block completely unreadable PlasmonShred = 0xEE, - #endregion Plasmon vendor commands - #region Kreon vendor commands +#endregion Plasmon vendor commands + +#region Kreon vendor commands + /// Most Kreon commands start with this KreonCommand = 0xFF, /// Kreon extract Security Sectors command start with this KreonSsCommand = 0xAD, - #endregion Kreon vendor commands - #region MiniDisc vendor commands +#endregion Kreon vendor commands + +#region MiniDisc vendor commands + /// Gets some list of pointers only present on MD-DATA discs MiniDiscReadDTOC = 0xD1, /// Writes some list of pointers only present on MD-DATA discs @@ -1833,12 +1984,16 @@ public enum ScsiCommands : byte MiniDiscReadPosition = 0xD7, /// Gets some values that are identical amongst audio discs and data discs, different between them MiniDiscGetType = 0xD8, - #endregion - #region MediaTek vendor commands +#endregion + +#region MediaTek vendor commands + MediaTekVendorCommand = 0xF1 - #endregion + +#endregion } + #endregion SCSI Commands /// SCSI command transfer direction @@ -1861,6 +2016,7 @@ public enum ScsiDirection } #region SCSI's ATA Command Pass-Through + public enum AtaProtocol : byte { /// Requests a device hard reset (pin 1) @@ -1918,6 +2074,7 @@ public enum AtaTransferRegister : byte /// The STPSIU contains the data length Sptsiu = 3 } + #endregion SCSI's ATA Command Pass-Through /// ZBC sub-commands, mask 0x1F @@ -1990,7 +2147,8 @@ public enum MmcGetConfigurationRt : byte Current = 0x01, /// Drive shall return only the Feature Header with the chosen Feature Descriptor - Single = 0x02, Reserved = 0x03 + Single = 0x02, + Reserved = 0x03 } public enum MmcDiscStructureMediaType : byte @@ -2422,13 +2580,16 @@ public enum SscSpaceCodes : byte SequentialFilemark = 2, /// End-of-data - EndOfData = 3, Obsolete1 = 4, Obsolete2 = 5 + EndOfData = 3, + Obsolete1 = 4, + Obsolete2 = 5 } /// MMC / SecureDigital commands public enum MmcCommands : byte { - #region Class 1 MMC Commands (Basic and read-stream) +#region Class 1 MMC Commands (Basic and read-stream) + /// Resets device to idle (BC) GoIdle = 0, @@ -2491,10 +2652,14 @@ public enum MmcCommands : byte GoInactiveState = 15, /// The host sends the bus testing data pattern to a device (ADTC, R1) - BusTestWrite = 19, SpiReadOcr = 58, SpicrcOnOff = 59, - #endregion Class 1 MMC Commands (Basic and read-stream) + BusTestWrite = 19, + SpiReadOcr = 58, + SpicrcOnOff = 59, + +#endregion Class 1 MMC Commands (Basic and read-stream) + +#region Class 2 MMC Commands (Block-oriented read) - #region Class 2 MMC Commands (Block-oriented read) /// Sets the block length in bytes (AC, R1) SetBlocklen = 16, @@ -2506,15 +2671,19 @@ public enum MmcCommands : byte /// 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) +#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) [Obsolete] WriteDatUntilStop = 20, - #endregion Class 3 MMC Commands (Stream write) - #region Class 4 MMC Commands (Block-oriented write) +#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) @@ -2535,9 +2704,11 @@ public enum MmcCommands : byte /// 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) +#endregion Class 4 MMC Commands (Block-oriented write) + +#region Class 5 MMC Commands (Erase) + /// Sets the address of the first erase group (AC, R1) EraseGroupStart = 35, @@ -2546,9 +2717,11 @@ public enum MmcCommands : byte /// Erases previously selected write blocks (AC, R1b) Erase = 38, - #endregion Class 5 MMC Commands (Erase) - #region Class 6 MMC Commands (Block-oriented write protection) +#endregion Class 5 MMC Commands (Erase) + +#region Class 6 MMC Commands (Block-oriented write protection) + /// Sets the write protection bit (AC, R1b) SetWriteProtect = 28, @@ -2560,22 +2733,28 @@ public enum MmcCommands : byte /// 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) +#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) LockUnlock = 42, - #endregion Class 7 MMC Commands (Lock) - #region Class 8 MMC Commands (Application-specific) +#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) ApplicationCommand = 55, /// 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) +#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) @@ -2584,17 +2763,21 @@ public enum MmcCommands : byte /// 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) +#endregion Class 9 MMC Commands (I/O mode) + +#region Class 10 MMC Commands (Security Protocols) + /// Reads data blocks (ADTC, R1) ProtocolRead = 53, /// Writes data blocks (ADTC, R1) ProtocolWrite = 54, - #endregion Class 10 MMC Commands (Security Protocols) - #region Class 11 MMC Commands (Command Queue) +#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) QueuedTaskParameters = 44, @@ -2609,25 +2792,31 @@ public enum MmcCommands : byte /// Manages queues and tasks (AC, R1b) CmdQTaskManagement = 48, - #endregion Class 11 MMC Commands (Command Queue) - #region Class 1 SecureDigital Commands (Basic) +#endregion Class 11 MMC Commands (Command Queue) + +#region Class 1 SecureDigital Commands (Basic) + /// Sends SD interface condition (BCR, R7) SendInterfaceCondition = 8, /// 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) +#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 optimal sampling point detection (ADTC, R1) SendTuningBlock = 19, /// Speed class control command (AC, R1b) SpeedClassControl = 20, - #endregion Class 2 SecureDigital Commands (Block-oriented read) - #region Class 11 SecureDigital Commands (Function Extension) +#endregion Class 2 SecureDigital Commands (Block-oriented read) + +#region Class 11 SecureDigital Commands (Function Extension) + /// Single block read type (ADTC, R1) ReadExtraSingle = 48, @@ -2639,7 +2828,8 @@ public enum MmcCommands : byte /// Multiple block write type (ADTC, R1) WriteExtraMulti = 59, - #endregion Class 11 SecureDigital Commands (Function Extension) + +#endregion Class 11 SecureDigital Commands (Function Extension) } /// SecureDigital application-specific commands @@ -2667,23 +2857,40 @@ public enum SecureDigitalCommands : byte SendScr = 51 } -[Flags, SuppressMessage("ReSharper", "ShiftExpressionZeroLeftOperand")] +[Flags] +[SuppressMessage("ReSharper", "ShiftExpressionZeroLeftOperand")] public enum MmcFlags : uint { - ResponsePresent = 1 << 0, Response136 = 1 << 1, ResponseCrc = 1 << 2, - ResponseBusy = 1 << 3, ResponseOpcode = 1 << 4, CommandMask = 3 << 5, - CommandAc = 0 << 5, CommandAdtc = 1 << 5, CommandBc = 2 << 5, - CommandBcr = 3 << 5, ResponseSpiS1 = 1 << 7, ResponseSpiS2 = 1 << 8, - ResponseSpiB4 = 1 << 9, ResponseSpiBusy = 1 << 10, ResponseNone = 0, + ResponsePresent = 1 << 0, + Response136 = 1 << 1, + ResponseCrc = 1 << 2, + ResponseBusy = 1 << 3, + ResponseOpcode = 1 << 4, + CommandMask = 3 << 5, + CommandAc = 0 << 5, + CommandAdtc = 1 << 5, + CommandBc = 2 << 5, + CommandBcr = 3 << 5, + ResponseSpiS1 = 1 << 7, + ResponseSpiS2 = 1 << 8, + ResponseSpiB4 = 1 << 9, + ResponseSpiBusy = 1 << 10, + ResponseNone = 0, ResponseR1 = ResponsePresent | ResponseCrc | ResponseOpcode, ResponseR1B = ResponsePresent | ResponseCrc | ResponseOpcode | ResponseBusy, - ResponseR2 = ResponsePresent | Response136 | ResponseCrc, ResponseR3 = ResponsePresent, - ResponseR4 = ResponsePresent, ResponseR5 = ResponsePresent | ResponseCrc | ResponseOpcode, + ResponseR2 = ResponsePresent | Response136 | ResponseCrc, + ResponseR3 = ResponsePresent, + ResponseR4 = ResponsePresent, + ResponseR5 = ResponsePresent | ResponseCrc | ResponseOpcode, ResponseR6 = ResponsePresent | ResponseCrc | ResponseOpcode, - ResponseR7 = ResponsePresent | ResponseCrc | ResponseOpcode, ResponseSpiR1 = ResponseSpiS1, - ResponseSpiR1B = ResponseSpiS1 | ResponseSpiBusy, ResponseSpiR2 = ResponseSpiS1 | ResponseSpiS2, - ResponseSpiR3 = ResponseSpiS1 | ResponseSpiB4, ResponseSpiR4 = ResponseSpiS1 | ResponseSpiB4, - ResponseSpiR5 = ResponseSpiS1 | ResponseSpiS2, ResponseSpiR7 = ResponseSpiS1 | ResponseSpiB4 + ResponseR7 = ResponsePresent | ResponseCrc | ResponseOpcode, + ResponseSpiR1 = ResponseSpiS1, + ResponseSpiR1B = ResponseSpiS1 | ResponseSpiBusy, + ResponseSpiR2 = ResponseSpiS1 | ResponseSpiS2, + ResponseSpiR3 = ResponseSpiS1 | ResponseSpiB4, + ResponseSpiR4 = ResponseSpiS1 | ResponseSpiB4, + ResponseSpiR5 = ResponseSpiS1 | ResponseSpiS2, + ResponseSpiR7 = ResponseSpiS1 | ResponseSpiB4 } [Flags] @@ -2864,33 +3071,46 @@ public enum AtaFeatures : byte DisableReleaseInterrupt = 0xDD, /// Disable SERVICE interrupt - DisableServiceInterrupt = 0xDE, VendorSpecific = 0xE0 + DisableServiceInterrupt = 0xDE, + VendorSpecific = 0xE0 } public enum KreonLockStates : byte { - Locked = 0, Xtreme = 1, Wxripper = 2 + Locked = 0, + Xtreme = 1, + Wxripper = 2 } public enum RotationalControl : byte { - ClvAndImpureCav = 0, PureCav = 1 + ClvAndImpureCav = 0, + PureCav = 1 } public enum TrackInformationType : byte { - LogicalBlockAddress = 0, LogicalTrackNumber = 1, SessionNumber = 2 + LogicalBlockAddress = 0, + LogicalTrackNumber = 1, + SessionNumber = 2 } public enum CssReportKeyFormat : byte { - AgidForCssCppm = 0x00, ChallengeKey = 0x01, Key1 = 0x02, - TitleKey = 0x04, Asf = 0x05, RpcState = 0x08, - AgidForCprm = 0x11, InvalidateAgid = 0x3f + AgidForCssCppm = 0x00, + ChallengeKey = 0x01, + Key1 = 0x02, + TitleKey = 0x04, + Asf = 0x05, + RpcState = 0x08, + AgidForCprm = 0x11, + InvalidateAgid = 0x3f } public enum CssSendKeyFormat : byte { - ChallengeKey = 0x01, Key2 = 0x03, RpcStructure = 0x06, + ChallengeKey = 0x01, + Key2 = 0x03, + RpcStructure = 0x06, InvalidateAgid = 0x3f } \ No newline at end of file diff --git a/Aaru.Devices/Linux/Command.cs b/Aaru.Devices/Linux/Command.cs index c494ee4b3..d8bfe71ee 100644 --- a/Aaru.Devices/Linux/Command.cs +++ b/Aaru.Devices/Linux/Command.cs @@ -43,7 +43,7 @@ namespace Aaru.Devices.Linux; partial class Device { /// - public override int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, + public override int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, ScsiDirection direction, out double duration, out bool sense) { // We need a timeout @@ -58,13 +58,13 @@ partial class Device return -1; ScsiIoctlDirection dir = direction switch - { - ScsiDirection.In => ScsiIoctlDirection.In, - ScsiDirection.Out => ScsiIoctlDirection.Out, - ScsiDirection.Bidirectional => ScsiIoctlDirection.Unspecified, - ScsiDirection.None => ScsiIoctlDirection.None, - _ => ScsiIoctlDirection.Unknown - }; + { + ScsiDirection.In => ScsiIoctlDirection.In, + ScsiDirection.Out => ScsiIoctlDirection.Out, + ScsiDirection.Bidirectional => ScsiIoctlDirection.Unspecified, + ScsiDirection.None => ScsiIoctlDirection.None, + _ => ScsiIoctlDirection.Unknown + }; var ioHdr = new SgIoHdrT(); @@ -81,9 +81,9 @@ partial class Device ioHdr.timeout = timeout * 1000; ioHdr.flags = (uint)SgFlags.DirectIo; - Marshal.Copy(buffer, 0, ioHdr.dxferp, buffer.Length); - Marshal.Copy(cdb, 0, ioHdr.cmdp, cdb.Length); - Marshal.Copy(senseBuffer, 0, ioHdr.sbp, senseBuffer.Length); + Marshal.Copy(buffer, 0, ioHdr.dxferp, buffer.Length); + Marshal.Copy(cdb, 0, ioHdr.cmdp, cdb.Length); + Marshal.Copy(senseBuffer, 0, ioHdr.sbp, senseBuffer.Length); var cmdStopWatch = new Stopwatch(); cmdStopWatch.Start(); @@ -93,9 +93,9 @@ partial class Device if(error < 0) error = Marshal.GetLastWin32Error(); - Marshal.Copy(ioHdr.dxferp, buffer, 0, buffer.Length); - Marshal.Copy(ioHdr.cmdp, cdb, 0, cdb.Length); - Marshal.Copy(ioHdr.sbp, senseBuffer, 0, senseBuffer.Length); + Marshal.Copy(ioHdr.dxferp, buffer, 0, buffer.Length); + Marshal.Copy(ioHdr.cmdp, cdb, 0, cdb.Length); + Marshal.Copy(ioHdr.sbp, senseBuffer, 0, senseBuffer.Length); sense |= (ioHdr.info & SgInfo.OkMask) != SgInfo.Ok; @@ -120,12 +120,16 @@ partial class Device case AtaProtocol.HardReset: case AtaProtocol.NonData: case AtaProtocol.SoftReset: - case AtaProtocol.ReturnResponse: return ScsiDirection.None; + case AtaProtocol.ReturnResponse: + return ScsiDirection.None; case AtaProtocol.PioIn: - case AtaProtocol.UDmaIn: return ScsiDirection.In; + case AtaProtocol.UDmaIn: + return ScsiDirection.In; case AtaProtocol.PioOut: - case AtaProtocol.UDmaOut: return ScsiDirection.Out; - default: return ScsiDirection.Unspecified; + case AtaProtocol.UDmaOut: + return ScsiDirection.Out; + default: + return ScsiDirection.Unspecified; } } @@ -145,9 +149,9 @@ partial class Device if(buffer == null) return -1; - byte[] cdb = new byte[16]; + var cdb = new byte[16]; cdb[0] = (byte)ScsiCommands.AtaPassThrough16; - cdb[1] = (byte)(((byte)protocol << 1) & 0x1E); + cdb[1] = (byte)((byte)protocol << 1 & 0x1E); if(transferRegister != AtaTransferRegister.NoTransfer && protocol != AtaProtocol.NonData) @@ -181,11 +185,11 @@ partial class Device cdb[13] = registers.DeviceHead; cdb[14] = registers.Command; - int error = SendScsiCommand(cdb, ref buffer, out byte[] senseBuffer, timeout, + int error = SendScsiCommand(cdb, ref buffer, out byte[] senseBuffer, timeout, AtaProtocolToScsiDirection(protocol), out duration, out sense); if(senseBuffer.Length < 22 || - (senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C)) + senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C) return error; errorRegisters.Error = senseBuffer[11]; @@ -218,9 +222,9 @@ partial class Device if(buffer == null) return -1; - byte[] cdb = new byte[16]; + var cdb = new byte[16]; cdb[0] = (byte)ScsiCommands.AtaPassThrough16; - cdb[1] = (byte)(((byte)protocol << 1) & 0x1E); + cdb[1] = (byte)((byte)protocol << 1 & 0x1E); if(transferRegister != AtaTransferRegister.NoTransfer && protocol != AtaProtocol.NonData) @@ -254,11 +258,11 @@ partial class Device cdb[13] = registers.DeviceHead; cdb[14] = registers.Command; - int error = SendScsiCommand(cdb, ref buffer, out byte[] senseBuffer, timeout, + int error = SendScsiCommand(cdb, ref buffer, out byte[] senseBuffer, timeout, AtaProtocolToScsiDirection(protocol), out duration, out sense); if(senseBuffer.Length < 22 || - (senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C)) + senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C) return error; errorRegisters.Error = senseBuffer[11]; @@ -291,9 +295,9 @@ partial class Device if(buffer == null) return -1; - byte[] cdb = new byte[16]; + var cdb = new byte[16]; cdb[0] = (byte)ScsiCommands.AtaPassThrough16; - cdb[1] = (byte)(((byte)protocol << 1) & 0x1E); + cdb[1] = (byte)((byte)protocol << 1 & 0x1E); cdb[1] |= 0x01; if(transferRegister != AtaTransferRegister.NoTransfer && @@ -333,11 +337,11 @@ partial class Device cdb[13] = registers.DeviceHead; cdb[14] = registers.Command; - int error = SendScsiCommand(cdb, ref buffer, out byte[] senseBuffer, timeout, + int error = SendScsiCommand(cdb, ref buffer, out byte[] senseBuffer, timeout, AtaProtocolToScsiDirection(protocol), out duration, out sense); if(senseBuffer.Length < 22 || - (senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C)) + senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C) return error; errorRegisters.Error = senseBuffer[11]; @@ -360,9 +364,9 @@ partial class Device } /// - public override int SendMmcCommand(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 = 15) + public override int SendMmcCommand(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 = 15) { // We need a timeout if(timeout == 0) @@ -474,7 +478,7 @@ partial class Device /// public override int SendMultipleMmcCommands(MmcSingleCommand[] commands, out double duration, out bool sense, - uint timeout = 15) + uint timeout = 15) { // We need a timeout if(timeout == 0) @@ -484,17 +488,17 @@ partial class Device sense = false; // Create array for buffers - nint[] bufferPointers = new nint[commands.Length]; + var bufferPointers = new nint[commands.Length]; // Allocate memory for the array for commands - byte[] ioMultiCmd = new byte[sizeof(ulong) + (Marshal.SizeOf() * commands.Length)]; + var ioMultiCmd = new byte[sizeof(ulong) + Marshal.SizeOf() * commands.Length]; // First value of array is uint64 with count of commands Array.Copy(BitConverter.GetBytes((ulong)commands.Length), 0, ioMultiCmd, 0, sizeof(ulong)); int off = sizeof(ulong); - for(int i = 0; i < commands.Length; i++) + for(var i = 0; i < commands.Length; i++) { // Create command var ioCmd = new MmcIocCmd(); @@ -555,9 +559,9 @@ partial class Device Marshal.Copy(ioMultiCmdPtr, ioMultiCmd, 0, ioMultiCmd.Length); // TODO: Use real pointers this is too slow - for(int i = 0; i < commands.Length; i++) + for(var i = 0; i < commands.Length; i++) { - byte[] tmp = new byte[Marshal.SizeOf()]; + var tmp = new byte[Marshal.SizeOf()]; // Copy command to managed space Array.Copy(ioMultiCmd, off, tmp, 0, tmp.Length); @@ -660,7 +664,7 @@ partial class Device resultSize = result; } - byte[] resultString = new byte[resultSize]; + var resultString = new byte[resultSize]; Marshal.Copy(buf, resultString, 0, resultSize); Marshal.FreeHGlobal(buf); @@ -689,7 +693,8 @@ partial class Device return true; } - sense = DetectOS.Is64Bit ? Extern.read64(_fileDescriptor, buffer, length) + sense = DetectOS.Is64Bit + ? Extern.read64(_fileDescriptor, buffer, length) : Extern.read(_fileDescriptor, buffer, (int)length); cmdStopwatch.Stop(); diff --git a/Aaru.Devices/Linux/Device.cs b/Aaru.Devices/Linux/Device.cs index 0d6d6ef7b..74e9e78c7 100644 --- a/Aaru.Devices/Linux/Device.cs +++ b/Aaru.Devices/Linux/Device.cs @@ -115,6 +115,7 @@ partial class Device : Devices.Device devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) || devicePath.StartsWith("/dev/st", StringComparison.Ordinal) || devicePath.StartsWith("/dev/sg", StringComparison.Ordinal)) + { if(!dev.ScsiInquiry(out byte[] _, out _)) dev.Type = DeviceType.SCSI; @@ -155,8 +156,10 @@ partial class Device : Devices.Device dev._cachedOcr = null; } } + } + + #region SecureDigital / MultiMediaCard - #region SecureDigital / MultiMediaCard if(dev._cachedCid != null) { dev.ScsiType = PeripheralDeviceTypes.DirectAccess; @@ -189,9 +192,11 @@ partial class Device : Devices.Device return dev; } - #endregion SecureDigital / MultiMediaCard - #region USB + #endregion SecureDigital / MultiMediaCard + + #region USB + string resolvedLink; if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) || @@ -219,8 +224,8 @@ partial class Device : Devices.Device var usbFs = new FileStream(resolvedLink + "/descriptors", FileMode.Open, FileAccess.Read); - byte[] usbBuf = new byte[65536]; - int usbCount = usbFs.EnsureRead(usbBuf, 0, 65536); + var usbBuf = new byte[65536]; + int usbCount = usbFs.EnsureRead(usbBuf, 0, 65536); dev.UsbDescriptors = new byte[usbCount]; Array.Copy(usbBuf, 0, dev.UsbDescriptors, 0, usbCount); usbFs.Close(); @@ -269,9 +274,11 @@ partial class Device : Devices.Device } } } - #endregion USB - #region FireWire + #endregion USB + + #region FireWire + if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) || devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) || devicePath.StartsWith("/dev/st", StringComparison.Ordinal)) @@ -284,6 +291,7 @@ partial class Device : Devices.Device resolvedLink = "/sys" + resolvedLink[2..]; if(!string.IsNullOrEmpty(resolvedLink)) + { while(resolvedLink?.Contains("firewire") == true) { resolvedLink = Path.GetDirectoryName(resolvedLink); @@ -335,11 +343,14 @@ partial class Device : Devices.Device break; } + } } } - #endregion FireWire - #region PCMCIA + #endregion FireWire + + #region PCMCIA + if(!devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) && !devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) && !devicePath.StartsWith("/dev/st", StringComparison.Ordinal)) @@ -377,8 +388,8 @@ partial class Device : Devices.Device var cisFs = new FileStream(possibleDir + "/cis", FileMode.Open, FileAccess.Read); - byte[] cisBuf = new byte[65536]; - int cisCount = cisFs.EnsureRead(cisBuf, 0, 65536); + var cisBuf = new byte[65536]; + int cisCount = cisFs.EnsureRead(cisBuf, 0, 65536); dev.Cis = new byte[cisCount]; Array.Copy(cisBuf, 0, dev.Cis, 0, cisCount); cisFs.Close(); @@ -387,7 +398,8 @@ partial class Device : Devices.Device break; } - #endregion PCMCIA + + #endregion PCMCIA return dev; } diff --git a/Aaru.Devices/Linux/Enums.cs b/Aaru.Devices/Linux/Enums.cs index 574350bab..d258bb7b0 100644 --- a/Aaru.Devices/Linux/Enums.cs +++ b/Aaru.Devices/Linux/Enums.cs @@ -92,10 +92,12 @@ enum ScsiIoctlDirection enum LinuxIoctl : uint { // SCSI IOCtls - SgGetVersionNum = 0x2282, SgIo = 0x2285, + SgGetVersionNum = 0x2282, + SgIo = 0x2285, // MMC IOCtl - MmcIocCmd = 0xC048B300, MmcIocMultiCmd = 0xC008B301 + MmcIocCmd = 0xC048B300, + MmcIocMultiCmd = 0xC008B301 } [Flags] @@ -121,12 +123,19 @@ enum SgInfo : uint [Flags] enum SgFlags : uint { - DirectIo = 1, UnusedLunInhibit = 2, MmapIo = 4, - NoDxfer = 0x10000, QAtTail = 0x10, QAtHead = 0x20 + DirectIo = 1, + UnusedLunInhibit = 2, + MmapIo = 4, + NoDxfer = 0x10000, + QAtTail = 0x10, + QAtHead = 0x20 } enum SeekWhence { - Begin = 0, Current = 1, End = 2, - Data = 3, Hole = 4 + Begin = 0, + Current = 1, + End = 2, + Data = 3, + Hole = 4 } \ No newline at end of file diff --git a/Aaru.Devices/Linux/ListDevices.cs b/Aaru.Devices/Linux/ListDevices.cs index 4b1ad0aa7..e09fc0046 100644 --- a/Aaru.Devices/Linux/ListDevices.cs +++ b/Aaru.Devices/Linux/ListDevices.cs @@ -48,8 +48,8 @@ static class ListDevices { string[] sysdevs = Directory.GetFileSystemEntries(PATH_SYS_DEVBLOCK, "*", SearchOption.TopDirectoryOnly); - DeviceInfo[] devices = new DeviceInfo[sysdevs.Length]; - bool hasUdev; + var devices = new DeviceInfo[sysdevs.Length]; + bool hasUdev; IntPtr udev = IntPtr.Zero; @@ -63,7 +63,7 @@ static class ListDevices hasUdev = false; } - for(int i = 0; i < sysdevs.Length; i++) + for(var i = 0; i < sysdevs.Length; i++) { devices[i] = new DeviceInfo { @@ -118,6 +118,7 @@ static class ListDevices if(string.IsNullOrEmpty(devices[i].Vendor) || devices[i].Vendor == "ATA") + { if(devices[i].Model != null) { string[] pieces = devices[i].Model.Split(' '); @@ -128,6 +129,7 @@ static class ListDevices devices[i].Model = devices[i].Model[(pieces[0].Length + 1)..]; } } + } // TODO: Get better device type from sysfs paths if(string.IsNullOrEmpty(devices[i].Bus)) diff --git a/Aaru.Devices/Linux/Structs.cs b/Aaru.Devices/Linux/Structs.cs index 603f94ad7..7c6165e6b 100644 --- a/Aaru.Devices/Linux/Structs.cs +++ b/Aaru.Devices/Linux/Structs.cs @@ -36,7 +36,8 @@ using System.Runtime.InteropServices; namespace Aaru.Devices.Linux; -[StructLayout(LayoutKind.Sequential), SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct SgIoHdrT { /// Always 'S' for SG v3 @@ -64,7 +65,8 @@ struct SgIoHdrT public SgInfo info; /* [o] */ } -[StructLayout(LayoutKind.Sequential), SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct MmcIocCmd { /// Implies direction of data. true = write, false = read diff --git a/Aaru.Devices/Localization/Localization.Designer.cs b/Aaru.Devices/Localization/Localization.Designer.cs index 72c56c13a..d0677465c 100644 --- a/Aaru.Devices/Localization/Localization.Designer.cs +++ b/Aaru.Devices/Localization/Localization.Designer.cs @@ -11,32 +11,46 @@ namespace Aaru.Devices { using System; - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [System.Diagnostics.DebuggerNonUserCodeAttribute()] - [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Localization { - private static System.Resources.ResourceManager resourceMan; + private static global::System.Resources.ResourceManager resourceMan; - private static System.Globalization.CultureInfo resourceCulture; + private static global::System.Globalization.CultureInfo resourceCulture; - [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Localization() { } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] - internal static System.Resources.ResourceManager ResourceManager { + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { get { - if (object.Equals(null, resourceMan)) { - System.Resources.ResourceManager temp = new System.Resources.ResourceManager("Aaru.Devices.Localization.Localization", typeof(Localization).Assembly); + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Aaru.Devices.Localization.Localization", typeof(Localization).Assembly); resourceMan = temp; } return resourceMan; } } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] - internal static System.Globalization.CultureInfo Culture { + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } @@ -45,396 +59,297 @@ namespace Aaru.Devices { } } - internal static string READ_BUFFER_took_0_ms { - get { - return ResourceManager.GetString("READ_BUFFER_took_0_ms", resourceCulture); - } - } - - internal static string READ_BUFFER_DMA_took_0_ms { - get { - return ResourceManager.GetString("READ_BUFFER_DMA_took_0_ms", resourceCulture); - } - } - - internal static string READ_DMA_took_0_ms { - get { - return ResourceManager.GetString("READ_DMA_took_0_ms", resourceCulture); - } - } - - internal static string READ_MULTIPLE_took_0_ms { - get { - return ResourceManager.GetString("READ_MULTIPLE_took_0_ms", resourceCulture); - } - } - - internal static string READ_NATIVE_MAX_ADDRESS_took_0_ms { - get { - return ResourceManager.GetString("READ_NATIVE_MAX_ADDRESS_took_0_ms", resourceCulture); - } - } - - internal static string READ_SECTORS_took_0_ms { - get { - return ResourceManager.GetString("READ_SECTORS_took_0_ms", resourceCulture); - } - } - - internal static string READ_LONG_took_0_ms { - get { - return ResourceManager.GetString("READ_LONG_took_0_ms", resourceCulture); - } - } - - internal static string SEEK_took_0_ms { - get { - return ResourceManager.GetString("SEEK_took_0_ms", resourceCulture); - } - } - - internal static string GET_NATIVE_MAX_ADDRESS_EXT_took_0_ms { - get { - return ResourceManager.GetString("GET_NATIVE_MAX_ADDRESS_EXT_took_0_ms", resourceCulture); - } - } - - internal static string READ_DMA_EXT_took_0_ms { - get { - return ResourceManager.GetString("READ_DMA_EXT_took_0_ms", resourceCulture); - } - } - - internal static string READ_LOG_EXT_took_0_ms { - get { - return ResourceManager.GetString("READ_LOG_EXT_took_0_ms", resourceCulture); - } - } - - internal static string READ_LOG_DMA_EXT_took_0_ms { - get { - return ResourceManager.GetString("READ_LOG_DMA_EXT_took_0_ms", resourceCulture); - } - } - - internal static string READ_MULTIPLE_EXT_took_0_ms { - get { - return ResourceManager.GetString("READ_MULTIPLE_EXT_took_0_ms", resourceCulture); - } - } - - internal static string READ_NATIVE_MAX_ADDRESS_EXT_took_0_ms { - get { - return ResourceManager.GetString("READ_NATIVE_MAX_ADDRESS_EXT_took_0_ms", resourceCulture); - } - } - - internal static string READ_SECTORS_EXT_took_0_ms { - get { - return ResourceManager.GetString("READ_SECTORS_EXT_took_0_ms", resourceCulture); - } - } - - internal static string SET_FEATURES_took_0_ms { - get { - return ResourceManager.GetString("SET_FEATURES_took_0_ms", resourceCulture); - } - } - - internal static string DOOR_LOCK_took_0_ms { - get { - return ResourceManager.GetString("DOOR_LOCK_took_0_ms", resourceCulture); - } - } - - internal static string DOOR_UNLOCK_took_0_ms { - get { - return ResourceManager.GetString("DOOR_UNLOCK_took_0_ms", resourceCulture); - } - } - - internal static string MEDIA_EJECT_took_0_ms { - get { - return ResourceManager.GetString("MEDIA_EJECT_took_0_ms", resourceCulture); - } - } - - internal static string IDENTIFY_PACKET_DEVICE_took_0_ms { - get { - return ResourceManager.GetString("IDENTIFY_PACKET_DEVICE_took_0_ms", resourceCulture); - } - } - - internal static string CFA_TRANSLATE_SECTOR_took_0_ms { - get { - return ResourceManager.GetString("CFA_TRANSLATE_SECTOR_took_0_ms", resourceCulture); - } - } - - internal static string CFA_REQUEST_EXTENDED_ERROR_CODE_took_0_ms { - get { - return ResourceManager.GetString("CFA_REQUEST_EXTENDED_ERROR_CODE_took_0_ms", resourceCulture); - } - } - - internal static string CHECK_MEDIA_CARD_TYPE_took_0_ms { - get { - return ResourceManager.GetString("CHECK_MEDIA_CARD_TYPE_took_0_ms", resourceCulture); - } - } - - internal static string SMART_DISABLE_OPERATIONS_took_0_ms { - get { - return ResourceManager.GetString("SMART_DISABLE_OPERATIONS_took_0_ms", resourceCulture); - } - } - - internal static string SMART_ENABLE_ATTRIBUTE_AUTOSAVE_took_0_ms { - get { - return ResourceManager.GetString("SMART_ENABLE_ATTRIBUTE_AUTOSAVE_took_0_ms", resourceCulture); - } - } - - internal static string SMART_DISABLE_ATTRIBUTE_AUTOSAVE_took_0_ms { - get { - return ResourceManager.GetString("SMART_DISABLE_ATTRIBUTE_AUTOSAVE_took_0_ms", resourceCulture); - } - } - - internal static string SMART_ENABLE_OPERATIONS_took_0_ms { - get { - return ResourceManager.GetString("SMART_ENABLE_OPERATIONS_took_0_ms", resourceCulture); - } - } - - internal static string SMART_EXECUTE_OFF_LINE_IMMEDIATE_took_0_ms { - get { - return ResourceManager.GetString("SMART_EXECUTE_OFF_LINE_IMMEDIATE_took_0_ms", resourceCulture); - } - } - - internal static string SMART_READ_DATA_took_0_ms { - get { - return ResourceManager.GetString("SMART_READ_DATA_took_0_ms", resourceCulture); - } - } - - internal static string SMART_READ_LOG_took_0_ms { - get { - return ResourceManager.GetString("SMART_READ_LOG_took_0_ms", resourceCulture); - } - } - - internal static string SMART_RETURN_STATUS_took_0_ms { - get { - return ResourceManager.GetString("SMART_RETURN_STATUS_took_0_ms", resourceCulture); - } - } - - internal static string SEND_CSD_took_0_ms { - get { - return ResourceManager.GetString("SEND_CSD_took_0_ms", resourceCulture); - } - } - - internal static string SEND_CID_took_0_ms { - get { - return ResourceManager.GetString("SEND_CID_took_0_ms", resourceCulture); - } - } - - internal static string SEND_OP_COND_took_0_ms { - get { - return ResourceManager.GetString("SEND_OP_COND_took_0_ms", resourceCulture); - } - } - - internal static string SEND_EXT_CSD_took_0_ms { - get { - return ResourceManager.GetString("SEND_EXT_CSD_took_0_ms", resourceCulture); - } - } - - internal static string SET_BLOCKLEN_took_0_ms { - get { - return ResourceManager.GetString("SET_BLOCKLEN_took_0_ms", resourceCulture); - } - } - - internal static string READ_SINGLE_BLOCK_took_0_ms { - get { - return ResourceManager.GetString("READ_SINGLE_BLOCK_took_0_ms", resourceCulture); - } - } - - internal static string READ_MULTIPLE_BLOCK_took_0_ms { - get { - return ResourceManager.GetString("READ_MULTIPLE_BLOCK_took_0_ms", resourceCulture); - } - } - - internal static string Multiple_READ_SINGLE_BLOCKs_took_0_ms { - get { - return ResourceManager.GetString("Multiple_READ_SINGLE_BLOCKs_took_0_ms", resourceCulture); - } - } - - internal static string SEND_STATUS_took_0_ms { - get { - return ResourceManager.GetString("SEND_STATUS_took_0_ms", resourceCulture); - } - } - - internal static string SD_STATUS_took_0_ms { - get { - return ResourceManager.GetString("SD_STATUS_took_0_ms", resourceCulture); - } - } - - internal static string SD_SEND_OP_COND_took_0_ms { - get { - return ResourceManager.GetString("SD_SEND_OP_COND_took_0_ms", resourceCulture); - } - } - - internal static string SEND_SCR_took_0_ms { - get { - return ResourceManager.GetString("SEND_SCR_took_0_ms", resourceCulture); - } - } - - internal static string ADAPTEC_TRANSLATE_took_0_ms { - get { - return ResourceManager.GetString("ADAPTEC_TRANSLATE_took_0_ms", resourceCulture); - } - } - - internal static string ADAPTEC_SET_ERROR_THRESHOLD_took_0_ms { - get { - return ResourceManager.GetString("ADAPTEC_SET_ERROR_THRESHOLD_took_0_ms", resourceCulture); - } - } - - internal static string ADAPTEC_READ_RESET_USAGE_COUNTER_took_0_ms { - get { - return ResourceManager.GetString("ADAPTEC_READ_RESET_USAGE_COUNTER_took_0_ms", resourceCulture); - } - } - - internal static string ADAPTEC_WRITE_DATA_BUFFER_took_0_ms { - get { - return ResourceManager.GetString("ADAPTEC_WRITE_DATA_BUFFER_took_0_ms", resourceCulture); - } - } - + /// + /// Looks up a localized string similar to ADAPTEC READ DATA BUFFER took {0} ms.. + /// internal static string ADAPTEC_READ_DATA_BUFFER_took_0_ms { get { return ResourceManager.GetString("ADAPTEC_READ_DATA_BUFFER_took_0_ms", resourceCulture); } } + /// + /// Looks up a localized string similar to ADAPTEC READ/RESET USAGE COUNTER took {0} ms.. + /// + internal static string ADAPTEC_READ_RESET_USAGE_COUNTER_took_0_ms { + get { + return ResourceManager.GetString("ADAPTEC_READ_RESET_USAGE_COUNTER_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ADAPTEC SET ERROR THRESHOLD took {0} ms.. + /// + internal static string ADAPTEC_SET_ERROR_THRESHOLD_took_0_ms { + get { + return ResourceManager.GetString("ADAPTEC_SET_ERROR_THRESHOLD_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ADAPTEC TRANSLATE took {0} ms.. + /// + internal static string ADAPTEC_TRANSLATE_took_0_ms { + get { + return ResourceManager.GetString("ADAPTEC_TRANSLATE_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ADAPTEC WRITE DATA BUFFER took {0} ms.. + /// + internal static string ADAPTEC_WRITE_DATA_BUFFER_took_0_ms { + get { + return ResourceManager.GetString("ADAPTEC_WRITE_DATA_BUFFER_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ARCHIVE CORP. REQUEST BLOCK ADDRESS took {0} ms.. + /// internal static string ARCHIVE_CORP_REQUEST_BLOCK_ADDRESS_took_0_ms { get { return ResourceManager.GetString("ARCHIVE_CORP_REQUEST_BLOCK_ADDRESS_took_0_ms", resourceCulture); } } + /// + /// Looks up a localized string similar to ARCHIVE CORP. SEEK BLOCK took {0} ms.. + /// internal static string ARCHIVE_CORP_SEEK_BLOCK_took_0_ms { get { return ResourceManager.GetString("ARCHIVE_CORP_SEEK_BLOCK_took_0_ms", resourceCulture); } } + /// + /// Looks up a localized string similar to CERTANCE PARK UNPARK took {0} ms.. + /// internal static string CERTANCE_PARK_UNPARK_took_0_ms { get { return ResourceManager.GetString("CERTANCE_PARK_UNPARK_took_0_ms", resourceCulture); } } + /// + /// Looks up a localized string similar to CFA REQUEST EXTENDED ERROR CODE took {0} ms.. + /// + internal static string CFA_REQUEST_EXTENDED_ERROR_CODE_took_0_ms { + get { + return ResourceManager.GetString("CFA_REQUEST_EXTENDED_ERROR_CODE_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to CFA TRANSLATE SECTOR took {0} ms.. + /// + internal static string CFA_TRANSLATE_SECTOR_took_0_ms { + get { + return ResourceManager.GetString("CFA_TRANSLATE_SECTOR_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to CHECK MEDIA CARD TYPE took {0} ms.. + /// + internal static string CHECK_MEDIA_CARD_TYPE_took_0_ms { + get { + return ResourceManager.GetString("CHECK_MEDIA_CARD_TYPE_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Connected to {0}. + /// + internal static string Connected_to_0 { + get { + return ResourceManager.GetString("Connected_to_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not read from the network.... + /// + internal static string Could_not_read_from_the_network { + get { + return ResourceManager.GetString("Could_not_read_from_the_network", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not write to the network.... + /// + internal static string Could_not_write_to_the_network { + get { + return ResourceManager.GetString("Could_not_write_to_the_network", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to DOOR LOCK took {0} ms.. + /// + internal static string DOOR_LOCK_took_0_ms { + get { + return ResourceManager.GetString("DOOR_LOCK_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to DOOR UNLOCK took {0} ms.. + /// + internal static string DOOR_UNLOCK_took_0_ms { + get { + return ResourceManager.GetString("DOOR_UNLOCK_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Error connecting to host.. + /// + internal static string Error_connecting_to_host { + get { + return ResourceManager.GetString("Error_connecting_to_host", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected ATA CHS Response Packet, got packet type {0}.... + /// + internal static string Expected_ATA_CHS_Response_Packet_got_packet_type_0 { + get { + return ResourceManager.GetString("Expected_ATA_CHS_Response_Packet_got_packet_type_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected ATA LBA28 Response Packet, got packet type {0}.... + /// + internal static string Expected_ATA_LBA28_Response_Packet_got_packet_type_0 { + get { + return ResourceManager.GetString("Expected_ATA_LBA28_Response_Packet_got_packet_type_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected ATA LBA48 Response Packet, got packet type {0}.... + /// + internal static string Expected_ATA_LBA48_Response_Packet_got_packet_type_0 { + get { + return ResourceManager.GetString("Expected_ATA_LBA48_Response_Packet_got_packet_type_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected Device Type Response Packet, got packet type {0}.... + /// + internal static string Expected_Device_Type_Response_Packet_got_packet_type_0 { + get { + return ResourceManager.GetString("Expected_Device_Type_Response_Packet_got_packet_type_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected FireWire Data Response Packet, got packet type {0}.... + /// + internal static string Expected_FireWire_Data_Response_Packet_got_packet_type_0 { + get { + return ResourceManager.GetString("Expected_FireWire_Data_Response_Packet_got_packet_type_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected Hello Packet, got packet type {0}.... + /// + internal static string Expected_Hello_Packet_got_packet_type_0 { + get { + return ResourceManager.GetString("Expected_Hello_Packet_got_packet_type_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected multi MMC/SD command Response Packet, got packet type {0}.... + /// + internal static string Expected_multi_MMC_SD_command_Response_Packet_got_packet_type_0 { + get { + return ResourceManager.GetString("Expected_multi_MMC_SD_command_Response_Packet_got_packet_type_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected NOP Packet, got packet type {0}.... + /// + internal static string Expected_NOP_Packet_got_packet_type_0 { + get { + return ResourceManager.GetString("Expected_NOP_Packet_got_packet_type_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected OS Read Response Packet, got packet type {0}.... + /// + internal static string Expected_OS_Read_Response_Packet_got_packet_type_0 { + get { + return ResourceManager.GetString("Expected_OS_Read_Response_Packet_got_packet_type_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected PCMCIA Data Response Packet, got packet type {0}.... + /// + internal static string Expected_PCMCIA_Data_Response_Packet_got_packet_type_0 { + get { + return ResourceManager.GetString("Expected_PCMCIA_Data_Response_Packet_got_packet_type_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected SCSI Response Packet, got packet type {0}.... + /// + internal static string Expected_SCSI_Response_Packet_got_packet_type_0 { + get { + return ResourceManager.GetString("Expected_SCSI_Response_Packet_got_packet_type_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected SDHCI Response Packet, got packet type {0}.... + /// + internal static string Expected_SDHCI_Response_Packet_got_packet_type_0 { + get { + return ResourceManager.GetString("Expected_SDHCI_Response_Packet_got_packet_type_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected the response to {0} SD/MMC commands, but got {1} responses.... + /// + internal static string Expected_the_response_to_0_SD_MMC_commands_but_got_1_responses { + get { + return ResourceManager.GetString("Expected_the_response_to_0_SD_MMC_commands_but_got_1_responses", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected USB Data Response Packet, got packet type {0}.... + /// + internal static string Expected_USB_Data_Response_Packet_got_packet_type_0 { + get { + return ResourceManager.GetString("Expected_USB_Data_Response_Packet_got_packet_type_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to FUJITSU DISPLAY took {0} ms.. + /// internal static string FUJITSU_DISPLAY_took_0_ms { get { return ResourceManager.GetString("FUJITSU_DISPLAY_took_0_ms", resourceCulture); } } - internal static string HL_DT_ST_READ_DVD_RAW_took_0_ms { - get { - return ResourceManager.GetString("HL_DT_ST_READ_DVD_RAW_took_0_ms", resourceCulture); - } - } - - internal static string HP_READ_LONG_took_0_ms { - get { - return ResourceManager.GetString("HP_READ_LONG_took_0_ms", resourceCulture); - } - } - - internal static string KREON_DEPRECATED_UNLOCK_took_0_ms { - get { - return ResourceManager.GetString("KREON_DEPRECATED_UNLOCK_took_0_ms", resourceCulture); - } - } - - internal static string KREON_SET_LOCK_STATE_took_0_ms { - get { - return ResourceManager.GetString("KREON_SET_LOCK_STATE_took_0_ms", resourceCulture); - } - } - - internal static string KREON_GET_FEATURE_LIST_took_0_ms { - get { - return ResourceManager.GetString("KREON_GET_FEATURE_LIST_took_0_ms", resourceCulture); - } - } - - internal static string KREON_EXTRACT_SS_took_0_ms { - get { - return ResourceManager.GetString("KREON_EXTRACT_SS_took_0_ms", resourceCulture); - } - } - - internal static string MediaTek_READ_DRAM_took_0_ms { - get { - return ResourceManager.GetString("MediaTek_READ_DRAM_took_0_ms", resourceCulture); - } - } - - internal static string MINIDISC_READ_DTOC_took_0_ms { - get { - return ResourceManager.GetString("MINIDISC_READ_DTOC_took_0_ms", resourceCulture); - } - } - - internal static string MINIDISC_READ_UTOC_took_0_ms { - get { - return ResourceManager.GetString("MINIDISC_READ_UTOC_took_0_ms", resourceCulture); - } - } - - internal static string MINIDISC_command_D5h_took_0_ms { - get { - return ResourceManager.GetString("MINIDISC_command_D5h_took_0_ms", resourceCulture); - } - } - - internal static string MINIDISC_STOP_PLAY_took_0_ms { - get { - return ResourceManager.GetString("MINIDISC_STOP_PLAY_took_0_ms", resourceCulture); - } - } - - internal static string MINIDISC_READ_POSITION_took_0_ms { - get { - return ResourceManager.GetString("MINIDISC_READ_POSITION_took_0_ms", resourceCulture); - } - } - - internal static string MINIDISC_GET_TYPE_took_0_ms { - get { - return ResourceManager.GetString("MINIDISC_GET_TYPE_took_0_ms", resourceCulture); - } - } - + /// + /// Looks up a localized string similar to GET CONFIGURATION (Starting Feature Number: {1}, Return Type: {2}, Sense: {3}, Last Error: {4}) took {0} ms.. + /// internal static string GET_CONFIGURATION_Starting_Feature_Number_1_Return_Type_2_Sense_3_Last_Error_4_took_0_ms { get { return ResourceManager.GetString("GET_CONFIGURATION_Starting_Feature_Number_1_Return_Type_2_Sense_3_Last_Error_4_to" + @@ -442,26 +357,542 @@ namespace Aaru.Devices { } } - internal static string READ_DISC_STRUCTURE_Media_Type_1_Address_2_Layer_Number_3_Format_4_AGID_5_Sense_6_Last_Error_7_took_0_ms { + /// + /// Looks up a localized string similar to GET NATIVE MAX ADDRESS EXT took {0} ms.. + /// + internal static string GET_NATIVE_MAX_ADDRESS_EXT_took_0_ms { get { - return ResourceManager.GetString("READ_DISC_STRUCTURE_Media_Type_1_Address_2_Layer_Number_3_Format_4_AGID_5_Sense_6" + - "_Last_Error_7_took_0_ms", resourceCulture); + return ResourceManager.GetString("GET_NATIVE_MAX_ADDRESS_EXT_took_0_ms", resourceCulture); } } - internal static string READ_TOC_PMA_ATIP_took_MSF_1_Format_2_Track_Session_Number_3_Sense_4_LastError_5_0_ms { + /// + /// Looks up a localized string similar to HL-DT-ST READ DVD (RAW) took {0} ms.. + /// + internal static string HL_DT_ST_READ_DVD_RAW_took_0_ms { get { - return ResourceManager.GetString("READ_TOC_PMA_ATIP_took_MSF_1_Format_2_Track_Session_Number_3_Sense_4_LastError_5_" + - "0_ms", resourceCulture); + return ResourceManager.GetString("HL_DT_ST_READ_DVD_RAW_took_0_ms", resourceCulture); } } - internal static string READ_DISC_INFORMATION_Data_Type_1_Sense_2_Last_Error_3_took_0_ms { + /// + /// Looks up a localized string similar to Host not found. + /// + internal static string Host_not_found { get { - return ResourceManager.GetString("READ_DISC_INFORMATION_Data_Type_1_Sense_2_Last_Error_3_took_0_ms", resourceCulture); + return ResourceManager.GetString("Host_not_found", resourceCulture); } } + /// + /// Looks up a localized string similar to HP READ LONG took {0} ms.. + /// + internal static string HP_READ_LONG_took_0_ms { + get { + return ResourceManager.GetString("HP_READ_LONG_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to IDENTIFY PACKET DEVICE took {0} ms.. + /// + internal static string IDENTIFY_PACKET_DEVICE_took_0_ms { + get { + return ResourceManager.GetString("IDENTIFY_PACKET_DEVICE_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to INQUIRY took {0} ms.. + /// + internal static string INQUIRY_took_0_ms { + get { + return ResourceManager.GetString("INQUIRY_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid remote protocol.. + /// + internal static string Invalid_remote_protocol { + get { + return ResourceManager.GetString("Invalid_remote_protocol", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid remote URI.. + /// + internal static string Invalid_remote_URI { + get { + return ResourceManager.GetString("Invalid_remote_URI", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to KREON DEPRECATED UNLOCK took {0} ms.. + /// + internal static string KREON_DEPRECATED_UNLOCK_took_0_ms { + get { + return ResourceManager.GetString("KREON_DEPRECATED_UNLOCK_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to KREON EXTRACT SS took {0} ms.. + /// + internal static string KREON_EXTRACT_SS_took_0_ms { + get { + return ResourceManager.GetString("KREON_EXTRACT_SS_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to KREON GET FEATURE LIST took {0} ms.. + /// + internal static string KREON_GET_FEATURE_LIST_took_0_ms { + get { + return ResourceManager.GetString("KREON_GET_FEATURE_LIST_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to KREON SET LOCK STATE took {0} ms.. + /// + internal static string KREON_SET_LOCK_STATE_took_0_ms { + get { + return ResourceManager.GetString("KREON_SET_LOCK_STATE_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to LOAD UNLOAD (6) took {0} ms.. + /// + internal static string LOAD_UNLOAD_6_took_0_ms { + get { + return ResourceManager.GetString("LOAD_UNLOAD_6_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to LOCATE (10) took {0} ms.. + /// + internal static string LOCATE_10_took_0_ms { + get { + return ResourceManager.GetString("LOCATE_10_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to LOCATE (16) took {0} ms.. + /// + internal static string LOCATE_16_took_0_ms { + get { + return ResourceManager.GetString("LOCATE_16_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MEDIA EJECT took {0} ms.. + /// + internal static string MEDIA_EJECT_took_0_ms { + get { + return ResourceManager.GetString("MEDIA_EJECT_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MediaTek READ DRAM took {0} ms.. + /// + internal static string MediaTek_READ_DRAM_took_0_ms { + get { + return ResourceManager.GetString("MediaTek_READ_DRAM_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MEDIUM SCAN took {0} ms.. + /// + internal static string MEDIUM_SCAN_took_0_ms { + get { + return ResourceManager.GetString("MEDIUM_SCAN_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MINIDISC command D5h took {0} ms.. + /// + internal static string MINIDISC_command_D5h_took_0_ms { + get { + return ResourceManager.GetString("MINIDISC_command_D5h_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MINIDISC GET TYPE took {0} ms.. + /// + internal static string MINIDISC_GET_TYPE_took_0_ms { + get { + return ResourceManager.GetString("MINIDISC_GET_TYPE_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MINIDISC READ DTOC took {0} ms.. + /// + internal static string MINIDISC_READ_DTOC_took_0_ms { + get { + return ResourceManager.GetString("MINIDISC_READ_DTOC_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MINIDISC READ POSITION took {0} ms.. + /// + internal static string MINIDISC_READ_POSITION_took_0_ms { + get { + return ResourceManager.GetString("MINIDISC_READ_POSITION_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MINIDISC READ UTOC took {0} ms.. + /// + internal static string MINIDISC_READ_UTOC_took_0_ms { + get { + return ResourceManager.GetString("MINIDISC_READ_UTOC_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MINIDISC STOP PLAY took {0} ms.. + /// + internal static string MINIDISC_STOP_PLAY_took_0_ms { + get { + return ResourceManager.GetString("MINIDISC_STOP_PLAY_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MODE SELECT(10) took {0} ms.. + /// + internal static string MODE_SELECT_10_took_0_ms { + get { + return ResourceManager.GetString("MODE_SELECT_10_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MODE SELECT(6) took {0} ms.. + /// + internal static string MODE_SELECT_6_took_0_ms { + get { + return ResourceManager.GetString("MODE_SELECT_6_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MODE SENSE(10) took {0} ms.. + /// + internal static string MODE_SENSE_10_took_0_ms { + get { + return ResourceManager.GetString("MODE_SENSE_10_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MODE SENSE(6) took {0} ms.. + /// + internal static string MODE_SENSE_6_took_0_ms { + get { + return ResourceManager.GetString("MODE_SENSE_6_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Multiple READ_SINGLE_BLOCKs took {0} ms.. + /// + internal static string Multiple_READ_SINGLE_BLOCKs_took_0_ms { + get { + return ResourceManager.GetString("Multiple_READ_SINGLE_BLOCKs_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to NEC READ CD-DA took {0} ms.. + /// + internal static string NEC_READ_CD_DA_took_0_ms { + get { + return ResourceManager.GetString("NEC_READ_CD_DA_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to PIONEER READ CD-DA MSF took {0} ms.. + /// + internal static string PIONEER_READ_CD_DA_MSF_took_0_ms { + get { + return ResourceManager.GetString("PIONEER_READ_CD_DA_MSF_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to PIONEER READ CD-DA took {0} ms.. + /// + internal static string PIONEER_READ_CD_DA_took_0_ms { + get { + return ResourceManager.GetString("PIONEER_READ_CD_DA_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to PIONEER READ CD-XA took {0} ms.. + /// + internal static string PIONEER_READ_CD_XA_took_0_ms { + get { + return ResourceManager.GetString("PIONEER_READ_CD_XA_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to PLASMON READ SECTOR LOCATION took {0} ms.. + /// + internal static string PLASMON_READ_SECTOR_LOCATION_took_0_ms { + get { + return ResourceManager.GetString("PLASMON_READ_SECTOR_LOCATION_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Platform {0} not yet supported.. + /// + internal static string Platform_0_not_yet_supported { + get { + return ResourceManager.GetString("Platform_0_not_yet_supported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to PLEXTOR GET BOOK BITSETTING took {0} ms.. + /// + internal static string PLEXTOR_GET_BOOK_BITSETTING_took_0_ms { + get { + return ResourceManager.GetString("PLEXTOR_GET_BOOK_BITSETTING_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to PLEXTOR GET GIGAREC took {0} ms.. + /// + internal static string PLEXTOR_GET_GIGAREC_took_0_ms { + get { + return ResourceManager.GetString("PLEXTOR_GET_GIGAREC_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to PLEXTOR GET SECUREC took {0} ms.. + /// + internal static string PLEXTOR_GET_SECUREC_took_0_ms { + get { + return ResourceManager.GetString("PLEXTOR_GET_SECUREC_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to PLEXTOR GET SILENT MODE took {0} ms.. + /// + internal static string PLEXTOR_GET_SILENT_MODE_took_0_ms { + get { + return ResourceManager.GetString("PLEXTOR_GET_SILENT_MODE_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to PLEXTOR GET SINGLE-SESSION / HIDE CD-R took {0} ms.. + /// + internal static string PLEXTOR_GET_SINGLE_SESSION_HIDE_CD_R_took_0_ms { + get { + return ResourceManager.GetString("PLEXTOR_GET_SINGLE_SESSION_HIDE_CD_R_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to PLEXTOR GET SPEEDREAD took {0} ms.. + /// + internal static string PLEXTOR_GET_SPEEDREAD_took_0_ms { + get { + return ResourceManager.GetString("PLEXTOR_GET_SPEEDREAD_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to PLEXTOR GET TEST WRITE DVD+ took {0} ms.. + /// + internal static string PLEXTOR_GET_TEST_WRITE_DVD_took_0_ms { + get { + return ResourceManager.GetString("PLEXTOR_GET_TEST_WRITE_DVD_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to PLEXTOR GET VARIREC took {0} ms.. + /// + internal static string PLEXTOR_GET_VARIREC_took_0_ms { + get { + return ResourceManager.GetString("PLEXTOR_GET_VARIREC_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to PLEXTOR POWEREC GET SPEEDS took {0} ms.. + /// + internal static string PLEXTOR_POWEREC_GET_SPEEDS_took_0_ms { + get { + return ResourceManager.GetString("PLEXTOR_POWEREC_GET_SPEEDS_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Plextor READ CD-DA (LBA: {1}, Block Size: {2}, Transfer Length: {3}, Subchannel: {4}, Sense: {5}, Last Error: {6}) took {0} ms.. + /// + internal static string Plextor_READ_CD_DA_LBA_1_Block_Size_2_Transfer_Length_3_Subchannel_4_Sense_5_Last_Error_6_took_0_ms { + get { + return ResourceManager.GetString("Plextor_READ_CD_DA_LBA_1_Block_Size_2_Transfer_Length_3_Subchannel_4_Sense_5_Last" + + "_Error_6_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Plextor READ DVD (RAW) took {0} ms.. + /// + internal static string Plextor_READ_DVD_RAW_took_0_ms { + get { + return ResourceManager.GetString("Plextor_READ_DVD_RAW_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to PLEXTOR READ EEPROM took {0} ms.. + /// + internal static string PLEXTOR_READ_EEPROM_took_0_ms { + get { + return ResourceManager.GetString("PLEXTOR_READ_EEPROM_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to PREVENT ALLOW MEDIUM REMOVAL (Persistent: {1}, Prevent: {2}, Sense: {3}, LastError: {4}) took {0} ms.. + /// + internal static string PREVENT_ALLOW_MEDIUM_REMOVAL_Persistent_1_Prevent_2_Sense_3_LastError_4_took_0_ms { + get { + return ResourceManager.GetString("PREVENT_ALLOW_MEDIUM_REMOVAL_Persistent_1_Prevent_2_Sense_3_LastError_4_took_0_ms" + + "", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to PREVENT ALLOW MEDIUM REMOVAL took {0} ms.. + /// + internal static string PREVENT_ALLOW_MEDIUM_REMOVAL_took_0_ms { + get { + return ResourceManager.GetString("PREVENT_ALLOW_MEDIUM_REMOVAL_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ (10) took {0} ms.. + /// + internal static string READ_10_took_0_ms { + get { + return ResourceManager.GetString("READ_10_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ (12) took {0} ms.. + /// + internal static string READ_12_took_0_ms { + get { + return ResourceManager.GetString("READ_12_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ (16) took {0} ms.. + /// + internal static string READ_16_took_0_ms { + get { + return ResourceManager.GetString("READ_16_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ (6) took {0} ms.. + /// + internal static string READ_6_took_0_ms { + get { + return ResourceManager.GetString("READ_6_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ ATTRIBUTE took {0} ms.. + /// + internal static string READ_ATTRIBUTE_took_0_ms { + get { + return ResourceManager.GetString("READ_ATTRIBUTE_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ BLOCK LIMITS took {0} ms.. + /// + internal static string READ_BLOCK_LIMITS_took_0_ms { + get { + return ResourceManager.GetString("READ_BLOCK_LIMITS_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ BUFFER DMA took {0} ms.. + /// + internal static string READ_BUFFER_DMA_took_0_ms { + get { + return ResourceManager.GetString("READ_BUFFER_DMA_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ BUFFER took {0} ms.. + /// + internal static string READ_BUFFER_took_0_ms { + get { + return ResourceManager.GetString("READ_BUFFER_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ CAPACITY(16) took {0} ms.. + /// + internal static string READ_CAPACITY_16_took_0_ms { + get { + return ResourceManager.GetString("READ_CAPACITY_16_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ CAPACITY took {0} ms.. + /// + internal static string READ_CAPACITY_took_0_ms { + get { + return ResourceManager.GetString("READ_CAPACITY_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ CD (LBA: {1}, Block Size: {2}, Transfer Length: {3}, Expected Sector Type: {4}, DAP: {5}, Relative Address: {6}, Sync: {7}, Headers: {8}, User Data: {9}, ECC/EDC: {10}, C2: {11}, Subchannel: {12}, Sense: {13}, Last Error: {14}) took {0} ms.. + /// internal static string READ_CD_LBA_1_Block_Size_2_Transfer_Length_3_Expected_Sector_Type_4_DAP_5_Relative_Address_6_Sync_7_Headers_8_User_Data_9_ECC_EDC_10_C2_11_Subchannel_12_Sense_13_Last_Error_14_took_0_ms { get { return ResourceManager.GetString("READ_CD_LBA_1_Block_Size_2_Transfer_Length_3_Expected_Sector_Type_4_DAP_5_Relativ" + @@ -470,6 +901,9 @@ namespace Aaru.Devices { } } + /// + /// Looks up a localized string similar to READ CD MSF (Start MSF: {1}, End MSF: {2}, Block Size: {3}, Expected Sector Type: {4}, DAP: {5}, Sync: {6}, Headers: {7}, User Data: {8}, ECC/EDC: {9}, C2: {10}, Subchannel: {11}, Sense: {12}, LastError: {13}) took {0} ms.. + /// internal static string READ_CD_MSF_Start_MSF_1_End_MSF_2_Block_Size_3_Expected_Sector_Type_4_DAP_5_Sync_6_Headers_7_User_Data_8_ECC_EDC_9_C2_10_Subchannel_11_Sense_12_LastError_13_took_0_ms { get { return ResourceManager.GetString("READ_CD_MSF_Start_MSF_1_End_MSF_2_Block_Size_3_Expected_Sector_Type_4_DAP_5_Sync_" + @@ -478,32 +912,434 @@ namespace Aaru.Devices { } } - internal static string PREVENT_ALLOW_MEDIUM_REMOVAL_Persistent_1_Prevent_2_Sense_3_LastError_4_took_0_ms { + /// + /// Looks up a localized string similar to READ DISC INFORMATION (Data Type: {1}, Sense: {2}, Last Error: {3}) took {0} ms.. + /// + internal static string READ_DISC_INFORMATION_Data_Type_1_Sense_2_Last_Error_3_took_0_ms { get { - return ResourceManager.GetString("PREVENT_ALLOW_MEDIUM_REMOVAL_Persistent_1_Prevent_2_Sense_3_LastError_4_took_0_ms" + - "", resourceCulture); + return ResourceManager.GetString("READ_DISC_INFORMATION_Data_Type_1_Sense_2_Last_Error_3_took_0_ms", resourceCulture); } } - internal static string START_STOP_UNIT_Immediate_1_FormatLayer_2_Power_Conditions_3_Change_Format_Layer_4_Load_Eject_5_Start_6_Sense_7_Last_Error_8_took_0_ms { + /// + /// Looks up a localized string similar to READ DISC STRUCTURE (Media Type: {1}, Address: {2}, Layer Number: {3}, Format: {4}, AGID: {5}, Sense: {6}, Last Error: {7}) took {0} ms.. + /// + internal static string READ_DISC_STRUCTURE_Media_Type_1_Address_2_Layer_Number_3_Format_4_AGID_5_Sense_6_Last_Error_7_took_0_ms { get { - return ResourceManager.GetString("START_STOP_UNIT_Immediate_1_FormatLayer_2_Power_Conditions_3_Change_Format_Layer_" + - "4_Load_Eject_5_Start_6_Sense_7_Last_Error_8_took_0_ms", resourceCulture); + return ResourceManager.GetString("READ_DISC_STRUCTURE_Media_Type_1_Address_2_Layer_Number_3_Format_4_AGID_5_Sense_6" + + "_Last_Error_7_took_0_ms", resourceCulture); } } - internal static string READ_READ_SUB_CHANNEL_MCN_Sense_1_Last_Error_2_took_0_ms { + /// + /// Looks up a localized string similar to READ DMA EXT took {0} ms.. + /// + internal static string READ_DMA_EXT_took_0_ms { get { - return ResourceManager.GetString("READ_READ_SUB_CHANNEL_MCN_Sense_1_Last_Error_2_took_0_ms", resourceCulture); + return ResourceManager.GetString("READ_DMA_EXT_took_0_ms", resourceCulture); } } + /// + /// Looks up a localized string similar to READ DMA took {0} ms.. + /// + internal static string READ_DMA_took_0_ms { + get { + return ResourceManager.GetString("READ_DMA_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ LOG DMA EXT took {0} ms.. + /// + internal static string READ_LOG_DMA_EXT_took_0_ms { + get { + return ResourceManager.GetString("READ_LOG_DMA_EXT_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ LOG EXT took {0} ms.. + /// + internal static string READ_LOG_EXT_took_0_ms { + get { + return ResourceManager.GetString("READ_LOG_EXT_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ LONG (10) took {0} ms.. + /// + internal static string READ_LONG_10_took_0_ms { + get { + return ResourceManager.GetString("READ_LONG_10_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ LONG (16) took {0} ms.. + /// + internal static string READ_LONG_16_took_0_ms { + get { + return ResourceManager.GetString("READ_LONG_16_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ LONG took {0} ms.. + /// + internal static string READ_LONG_took_0_ms { + get { + return ResourceManager.GetString("READ_LONG_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ MEDIA SERIAL NUMBER took {0} ms.. + /// + internal static string READ_MEDIA_SERIAL_NUMBER_took_0_ms { + get { + return ResourceManager.GetString("READ_MEDIA_SERIAL_NUMBER_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ_MULTIPLE_BLOCK took {0} ms.. + /// + internal static string READ_MULTIPLE_BLOCK_took_0_ms { + get { + return ResourceManager.GetString("READ_MULTIPLE_BLOCK_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ MULTIPLE EXT took {0} ms.. + /// + internal static string READ_MULTIPLE_EXT_took_0_ms { + get { + return ResourceManager.GetString("READ_MULTIPLE_EXT_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ MULTIPLE took {0} ms.. + /// + internal static string READ_MULTIPLE_took_0_ms { + get { + return ResourceManager.GetString("READ_MULTIPLE_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ NATIVE MAX ADDRESS EXT took {0} ms.. + /// + internal static string READ_NATIVE_MAX_ADDRESS_EXT_took_0_ms { + get { + return ResourceManager.GetString("READ_NATIVE_MAX_ADDRESS_EXT_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ NATIVE MAX ADDRESS took {0} ms.. + /// + internal static string READ_NATIVE_MAX_ADDRESS_took_0_ms { + get { + return ResourceManager.GetString("READ_NATIVE_MAX_ADDRESS_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ POSITION took {0} ms.. + /// + internal static string READ_POSITION_took_0_ms { + get { + return ResourceManager.GetString("READ_POSITION_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ READ SUB-CHANNEL (ISRC, Track Number: {1}, Sense: {2}, Last Error: {3}) took {0} ms.. + /// internal static string READ_READ_SUB_CHANNEL_ISRC_Track_Number_1_Sense_2_Last_Error_3_took_0_ms { get { return ResourceManager.GetString("READ_READ_SUB_CHANNEL_ISRC_Track_Number_1_Sense_2_Last_Error_3_took_0_ms", resourceCulture); } } + /// + /// Looks up a localized string similar to READ READ SUB-CHANNEL (MCN, Sense {1}, Last Error {2}) took {0} ms.. + /// + internal static string READ_READ_SUB_CHANNEL_MCN_Sense_1_Last_Error_2_took_0_ms { + get { + return ResourceManager.GetString("READ_READ_SUB_CHANNEL_MCN_Sense_1_Last_Error_2_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ REVERSE (16) took {0} ms.. + /// + internal static string READ_REVERSE_16_took_0_ms { + get { + return ResourceManager.GetString("READ_REVERSE_16_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ REVERSE (6) took {0} ms.. + /// + internal static string READ_REVERSE_6_took_0_ms { + get { + return ResourceManager.GetString("READ_REVERSE_6_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ SECTORS EXT took {0} ms.. + /// + internal static string READ_SECTORS_EXT_took_0_ms { + get { + return ResourceManager.GetString("READ_SECTORS_EXT_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ SECTORS took {0} ms.. + /// + internal static string READ_SECTORS_took_0_ms { + get { + return ResourceManager.GetString("READ_SECTORS_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ_SINGLE_BLOCK took {0} ms.. + /// + internal static string READ_SINGLE_BLOCK_took_0_ms { + get { + return ResourceManager.GetString("READ_SINGLE_BLOCK_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ TOC/PMA/ATIP took (MSF: {1}, Format: {2}, Track/Session Number: {3}, Sense: {4}, LastError: {5}) {0} ms.. + /// + internal static string READ_TOC_PMA_ATIP_took_MSF_1_Format_2_Track_Session_Number_3_Sense_4_LastError_5_0_ms { + get { + return ResourceManager.GetString("READ_TOC_PMA_ATIP_took_MSF_1_Format_2_Track_Session_Number_3_Sense_4_LastError_5_" + + "0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to READ TRACK INFORMATION (Data Type: {1}, Sense: {2}, Last Error: {3}) took {0} ms.. + /// + internal static string READ_TRACK_INFORMATION_Data_Type_1_Sense_2_Last_Error_3_took_0_ms { + get { + return ResourceManager.GetString("READ_TRACK_INFORMATION_Data_Type_1_Sense_2_Last_Error_3_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Received data is not an Aaru Remote Packet.... + /// + internal static string Received_data_is_not_an_Aaru_Remote_Packet { + get { + return ResourceManager.GetString("Received_data_is_not_an_Aaru_Remote_Packet", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RECOVER BUFFERED DATA took {0} ms.. + /// + internal static string RECOVER_BUFFERED_DATA_took_0_ms { + get { + return ResourceManager.GetString("RECOVER_BUFFERED_DATA_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remote error {0} in OS Read.... + /// + internal static string Remote_error_0_in_OS_Read { + get { + return ResourceManager.GetString("Remote_error_0_in_OS_Read", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected Am I Root? Response Packet, got packet type {0}.... + /// + internal static string Remote_IsRoot_Expected_Am_I_Root_Response_Packet_got_packet_type_0 { + get { + return ResourceManager.GetString("Remote_IsRoot_Expected_Am_I_Root_Response_Packet_got_packet_type_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected List Devices Response Packet, got packet type {0}.... + /// + internal static string Remote_ListDevices_Expected_List_Devices_Response_Packet_got_packet_type_0 { + get { + return ResourceManager.GetString("Remote_ListDevices_Expected_List_Devices_Response_Packet_got_packet_type_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ReOpen error {0} with reason: {1}.... + /// + internal static string ReOpen_error_0_with_reason_1 { + get { + return ResourceManager.GetString("ReOpen_error_0_with_reason_1", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ReOpen error closing device.... + /// + internal static string ReOpen_error_closing_device { + get { + return ResourceManager.GetString("ReOpen_error_closing_device", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to REPORT DENSITY SUPPORT took {0} ms.. + /// + internal static string REPORT_DENSITY_SUPPORT_took_0_ms { + get { + return ResourceManager.GetString("REPORT_DENSITY_SUPPORT_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to REQUEST SENSE took {0} ms.. + /// + internal static string REQUEST_SENSE_took_0_ms { + get { + return ResourceManager.GetString("REQUEST_SENSE_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to REWIND took {0} ms.. + /// + internal static string REWIND_took_0_ms { + get { + return ResourceManager.GetString("REWIND_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SD_SEND_OP_COND took {0} ms.. + /// + internal static string SD_SEND_OP_COND_took_0_ms { + get { + return ResourceManager.GetString("SD_SEND_OP_COND_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SD_STATUS took {0} ms.. + /// + internal static string SD_STATUS_took_0_ms { + get { + return ResourceManager.GetString("SD_STATUS_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SEEK (10) took {0} ms.. + /// + internal static string SEEK_10_took_0_ms { + get { + return ResourceManager.GetString("SEEK_10_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SEEK (6) took {0} ms.. + /// + internal static string SEEK_6_took_0_ms { + get { + return ResourceManager.GetString("SEEK_6_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SEEK took {0} ms.. + /// + internal static string SEEK_took_0_ms { + get { + return ResourceManager.GetString("SEEK_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SEND_CID took {0} ms.. + /// + internal static string SEND_CID_took_0_ms { + get { + return ResourceManager.GetString("SEND_CID_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SEND_CSD took {0} ms.. + /// + internal static string SEND_CSD_took_0_ms { + get { + return ResourceManager.GetString("SEND_CSD_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SEND_EXT_CSD took {0} ms.. + /// + internal static string SEND_EXT_CSD_took_0_ms { + get { + return ResourceManager.GetString("SEND_EXT_CSD_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SEND_OP_COND took {0} ms.. + /// + internal static string SEND_OP_COND_took_0_ms { + get { + return ResourceManager.GetString("SEND_OP_COND_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SEND_SCR took {0} ms.. + /// + internal static string SEND_SCR_took_0_ms { + get { + return ResourceManager.GetString("SEND_SCR_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SEND_STATUS took {0} ms.. + /// + internal static string SEND_STATUS_took_0_ms { + get { + return ResourceManager.GetString("SEND_STATUS_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SET_BLOCKLEN took {0} ms.. + /// + internal static string SET_BLOCKLEN_took_0_ms { + get { + return ResourceManager.GetString("SET_BLOCKLEN_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SET CD SPEED (Rotational Control: {1}, Read Speed: {2}, Write Speed: {3}, Sense: {4}, Last Error: {5}) took {0} ms.. + /// internal static string SET_CD_SPEED_Rotational_Control_1_Read_Speed_2_Write_Speed_3_Sense_4_Last_Error_5_took_0_ms { get { return ResourceManager.GetString("SET_CD_SPEED_Rotational_Control_1_Read_Speed_2_Write_Speed_3_Sense_4_Last_Error_5" + @@ -511,497 +1347,149 @@ namespace Aaru.Devices { } } - internal static string READ_TRACK_INFORMATION_Data_Type_1_Sense_2_Last_Error_3_took_0_ms { + /// + /// Looks up a localized string similar to SET FEATURES took {0} ms.. + /// + internal static string SET_FEATURES_took_0_ms { get { - return ResourceManager.GetString("READ_TRACK_INFORMATION_Data_Type_1_Sense_2_Last_Error_3_took_0_ms", resourceCulture); + return ResourceManager.GetString("SET_FEATURES_took_0_ms", resourceCulture); } } - internal static string NEC_READ_CD_DA_took_0_ms { + /// + /// Looks up a localized string similar to SMART DISABLE ATTRIBUTE AUTOSAVE took {0} ms.. + /// + internal static string SMART_DISABLE_ATTRIBUTE_AUTOSAVE_took_0_ms { get { - return ResourceManager.GetString("NEC_READ_CD_DA_took_0_ms", resourceCulture); + return ResourceManager.GetString("SMART_DISABLE_ATTRIBUTE_AUTOSAVE_took_0_ms", resourceCulture); } } - internal static string MEDIUM_SCAN_took_0_ms { + /// + /// Looks up a localized string similar to SMART DISABLE OPERATIONS took {0} ms.. + /// + internal static string SMART_DISABLE_OPERATIONS_took_0_ms { get { - return ResourceManager.GetString("MEDIUM_SCAN_took_0_ms", resourceCulture); + return ResourceManager.GetString("SMART_DISABLE_OPERATIONS_took_0_ms", resourceCulture); } } - internal static string PIONEER_READ_CD_DA_took_0_ms { + /// + /// Looks up a localized string similar to SMART ENABLE ATTRIBUTE AUTOSAVE took {0} ms.. + /// + internal static string SMART_ENABLE_ATTRIBUTE_AUTOSAVE_took_0_ms { get { - return ResourceManager.GetString("PIONEER_READ_CD_DA_took_0_ms", resourceCulture); + return ResourceManager.GetString("SMART_ENABLE_ATTRIBUTE_AUTOSAVE_took_0_ms", resourceCulture); } } - internal static string PIONEER_READ_CD_DA_MSF_took_0_ms { + /// + /// Looks up a localized string similar to SMART ENABLE OPERATIONS took {0} ms.. + /// + internal static string SMART_ENABLE_OPERATIONS_took_0_ms { get { - return ResourceManager.GetString("PIONEER_READ_CD_DA_MSF_took_0_ms", resourceCulture); + return ResourceManager.GetString("SMART_ENABLE_OPERATIONS_took_0_ms", resourceCulture); } } - internal static string PIONEER_READ_CD_XA_took_0_ms { + /// + /// Looks up a localized string similar to SMART EXECUTE OFF-LINE IMMEDIATE took {0} ms.. + /// + internal static string SMART_EXECUTE_OFF_LINE_IMMEDIATE_took_0_ms { get { - return ResourceManager.GetString("PIONEER_READ_CD_XA_took_0_ms", resourceCulture); + return ResourceManager.GetString("SMART_EXECUTE_OFF_LINE_IMMEDIATE_took_0_ms", resourceCulture); } } - internal static string PLASMON_READ_SECTOR_LOCATION_took_0_ms { + /// + /// Looks up a localized string similar to SMART READ DATA took {0} ms.. + /// + internal static string SMART_READ_DATA_took_0_ms { get { - return ResourceManager.GetString("PLASMON_READ_SECTOR_LOCATION_took_0_ms", resourceCulture); + return ResourceManager.GetString("SMART_READ_DATA_took_0_ms", resourceCulture); } } - internal static string Plextor_READ_CD_DA_LBA_1_Block_Size_2_Transfer_Length_3_Subchannel_4_Sense_5_Last_Error_6_took_0_ms { + /// + /// Looks up a localized string similar to SMART READ LOG took {0} ms.. + /// + internal static string SMART_READ_LOG_took_0_ms { get { - return ResourceManager.GetString("Plextor_READ_CD_DA_LBA_1_Block_Size_2_Transfer_Length_3_Subchannel_4_Sense_5_Last" + - "_Error_6_took_0_ms", resourceCulture); + return ResourceManager.GetString("SMART_READ_LOG_took_0_ms", resourceCulture); } } - internal static string Plextor_READ_DVD_RAW_took_0_ms { + /// + /// Looks up a localized string similar to SMART RETURN STATUS took {0} ms.. + /// + internal static string SMART_RETURN_STATUS_took_0_ms { get { - return ResourceManager.GetString("Plextor_READ_DVD_RAW_took_0_ms", resourceCulture); - } - } - - internal static string PLEXTOR_READ_EEPROM_took_0_ms { - get { - return ResourceManager.GetString("PLEXTOR_READ_EEPROM_took_0_ms", resourceCulture); - } - } - - internal static string PLEXTOR_POWEREC_GET_SPEEDS_took_0_ms { - get { - return ResourceManager.GetString("PLEXTOR_POWEREC_GET_SPEEDS_took_0_ms", resourceCulture); - } - } - - internal static string PLEXTOR_GET_SILENT_MODE_took_0_ms { - get { - return ResourceManager.GetString("PLEXTOR_GET_SILENT_MODE_took_0_ms", resourceCulture); - } - } - - internal static string PLEXTOR_GET_GIGAREC_took_0_ms { - get { - return ResourceManager.GetString("PLEXTOR_GET_GIGAREC_took_0_ms", resourceCulture); - } - } - - internal static string PLEXTOR_GET_VARIREC_took_0_ms { - get { - return ResourceManager.GetString("PLEXTOR_GET_VARIREC_took_0_ms", resourceCulture); - } - } - - internal static string PLEXTOR_GET_SECUREC_took_0_ms { - get { - return ResourceManager.GetString("PLEXTOR_GET_SECUREC_took_0_ms", resourceCulture); - } - } - - internal static string PLEXTOR_GET_SPEEDREAD_took_0_ms { - get { - return ResourceManager.GetString("PLEXTOR_GET_SPEEDREAD_took_0_ms", resourceCulture); - } - } - - internal static string PLEXTOR_GET_SINGLE_SESSION_HIDE_CD_R_took_0_ms { - get { - return ResourceManager.GetString("PLEXTOR_GET_SINGLE_SESSION_HIDE_CD_R_took_0_ms", resourceCulture); - } - } - - internal static string PLEXTOR_GET_BOOK_BITSETTING_took_0_ms { - get { - return ResourceManager.GetString("PLEXTOR_GET_BOOK_BITSETTING_took_0_ms", resourceCulture); - } - } - - internal static string PLEXTOR_GET_TEST_WRITE_DVD_took_0_ms { - get { - return ResourceManager.GetString("PLEXTOR_GET_TEST_WRITE_DVD_took_0_ms", resourceCulture); - } - } - - internal static string READ_6_took_0_ms { - get { - return ResourceManager.GetString("READ_6_took_0_ms", resourceCulture); - } - } - - internal static string READ_10_took_0_ms { - get { - return ResourceManager.GetString("READ_10_took_0_ms", resourceCulture); - } - } - - internal static string READ_12_took_0_ms { - get { - return ResourceManager.GetString("READ_12_took_0_ms", resourceCulture); - } - } - - internal static string READ_16_took_0_ms { - get { - return ResourceManager.GetString("READ_16_took_0_ms", resourceCulture); - } - } - - internal static string READ_LONG_10_took_0_ms { - get { - return ResourceManager.GetString("READ_LONG_10_took_0_ms", resourceCulture); - } - } - - internal static string READ_LONG_16_took_0_ms { - get { - return ResourceManager.GetString("READ_LONG_16_took_0_ms", resourceCulture); - } - } - - internal static string SEEK_6_took_0_ms { - get { - return ResourceManager.GetString("SEEK_6_took_0_ms", resourceCulture); - } - } - - internal static string SEEK_10_took_0_ms { - get { - return ResourceManager.GetString("SEEK_10_took_0_ms", resourceCulture); - } - } - - internal static string READ_ATTRIBUTE_took_0_ms { - get { - return ResourceManager.GetString("READ_ATTRIBUTE_took_0_ms", resourceCulture); - } - } - - internal static string INQUIRY_took_0_ms { - get { - return ResourceManager.GetString("INQUIRY_took_0_ms", resourceCulture); - } - } - - internal static string TEST_UNIT_READY_took_0_ms { - get { - return ResourceManager.GetString("TEST_UNIT_READY_took_0_ms", resourceCulture); - } - } - - internal static string MODE_SENSE_6_took_0_ms { - get { - return ResourceManager.GetString("MODE_SENSE_6_took_0_ms", resourceCulture); - } - } - - internal static string MODE_SENSE_10_took_0_ms { - get { - return ResourceManager.GetString("MODE_SENSE_10_took_0_ms", resourceCulture); - } - } - - internal static string PREVENT_ALLOW_MEDIUM_REMOVAL_took_0_ms { - get { - return ResourceManager.GetString("PREVENT_ALLOW_MEDIUM_REMOVAL_took_0_ms", resourceCulture); - } - } - - internal static string READ_CAPACITY_took_0_ms { - get { - return ResourceManager.GetString("READ_CAPACITY_took_0_ms", resourceCulture); - } - } - - internal static string READ_CAPACITY_16_took_0_ms { - get { - return ResourceManager.GetString("READ_CAPACITY_16_took_0_ms", resourceCulture); - } - } - - internal static string READ_MEDIA_SERIAL_NUMBER_took_0_ms { - get { - return ResourceManager.GetString("READ_MEDIA_SERIAL_NUMBER_took_0_ms", resourceCulture); - } - } - - internal static string MODE_SELECT_6_took_0_ms { - get { - return ResourceManager.GetString("MODE_SELECT_6_took_0_ms", resourceCulture); - } - } - - internal static string MODE_SELECT_10_took_0_ms { - get { - return ResourceManager.GetString("MODE_SELECT_10_took_0_ms", resourceCulture); - } - } - - internal static string REQUEST_SENSE_took_0_ms { - get { - return ResourceManager.GetString("REQUEST_SENSE_took_0_ms", resourceCulture); - } - } - - internal static string LOAD_UNLOAD_6_took_0_ms { - get { - return ResourceManager.GetString("LOAD_UNLOAD_6_took_0_ms", resourceCulture); - } - } - - internal static string LOCATE_10_took_0_ms { - get { - return ResourceManager.GetString("LOCATE_10_took_0_ms", resourceCulture); - } - } - - internal static string LOCATE_16_took_0_ms { - get { - return ResourceManager.GetString("LOCATE_16_took_0_ms", resourceCulture); - } - } - - internal static string READ_BLOCK_LIMITS_took_0_ms { - get { - return ResourceManager.GetString("READ_BLOCK_LIMITS_took_0_ms", resourceCulture); - } - } - - internal static string READ_POSITION_took_0_ms { - get { - return ResourceManager.GetString("READ_POSITION_took_0_ms", resourceCulture); - } - } - - internal static string READ_REVERSE_6_took_0_ms { - get { - return ResourceManager.GetString("READ_REVERSE_6_took_0_ms", resourceCulture); - } - } - - internal static string READ_REVERSE_16_took_0_ms { - get { - return ResourceManager.GetString("READ_REVERSE_16_took_0_ms", resourceCulture); - } - } - - internal static string RECOVER_BUFFERED_DATA_took_0_ms { - get { - return ResourceManager.GetString("RECOVER_BUFFERED_DATA_took_0_ms", resourceCulture); - } - } - - internal static string REPORT_DENSITY_SUPPORT_took_0_ms { - get { - return ResourceManager.GetString("REPORT_DENSITY_SUPPORT_took_0_ms", resourceCulture); - } - } - - internal static string REWIND_took_0_ms { - get { - return ResourceManager.GetString("REWIND_took_0_ms", resourceCulture); - } - } - - internal static string TRACK_SELECT_took_0_ms { - get { - return ResourceManager.GetString("TRACK_SELECT_took_0_ms", resourceCulture); + return ResourceManager.GetString("SMART_RETURN_STATUS_took_0_ms", resourceCulture); } } + /// + /// Looks up a localized string similar to SPACE took {0} ms.. + /// internal static string SPACE_took_0_ms { get { return ResourceManager.GetString("SPACE_took_0_ms", resourceCulture); } } - internal static string SYQUEST_READ_6_took_0_ms { + /// + /// Looks up a localized string similar to START STOP UNIT (Immediate: {1}, FormatLayer: {2}, Power Conditions: {3}, Change Format Layer: {4}, Load/Eject: {5}, Start: {6}, Sense: {7}, Last Error: {8}) took {0} ms.. + /// + internal static string START_STOP_UNIT_Immediate_1_FormatLayer_2_Power_Conditions_3_Change_Format_Layer_4_Load_Eject_5_Start_6_Sense_7_Last_Error_8_took_0_ms { get { - return ResourceManager.GetString("SYQUEST_READ_6_took_0_ms", resourceCulture); + return ResourceManager.GetString("START_STOP_UNIT_Immediate_1_FormatLayer_2_Power_Conditions_3_Change_Format_Layer_" + + "4_Load_Eject_5_Start_6_Sense_7_Last_Error_8_took_0_ms", resourceCulture); } } + /// + /// Looks up a localized string similar to SYQUEST READ (10) took {0} ms.. + /// internal static string SYQUEST_READ_10_took_0_ms { get { return ResourceManager.GetString("SYQUEST_READ_10_took_0_ms", resourceCulture); } } - internal static string Platform_0_not_yet_supported { + /// + /// Looks up a localized string similar to SYQUEST READ (6) took {0} ms.. + /// + internal static string SYQUEST_READ_6_took_0_ms { get { - return ResourceManager.GetString("Platform_0_not_yet_supported", resourceCulture); + return ResourceManager.GetString("SYQUEST_READ_6_took_0_ms", resourceCulture); } } - internal static string Invalid_remote_URI { + /// + /// Looks up a localized string similar to TEST UNIT READY took {0} ms.. + /// + internal static string TEST_UNIT_READY_took_0_ms { get { - return ResourceManager.GetString("Invalid_remote_URI", resourceCulture); + return ResourceManager.GetString("TEST_UNIT_READY_took_0_ms", resourceCulture); } } - internal static string Error_connecting_to_host { + /// + /// Looks up a localized string similar to TRACK SELECT took {0} ms.. + /// + internal static string TRACK_SELECT_took_0_ms { get { - return ResourceManager.GetString("Error_connecting_to_host", resourceCulture); - } - } - - internal static string Invalid_remote_protocol { - get { - return ResourceManager.GetString("Invalid_remote_protocol", resourceCulture); - } - } - - internal static string Host_not_found { - get { - return ResourceManager.GetString("Host_not_found", resourceCulture); - } - } - - internal static string Connected_to_0 { - get { - return ResourceManager.GetString("Connected_to_0", resourceCulture); - } - } - - internal static string Could_not_read_from_the_network { - get { - return ResourceManager.GetString("Could_not_read_from_the_network", resourceCulture); - } - } - - internal static string Received_data_is_not_an_Aaru_Remote_Packet { - get { - return ResourceManager.GetString("Received_data_is_not_an_Aaru_Remote_Packet", resourceCulture); - } - } - - internal static string Expected_Hello_Packet_got_packet_type_0 { - get { - return ResourceManager.GetString("Expected_Hello_Packet_got_packet_type_0", resourceCulture); + return ResourceManager.GetString("TRACK_SELECT_took_0_ms", resourceCulture); } } + /// + /// Looks up a localized string similar to Unrecognized packet version.... + /// internal static string Unrecognized_packet_version { get { return ResourceManager.GetString("Unrecognized_packet_version", resourceCulture); } } - - internal static string Could_not_write_to_the_network { - get { - return ResourceManager.GetString("Could_not_write_to_the_network", resourceCulture); - } - } - - internal static string Remote_IsRoot_Expected_Am_I_Root_Response_Packet_got_packet_type_0 { - get { - return ResourceManager.GetString("Remote_IsRoot_Expected_Am_I_Root_Response_Packet_got_packet_type_0", resourceCulture); - } - } - - internal static string Remote_ListDevices_Expected_List_Devices_Response_Packet_got_packet_type_0 { - get { - return ResourceManager.GetString("Remote_ListDevices_Expected_List_Devices_Response_Packet_got_packet_type_0", resourceCulture); - } - } - - internal static string Expected_SCSI_Response_Packet_got_packet_type_0 { - get { - return ResourceManager.GetString("Expected_SCSI_Response_Packet_got_packet_type_0", resourceCulture); - } - } - - internal static string Expected_ATA_CHS_Response_Packet_got_packet_type_0 { - get { - return ResourceManager.GetString("Expected_ATA_CHS_Response_Packet_got_packet_type_0", resourceCulture); - } - } - - internal static string Expected_ATA_LBA28_Response_Packet_got_packet_type_0 { - get { - return ResourceManager.GetString("Expected_ATA_LBA28_Response_Packet_got_packet_type_0", resourceCulture); - } - } - - internal static string Expected_ATA_LBA48_Response_Packet_got_packet_type_0 { - get { - return ResourceManager.GetString("Expected_ATA_LBA48_Response_Packet_got_packet_type_0", resourceCulture); - } - } - - internal static string Expected_SDHCI_Response_Packet_got_packet_type_0 { - get { - return ResourceManager.GetString("Expected_SDHCI_Response_Packet_got_packet_type_0", resourceCulture); - } - } - - internal static string Expected_Device_Type_Response_Packet_got_packet_type_0 { - get { - return ResourceManager.GetString("Expected_Device_Type_Response_Packet_got_packet_type_0", resourceCulture); - } - } - - internal static string Expected_USB_Data_Response_Packet_got_packet_type_0 { - get { - return ResourceManager.GetString("Expected_USB_Data_Response_Packet_got_packet_type_0", resourceCulture); - } - } - - internal static string Expected_FireWire_Data_Response_Packet_got_packet_type_0 { - get { - return ResourceManager.GetString("Expected_FireWire_Data_Response_Packet_got_packet_type_0", resourceCulture); - } - } - - internal static string Expected_PCMCIA_Data_Response_Packet_got_packet_type_0 { - get { - return ResourceManager.GetString("Expected_PCMCIA_Data_Response_Packet_got_packet_type_0", resourceCulture); - } - } - - internal static string Expected_multi_MMC_SD_command_Response_Packet_got_packet_type_0 { - get { - return ResourceManager.GetString("Expected_multi_MMC_SD_command_Response_Packet_got_packet_type_0", resourceCulture); - } - } - - internal static string Expected_the_response_to_0_SD_MMC_commands_but_got_1_responses { - get { - return ResourceManager.GetString("Expected_the_response_to_0_SD_MMC_commands_but_got_1_responses", resourceCulture); - } - } - - internal static string Expected_NOP_Packet_got_packet_type_0 { - get { - return ResourceManager.GetString("Expected_NOP_Packet_got_packet_type_0", resourceCulture); - } - } - - internal static string ReOpen_error_closing_device { - get { - return ResourceManager.GetString("ReOpen_error_closing_device", resourceCulture); - } - } - - internal static string ReOpen_error_0_with_reason_1 { - get { - return ResourceManager.GetString("ReOpen_error_0_with_reason_1", resourceCulture); - } - } - - internal static string Expected_OS_Read_Response_Packet_got_packet_type_0 { - get { - return ResourceManager.GetString("Expected_OS_Read_Response_Packet_got_packet_type_0", resourceCulture); - } - } - - internal static string Remote_error_0_in_OS_Read { - get { - return ResourceManager.GetString("Remote_error_0_in_OS_Read", resourceCulture); - } - } } } diff --git a/Aaru.Devices/Localization/Localization.es.resx b/Aaru.Devices/Localization/Localization.es.resx index cb96aee5f..db8b2b4eb 100644 --- a/Aaru.Devices/Localization/Localization.es.resx +++ b/Aaru.Devices/Localization/Localization.es.resx @@ -1,504 +1,504 @@ - - - text/microsoft-resx - - - 1.3 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, - PublicKeyToken=b77a5c561934e089 - - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, - PublicKeyToken=b77a5c561934e089 - - - + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + READ BUFFER tomó {0} ms. - + READ BUFFER DMA tomó {0} ms. - + READ DMA tomó {0} ms. - + READ MULTIPLE tomó {0} ms. - + READ NATIVE MAX ADDRESS tomó {0} ms. - + READ SECTORS tomó {0} ms. - + READ LONG tomó {0} ms. - + SEEK tomó {0} ms. - + GET NATIVE MAX ADDRESS EXT tomó {0} ms. - + READ DMA EXT tomó {0} ms. - + READ LOG EXT tomó {0} ms. - + READ LOG DMA EXT tomó {0} ms. - + READ MULTIPLE EXT tomó {0} ms. - + READ NATIVE MAX ADDRESS EXT tomó {0} ms. - + READ SECTORS EXT tomó {0} ms. - + SET FEATURES tomó {0} ms. - + DOOR LOCK tomó {0} ms. - + DOOR UNLOCK tomó {0} ms. - + MEDIA EJECT tomó {0} ms. - + IDENTIFY PACKET DEVICE tomó {0} ms. - + CFA TRANSLATE SECTOR tomó {0} ms. - + CFA REQUEST EXTENDED ERROR CODE tomó {0} ms. - + CHECK MEDIA CARD TYPE tomó {0} ms. - + SMART DISABLE OPERATIONS tomó {0} ms. - + SMART ENABLE ATTRIBUTE AUTOSAVE tomó {0} ms. - + SMART DISABLE ATTRIBUTE AUTOSAVE tomó {0} ms. - + SMART ENABLE OPERATIONS tomó {0} ms. - + SMART EXECUTE OFF-LINE IMMEDIATE tomó {0} ms. - + SMART READ DATA tomó {0} ms. - + SMART READ LOG tomó {0} ms. - + SMART RETURN STATUS tomó {0} ms. - + SEND_CSD tomó {0} ms. - + SEND_CID tomó {0} ms. - + SEND_OP_COND tomó {0} ms. - + SEND_EXT_CSD tomó {0} ms. - + SET_BLOCKLEN tomó {0} ms. - + READ_SINGLE_BLOCK tomó {0} ms. - + READ_MULTIPLE_BLOCK tomó {0} ms. - + Múltiples READ_SINGLE_BLOCKs tomaron {0} ms. - + SEND_STATUS tomó {0} ms. - + SD_STATUS tomó {0} ms. - + SD_SEND_OP_COND tomó {0} ms. - + SEND_SCR tomó {0} ms. - + ADAPTEC TRANSLATE tomó {0} ms. - + ADAPTEC SET ERROR THRESHOLD tomó {0} ms. - + ADAPTEC READ/RESET USAGE COUNTER tomó {0} ms. - + ADAPTEC WRITE DATA BUFFER tomó {0} ms. - + ADAPTEC READ DATA BUFFER tomó {0} ms. - + ARCHIVE CORP. REQUEST BLOCK ADDRESS tomó {0} ms. - + ARCHIVE CORP. SEEK BLOCK tomó {0} ms. - + CERTANCE PARK UNPARK tomó {0} ms. - + FUJITSU DISPLAY tomó {0} ms. - + HL-DT-ST READ DVD (RAW) tomó {0} ms. - + HP READ LONG tomó {0} ms. - + KREON DEPRECATED UNLOCK tomó {0} ms. - + KREON SET LOCK STATE tomó {0} ms. - + KREON GET FEATURE LIST tomó {0} ms. - + KREON EXTRACT SS tomó {0} ms. - + MediaTek READ DRAM tomó {0} ms. - + MINIDISC READ DTOC tomó {0} ms. - + MINIDISC READ UTOC tomó {0} ms. - + MINIDISC command D5h tomó {0} ms. - + MINIDISC STOP PLAY tomó {0} ms. - + MINIDISC READ POSITION tomó {0} ms. - + MINIDISC GET TYPE tomó {0} ms. - + GET CONFIGURATION (Número de primera funcionalidad Feature Number: {1}, Tipo de retorno: {2}, Sense: {3}, Error: {4}) tomó {0} ms. - + READ DISC STRUCTURE (Tipo de medio: {1}, Dirección: {2}, Capa: {3}, Formato: {4}, AGID: {5}, Sense: {6}, Error: {7}) tomó {0} ms. - + READ TOC/PMA/ATIP tomó (MSF: {1}, Formato: {2}, Pista/Sesión: {3}, Sense: {4}, Error: {5}) {0} ms. - + READ DISC INFORMATION (Tipo de datos: {1}, Sense: {2}, Last Error: {3}) tomó {0} ms. - + READ CD (LBA: {1}, Tamaño del bloque: {2}, Longitud de la transferencia: {3}, Tipo de sector esperado: {4}, DAP: {5}, Dirección relativa: {6}, Síncrono: {7}, Cabeceras: {8}, Datos de usuario: {9}, ECC/EDC: {10}, C2: {11}, Subcanal: {12}, Sense: {13}, Error: {14}) tomó {0} ms. - + READ CD MSF (Start MSF: {1}, End MSF: {2}, Block Size: {3}, Expected Sector Type: {4}, DAP: {5}, Sync: {6}, Headers: {7}, User Data: {8}, ECC/EDC: {9}, C2: {10}, Subchannel: {11}, Sense: {12}, LastError: {13}) tomó {0} ms. - + PREVENT ALLOW MEDIUM REMOVAL (Persistente: {1}, Evitar: {2}, Sense: {3}, Error: {4}) tomó {0} ms. - + START STOP UNIT (Inmediato: {1}, Formato de capa: {2}, Condiciones de energía: {3}, Cambiar capa de formato: {4}, Cargar/Expulsar: {5}, Iniciar: {6}, Sense: {7}, Error: {8}) tomó {0} ms. - + READ READ SUB-CHANNEL (MCN, Sense {1}, Error {2}) tomó {0} ms. - + READ READ SUB-CHANNEL (ISRC, Pista: {1}, Sense: {2}, Error: {3}) tomó {0} ms. - + SET CD SPEED (Control rotación: {1}, Velocidad de lectura: {2}, Velocidad de escritura: {3}, Sense: {4}, Error: {5}) tomó {0} ms. - + READ TRACK INFORMATION (Data Type: {1}, Sense: {2}, Last Error: {3}) tomó {0} ms. - + NEC READ CD-DA tomó {0} ms. - + MEDIUM SCAN tomó {0} ms. - + PIONEER READ CD-DA tomó {0} ms. - + PIONEER READ CD-DA MSF tomó {0} ms. - + PIONEER READ CD-XA tomó {0} ms. - + PLASMON READ SECTOR LOCATION tomó {0} ms. - + Plextor READ CD-DA (LBA: {1}, Tamaño del bloque: {2}, Longitud de la transferencia: {3}, Subcanal: {4}, Sense: {5}, Error: {6}) tomó {0} ms. - + Plextor READ DVD (RAW) tomó {0} ms. - + PLEXTOR READ EEPROM tomó {0} ms. - + PLEXTOR POWEREC GET SPEEDS tomó {0} ms. - + PLEXTOR GET SILENT MODE tomó {0} ms. - + PLEXTOR GET GIGAREC tomó {0} ms. - + PLEXTOR GET VARIREC tomó {0} ms. - + PLEXTOR GET SECUREC tomó {0} ms. - + PLEXTOR GET SPEEDREAD tomó {0} ms. - + PLEXTOR GET SINGLE-SESSION / HIDE CD-R tomó {0} ms. - + PLEXTOR GET BOOK BITSETTING tomó {0} ms. - + PLEXTOR GET TEST WRITE DVD+ tomó {0} ms. - + READ (6) tomó {0} ms. - + READ (10) tomó {0} ms. - + READ (12) tomó {0} ms. - + READ (16) tomó {0} ms. - + READ LONG (10) tomó {0} ms. - + READ LONG (16) tomó {0} ms. - + SEEK (6) tomó {0} ms. - + SEEK (10) tomó {0} ms. - + READ ATTRIBUTE tomó {0} ms. - + INQUIRY tomó {0} ms. - + TEST UNIT READY tomó {0} ms. - + MODE SENSE(6) tomó {0} ms. - + MODE SENSE(10) tomó {0} ms. - + PREVENT ALLOW MEDIUM REMOVAL tomó {0} ms. - + READ CAPACITY tomó {0} ms. - + READ CAPACITY(16) tomó {0} ms. - + READ MEDIA SERIAL NUMBER tomó {0} ms. - + MODE SELECT(6) tomó {0} ms. - + MODE SELECT(10) tomó {0} ms. - + REQUEST SENSE tomó {0} ms. - + LOAD UNLOAD (6) tomó {0} ms. - + LOCATE (10) tomó {0} ms. - + LOCATE (16) tomó {0} ms. - + READ BLOCK LIMITS tomó {0} ms. - + READ POSITION tomó {0} ms. - + READ REVERSE (6) tomó {0} ms. - + READ REVERSE (16) tomó {0} ms. - + RECOVER BUFFERED DATA tomó {0} ms. - + REPORT DENSITY SUPPORT tomó {0} ms. - + REWIND tomó {0} ms. - + TRACK SELECT tomó {0} ms. - + SPACE tomó {0} ms. - + SYQUEST READ (6) tomó {0} ms. - + SYQUEST READ (10) tomó {0} ms. - + La plataforma {0} no está soportada. - + URI remota inválida. - + Error al conectar al servidor. - + Protocolo remoto inválido. - + Servidor no encontrado - + Conectado a {0} - + No se pudo leer desde la red... - + Los datos recibidos no son un paquete Aaru Remote... - + Se esperaba paquete de saludo, se recibió paquete tipo {0}... - + Versión de paquete no reconocida... - + No se pudo escribir hacia la red... - + Se esperaba paquete de respuesta ¿Soy root?, pero se recibió paquete tipo {0} - + Se esperaba paquete de respuesta de listado de dispositivos, pero se recibió paquete tipo {0} - + Se esperaba paquete de respuesta SCSI, se recibió paquete tipo {0}... - + Se esperaba paquete de respuesta ATA CHS, se recibió paquete tipo {0}... - + Se esperaba paquete de respuesta ATA LBA48, se recibió paquete tipo {0}... - + Se esperaba paquete de respuesta ATA LBA48, se recibió paquete tipo {0}... - + Se esperaba paquete de respuesta SDHCI, se recibió paquete tipo {0} - + Se esperaba paquete de respuesta Tipo de Dispositivo, se recibió paquete tipo {0}... - + Se esperaba paquete de respuesta de datos USB, pero se recibió paquete tipo {0}... - + Se esperaba paquete de respuesta de datos FireWire, se recibió paquete tipo {0}... - + Se esperaba paquete de respuesta de datos PCMCIA, se recibió paquete tipo {0}... - + Se esperaba paquete de respuesta de multi comando MMC/SD, se recibió paquete tipo {0}... - + Se esperaban {0} respuestas a comandos SD/MMC, pero se recibieron {1} respuestas... - + Se esperaba paquete NOP, se recibió paquete tipo {0}... - + Error de reapertura cerrando dispositivo... - + Error {0} al reabrir con razón: {1}... - + Se esperaba paquete de respuesta de lectura de SO, se recibió paquete tipo {0}... - + Error remoto {0} en lectura de OS... \ No newline at end of file diff --git a/Aaru.Devices/Localization/Localization.resx b/Aaru.Devices/Localization/Localization.resx index 5df68834e..b87667258 100644 --- a/Aaru.Devices/Localization/Localization.resx +++ b/Aaru.Devices/Localization/Localization.resx @@ -1,509 +1,511 @@ - - - - - text/microsoft-resx - - - 1.3 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, - PublicKeyToken=b77a5c561934e089 - - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, - PublicKeyToken=b77a5c561934e089 - - - + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + READ BUFFER took {0} ms. - + READ BUFFER DMA took {0} ms. - + READ DMA took {0} ms. - + READ MULTIPLE took {0} ms. - + READ NATIVE MAX ADDRESS took {0} ms. - + READ SECTORS took {0} ms. - + READ LONG took {0} ms. - + SEEK took {0} ms. - + GET NATIVE MAX ADDRESS EXT took {0} ms. - + READ DMA EXT took {0} ms. - + READ LOG EXT took {0} ms. - + READ LOG DMA EXT took {0} ms. - + READ MULTIPLE EXT took {0} ms. - + READ NATIVE MAX ADDRESS EXT took {0} ms. - + READ SECTORS EXT took {0} ms. - + SET FEATURES took {0} ms. - + DOOR LOCK took {0} ms. - + DOOR UNLOCK took {0} ms. - + MEDIA EJECT took {0} ms. - + IDENTIFY PACKET DEVICE took {0} ms. - + CFA TRANSLATE SECTOR took {0} ms. - + CFA REQUEST EXTENDED ERROR CODE took {0} ms. - + CHECK MEDIA CARD TYPE took {0} ms. - + SMART DISABLE OPERATIONS took {0} ms. - + SMART ENABLE ATTRIBUTE AUTOSAVE took {0} ms. - + SMART DISABLE ATTRIBUTE AUTOSAVE took {0} ms. - + SMART ENABLE OPERATIONS took {0} ms. - + SMART EXECUTE OFF-LINE IMMEDIATE took {0} ms. - + SMART READ DATA took {0} ms. - + SMART READ LOG took {0} ms. - + SMART RETURN STATUS took {0} ms. - + SEND_CSD took {0} ms. - + SEND_CID took {0} ms. - + SEND_OP_COND took {0} ms. - + SEND_EXT_CSD took {0} ms. - + SET_BLOCKLEN took {0} ms. - + READ_SINGLE_BLOCK took {0} ms. - + READ_MULTIPLE_BLOCK took {0} ms. - + Multiple READ_SINGLE_BLOCKs took {0} ms. - + SEND_STATUS took {0} ms. - + SD_STATUS took {0} ms. - + SD_SEND_OP_COND took {0} ms. - + SEND_SCR took {0} ms. - + ADAPTEC TRANSLATE took {0} ms. - + ADAPTEC SET ERROR THRESHOLD took {0} ms. - + ADAPTEC READ/RESET USAGE COUNTER took {0} ms. - + ADAPTEC WRITE DATA BUFFER took {0} ms. - + ADAPTEC READ DATA BUFFER took {0} ms. - + ARCHIVE CORP. REQUEST BLOCK ADDRESS took {0} ms. - + ARCHIVE CORP. SEEK BLOCK took {0} ms. - + CERTANCE PARK UNPARK took {0} ms. - + FUJITSU DISPLAY took {0} ms. - + HL-DT-ST READ DVD (RAW) took {0} ms. - + HP READ LONG took {0} ms. - + KREON DEPRECATED UNLOCK took {0} ms. - + KREON SET LOCK STATE took {0} ms. - + KREON GET FEATURE LIST took {0} ms. - + KREON EXTRACT SS took {0} ms. - + MediaTek READ DRAM took {0} ms. - + MINIDISC READ DTOC took {0} ms. - + MINIDISC READ UTOC took {0} ms. - + MINIDISC command D5h took {0} ms. - + MINIDISC STOP PLAY took {0} ms. - + MINIDISC READ POSITION took {0} ms. - + MINIDISC GET TYPE took {0} ms. - + GET CONFIGURATION (Starting Feature Number: {1}, Return Type: {2}, Sense: {3}, Last Error: {4}) took {0} ms. - + READ DISC STRUCTURE (Media Type: {1}, Address: {2}, Layer Number: {3}, Format: {4}, AGID: {5}, Sense: {6}, Last Error: {7}) took {0} ms. - + READ TOC/PMA/ATIP took (MSF: {1}, Format: {2}, Track/Session Number: {3}, Sense: {4}, LastError: {5}) {0} ms. - + READ DISC INFORMATION (Data Type: {1}, Sense: {2}, Last Error: {3}) took {0} ms. - + READ CD (LBA: {1}, Block Size: {2}, Transfer Length: {3}, Expected Sector Type: {4}, DAP: {5}, Relative Address: {6}, Sync: {7}, Headers: {8}, User Data: {9}, ECC/EDC: {10}, C2: {11}, Subchannel: {12}, Sense: {13}, Last Error: {14}) took {0} ms. - + READ CD MSF (Start MSF: {1}, End MSF: {2}, Block Size: {3}, Expected Sector Type: {4}, DAP: {5}, Sync: {6}, Headers: {7}, User Data: {8}, ECC/EDC: {9}, C2: {10}, Subchannel: {11}, Sense: {12}, LastError: {13}) took {0} ms. - + PREVENT ALLOW MEDIUM REMOVAL (Persistent: {1}, Prevent: {2}, Sense: {3}, LastError: {4}) took {0} ms. - + START STOP UNIT (Immediate: {1}, FormatLayer: {2}, Power Conditions: {3}, Change Format Layer: {4}, Load/Eject: {5}, Start: {6}, Sense: {7}, Last Error: {8}) took {0} ms. - + READ READ SUB-CHANNEL (MCN, Sense {1}, Last Error {2}) took {0} ms. - + READ READ SUB-CHANNEL (ISRC, Track Number: {1}, Sense: {2}, Last Error: {3}) took {0} ms. - + SET CD SPEED (Rotational Control: {1}, Read Speed: {2}, Write Speed: {3}, Sense: {4}, Last Error: {5}) took {0} ms. - + READ TRACK INFORMATION (Data Type: {1}, Sense: {2}, Last Error: {3}) took {0} ms. - + NEC READ CD-DA took {0} ms. - + MEDIUM SCAN took {0} ms. - + PIONEER READ CD-DA took {0} ms. - + PIONEER READ CD-DA MSF took {0} ms. - + PIONEER READ CD-XA took {0} ms. - + PLASMON READ SECTOR LOCATION took {0} ms. - + Plextor READ CD-DA (LBA: {1}, Block Size: {2}, Transfer Length: {3}, Subchannel: {4}, Sense: {5}, Last Error: {6}) took {0} ms. - + Plextor READ DVD (RAW) took {0} ms. - + PLEXTOR READ EEPROM took {0} ms. - + PLEXTOR POWEREC GET SPEEDS took {0} ms. - + PLEXTOR GET SILENT MODE took {0} ms. - + PLEXTOR GET GIGAREC took {0} ms. - + PLEXTOR GET VARIREC took {0} ms. - + PLEXTOR GET SECUREC took {0} ms. - + PLEXTOR GET SPEEDREAD took {0} ms. - + PLEXTOR GET SINGLE-SESSION / HIDE CD-R took {0} ms. - + PLEXTOR GET BOOK BITSETTING took {0} ms. - + PLEXTOR GET TEST WRITE DVD+ took {0} ms. - + READ (6) took {0} ms. - + READ (10) took {0} ms. - + READ (12) took {0} ms. - + READ (16) took {0} ms. - + READ LONG (10) took {0} ms. - + READ LONG (16) took {0} ms. - + SEEK (6) took {0} ms. - + SEEK (10) took {0} ms. - + READ ATTRIBUTE took {0} ms. - + INQUIRY took {0} ms. - + TEST UNIT READY took {0} ms. - + MODE SENSE(6) took {0} ms. - + MODE SENSE(10) took {0} ms. - + PREVENT ALLOW MEDIUM REMOVAL took {0} ms. - + READ CAPACITY took {0} ms. - + READ CAPACITY(16) took {0} ms. - + READ MEDIA SERIAL NUMBER took {0} ms. - + MODE SELECT(6) took {0} ms. - + MODE SELECT(10) took {0} ms. - + REQUEST SENSE took {0} ms. - + LOAD UNLOAD (6) took {0} ms. - + LOCATE (10) took {0} ms. - + LOCATE (16) took {0} ms. - + READ BLOCK LIMITS took {0} ms. - + READ POSITION took {0} ms. - + READ REVERSE (6) took {0} ms. - + READ REVERSE (16) took {0} ms. - + RECOVER BUFFERED DATA took {0} ms. - + REPORT DENSITY SUPPORT took {0} ms. - + REWIND took {0} ms. - + TRACK SELECT took {0} ms. - + SPACE took {0} ms. - + SYQUEST READ (6) took {0} ms. - + SYQUEST READ (10) took {0} ms. - + Platform {0} not yet supported. - + Invalid remote URI. - + Error connecting to host. - + Invalid remote protocol. - + Host not found - + Connected to {0} - + Could not read from the network... - + Received data is not an Aaru Remote Packet... - + Expected Hello Packet, got packet type {0}... - + Unrecognized packet version... - + Could not write to the network... - + Expected Am I Root? Response Packet, got packet type {0}... - + Expected List Devices Response Packet, got packet type {0}... - + Expected SCSI Response Packet, got packet type {0}... - + Expected ATA CHS Response Packet, got packet type {0}... - + Expected ATA LBA28 Response Packet, got packet type {0}... - + Expected ATA LBA48 Response Packet, got packet type {0}... - + Expected SDHCI Response Packet, got packet type {0}... - + Expected Device Type Response Packet, got packet type {0}... - + Expected USB Data Response Packet, got packet type {0}... - + Expected FireWire Data Response Packet, got packet type {0}... - + Expected PCMCIA Data Response Packet, got packet type {0}... - + Expected multi MMC/SD command Response Packet, got packet type {0}... - + Expected the response to {0} SD/MMC commands, but got {1} responses... - + Expected NOP Packet, got packet type {0}... - + ReOpen error closing device... - + ReOpen error {0} with reason: {1}... - + Expected OS Read Response Packet, got packet type {0}... - + Remote error {0} in OS Read... \ No newline at end of file diff --git a/Aaru.Devices/Remote/Command.cs b/Aaru.Devices/Remote/Command.cs index ee1992652..ffc7542bc 100644 --- a/Aaru.Devices/Remote/Command.cs +++ b/Aaru.Devices/Remote/Command.cs @@ -41,7 +41,7 @@ namespace Aaru.Devices.Remote; public partial class Device { /// - public override int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, + public override int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, ScsiDirection direction, out double duration, out bool sense) { // We need a timeout @@ -91,9 +91,9 @@ public partial class Device } /// - public override int SendMmcCommand(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 = 15) + public override int SendMmcCommand(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 = 15) { // We need a timeout if(timeout == 0) @@ -160,7 +160,7 @@ public partial class Device /// public override int SendMultipleMmcCommands(MmcSingleCommand[] commands, out double duration, out bool sense, - uint timeout = 15) + uint timeout = 15) { // We need a timeout if(timeout == 0) @@ -169,7 +169,7 @@ public partial class Device if(_remote.ServerProtocolVersion >= 2) return _remote.SendMultipleMmcCommands(commands, out duration, out sense, timeout); - int error = 0; + var error = 0; duration = 0; sense = false; diff --git a/Aaru.Devices/Remote/Device.cs b/Aaru.Devices/Remote/Device.cs index 2f51640f9..0ec188cd4 100644 --- a/Aaru.Devices/Remote/Device.cs +++ b/Aaru.Devices/Remote/Device.cs @@ -42,8 +42,11 @@ namespace Aaru.Devices.Remote; /// public sealed partial class Device : Devices.Device { + bool? _isRemoteAdmin; Remote _remote; + Device() {} + /// Returns if remote is running under administrative (aka root) privileges public bool IsAdmin { @@ -57,21 +60,24 @@ public sealed partial class Device : Devices.Device /// Current device is remote public bool IsRemote => _remote != null; + /// Remote application public string RemoteApplication => _remote?.ServerApplication; + /// Remote application server public string RemoteVersion => _remote?.ServerVersion; + /// Remote operating system name public string RemoteOperatingSystem => _remote?.ServerOperatingSystem; + /// Remote operating system version public string RemoteOperatingSystemVersion => _remote?.ServerOperatingSystemVersion; + /// Remote architecture public string RemoteArchitecture => _remote?.ServerArchitecture; + /// Remote protocol version public int RemoteProtocolVersion => _remote?.ServerProtocolVersion ?? 0; - bool? _isRemoteAdmin; - - Device() {} /// Opens the device for sending direct commands /// AaruRemote URI @@ -156,7 +162,8 @@ public sealed partial class Device : Devices.Device break; } - #region SecureDigital / MultiMediaCard + #region SecureDigital / MultiMediaCard + if(dev._cachedCid != null) { dev.ScsiType = PeripheralDeviceTypes.DirectAccess; @@ -189,9 +196,11 @@ public sealed partial class Device : Devices.Device return dev; } - #endregion SecureDigital / MultiMediaCard - #region USB + #endregion SecureDigital / MultiMediaCard + + #region USB + if(dev._remote.GetUsbData(out byte[] remoteUsbDescriptors, out ushort remoteUsbVendor, out ushort remoteUsbProduct, out string remoteUsbManufacturer, out string remoteUsbProductString, out string remoteUsbSerial)) @@ -204,9 +213,11 @@ public sealed partial class Device : Devices.Device dev.UsbProductString = remoteUsbProductString; dev.UsbSerialString = remoteUsbSerial; } - #endregion USB - #region FireWire + #endregion USB + + #region FireWire + if(dev._remote.GetFireWireData(out dev._firewireVendor, out dev._firewireModel, out dev._firewireGuid, out string remoteFireWireVendorName, out string remoteFireWireModelName)) { @@ -214,14 +225,18 @@ public sealed partial class Device : Devices.Device dev.FireWireVendorName = remoteFireWireVendorName; dev.FireWireModelName = remoteFireWireModelName; } - #endregion FireWire - #region PCMCIA + + #endregion FireWire + + #region PCMCIA + if(!dev._remote.GetPcmciaData(out byte[] cisBuf)) return dev; dev.IsPcmcia = true; dev.Cis = cisBuf; - #endregion PCMCIA + + #endregion PCMCIA return dev; } diff --git a/Aaru.Devices/Remote/Enums.cs b/Aaru.Devices/Remote/Enums.cs index ac25434ff..843b70815 100644 --- a/Aaru.Devices/Remote/Enums.cs +++ b/Aaru.Devices/Remote/Enums.cs @@ -35,19 +35,41 @@ namespace Aaru.Devices.Remote; /// Packet type enumeration public enum AaruPacketType : sbyte { - #pragma warning disable 1591 - Nop = -1, Hello = 1, CommandListDevices = 2, - ResponseListDevices = 3, CommandOpen = 4, CommandScsi = 5, - ResponseScsi = 6, CommandAtaChs = 7, ResponseAtaChs = 8, - CommandAtaLba28 = 9, ResponseAtaLba28 = 10, CommandAtaLba48 = 11, - ResponseAtaLba48 = 12, CommandSdhci = 13, ResponseSdhci = 14, - CommandGetType = 15, ResponseGetType = 16, CommandGetSdhciRegisters = 17, - ResponseGetSdhciRegisters = 18, CommandGetUsbData = 19, ResponseGetUsbData = 20, - CommandGetFireWireData = 21, ResponseGetFireWireData = 22, CommandGetPcmciaData = 23, - ResponseGetPcmciaData = 24, CommandCloseDevice = 25, CommandAmIRoot = 26, - ResponseAmIRoot = 27, MultiCommandSdhci = 28, ResponseMultiSdhci = 29, - CommandReOpenDevice = 30, CommandOsRead = 31, ResponseOsRead = 32 - #pragma warning restore 1591 +#pragma warning disable 1591 + Nop = -1, + Hello = 1, + CommandListDevices = 2, + ResponseListDevices = 3, + CommandOpen = 4, + CommandScsi = 5, + ResponseScsi = 6, + CommandAtaChs = 7, + ResponseAtaChs = 8, + CommandAtaLba28 = 9, + ResponseAtaLba28 = 10, + CommandAtaLba48 = 11, + ResponseAtaLba48 = 12, + CommandSdhci = 13, + ResponseSdhci = 14, + CommandGetType = 15, + ResponseGetType = 16, + CommandGetSdhciRegisters = 17, + ResponseGetSdhciRegisters = 18, + CommandGetUsbData = 19, + ResponseGetUsbData = 20, + CommandGetFireWireData = 21, + ResponseGetFireWireData = 22, + CommandGetPcmciaData = 23, + ResponseGetPcmciaData = 24, + CommandCloseDevice = 25, + CommandAmIRoot = 26, + ResponseAmIRoot = 27, + MultiCommandSdhci = 28, + ResponseMultiSdhci = 29, + CommandReOpenDevice = 30, + CommandOsRead = 31, + ResponseOsRead = 32 +#pragma warning restore 1591 } /// Reasons for non-data request or response diff --git a/Aaru.Devices/Remote/Remote.cs b/Aaru.Devices/Remote/Remote.cs index 6bd1ee098..5d35ba6c5 100644 --- a/Aaru.Devices/Remote/Remote.cs +++ b/Aaru.Devices/Remote/Remote.cs @@ -89,7 +89,7 @@ public class Remote : IDisposable AaruConsole.WriteLine(Localization.Connected_to_0, uri.Host); - byte[] hdrBuf = new byte[Marshal.SizeOf()]; + var hdrBuf = new byte[Marshal.SizeOf()]; int len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -196,14 +196,19 @@ public class Remote : IDisposable /// Remote server application public string ServerApplication { get; } + /// Remote server application version public string ServerVersion { get; } + /// Remote server operating system public string ServerOperatingSystem { get; } + /// Remote server operating system version public string ServerOperatingSystemVersion { get; } + /// Remote server architecture public string ServerArchitecture { get; } + /// Remote server protocol version public int ServerProtocolVersion { get; } @@ -235,7 +240,7 @@ public class Remote : IDisposable return false; } - byte[] hdrBuf = new byte[Marshal.SizeOf()]; + var hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -281,9 +286,13 @@ public class Remote : IDisposable } } +#region IDisposable Members + /// public void Dispose() => Disconnect(); +#endregion + /// Disconnects from remote public void Disconnect() { @@ -325,7 +334,7 @@ public class Remote : IDisposable return Array.Empty(); } - byte[] hdrBuf = new byte[Marshal.SizeOf()]; + var hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -351,8 +360,9 @@ public class Remote : IDisposable if(hdr.packetType != AaruPacketType.Nop) { AaruConsole. - ErrorWriteLine(Localization.Remote_ListDevices_Expected_List_Devices_Response_Packet_got_packet_type_0, - hdr.packetType); + ErrorWriteLine( + Localization.Remote_ListDevices_Expected_List_Devices_Response_Packet_got_packet_type_0, + hdr.packetType); return Array.Empty(); } @@ -446,7 +456,7 @@ public class Remote : IDisposable return false; } - byte[] hdrBuf = new byte[Marshal.SizeOf()]; + var hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -495,8 +505,10 @@ public class Remote : IDisposable switch(nop.reasonCode) { - case AaruNopReason.OpenOk: return true; - case AaruNopReason.NotImplemented: throw new NotImplementedException($"{nop.reason}"); + case AaruNopReason.OpenOk: + return true; + case AaruNopReason.NotImplemented: + throw new NotImplementedException($"{nop.reason}"); } AaruConsole.ErrorWriteLine($"{nop.reason}"); @@ -517,8 +529,8 @@ public class Remote : IDisposable /// 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) + public int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, + ScsiDirection direction, out double duration, out bool sense) { senseBuffer = null; duration = 0; @@ -546,7 +558,7 @@ public class Remote : IDisposable cmdPkt.hdr.len = (uint)(Marshal.SizeOf() + cmdPkt.cdb_len + cmdPkt.buf_len); byte[] pktBuf = Marshal.StructureToByteArrayLittleEndian(cmdPkt); - byte[] buf = new byte[cmdPkt.hdr.len]; + var buf = new byte[cmdPkt.hdr.len]; Array.Copy(pktBuf, 0, buf, 0, Marshal.SizeOf()); @@ -565,7 +577,7 @@ public class Remote : IDisposable return -1; } - byte[] hdrBuf = new byte[Marshal.SizeOf()]; + var hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -659,7 +671,7 @@ public class Remote : IDisposable cmdPkt.hdr.len = (uint)(Marshal.SizeOf() + cmdPkt.buf_len); byte[] pktBuf = Marshal.StructureToByteArrayLittleEndian(cmdPkt); - byte[] buf = new byte[cmdPkt.hdr.len]; + var buf = new byte[cmdPkt.hdr.len]; Array.Copy(pktBuf, 0, buf, 0, Marshal.SizeOf()); @@ -675,7 +687,7 @@ public class Remote : IDisposable return -1; } - byte[] hdrBuf = new byte[Marshal.SizeOf()]; + var hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -739,8 +751,8 @@ public class Remote : IDisposable /// 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) + AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer, + uint timeout, bool transferBlocks, out double duration, out bool sense) { duration = 0; sense = true; @@ -768,7 +780,7 @@ public class Remote : IDisposable cmdPkt.hdr.len = (uint)(Marshal.SizeOf() + cmdPkt.buf_len); byte[] pktBuf = Marshal.StructureToByteArrayLittleEndian(cmdPkt); - byte[] buf = new byte[cmdPkt.hdr.len]; + var buf = new byte[cmdPkt.hdr.len]; Array.Copy(pktBuf, 0, buf, 0, Marshal.SizeOf()); @@ -784,7 +796,7 @@ public class Remote : IDisposable return -1; } - byte[] hdrBuf = new byte[Marshal.SizeOf()]; + var hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -849,8 +861,8 @@ public class Remote : IDisposable /// 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) + AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer, + uint timeout, bool transferBlocks, out double duration, out bool sense) { duration = 0; sense = true; @@ -878,7 +890,7 @@ public class Remote : IDisposable cmdPkt.hdr.len = (uint)(Marshal.SizeOf() + cmdPkt.buf_len); byte[] pktBuf = Marshal.StructureToByteArrayLittleEndian(cmdPkt); - byte[] buf = new byte[cmdPkt.hdr.len]; + var buf = new byte[cmdPkt.hdr.len]; Array.Copy(pktBuf, 0, buf, 0, Marshal.SizeOf()); @@ -894,7 +906,7 @@ public class Remote : IDisposable return -1; } - byte[] hdrBuf = new byte[Marshal.SizeOf()]; + var hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -994,7 +1006,7 @@ public class Remote : IDisposable cmdPkt.hdr.len = (uint)(Marshal.SizeOf() + cmdPkt.command.buf_len); byte[] pktBuf = Marshal.StructureToByteArrayLittleEndian(cmdPkt); - byte[] buf = new byte[cmdPkt.hdr.len]; + var buf = new byte[cmdPkt.hdr.len]; Array.Copy(pktBuf, 0, buf, 0, Marshal.SizeOf()); @@ -1010,7 +1022,7 @@ public class Remote : IDisposable return -1; } - byte[] hdrBuf = new byte[Marshal.SizeOf()]; + var hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -1092,7 +1104,7 @@ public class Remote : IDisposable return DeviceType.Unknown; } - byte[] hdrBuf = new byte[Marshal.SizeOf()]; + var hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -1172,7 +1184,7 @@ public class Remote : IDisposable return false; } - byte[] hdrBuf = new byte[Marshal.SizeOf()]; + var hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -1246,7 +1258,8 @@ public class Remote : IDisposable switch(res.scr_len) { - case <= 0: return res.isSdhci; + case <= 0: + return res.isSdhci; case > 16: res.scr_len = 16; @@ -1269,7 +1282,7 @@ public class Remote : IDisposable /// USB serial number string /// true if the device is attached via USB, false otherwise public bool GetUsbData(out byte[] descriptors, out ushort idVendor, out ushort idProduct, out string manufacturer, - out string product, out string serial) + out string product, out string serial) { descriptors = null; idVendor = 0; @@ -1301,7 +1314,7 @@ public class Remote : IDisposable return false; } - byte[] hdrBuf = new byte[Marshal.SizeOf()]; + var hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -1363,7 +1376,7 @@ public class Remote : IDisposable /// FireWire model string /// FireWire GUID /// true if the device is attached via FireWire, false otherwise - public bool GetFireWireData(out uint idVendor, out uint idProduct, out ulong guid, out string vendor, + public bool GetFireWireData(out uint idVendor, out uint idProduct, out ulong guid, out string vendor, out string model) { idVendor = 0; @@ -1395,7 +1408,7 @@ public class Remote : IDisposable return false; } - byte[] hdrBuf = new byte[Marshal.SizeOf()]; + var hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -1478,7 +1491,7 @@ public class Remote : IDisposable return false; } - byte[] hdrBuf = new byte[Marshal.SizeOf()]; + var hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -1535,7 +1548,7 @@ public class Remote : IDisposable /// Retrieved number of bytes static int Receive(Socket socket, byte[] buffer, int size, SocketFlags socketFlags) { - int offset = 0; + var offset = 0; while(size > 0) { @@ -1588,7 +1601,7 @@ public class Remote : IDisposable /// Maximum allowed time to execute a single command /// 0 if no error occurred, otherwise, errno public int SendMultipleMmcCommands(Devices.Device.MmcSingleCommand[] commands, out double duration, out bool sense, - uint timeout = 0) + uint timeout = 0) { if(ServerProtocolVersion < 2) return SendMultipleMmcCommandsV1(commands, out duration, out sense, timeout); @@ -1597,7 +1610,7 @@ public class Remote : IDisposable duration = 0; long packetSize = Marshal.SizeOf() + - (Marshal.SizeOf() * commands.LongLength); + Marshal.SizeOf() * commands.LongLength; packetSize = commands.Aggregate(packetSize, (current, command) => current + (command.buffer?.Length ?? 0)); @@ -1614,7 +1627,7 @@ public class Remote : IDisposable } }; - byte[] buf = new byte[packetSize]; + var buf = new byte[packetSize]; byte[] tmp = Marshal.StructureToByteArrayLittleEndian(packet); Array.Copy(tmp, 0, buf, 0, tmp.Length); @@ -1657,7 +1670,7 @@ public class Remote : IDisposable return -1; } - byte[] hdrBuf = new byte[Marshal.SizeOf()]; + var hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -1708,7 +1721,7 @@ public class Remote : IDisposable off = Marshal.SizeOf(); - int error = 0; + var error = 0; foreach(Devices.Device.MmcSingleCommand command in commands) { @@ -1750,16 +1763,16 @@ public class Remote : IDisposable /// Maximum allowed time to execute a single command /// 0 if no error occurred, otherwise, errno int SendMultipleMmcCommandsV1(Devices.Device.MmcSingleCommand[] commands, out double duration, out bool sense, - uint timeout) + uint timeout) { sense = false; duration = 0; - int error = 0; + var error = 0; foreach(Devices.Device.MmcSingleCommand command in commands) { - error = SendMmcCommand(command.command, command.write, command.isApplication, command.flags, - command.argument, command.blockSize, command.blocks, ref command.buffer, + error = SendMmcCommand(command.command, command.write, command.isApplication, command.flags, + command.argument, command.blockSize, command.blocks, ref command.buffer, out command.response, out double cmdDuration, out bool cmdSense, timeout); if(cmdSense) @@ -1801,7 +1814,7 @@ public class Remote : IDisposable return false; } - byte[] hdrBuf = new byte[Marshal.SizeOf()]; + var hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); @@ -1850,7 +1863,8 @@ public class Remote : IDisposable switch(nop.reasonCode) { - case AaruNopReason.ReOpenOk: return true; + case AaruNopReason.ReOpenOk: + return true; case AaruNopReason.CloseError: case AaruNopReason.OpenError: AaruConsole.ErrorWriteLine(Localization.ReOpen_error_closing_device); @@ -1904,7 +1918,7 @@ public class Remote : IDisposable return false; } - byte[] hdrBuf = new byte[Marshal.SizeOf()]; + var hdrBuf = new byte[Marshal.SizeOf()]; len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek); diff --git a/Aaru.Devices/Windows/Command.cs b/Aaru.Devices/Windows/Command.cs index 65007a0ff..033f1950b 100644 --- a/Aaru.Devices/Windows/Command.cs +++ b/Aaru.Devices/Windows/Command.cs @@ -44,7 +44,7 @@ namespace Aaru.Devices.Windows; partial class Device { /// - public override int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, + public override int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, ScsiDirection direction, out double duration, out bool sense) { // We need a timeout @@ -59,11 +59,11 @@ partial class Device return -1; ScsiIoctlDirection dir = direction switch - { - ScsiDirection.In => ScsiIoctlDirection.In, - ScsiDirection.Out => ScsiIoctlDirection.Out, - _ => ScsiIoctlDirection.Unspecified - }; + { + ScsiDirection.In => ScsiIoctlDirection.In, + ScsiDirection.Out => ScsiIoctlDirection.Out, + _ => ScsiIoctlDirection.Unspecified + }; var sptdSb = new ScsiPassThroughDirectAndSenseBuffer { @@ -85,7 +85,7 @@ partial class Device Array.Copy(cdb, sptdSb.sptd.Cdb, cdb.Length); uint k = 0; - int error = 0; + var error = 0; Marshal.Copy(buffer, 0, sptdSb.sptd.DataBuffer, buffer.Length); @@ -181,7 +181,7 @@ partial class Device aptd.AtaFlags |= AtaFlags.DrdyRequired; uint k = 0; - int error = 0; + var error = 0; Marshal.Copy(buffer, 0, aptd.DataBuffer, buffer.Length); @@ -282,7 +282,7 @@ partial class Device aptd.AtaFlags |= AtaFlags.DrdyRequired; uint k = 0; - int error = 0; + var error = 0; Marshal.Copy(buffer, 0, aptd.DataBuffer, buffer.Length); @@ -392,7 +392,7 @@ partial class Device aptd.AtaFlags |= AtaFlags.DrdyRequired; uint k = 0; - int error = 0; + var error = 0; Marshal.Copy(buffer, 0, aptd.DataBuffer, buffer.Length); @@ -448,9 +448,9 @@ partial class Device } /// - public override int SendMmcCommand(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 = 15) + public override int SendMmcCommand(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 = 15) { var cmdStopwatch = new Stopwatch(); @@ -517,9 +517,10 @@ partial class Device commandDescriptor.cmdClass = isApplication ? SdCommandClass.AppCmd : SdCommandClass.Standard; commandDescriptor.transferDirection = write ? SdTransferDirection.Write : SdTransferDirection.Read; - commandDescriptor.transferType = flags.HasFlag(MmcFlags.CommandAdtc) ? command == MmcCommands.ReadMultipleBlock - ? SdTransferType.MultiBlock - : SdTransferType.SingleBlock + commandDescriptor.transferType = flags.HasFlag(MmcFlags.CommandAdtc) + ? command == MmcCommands.ReadMultipleBlock + ? SdTransferType.MultiBlock + : SdTransferType.SingleBlock : SdTransferType.CmdOnly; commandDescriptor.responseType = 0; @@ -551,7 +552,7 @@ partial class Device if(flags.HasFlag(MmcFlags.ResponseR6)) commandDescriptor.responseType = SdResponseType.R6; - byte[] commandB = + var commandB = new byte[commandData.size + commandData.protocolArgumentSize + commandData.deviceDataBufferSize]; Array.Copy(buffer, 0, commandB, commandData.size + commandData.protocolArgumentSize, buffer.Length); @@ -562,7 +563,7 @@ partial class Device Marshal.Copy(hBuf, commandB, 0, commandB.Length); Marshal.FreeHGlobal(hBuf); - int error = 0; + var error = 0; cmdStopwatch.Restart(); sense = !Extern.DeviceIoControl(_fileHandle, WindowsIoctl.IoctlSffdiskDeviceCommand, commandB, @@ -584,13 +585,13 @@ partial class Device /// public override int SendMultipleMmcCommands(MmcSingleCommand[] commands, out double duration, out bool sense, - uint timeout = 15) + uint timeout = 15) { // We need a timeout if(timeout == 0) timeout = Timeout > 0 ? Timeout : 15; - int error = 0; + var error = 0; duration = 0; sense = false; @@ -598,9 +599,11 @@ partial class Device commands[0].command == MmcCommands.SetBlocklen && commands[1].command == MmcCommands.ReadMultipleBlock && commands[2].command == MmcCommands.StopTransmission) + { return SendMmcCommand(commands[1].command, commands[1].write, commands[1].isApplication, commands[1].flags, commands[1].argument, commands[1].blockSize, commands[1].blocks, ref commands[1].buffer, out commands[1].response, out duration, out sense, timeout); + } foreach(MmcSingleCommand command in commands) { diff --git a/Aaru.Devices/Windows/Device.cs b/Aaru.Devices/Windows/Device.cs index fb5f3d1c7..7d01cabb1 100644 --- a/Aaru.Devices/Windows/Device.cs +++ b/Aaru.Devices/Windows/Device.cs @@ -98,10 +98,10 @@ partial class Device : Devices.Device }; IntPtr descriptorPtr = Marshal.AllocHGlobal(1000); - byte[] descriptorB = new byte[1000]; + var descriptorB = new byte[1000]; uint returned = 0; - int error = 0; + var error = 0; bool hasError = !Extern.DeviceIoControlStorageQuery(dev._fileHandle, WindowsIoctl.IoctlStorageQueryProperty, ref query, (uint)Marshal.SizeOf(query), descriptorPtr, 1000, @@ -196,7 +196,7 @@ partial class Device : Devices.Device if(IsSdhci(dev._fileHandle)) { - byte[] sdBuffer = new byte[16]; + var sdBuffer = new byte[16]; dev.LastError = dev.SendMmcCommand(MmcCommands.SendCsd, false, false, MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 | MmcFlags.CommandAc, 0, 16, @@ -235,9 +235,12 @@ partial class Device : Devices.Device sdBuffer = new byte[4]; dev.LastError = - dev.SendMmcCommand(dev._cachedScr != null ? (MmcCommands)SecureDigitalCommands.SendOperatingCondition : MmcCommands.SendOpCond, - false, true, MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 | MmcFlags.CommandBcr, 0, - 4, 1, ref sdBuffer, out _, out _, out sense); + dev.SendMmcCommand( + dev._cachedScr != null + ? (MmcCommands)SecureDigitalCommands.SendOperatingCondition + : MmcCommands.SendOpCond, + false, true, MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 | MmcFlags.CommandBcr, 0, + 4, 1, ref sdBuffer, out _, out _, out sense); if(!sense) { @@ -246,7 +249,8 @@ partial class Device : Devices.Device } } - #region SecureDigital / MultiMediaCard + #region SecureDigital / MultiMediaCard + if(dev._cachedCid != null) { dev.ScsiType = PeripheralDeviceTypes.DirectAccess; @@ -279,9 +283,11 @@ partial class Device : Devices.Device return dev; } - #endregion SecureDigital / MultiMediaCard - #region USB + #endregion SecureDigital / MultiMediaCard + + #region USB + Usb.UsbDevice usbDevice = null; // I have to search for USB disks, floppies and CD-ROMs as separate device types @@ -308,17 +314,22 @@ partial class Device : Devices.Device dev.UsbSerialString = usbDevice.SerialNumber; // This is incorrect filled by Windows with SCSI/ATA serial number } - #endregion USB - #region FireWire + #endregion USB + + #region FireWire + // TODO: Implement dev.IsFireWire = false; - #endregion FireWire - #region PCMCIA + #endregion FireWire + + #region PCMCIA + // TODO: Implement - #endregion PCMCIA + + #endregion PCMCIA return dev; } diff --git a/Aaru.Devices/Windows/Enums.cs b/Aaru.Devices/Windows/Enums.cs index 00e5f4634..68731a30c 100644 --- a/Aaru.Devices/Windows/Enums.cs +++ b/Aaru.Devices/Windows/Enums.cs @@ -234,7 +234,8 @@ enum ScsiIoctlDirection : byte enum WindowsIoctl : uint { - IoctlAtaPassThrough = 0x4D02C, IoctlAtaPassThroughDirect = 0x4D030, + IoctlAtaPassThrough = 0x4D02C, + IoctlAtaPassThroughDirect = 0x4D030, /// ScsiPassThrough IoctlScsiPassThrough = 0x4D004, @@ -243,9 +244,12 @@ enum WindowsIoctl : uint IoctlScsiPassThroughDirect = 0x4D014, /// ScsiGetAddress - IoctlScsiGetAddress = 0x41018, IoctlStorageQueryProperty = 0x2D1400, IoctlIdePassThrough = 0x4D028, - IoctlStorageGetDeviceNumber = 0x2D1080, IoctlSffdiskQueryDeviceProtocol = 0x71E80, - IoctlSffdiskDeviceCommand = 0x79E84 + IoctlScsiGetAddress = 0x41018, + IoctlStorageQueryProperty = 0x2D1400, + IoctlIdePassThrough = 0x4D028, + IoctlStorageGetDeviceNumber = 0x2D1080, + IoctlSffdiskQueryDeviceProtocol = 0x71E80, + IoctlSffdiskDeviceCommand = 0x79E84 } [Flags] @@ -272,29 +276,55 @@ enum AtaFlags : ushort enum StoragePropertyId { - Device = 0, Adapter = 1, Id = 2, - UniqueId = 3, WriteCache = 4, Miniport = 5, - AccessAlignment = 6, SeekPenalty = 7, Trim = 8, - WriteAggregation = 9, Telemetry = 10, LbProvisioning = 11, - Power = 12, Copyoffload = 13, Resiliency = 14 + Device = 0, + Adapter = 1, + Id = 2, + UniqueId = 3, + WriteCache = 4, + Miniport = 5, + AccessAlignment = 6, + SeekPenalty = 7, + Trim = 8, + WriteAggregation = 9, + Telemetry = 10, + LbProvisioning = 11, + Power = 12, + Copyoffload = 13, + Resiliency = 14 } enum StorageQueryType { - Standard = 0, Exists = 1, Mask = 2, + Standard = 0, + Exists = 1, + Mask = 2, Max = 3 } [SuppressMessage("ReSharper", "InconsistentNaming")] enum StorageBusType { - Unknown = 0, SCSI = 1, ATAPI = 2, - ATA = 3, FireWire = 4, SSA = 5, - Fibre = 6, USB = 7, RAID = 8, - iSCSI = 9, SAS = 0xA, SATA = 0xB, - SecureDigital = 0xC, MultiMediaCard = 0xD, Virtual = 0xE, - FileBackedVirtual = 0xF, Spaces = 16, SCM = 18, - UFS = 19, Max = 20, MaxReserved = 127, + Unknown = 0, + SCSI = 1, + ATAPI = 2, + ATA = 3, + FireWire = 4, + SSA = 5, + Fibre = 6, + USB = 7, + RAID = 8, + iSCSI = 9, + SAS = 0xA, + SATA = 0xB, + SecureDigital = 0xC, + MultiMediaCard = 0xD, + Virtual = 0xE, + FileBackedVirtual = 0xF, + Spaces = 16, + SCM = 18, + UFS = 19, + Max = 20, + MaxReserved = 127, NVMe = 0x11 } @@ -319,32 +349,46 @@ enum DeviceGetClassFlags : uint enum SdCommandClass : uint { - Standard, AppCmd + Standard, + AppCmd } enum SdTransferDirection : uint { - Unspecified, Read, Write + Unspecified, + Read, + Write } enum SdTransferType : uint { - Unspecified, CmdOnly, SingleBlock, - MultiBlock, MultiBlockNoCmd12 + Unspecified, + CmdOnly, + SingleBlock, + MultiBlock, + MultiBlockNoCmd12 } [SuppressMessage("ReSharper", "InconsistentNaming")] enum SdResponseType : uint { - Unspecified, None, R1, - R1b, R2, R3, - R4, R5, R5b, + Unspecified, + None, + R1, + R1b, + R2, + R3, + R4, + R5, + R5b, R6 } enum SffdiskDcmd : uint { - GetVersion, LockChannel, UnlockChannel, + GetVersion, + LockChannel, + UnlockChannel, DeviceCommand } @@ -359,5 +403,7 @@ static class Consts enum MoveMethod : uint { - Begin = 0, Current = 1, End = 2 + Begin = 0, + Current = 1, + End = 2 } \ No newline at end of file diff --git a/Aaru.Devices/Windows/Extern.cs b/Aaru.Devices/Windows/Extern.cs index 72988b40d..3f58c8dda 100644 --- a/Aaru.Devices/Windows/Extern.cs +++ b/Aaru.Devices/Windows/Extern.cs @@ -41,8 +41,8 @@ static class Extern { [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] internal static extern SafeFileHandle CreateFile([MarshalAs(UnmanagedType.LPTStr)] string filename, - [MarshalAs(UnmanagedType.U4)] FileAccess access, - [MarshalAs(UnmanagedType.U4)] FileShare share, + [MarshalAs(UnmanagedType.U4)] FileAccess access, + [MarshalAs(UnmanagedType.U4)] FileShare share, nint securityAttributes, // optional SECURITY_ATTRIBUTES struct or IntPtr.Zero [MarshalAs(UnmanagedType.U4)] FileMode creationDisposition, [MarshalAs(UnmanagedType.U4)] FileAttributes flagsAndAttributes, @@ -56,10 +56,10 @@ static class Extern uint nOutBufferSize, ref uint pBytesReturned, nint overlapped); [DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)] - internal static extern bool DeviceIoControlAta(SafeFileHandle hDevice, WindowsIoctl ioControlCode, - ref AtaPassThroughDirect inBuffer, uint nInBufferSize, - ref AtaPassThroughDirect outBuffer, uint nOutBufferSize, - ref uint pBytesReturned, nint overlapped); + internal static extern bool DeviceIoControlAta(SafeFileHandle hDevice, WindowsIoctl ioControlCode, + ref AtaPassThroughDirect inBuffer, uint nInBufferSize, + ref AtaPassThroughDirect outBuffer, uint nOutBufferSize, + ref uint pBytesReturned, nint overlapped); [DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)] internal static extern bool DeviceIoControlStorageQuery(SafeFileHandle hDevice, WindowsIoctl ioControlCode, @@ -68,10 +68,10 @@ static class Extern ref uint pBytesReturned, nint overlapped); [DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)] - internal static extern bool DeviceIoControlIde(SafeFileHandle hDevice, WindowsIoctl ioControlCode, - ref IdePassThroughDirect inBuffer, uint nInBufferSize, - ref IdePassThroughDirect outBuffer, uint nOutBufferSize, - ref uint pBytesReturned, nint overlapped); + internal static extern bool DeviceIoControlIde(SafeFileHandle hDevice, WindowsIoctl ioControlCode, + ref IdePassThroughDirect inBuffer, uint nInBufferSize, + ref IdePassThroughDirect outBuffer, uint nOutBufferSize, + ref uint pBytesReturned, nint overlapped); [DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)] internal static extern bool DeviceIoControlGetDeviceNumber(SafeFileHandle hDevice, WindowsIoctl ioControlCode, @@ -86,16 +86,16 @@ static class Extern [DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)] internal static extern bool DeviceIoControl(SafeFileHandle hDevice, WindowsIoctl ioControlCode, byte[] inBuffer, - uint nInBufferSize, byte[] outBuffer, uint nOutBufferSize, - out uint pBytesReturned, nint overlapped); + uint nInBufferSize, byte[] outBuffer, uint nOutBufferSize, + out uint pBytesReturned, nint overlapped); [DllImport("setupapi.dll", CharSet = CharSet.Auto)] internal static extern SafeFileHandle SetupDiGetClassDevs(ref Guid classGuid, nint enumerator, nint hwndParent, DeviceGetClassFlags flags); [DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)] - public static extern bool SetupDiEnumDeviceInterfaces(SafeFileHandle hDevInfo, nint devInfo, - ref Guid interfaceClassGuid, uint memberIndex, + public static extern bool SetupDiEnumDeviceInterfaces(SafeFileHandle hDevInfo, nint devInfo, + ref Guid interfaceClassGuid, uint memberIndex, ref DeviceInterfaceData deviceInterfaceData); [DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)] @@ -113,9 +113,9 @@ static class Extern [DllImport("Kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] public static extern bool SetFilePointerEx(SafeFileHandle hFile, long liDistanceToMove, out long lpNewFilePointer, - MoveMethod dwMoveMethod); + MoveMethod dwMoveMethod); [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] - public static extern bool ReadFile(SafeFileHandle hFile, byte[] lpBuffer, uint nNumberOfBytesToRead, - out uint lpNumberOfBytesRead, nint lpOverlapped); + public static extern bool ReadFile(SafeFileHandle hFile, byte[] lpBuffer, uint nNumberOfBytesToRead, + out uint lpNumberOfBytesRead, nint lpOverlapped); } \ No newline at end of file diff --git a/Aaru.Devices/Windows/ListDevices.cs b/Aaru.Devices/Windows/ListDevices.cs index 42271fe2e..9516d2d7d 100644 --- a/Aaru.Devices/Windows/ListDevices.cs +++ b/Aaru.Devices/Windows/ListDevices.cs @@ -54,8 +54,8 @@ static class ListDevices var 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(var 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(); } @@ -65,7 +65,7 @@ static class ListDevices [SuppressMessage("ReSharper", "RedundantCatchClause")] internal static DeviceInfo[] GetList() { - List deviceIDs = new List(); + var deviceIDs = new List(); try { @@ -94,7 +94,7 @@ static class ListDevices #endif } - List devList = new List(); + var devList = new List(); foreach(string devId in deviceIDs) { @@ -125,10 +125,10 @@ static class ListDevices //descriptor.RawDeviceProperties = new byte[16384]; IntPtr descriptorPtr = Marshal.AllocHGlobal(1000); - byte[] descriptorB = new byte[1000]; + var descriptorB = new byte[1000]; uint returned = 0; - int error = 0; + var error = 0; bool hasError = !Extern.DeviceIoControlStorageQuery(fd, WindowsIoctl.IoctlStorageQueryProperty, ref query, (uint)Marshal.SizeOf(query), descriptorPtr, 1000, diff --git a/Aaru.Devices/Windows/Structs.cs b/Aaru.Devices/Windows/Structs.cs index 0f5d91067..97d1a5182 100644 --- a/Aaru.Devices/Windows/Structs.cs +++ b/Aaru.Devices/Windows/Structs.cs @@ -37,7 +37,8 @@ using System.Runtime.InteropServices; namespace Aaru.Devices.Windows; -[StructLayout(LayoutKind.Sequential), SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct ScsiPassThroughDirect { public ushort Length; @@ -67,7 +68,8 @@ struct ScsiPassThroughDirectAndSenseBuffer public byte[] SenseBuf; } -[StructLayout(LayoutKind.Sequential), SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct AtaPassThroughDirect { /// Length in bytes of this structure @@ -108,7 +110,8 @@ struct AtaPassThroughDirect public AtaTaskFile CurrentTaskFile; } -[StructLayout(LayoutKind.Explicit), SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] +[StructLayout(LayoutKind.Explicit)] +[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct AtaTaskFile { // Fields for commands sent @@ -150,7 +153,8 @@ struct StoragePropertyQuery public byte[] AdditionalParameters; } -[StructLayout(LayoutKind.Sequential), SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct StorageDescriptorHeader { public uint Version; @@ -191,7 +195,8 @@ struct IdePassThroughDirect public byte[] DataBuffer; } -[StructLayout(LayoutKind.Sequential), SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct StorageDeviceNumber { public int deviceType; @@ -199,7 +204,8 @@ struct StorageDeviceNumber public int partitionNumber; } -[StructLayout(LayoutKind.Sequential), SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct DeviceInfoData { public int cbSize; @@ -208,7 +214,8 @@ struct DeviceInfoData public nint reserved; } -[StructLayout(LayoutKind.Sequential), SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct DeviceInterfaceData { public int cbSize; @@ -217,7 +224,8 @@ struct DeviceInterfaceData readonly nint reserved; } -[StructLayout(LayoutKind.Sequential), SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct UsbSetupPacket { public byte bmRequest; @@ -227,7 +235,8 @@ struct UsbSetupPacket public short wLength; } -[StructLayout(LayoutKind.Sequential), SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct UsbDescriptorRequest { public int ConnectionIndex; @@ -237,7 +246,8 @@ struct UsbDescriptorRequest //public byte[] Data; } -[StructLayout(LayoutKind.Sequential), SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct SffdiskQueryDeviceProtocolData { public ushort size; @@ -245,7 +255,8 @@ struct SffdiskQueryDeviceProtocolData public Guid protocolGuid; } -[StructLayout(LayoutKind.Sequential), SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] +[StructLayout(LayoutKind.Sequential)] +[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct SffdiskDeviceCommandData { public ushort size; diff --git a/Aaru.Devices/Windows/Usb.cs b/Aaru.Devices/Windows/Usb.cs index 2fd076c73..6bc8c1682 100644 --- a/Aaru.Devices/Windows/Usb.cs +++ b/Aaru.Devices/Windows/Usb.cs @@ -42,15 +42,16 @@ namespace Aaru.Devices.Windows; // TODO: Even after cleaning, refactoring and xml-documenting, this code needs some love /// Implements functions for getting and accessing information from the USB bus -[SuppressMessage("ReSharper", "UnusedMember.Local"), SuppressMessage("ReSharper", "UnusedType.Local")] +[SuppressMessage("ReSharper", "UnusedMember.Local")] +[SuppressMessage("ReSharper", "UnusedType.Local")] static partial class Usb { /// Return a list of USB Host Controllers /// List of USB Host Controllers static IEnumerable GetHostControllers() { - List hostList = new List(); - var hostGuid = new Guid(GUID_DEVINTERFACE_HUBCONTROLLER); + var hostList = new List(); + var 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 @@ -61,7 +62,7 @@ static partial class Usb IntPtr ptrBuf = Marshal.AllocHGlobal(BUFFER_SIZE); bool success; - int i = 0; + var i = 0; do { @@ -92,14 +93,14 @@ static partial class Usb // trust me :) // now we can get some more detailed information - int nRequiredSize = 0; + var nRequiredSize = 0; if(SetupDiGetDeviceInterfaceDetail(h, ref dia, ref didd, BUFFER_SIZE, ref nRequiredSize, ref da)) { host._controllerDevicePath = didd.DevicePath; // get the Device Description and DriverKeyName - int requiredSize = 0; + var requiredSize = 0; int regType = REG_SZ; if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DEVICEDESC, ref regType, ptrBuf, BUFFER_SIZE, @@ -129,7 +130,7 @@ static partial class Usb /// USB device description static string GetDescriptionByKeyName(string driverKeyName) { - string ans = ""; + var ans = ""; // Use the "enumerator form" of the SetupDiGetClassDevs API // to generate a list of all USB devices @@ -141,7 +142,7 @@ static partial class Usb IntPtr ptrBuf = Marshal.AllocHGlobal(BUFFER_SIZE); bool success; - int i = 0; + var i = 0; do { @@ -154,9 +155,9 @@ static partial class Usb if(success) { - int requiredSize = 0; - int regType = REG_SZ; - string keyName = ""; + var requiredSize = 0; + int regType = REG_SZ; + var keyName = ""; if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DRIVER, ref regType, ptrBuf, BUFFER_SIZE, ref requiredSize)) @@ -187,7 +188,7 @@ static partial class Usb /// Device instance ID static string GetInstanceIdByKeyName(string driverKeyName) { - string ans = ""; + var ans = ""; // Use the "enumerator form" of the SetupDiGetClassDevs API // to generate a list of all USB devices @@ -199,7 +200,7 @@ static partial class Usb IntPtr ptrBuf = Marshal.AllocHGlobal(BUFFER_SIZE); bool success; - int i = 0; + var i = 0; do { @@ -212,10 +213,10 @@ static partial class Usb if(success) { - int requiredSize = 0; + var requiredSize = 0; int regType = REG_SZ; - string keyName = ""; + var keyName = ""; if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DRIVER, ref regType, ptrBuf, BUFFER_SIZE, ref requiredSize)) @@ -241,6 +242,8 @@ static partial class Usb return ans; } +#region Nested type: UsbController + /// Represents a USB Host Controller sealed class UsbController { @@ -339,6 +342,61 @@ static partial class Usb } } +#endregion + +#region Nested type: UsbDevice + + /// 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; + } + +#endregion + +#region Nested type: UsbHub + /// The Hub class internal class UsbHub { @@ -396,7 +454,7 @@ static partial class Usb /// List of downstream ports internal IEnumerable GetPorts() { - List portList = new List(); + var portList = new List(); // Open a handle to the Hub device IntPtr h = CreateFile(_hubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, @@ -410,7 +468,7 @@ static partial class Usb // loop thru all of the ports on the hub // BTW: Ports are numbered starting at 1 - for(int i = 1; i <= _hubPortCount; i++) + for(var i = 1; i <= _hubPortCount; i++) { var nodeConnection = new UsbNodeConnectionInformationEx { @@ -453,6 +511,10 @@ static partial class Usb } } +#endregion + +#region Nested type: UsbPort + /// Represents an USB port internal class UsbPort { @@ -517,7 +579,7 @@ static partial class Usb int nBytes = BUFFER_SIZE; // We use this to zero fill a buffer - string nullString = new string((char)0, BUFFER_SIZE / Marshal.SystemDefaultCharSize); + var 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 @@ -676,8 +738,8 @@ static partial class Usb 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)) + 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)) ?? @@ -782,54 +844,10 @@ static partial class Usb } } - /// 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; +#endregion - /// a simple default constructor - internal UsbDevice() - { - _devicePortNumber = 0; - _deviceHubDevicePath = ""; - _deviceDriverKey = ""; - _deviceManufacturer = ""; - _deviceProduct = "Unknown USB Device"; - _deviceSerialNumber = ""; - _deviceName = ""; - _deviceInstanceId = ""; - _binaryDeviceDescriptors = null; - } +#region "API Region" - /// 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 ************************ const int GENERIC_WRITE = 0x40000000; @@ -866,19 +884,28 @@ static partial class Usb enum UsbHubNode { - UsbHub, UsbMiParent + UsbHub, + UsbMiParent } enum UsbConnectionStatus { - NoDeviceConnected, DeviceConnected, DeviceFailedEnumeration, - DeviceGeneralFailure, DeviceCausedOvercurrent, DeviceNotEnoughPower, - DeviceNotEnoughBandwidth, DeviceHubNestedTooDeeply, DeviceInLegacyHub + NoDeviceConnected, + DeviceConnected, + DeviceFailedEnumeration, + DeviceGeneralFailure, + DeviceCausedOvercurrent, + DeviceNotEnoughPower, + DeviceNotEnoughBandwidth, + DeviceHubNestedTooDeeply, + DeviceInLegacyHub } enum UsbDeviceSpeed : byte { - UsbLowSpeed, UsbFullSpeed, UsbHighSpeed + UsbLowSpeed, + UsbFullSpeed, + UsbHighSpeed } // ********************** Stuctures ************************ @@ -968,7 +995,8 @@ static partial class Usb //internal IntPtr PipeList; } - [StructLayout(LayoutKind.Sequential, Pack = 1), SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + [StructLayout(LayoutKind.Sequential, Pack = 1)] + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] internal struct UsbDeviceDescriptor { internal byte bLength; @@ -1044,8 +1072,8 @@ static partial class Usb static extern IntPtr SetupDiGetClassDevs(int classGuid, string enumerator, IntPtr hwndParent, int flags); [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern bool SetupDiEnumDeviceInterfaces(IntPtr deviceInfoSet, IntPtr deviceInfoData, - ref Guid interfaceClassGuid, int memberIndex, + static extern bool SetupDiEnumDeviceInterfaces(IntPtr deviceInfoSet, IntPtr deviceInfoData, + ref Guid interfaceClassGuid, int memberIndex, ref SpDeviceInterfaceData deviceInterfaceData); [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)] @@ -1056,9 +1084,9 @@ static partial class Usb ref SpDevinfoData deviceInfoData); [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern bool SetupDiGetDeviceRegistryProperty(IntPtr deviceInfoSet, ref SpDevinfoData deviceInfoData, - int iProperty, ref int propertyRegDataType, - IntPtr propertyBuffer, int propertyBufferSize, + static extern bool SetupDiGetDeviceRegistryProperty(IntPtr deviceInfoSet, ref SpDevinfoData deviceInfoData, + int iProperty, ref int propertyRegDataType, + IntPtr propertyBuffer, int propertyBufferSize, ref int requiredSize); [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)] @@ -1068,21 +1096,22 @@ static partial class Usb static extern bool SetupDiDestroyDeviceInfoList(IntPtr deviceInfoSet); [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern bool SetupDiGetDeviceInstanceId(IntPtr deviceInfoSet, ref SpDevinfoData deviceInfoData, + static extern bool SetupDiGetDeviceInstanceId(IntPtr deviceInfoSet, ref SpDevinfoData deviceInfoData, StringBuilder deviceInstanceId, int deviceInstanceIdSize, - out int requiredSize); + out int requiredSize); [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern bool DeviceIoControl(IntPtr hDevice, int dwIoControlCode, IntPtr lpInBuffer, int nInBufferSize, - IntPtr lpOutBuffer, int nOutBufferSize, out int lpBytesReturned, + static extern bool DeviceIoControl(IntPtr hDevice, int dwIoControlCode, IntPtr lpInBuffer, int nInBufferSize, + IntPtr lpOutBuffer, int nOutBufferSize, out int lpBytesReturned, IntPtr lpOverlapped); [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern IntPtr CreateFile(string lpFileName, int dwDesiredAccess, int dwShareMode, + static extern IntPtr CreateFile(string lpFileName, int dwDesiredAccess, int dwShareMode, IntPtr lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, IntPtr hTemplateFile); [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] static extern bool CloseHandle(IntPtr hObject); - #endregion + +#endregion } \ No newline at end of file diff --git a/Aaru.Devices/Windows/UsbFunctions.cs b/Aaru.Devices/Windows/UsbFunctions.cs index 9adbf66af..293cf3149 100644 --- a/Aaru.Devices/Windows/UsbFunctions.cs +++ b/Aaru.Devices/Windows/UsbFunctions.cs @@ -55,7 +55,7 @@ static partial class Usb /// List of usb devices internal static List GetConnectedDevices() { - List devList = new List(); + var devList = new List(); foreach(UsbController controller in GetHostControllers()) ListHub(controller.GetRootHub(), devList); @@ -69,6 +69,7 @@ static partial class Usb static void ListHub(UsbHub hub, ICollection devList) { foreach(UsbPort port in hub.GetPorts()) + { if(port.IsHub) ListHub(port.GetHub(), devList); else @@ -76,6 +77,7 @@ static partial class Usb if(port.IsDeviceConnected) devList.Add(port.GetDevice()); } + } } /// Find a device based upon it's DriverKeyName @@ -103,6 +105,7 @@ static partial class Usb static void SearchHubDriverKeyName(UsbHub hub, ref UsbDevice foundDevice, string driverKeyName) { foreach(UsbPort port in hub.GetPorts()) + { if(port.IsHub) SearchHubDriverKeyName(port.GetHub(), ref foundDevice, driverKeyName); else @@ -119,6 +122,7 @@ static partial class Usb break; } + } } /// Find a device based upon it's Instance ID @@ -146,6 +150,7 @@ static partial class Usb static void SearchHubInstanceId(UsbHub hub, ref UsbDevice foundDevice, string instanceId) { foreach(UsbPort port in hub.GetPorts()) + { if(port.IsHub) SearchHubInstanceId(port.GetHub(), ref foundDevice, instanceId); else @@ -162,6 +167,7 @@ static partial class Usb break; } + } } [DllImport("setupapi.dll")] @@ -205,7 +211,7 @@ static partial class Usb static UsbDevice FindDeviceNumber(int devNum, string deviceGuid) { UsbDevice foundDevice = null; - string instanceId = ""; + var instanceId = ""; var diskGuid = new Guid(deviceGuid); @@ -216,7 +222,7 @@ static partial class Usb if(h != _invalidHandleValue) { bool success; - int i = 0; + var i = 0; do { @@ -240,9 +246,10 @@ static partial class Usb }; // trust me :) // now we can get some more detailed information - int nRequiredSize = 0; + var nRequiredSize = 0; if(SetupDiGetDeviceInterfaceDetail(h, ref dia, ref didd, BUFFER_SIZE, ref nRequiredSize, ref da)) + { if(GetDeviceNumber(didd.DevicePath) == devNum) { // current InstanceID is at the "USBSTOR" level, so we @@ -259,6 +266,7 @@ static partial class Usb //System.Console.WriteLine("InstanceId: {0}", instanceId); //break; } + } } i++; @@ -306,6 +314,8 @@ static partial class Usb return ans; } +#region Nested type: StorageDeviceNumber + [StructLayout(LayoutKind.Sequential)] readonly struct StorageDeviceNumber { @@ -313,4 +323,6 @@ static partial class Usb internal readonly int DeviceNumber; internal readonly int PartitionNumber; } + +#endregion } \ No newline at end of file