[Aaru.Devices] Reformat and cleanup.

This commit is contained in:
2023-10-03 23:12:01 +01:00
parent f6c3799a9e
commit 546573dd30
55 changed files with 3060 additions and 2138 deletions

View File

@@ -42,7 +42,7 @@
<NrtShowRevision>true</NrtShowRevision>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Management" Version="8.0.0-rc.1.23419.4" />
<PackageReference Include="System.Management" Version="8.0.0-rc.1.23419.4"/>
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.3" PrivateAssets="all"/>
</ItemGroup>
<ItemGroup>

View File

@@ -1,6 +1,9 @@
<wpf:ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xml:space="preserve">
<wpf:ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xml:space="preserve">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=device/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=device_005Catacommands/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=device_005Cmmccommands/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=device_005Cscsicommands/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=localization/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=device_005Catacommands/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=device_005Cmmccommands/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=device_005Cscsicommands/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=localization/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -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
/// <param name="timeout">Timeout to wait for command execution</param>
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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);
/// <summary>Reads sectors using 48-bit addressing and DMA transfer</summary>
@@ -112,7 +112,7 @@ public partial class Device
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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
/// <param name="timeout">Timeout to wait for command execution</param>
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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
/// <param name="timeout">Timeout to wait for command execution</param>
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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
/// <param name="timeout">Timeout to wait for command execution</param>
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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
/// <param name="timeout">Timeout to wait for command execution</param>
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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);
/// <summary>Reads a long sector using 28-bit addressing and PIO transfer, retrying on error</summary>
@@ -283,8 +283,8 @@ public partial class Device
/// <param name="timeout">Timeout to wait for command execution</param>
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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;

View File

@@ -44,7 +44,7 @@ public partial class Device
/// <param name="timeout">Timeout to wait for command execution</param>
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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
/// <param name="timeout">Timeout to wait for command execution</param>
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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
/// <param name="timeout">Timeout to wait for command execution</param>
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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
/// <param name="timeout">Timeout to wait for command execution</param>
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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
/// <param name="timeout">Timeout to wait for command execution</param>
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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
/// <param name="timeout">Timeout to wait for command execution</param>
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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
/// <param name="timeout">Timeout to wait for command execution</param>
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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;

View File

@@ -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
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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);
/// <summary>Reads sectors using CHS addressing and DMA transfer</summary>
@@ -114,7 +114,7 @@ public partial class Device
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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);
/// <summary>Reads sectors using CHS addressing and PIO transfer</summary>
@@ -202,7 +202,7 @@ public partial class Device
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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);
/// <summary>Reads a long sector using CHS addressing and PIO transfer, retrying on error</summary>
@@ -252,7 +252,7 @@ public partial class Device
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
public bool Seek(out AtaErrorRegistersChs statusRegisters, ushort cylinder, byte head, byte sector, uint timeout,
out double duration)
out double duration)
{
byte[] buffer = Array.Empty<byte>();
@@ -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
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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);
/// <summary>Enables drive features</summary>
@@ -329,7 +329,7 @@ public partial class Device
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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<byte>();
@@ -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;

View File

@@ -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;

View File

@@ -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
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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
/// <param name="timeout">Timeout to wait for command execution</param>
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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<byte>();
@@ -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;

View File

@@ -44,7 +44,7 @@ public partial class Device
/// <param name="duration">Time it took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
public bool EnableMediaCardPassThrough(out AtaErrorRegistersChs statusRegisters, uint timeout,
out double duration) =>
out double duration) =>
CheckMediaCardType(1, out statusRegisters, timeout, out duration);
/// <summary>Disables media card pass through</summary>
@@ -53,7 +53,7 @@ public partial class Device
/// <param name="duration">Time it took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
public bool DisableMediaCardPassThrough(out AtaErrorRegistersChs statusRegisters, uint timeout,
out double duration) =>
out double duration) =>
CheckMediaCardType(0, out statusRegisters, timeout, out duration);
/// <summary>Checks media card pass through</summary>
@@ -62,7 +62,7 @@ public partial class Device
/// <param name="timeout">Timeout in seconds</param>
/// <param name="duration">Time it took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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<byte>();
@@ -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;

View File

@@ -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
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
public bool SmartEnableAttributeAutosave(out AtaErrorRegistersLba28 statusRegisters, uint timeout,
out double duration)
out double duration)
{
byte[] buffer = Array.Empty<byte>();
@@ -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
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
public bool SmartDisableAttributeAutosave(out AtaErrorRegistersLba28 statusRegisters, uint timeout,
out double duration)
out double duration)
{
byte[] buffer = Array.Empty<byte>();
@@ -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
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
public bool SmartExecuteOffLineImmediate(out AtaErrorRegistersLba28 statusRegisters, byte subcommand, uint timeout,
out double duration)
out double duration)
{
byte[] buffer = Array.Empty<byte>();
@@ -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
/// <param name="timeout">Timeout to wait for command execution</param>
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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;

View File

@@ -50,7 +50,7 @@ public partial class Device
/// <c>True</c> if SCSI command returned non-OK status and <paramref name="senseBuffer" /> contains
/// SCSI sense
/// </param>
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
/// <param name="duration">Time it took to execute the command in milliseconds</param>
/// <param name="sense"><c>True</c> if ATA/ATAPI command returned non-OK status</param>
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
/// <param name="argument">Command argument</param>
/// <param name="response">Response registers</param>
/// <param name="blockSize">Size of block in bytes</param>
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;
}
/// <summary>Encapsulates a single MMC command to send in a queue</summary>
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal")]
public class MmcSingleCommand
{
/// <summary>Command argument</summary>
public uint argument;
/// <summary>How many blocks to transfer</summary>
public uint blocks;
/// <summary>Size of block in bytes</summary>
public uint blockSize;
/// <summary>Buffer for MMC/SD command response</summary>
public byte[] buffer;
/// <summary>MMC/SD opcode</summary>
public MmcCommands command;
/// <summary>Flags indicating kind and place of response</summary>
public MmcFlags flags;
/// <summary><c>True</c> if command should be preceded with CMD55</summary>
public bool isApplication;
/// <summary>Response registers</summary>
public uint[] response;
/// <summary><c>True</c> if data is sent from host to card</summary>
public bool write;
}
/// <summary>
/// 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
/// <param name="timeout">Maximum allowed time to execute a single command</param>
/// <returns>0 if no error occurred, otherwise, errno</returns>
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
/// <summary>Encapsulates a single MMC command to send in a queue</summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
public class MmcSingleCommand
{
/// <summary>Command argument</summary>
public uint argument;
/// <summary>How many blocks to transfer</summary>
public uint blocks;
/// <summary>Size of block in bytes</summary>
public uint blockSize;
/// <summary>Buffer for MMC/SD command response</summary>
public byte[] buffer;
/// <summary>MMC/SD opcode</summary>
public MmcCommands command;
/// <summary>Flags indicating kind and place of response</summary>
public MmcFlags flags;
/// <summary><c>True</c> if command should be preceded with CMD55</summary>
public bool isApplication;
/// <summary>Response registers</summary>
public uint[] response;
/// <summary><c>True</c> if data is sent from host to card</summary>
public bool write;
}
#endregion
}

View File

@@ -44,10 +44,13 @@ using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry;
namespace Aaru.Devices;
/// <summary>Implements a device or media containing drive</summary>
[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() {}
/// <summary>Opens the device for sending direct commands</summary>
/// <param name="devicePath">Device path</param>
/// <param name="errno">Sets the error if a device cannot be opened</param>
@@ -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() {}
}

View File

@@ -89,7 +89,7 @@ public partial class Device
/// <param name="aaruRemote">Remote URI</param>
/// <returns>List of devices</returns>
/// <exception cref="InvalidOperationException"></exception>
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)
{

View File

@@ -37,6 +37,8 @@ namespace Aaru.Devices;
public partial class Device
{
protected static bool ReadMultipleBlockCannotSetBlockCount;
/// <summary>Reads the CSD register from a SecureDigital or MultiMediaCard device</summary>
/// <param name="buffer">Data buffer</param>
/// <param name="response">Response</param>
@@ -152,10 +154,10 @@ public partial class Device
/// <param name="timeout">Timeout to wait for command execution</param>
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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
/// <param name="timeout">Timeout to wait for command execution</param>
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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;
/// <summary>Reads multiple blocks from a SecureDigital or MultiMediaCard device</summary>
/// <param name="buffer">Data buffer</param>
/// <param name="response">Response</param>
@@ -218,8 +222,8 @@ public partial class Device
/// <param name="timeout">Timeout to wait for command execution</param>
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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
/// <param name="timeout">Timeout to wait for command execution</param>
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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

View File

@@ -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
/// <param name="drive1">If set to <c>true</c> set the threshold from drive 1.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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
/// <param name="duration">Duration.</param>
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;

View File

@@ -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>();
byte[] cdb = new byte[6];
var cdb = new byte[6];
senseBuffer = new byte[64];
cdb[0] = (byte)ScsiCommands.ArchiveSeekBlock;

View File

@@ -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>();
byte[] cdb = new byte[6];
var cdb = new byte[6];
senseBuffer = new byte[64];
cdb[0] = (byte)ScsiCommands.CertanceParkUnpark;

View File

@@ -48,16 +48,16 @@ public partial class Device
/// <param name="timeout">Timeout to wait for command execution</param>
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
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;

View File

@@ -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;

View File

@@ -47,7 +47,7 @@ public partial class Device
/// <param name="timeout">Timeout in seconds.</param>
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
public bool 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);
/// <summary>Sends the HP READ LONG vendor command</summary>
@@ -66,10 +66,10 @@ public partial class Device
/// <param name="timeout">Timeout in seconds.</param>
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
public bool 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;

View File

@@ -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<byte>();
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<byte>();
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
/// <param name="buffer">The SS sector.</param>
/// <param name="requestNumber">Request number.</param>
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;

View File

@@ -68,11 +68,11 @@ public partial class Device
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
/// <param name="startingFeatureNumber">Starting Feature number.</param>
/// <param name="rt">Return type, <see cref="MmcGetConfigurationRt" />.</param>
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
/// <param name="format">Which disc structure are we requesting</param>
/// <param name="agid">AGID used in medium copy protection</param>
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
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
/// <param name="trackSessionNumber">Track/Session number</param>
/// <param name="timeout">Timeout in seconds.</param>
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
public bool 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
/// <param name="dataType">Which disc information to read</param>
/// <param name="timeout">Timeout in seconds.</param>
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
public bool 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<byte>();
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<byte>();
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
/// <param name="timeout">Timeout in seconds.</param>
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
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<byte>();
cdb[0] = (byte)ScsiCommands.SetCdRomSpeed;
@@ -778,11 +780,11 @@ public partial class Device
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
/// <param name="open">Report information of non-closed tracks</param>
/// <param name="type">Type of information to retrieve</param>
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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -59,11 +59,11 @@ public partial class Device
/// <param name="requested">Number of contiguous blocks to find</param>
/// <param name="foundLba">First LBA found</param>
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<byte>();
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;
}
}
}

View File

@@ -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
/// <param name="wholeSector">If set to <c>true</c>, returns all 2352 bytes of sector data.</param>
/// <param name="lba">Start block address.</param>
/// <param name="transferLength">How many blocks to read.</param>
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);

View File

@@ -46,8 +46,8 @@ public partial class Device
/// <param name="pba">If set to <c>true</c> address contain physical block address.</param>
/// <param name="timeout">Timeout in seconds.</param>
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
public bool 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);
/// <summary>Sends the Plasmon READ LONG vendor command</summary>
@@ -66,8 +66,8 @@ public partial class Device
/// <param name="timeout">Timeout in seconds.</param>
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
public bool 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
/// <param name="pba">If set to <c>true</c> address contain a physical block address.</param>
/// <param name="timeout">Timeout in seconds.</param>
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
public bool 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);

View File

@@ -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
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
/// <param name="lba">Start block address.</param>
/// <param name="transferLength">How many blocks to read.</param>
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
/// <param name="blockSize">How many bytes are in the EEPROM block</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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;

View File

@@ -58,11 +58,11 @@ public partial class Device
/// <param name="lba">Starting block.</param>
/// <param name="blockSize">Block size in bytes.</param>
/// <param name="transferLength">How many blocks to read.</param>
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.
/// </param>
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.
/// </param>
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<byte>();
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<byte>();
cdb[0] = (byte)ScsiCommands.Seek10;

View File

@@ -49,11 +49,11 @@ public partial class Device
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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);

View File

@@ -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<byte>();
@@ -232,8 +217,8 @@ public partial class Device
/// <param name="dbd">If set to <c>true</c> device MUST not return any block descriptor.</param>
/// <param name="pageControl">Page control.</param>
/// <param name="pageCode">Page code.</param>
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);
/// <summary>Sends the SPC MODE SENSE(6) command to the device as introduced in SCSI-3 SPC-3</summary>
@@ -246,11 +231,11 @@ public partial class Device
/// <param name="pageControl">Page control.</param>
/// <param name="pageCode">Page code.</param>
/// <param name="subPageCode">Sub-page code.</param>
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
/// <param name="dbd">If set to <c>true</c> device MUST not return any block descriptor.</param>
/// <param name="pageControl">Page control.</param>
/// <param name="pageCode">Page code.</param>
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);
/// <summary>Sends the SPC MODE SENSE(10) command to the device as introduced in SCSI-3 SPC-2</summary>
@@ -310,7 +295,7 @@ public partial class Device
/// <param name="pageControl">Page control.</param>
/// <param name="pageCode">Page code.</param>
/// <param name="llbaa">If set means 64-bit LBAs are accepted by the caller.</param>
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
/// <param name="pageCode">Page code.</param>
/// <param name="subPageCode">Sub-page code.</param>
/// <param name="llbaa">If set means 64-bit LBAs are accepted by the caller.</param>
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
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
/// <param name="prevent"><c>true</c> to prevent medium removal, <c>false</c> to allow it.</param>
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);
/// <summary>Sends the SPC PREVENT ALLOW MEDIUM REMOVAL command</summary>
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
@@ -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<byte>();
cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval;
@@ -442,11 +428,11 @@ public partial class Device
/// <param name="pmi">If set, it is requesting partial media capacity</param>
/// <param name="timeout">Timeout in seconds.</param>
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
public bool 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
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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
/// <param name="cache">If set to <c>true</c> device can return cached data.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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);
/// <summary>Reads an attribute from the medium auxiliary memory</summary>
@@ -610,7 +596,7 @@ public partial class Device
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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
/// <param name="firstAttribute">First attribute identifier.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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);
/// <summary>Reads an attribute from the medium auxiliary memory</summary>
@@ -634,8 +620,8 @@ public partial class Device
/// <param name="firstAttribute">First attribute identifier.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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
/// <param name="timeout">Timeout in seconds.</param>
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
/// <param name="pageFormat">Set if page is formatted.</param>
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
/// <param name="timeout">Timeout in seconds.</param>
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
/// <param name="pageFormat">Set if page is formatted.</param>
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
/// <returns><c>true</c> if the command failed.</returns>
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;

View File

@@ -67,10 +67,10 @@ public partial class Device
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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<byte>();
cdb[0] = (byte)ScsiCommands.LoadUnload;
@@ -147,10 +147,10 @@ public partial class Device
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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<byte>();
cdb[0] = (byte)ScsiCommands.Locate;
@@ -216,7 +216,7 @@ public partial class Device
/// <param name="duration">Duration.</param>
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);
/// <summary>Positions the medium to the specified object identifier</summary>
/// <param name="senseBuffer">Sense buffer.</param>
@@ -228,11 +228,11 @@ public partial class Device
/// <param name="identifier">Destination identifier.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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>();
byte[] idBytes = BitConverter.GetBytes(identifier);
@@ -310,11 +310,11 @@ public partial class Device
/// <param name="blockSize">Block size in bytes.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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
/// <param name="blockSize">Object size in bytes.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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);
/// <summary>Reads a number of fixed-length blocks starting at specified block from the specified partition</summary>
@@ -362,8 +362,8 @@ public partial class Device
/// <param name="blockSize">Object size in bytes.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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);
/// <summary>Reads a number of fixed-length blocks starting at specified object</summary>
@@ -374,9 +374,9 @@ public partial class Device
/// <param name="blockSize">Object size in bytes.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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);
/// <summary>Reads a number of fixed-length blocks starting at specified block from the specified partition</summary>
/// <param name="buffer">Buffer.</param>
@@ -387,8 +387,8 @@ public partial class Device
/// <param name="blockSize">Object size in bytes.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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);
/// <summary>Reads a number of bytes or objects starting at specified object from the specified partition</summary>
@@ -408,11 +408,11 @@ public partial class Device
/// <param name="objectSize">Object size in bytes.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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
/// <param name="totalPosition">Requests current logical position.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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);
/// <summary>Reads the specified number of bytes or of blocks from the medium, backwards</summary>
/// <param name="buffer">Buffer.</param>
@@ -584,8 +584,8 @@ public partial class Device
/// <param name="blockSize">Block size in bytes.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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);
/// <summary>Reads the specified number of bytes or of blocks from the medium, backwards</summary>
@@ -604,11 +604,11 @@ public partial class Device
/// <param name="blockSize">Block size in bytes.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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
/// <param name="blockSize">Object size in bytes.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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
/// <param name="blockSize">Object size in bytes.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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
/// <param name="blockSize">Object size in bytes.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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
/// <param name="blockSize">Object size in bytes.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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
/// <param name="objectSize">Object size in bytes.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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
/// <param name="blockSize">Block size in bytes.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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);
/// <summary>Reads the specified number of bytes or of blocks from the device's buffer</summary>
@@ -772,8 +772,8 @@ public partial class Device
/// <param name="blockSize">Block size in bytes.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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);
/// <summary>Reads the specified number of bytes or of blocks from the device's buffer</summary>
@@ -791,11 +791,11 @@ public partial class Device
/// <param name="blockSize">Block size in bytes.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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
/// <param name="currentMedia">If set to <c>true</c> descriptors should apply to currently inserted media.</param>
/// <param name="timeout">Timeout.</param>
/// <param name="duration">Duration.</param>
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<byte>();
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<byte>();
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>();
byte[] countB = BitConverter.GetBytes(count);

View File

@@ -47,7 +47,7 @@ public partial class Device
/// <param name="blockSize">Block size in bytes.</param>
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);
/// <summary>Sends the SyQuest READ LONG (6) command</summary>
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
@@ -73,11 +73,11 @@ public partial class Device
/// <param name="blockSize">Block size in bytes.</param>
/// <param name="transferLength">How many blocks to read.</param>
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<byte>();
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<byte>();
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;

View File

@@ -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;
/// <summary>Gets the Platform ID for this device</summary>
/// <value>The Platform ID</value>
@@ -157,11 +163,4 @@ public partial class Device
/// <summary>Contains the PCMCIA CIS if applicable</summary>
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";
}

File diff suppressed because it is too large Load Diff

View File

@@ -43,7 +43,7 @@ namespace Aaru.Devices.Linux;
partial class Device
{
/// <inheritdoc />
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
}
/// <inheritdoc />
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
/// <inheritdoc />
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<MmcIocCmd>() * commands.Length)];
var ioMultiCmd = new byte[sizeof(ulong) + Marshal.SizeOf<MmcIocCmd>() * 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<MmcIocCmd>()];
var tmp = new byte[Marshal.SizeOf<MmcIocCmd>()];
// 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();

View File

@@ -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;
}

View File

@@ -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
}

View File

@@ -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))

View File

@@ -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
{
/// <summary>Always 'S' for SG v3</summary>
@@ -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
{
/// <summary>Implies direction of data. true = write, false = read</summary>

File diff suppressed because it is too large Load Diff

View File

@@ -1,504 +1,504 @@
<root>
<!-- ReSharper disable MarkupTextTypo -->
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<data name="READ_BUFFER_took_0_ms" xml:space="preserve">
<!-- ReSharper disable MarkupTextTypo -->
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<data name="READ_BUFFER_took_0_ms" xml:space="preserve">
<value>READ BUFFER tomó {0} ms.</value>
</data>
<data name="READ_BUFFER_DMA_took_0_ms" xml:space="preserve">
<data name="READ_BUFFER_DMA_took_0_ms" xml:space="preserve">
<value>READ BUFFER DMA tomó {0} ms.</value>
</data>
<data name="READ_DMA_took_0_ms" xml:space="preserve">
<data name="READ_DMA_took_0_ms" xml:space="preserve">
<value>READ DMA tomó {0} ms.</value>
</data>
<data name="READ_MULTIPLE_took_0_ms" xml:space="preserve">
<data name="READ_MULTIPLE_took_0_ms" xml:space="preserve">
<value>READ MULTIPLE tomó {0} ms.</value>
</data>
<data name="READ_NATIVE_MAX_ADDRESS_took_0_ms" xml:space="preserve">
<data name="READ_NATIVE_MAX_ADDRESS_took_0_ms" xml:space="preserve">
<value>READ NATIVE MAX ADDRESS tomó {0} ms.</value>
</data>
<data name="READ_SECTORS_took_0_ms" xml:space="preserve">
<data name="READ_SECTORS_took_0_ms" xml:space="preserve">
<value>READ SECTORS tomó {0} ms.</value>
</data>
<data name="READ_LONG_took_0_ms" xml:space="preserve">
<data name="READ_LONG_took_0_ms" xml:space="preserve">
<value>READ LONG tomó {0} ms.</value>
</data>
<data name="SEEK_took_0_ms" xml:space="preserve">
<data name="SEEK_took_0_ms" xml:space="preserve">
<value>SEEK tomó {0} ms.</value>
</data>
<data name="GET_NATIVE_MAX_ADDRESS_EXT_took_0_ms" xml:space="preserve">
<data name="GET_NATIVE_MAX_ADDRESS_EXT_took_0_ms" xml:space="preserve">
<value>GET NATIVE MAX ADDRESS EXT tomó {0} ms.</value>
</data>
<data name="READ_DMA_EXT_took_0_ms" xml:space="preserve">
<data name="READ_DMA_EXT_took_0_ms" xml:space="preserve">
<value>READ DMA EXT tomó {0} ms.</value>
</data>
<data name="READ_LOG_EXT_took_0_ms" xml:space="preserve">
<data name="READ_LOG_EXT_took_0_ms" xml:space="preserve">
<value>READ LOG EXT tomó {0} ms.</value>
</data>
<data name="READ_LOG_DMA_EXT_took_0_ms" xml:space="preserve">
<data name="READ_LOG_DMA_EXT_took_0_ms" xml:space="preserve">
<value>READ LOG DMA EXT tomó {0} ms.</value>
</data>
<data name="READ_MULTIPLE_EXT_took_0_ms" xml:space="preserve">
<data name="READ_MULTIPLE_EXT_took_0_ms" xml:space="preserve">
<value>READ MULTIPLE EXT tomó {0} ms.</value>
</data>
<data name="READ_NATIVE_MAX_ADDRESS_EXT_took_0_ms" xml:space="preserve">
<data name="READ_NATIVE_MAX_ADDRESS_EXT_took_0_ms" xml:space="preserve">
<value>READ NATIVE MAX ADDRESS EXT tomó {0} ms.</value>
</data>
<data name="READ_SECTORS_EXT_took_0_ms" xml:space="preserve">
<data name="READ_SECTORS_EXT_took_0_ms" xml:space="preserve">
<value>READ SECTORS EXT tomó {0} ms.</value>
</data>
<data name="SET_FEATURES_took_0_ms" xml:space="preserve">
<data name="SET_FEATURES_took_0_ms" xml:space="preserve">
<value>SET FEATURES tomó {0} ms.</value>
</data>
<data name="DOOR_LOCK_took_0_ms" xml:space="preserve">
<data name="DOOR_LOCK_took_0_ms" xml:space="preserve">
<value>DOOR LOCK tomó {0} ms.</value>
</data>
<data name="DOOR_UNLOCK_took_0_ms" xml:space="preserve">
<data name="DOOR_UNLOCK_took_0_ms" xml:space="preserve">
<value>DOOR UNLOCK tomó {0} ms.</value>
</data>
<data name="MEDIA_EJECT_took_0_ms" xml:space="preserve">
<data name="MEDIA_EJECT_took_0_ms" xml:space="preserve">
<value>MEDIA EJECT tomó {0} ms.</value>
</data>
<data name="IDENTIFY_PACKET_DEVICE_took_0_ms" xml:space="preserve">
<data name="IDENTIFY_PACKET_DEVICE_took_0_ms" xml:space="preserve">
<value>IDENTIFY PACKET DEVICE tomó {0} ms.</value>
</data>
<data name="CFA_TRANSLATE_SECTOR_took_0_ms" xml:space="preserve">
<data name="CFA_TRANSLATE_SECTOR_took_0_ms" xml:space="preserve">
<value>CFA TRANSLATE SECTOR tomó {0} ms.</value>
</data>
<data name="CFA_REQUEST_EXTENDED_ERROR_CODE_took_0_ms" xml:space="preserve">
<data name="CFA_REQUEST_EXTENDED_ERROR_CODE_took_0_ms" xml:space="preserve">
<value>CFA REQUEST EXTENDED ERROR CODE tomó {0} ms.</value>
</data>
<data name="CHECK_MEDIA_CARD_TYPE_took_0_ms" xml:space="preserve">
<data name="CHECK_MEDIA_CARD_TYPE_took_0_ms" xml:space="preserve">
<value>CHECK MEDIA CARD TYPE tomó {0} ms.</value>
</data>
<data name="SMART_DISABLE_OPERATIONS_took_0_ms" xml:space="preserve">
<data name="SMART_DISABLE_OPERATIONS_took_0_ms" xml:space="preserve">
<value>SMART DISABLE OPERATIONS tomó {0} ms.</value>
</data>
<data name="SMART_ENABLE_ATTRIBUTE_AUTOSAVE_took_0_ms" xml:space="preserve">
<data name="SMART_ENABLE_ATTRIBUTE_AUTOSAVE_took_0_ms" xml:space="preserve">
<value>SMART ENABLE ATTRIBUTE AUTOSAVE tomó {0} ms.</value>
</data>
<data name="SMART_DISABLE_ATTRIBUTE_AUTOSAVE_took_0_ms" xml:space="preserve">
<data name="SMART_DISABLE_ATTRIBUTE_AUTOSAVE_took_0_ms" xml:space="preserve">
<value>SMART DISABLE ATTRIBUTE AUTOSAVE tomó {0} ms.</value>
</data>
<data name="SMART_ENABLE_OPERATIONS_took_0_ms" xml:space="preserve">
<data name="SMART_ENABLE_OPERATIONS_took_0_ms" xml:space="preserve">
<value>SMART ENABLE OPERATIONS tomó {0} ms.</value>
</data>
<data name="SMART_EXECUTE_OFF_LINE_IMMEDIATE_took_0_ms" xml:space="preserve">
<data name="SMART_EXECUTE_OFF_LINE_IMMEDIATE_took_0_ms" xml:space="preserve">
<value>SMART EXECUTE OFF-LINE IMMEDIATE tomó {0} ms.</value>
</data>
<data name="SMART_READ_DATA_took_0_ms" xml:space="preserve">
<data name="SMART_READ_DATA_took_0_ms" xml:space="preserve">
<value>SMART READ DATA tomó {0} ms.</value>
</data>
<data name="SMART_READ_LOG_took_0_ms" xml:space="preserve">
<data name="SMART_READ_LOG_took_0_ms" xml:space="preserve">
<value>SMART READ LOG tomó {0} ms.</value>
</data>
<data name="SMART_RETURN_STATUS_took_0_ms" xml:space="preserve">
<data name="SMART_RETURN_STATUS_took_0_ms" xml:space="preserve">
<value>SMART RETURN STATUS tomó {0} ms.</value>
</data>
<data name="SEND_CSD_took_0_ms" xml:space="preserve">
<data name="SEND_CSD_took_0_ms" xml:space="preserve">
<value>SEND_CSD tomó {0} ms.</value>
</data>
<data name="SEND_CID_took_0_ms" xml:space="preserve">
<data name="SEND_CID_took_0_ms" xml:space="preserve">
<value>SEND_CID tomó {0} ms.</value>
</data>
<data name="SEND_OP_COND_took_0_ms" xml:space="preserve">
<data name="SEND_OP_COND_took_0_ms" xml:space="preserve">
<value>SEND_OP_COND tomó {0} ms.</value>
</data>
<data name="SEND_EXT_CSD_took_0_ms" xml:space="preserve">
<data name="SEND_EXT_CSD_took_0_ms" xml:space="preserve">
<value>SEND_EXT_CSD tomó {0} ms.</value>
</data>
<data name="SET_BLOCKLEN_took_0_ms" xml:space="preserve">
<data name="SET_BLOCKLEN_took_0_ms" xml:space="preserve">
<value>SET_BLOCKLEN tomó {0} ms.</value>
</data>
<data name="READ_SINGLE_BLOCK_took_0_ms" xml:space="preserve">
<data name="READ_SINGLE_BLOCK_took_0_ms" xml:space="preserve">
<value>READ_SINGLE_BLOCK tomó {0} ms.</value>
</data>
<data name="READ_MULTIPLE_BLOCK_took_0_ms" xml:space="preserve">
<data name="READ_MULTIPLE_BLOCK_took_0_ms" xml:space="preserve">
<value>READ_MULTIPLE_BLOCK tomó {0} ms.</value>
</data>
<data name="Multiple_READ_SINGLE_BLOCKs_took_0_ms" xml:space="preserve">
<data name="Multiple_READ_SINGLE_BLOCKs_took_0_ms" xml:space="preserve">
<value>Múltiples READ_SINGLE_BLOCKs tomaron {0} ms.</value>
</data>
<data name="SEND_STATUS_took_0_ms" xml:space="preserve">
<data name="SEND_STATUS_took_0_ms" xml:space="preserve">
<value>SEND_STATUS tomó {0} ms.</value>
</data>
<data name="SD_STATUS_took_0_ms" xml:space="preserve">
<data name="SD_STATUS_took_0_ms" xml:space="preserve">
<value>SD_STATUS tomó {0} ms.</value>
</data>
<data name="SD_SEND_OP_COND_took_0_ms" xml:space="preserve">
<data name="SD_SEND_OP_COND_took_0_ms" xml:space="preserve">
<value>SD_SEND_OP_COND tomó {0} ms.</value>
</data>
<data name="SEND_SCR_took_0_ms" xml:space="preserve">
<data name="SEND_SCR_took_0_ms" xml:space="preserve">
<value>SEND_SCR tomó {0} ms.</value>
</data>
<data name="ADAPTEC_TRANSLATE_took_0_ms" xml:space="preserve">
<data name="ADAPTEC_TRANSLATE_took_0_ms" xml:space="preserve">
<value>ADAPTEC TRANSLATE tomó {0} ms.</value>
</data>
<data name="ADAPTEC_SET_ERROR_THRESHOLD_took_0_ms" xml:space="preserve">
<data name="ADAPTEC_SET_ERROR_THRESHOLD_took_0_ms" xml:space="preserve">
<value>ADAPTEC SET ERROR THRESHOLD tomó {0} ms.</value>
</data>
<data name="ADAPTEC_READ_RESET_USAGE_COUNTER_took_0_ms" xml:space="preserve">
<data name="ADAPTEC_READ_RESET_USAGE_COUNTER_took_0_ms" xml:space="preserve">
<value>ADAPTEC READ/RESET USAGE COUNTER tomó {0} ms.</value>
</data>
<data name="ADAPTEC_WRITE_DATA_BUFFER_took_0_ms" xml:space="preserve">
<data name="ADAPTEC_WRITE_DATA_BUFFER_took_0_ms" xml:space="preserve">
<value>ADAPTEC WRITE DATA BUFFER tomó {0} ms.</value>
</data>
<data name="ADAPTEC_READ_DATA_BUFFER_took_0_ms" xml:space="preserve">
<data name="ADAPTEC_READ_DATA_BUFFER_took_0_ms" xml:space="preserve">
<value>ADAPTEC READ DATA BUFFER tomó {0} ms.</value>
</data>
<data name="ARCHIVE_CORP_REQUEST_BLOCK_ADDRESS_took_0_ms" xml:space="preserve">
<data name="ARCHIVE_CORP_REQUEST_BLOCK_ADDRESS_took_0_ms" xml:space="preserve">
<value>ARCHIVE CORP. REQUEST BLOCK ADDRESS tomó {0} ms.</value>
</data>
<data name="ARCHIVE_CORP_SEEK_BLOCK_took_0_ms" xml:space="preserve">
<data name="ARCHIVE_CORP_SEEK_BLOCK_took_0_ms" xml:space="preserve">
<value>ARCHIVE CORP. SEEK BLOCK tomó {0} ms.</value>
</data>
<data name="CERTANCE_PARK_UNPARK_took_0_ms" xml:space="preserve">
<data name="CERTANCE_PARK_UNPARK_took_0_ms" xml:space="preserve">
<value>CERTANCE PARK UNPARK tomó {0} ms.</value>
</data>
<data name="FUJITSU_DISPLAY_took_0_ms" xml:space="preserve">
<data name="FUJITSU_DISPLAY_took_0_ms" xml:space="preserve">
<value>FUJITSU DISPLAY tomó {0} ms.</value>
</data>
<data name="HL_DT_ST_READ_DVD_RAW_took_0_ms" xml:space="preserve">
<data name="HL_DT_ST_READ_DVD_RAW_took_0_ms" xml:space="preserve">
<value>HL-DT-ST READ DVD (RAW) tomó {0} ms.</value>
</data>
<data name="HP_READ_LONG_took_0_ms" xml:space="preserve">
<data name="HP_READ_LONG_took_0_ms" xml:space="preserve">
<value>HP READ LONG tomó {0} ms.</value>
</data>
<data name="KREON_DEPRECATED_UNLOCK_took_0_ms" xml:space="preserve">
<data name="KREON_DEPRECATED_UNLOCK_took_0_ms" xml:space="preserve">
<value>KREON DEPRECATED UNLOCK tomó {0} ms.</value>
</data>
<data name="KREON_SET_LOCK_STATE_took_0_ms" xml:space="preserve">
<data name="KREON_SET_LOCK_STATE_took_0_ms" xml:space="preserve">
<value>KREON SET LOCK STATE tomó {0} ms.</value>
</data>
<data name="KREON_GET_FEATURE_LIST_took_0_ms" xml:space="preserve">
<data name="KREON_GET_FEATURE_LIST_took_0_ms" xml:space="preserve">
<value>KREON GET FEATURE LIST tomó {0} ms.</value>
</data>
<data name="KREON_EXTRACT_SS_took_0_ms" xml:space="preserve">
<data name="KREON_EXTRACT_SS_took_0_ms" xml:space="preserve">
<value>KREON EXTRACT SS tomó {0} ms.</value>
</data>
<data name="MediaTek_READ_DRAM_took_0_ms" xml:space="preserve">
<data name="MediaTek_READ_DRAM_took_0_ms" xml:space="preserve">
<value>MediaTek READ DRAM tomó {0} ms.</value>
</data>
<data name="MINIDISC_READ_DTOC_took_0_ms" xml:space="preserve">
<data name="MINIDISC_READ_DTOC_took_0_ms" xml:space="preserve">
<value>MINIDISC READ DTOC tomó {0} ms.</value>
</data>
<data name="MINIDISC_READ_UTOC_took_0_ms" xml:space="preserve">
<data name="MINIDISC_READ_UTOC_took_0_ms" xml:space="preserve">
<value>MINIDISC READ UTOC tomó {0} ms.</value>
</data>
<data name="MINIDISC_command_D5h_took_0_ms" xml:space="preserve">
<data name="MINIDISC_command_D5h_took_0_ms" xml:space="preserve">
<value>MINIDISC command D5h tomó {0} ms.</value>
</data>
<data name="MINIDISC_STOP_PLAY_took_0_ms" xml:space="preserve">
<data name="MINIDISC_STOP_PLAY_took_0_ms" xml:space="preserve">
<value>MINIDISC STOP PLAY tomó {0} ms.</value>
</data>
<data name="MINIDISC_READ_POSITION_took_0_ms" xml:space="preserve">
<data name="MINIDISC_READ_POSITION_took_0_ms" xml:space="preserve">
<value>MINIDISC READ POSITION tomó {0} ms.</value>
</data>
<data name="MINIDISC_GET_TYPE_took_0_ms" xml:space="preserve">
<data name="MINIDISC_GET_TYPE_took_0_ms" xml:space="preserve">
<value>MINIDISC GET TYPE tomó {0} ms.</value>
</data>
<data name="GET_CONFIGURATION_Starting_Feature_Number_1_Return_Type_2_Sense_3_Last_Error_4_took_0_ms"
xml:space="preserve">
<data name="GET_CONFIGURATION_Starting_Feature_Number_1_Return_Type_2_Sense_3_Last_Error_4_took_0_ms"
xml:space="preserve">
<value>GET CONFIGURATION (Número de primera funcionalidad Feature Number: {1}, Tipo de retorno: {2}, Sense: {3}, Error: {4}) tomó {0} ms.</value>
</data>
<data name="READ_DISC_STRUCTURE_Media_Type_1_Address_2_Layer_Number_3_Format_4_AGID_5_Sense_6_Last_Error_7_took_0_ms"
xml:space="preserve">
<data name="READ_DISC_STRUCTURE_Media_Type_1_Address_2_Layer_Number_3_Format_4_AGID_5_Sense_6_Last_Error_7_took_0_ms"
xml:space="preserve">
<value>READ DISC STRUCTURE (Tipo de medio: {1}, Dirección: {2}, Capa: {3}, Formato: {4}, AGID: {5}, Sense: {6}, Error: {7}) tomó {0} ms.</value>
</data>
<data name="READ_TOC_PMA_ATIP_took_MSF_1_Format_2_Track_Session_Number_3_Sense_4_LastError_5_0_ms"
xml:space="preserve">
<data name="READ_TOC_PMA_ATIP_took_MSF_1_Format_2_Track_Session_Number_3_Sense_4_LastError_5_0_ms"
xml:space="preserve">
<value>READ TOC/PMA/ATIP tomó (MSF: {1}, Formato: {2}, Pista/Sesión: {3}, Sense: {4}, Error: {5}) {0} ms.</value>
</data>
<data name="READ_DISC_INFORMATION_Data_Type_1_Sense_2_Last_Error_3_took_0_ms" xml:space="preserve">
<data name="READ_DISC_INFORMATION_Data_Type_1_Sense_2_Last_Error_3_took_0_ms" xml:space="preserve">
<value>READ DISC INFORMATION (Tipo de datos: {1}, Sense: {2}, Last Error: {3}) tomó {0} ms.</value>
</data>
<data
name="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"
xml:space="preserve">
<data
name="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"
xml:space="preserve">
<value>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.</value>
</data>
<data
name="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"
xml:space="preserve">
<data
name="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"
xml:space="preserve">
<value>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.</value>
</data>
<data name="PREVENT_ALLOW_MEDIUM_REMOVAL_Persistent_1_Prevent_2_Sense_3_LastError_4_took_0_ms" xml:space="preserve">
<data name="PREVENT_ALLOW_MEDIUM_REMOVAL_Persistent_1_Prevent_2_Sense_3_LastError_4_took_0_ms" xml:space="preserve">
<value>PREVENT ALLOW MEDIUM REMOVAL (Persistente: {1}, Evitar: {2}, Sense: {3}, Error: {4}) tomó {0} ms.</value>
</data>
<data
name="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"
xml:space="preserve">
<data
name="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"
xml:space="preserve">
<value>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.</value>
</data>
<data name="READ_READ_SUB_CHANNEL_MCN_Sense_1_Last_Error_2_took_0_ms" xml:space="preserve">
<data name="READ_READ_SUB_CHANNEL_MCN_Sense_1_Last_Error_2_took_0_ms" xml:space="preserve">
<value>READ READ SUB-CHANNEL (MCN, Sense {1}, Error {2}) tomó {0} ms.</value>
</data>
<data name="READ_READ_SUB_CHANNEL_ISRC_Track_Number_1_Sense_2_Last_Error_3_took_0_ms" xml:space="preserve">
<data name="READ_READ_SUB_CHANNEL_ISRC_Track_Number_1_Sense_2_Last_Error_3_took_0_ms" xml:space="preserve">
<value>READ READ SUB-CHANNEL (ISRC, Pista: {1}, Sense: {2}, Error: {3}) tomó {0} ms.</value>
</data>
<data name="SET_CD_SPEED_Rotational_Control_1_Read_Speed_2_Write_Speed_3_Sense_4_Last_Error_5_took_0_ms"
xml:space="preserve">
<data name="SET_CD_SPEED_Rotational_Control_1_Read_Speed_2_Write_Speed_3_Sense_4_Last_Error_5_took_0_ms"
xml:space="preserve">
<value>SET CD SPEED (Control rotación: {1}, Velocidad de lectura: {2}, Velocidad de escritura: {3}, Sense: {4}, Error: {5}) tomó {0} ms.</value>
</data>
<data name="READ_TRACK_INFORMATION_Data_Type_1_Sense_2_Last_Error_3_took_0_ms" xml:space="preserve">
<data name="READ_TRACK_INFORMATION_Data_Type_1_Sense_2_Last_Error_3_took_0_ms" xml:space="preserve">
<value>READ TRACK INFORMATION (Data Type: {1}, Sense: {2}, Last Error: {3}) tomó {0} ms.</value>
</data>
<data name="NEC_READ_CD_DA_took_0_ms" xml:space="preserve">
<data name="NEC_READ_CD_DA_took_0_ms" xml:space="preserve">
<value>NEC READ CD-DA tomó {0} ms.</value>
</data>
<data name="MEDIUM_SCAN_took_0_ms" xml:space="preserve">
<data name="MEDIUM_SCAN_took_0_ms" xml:space="preserve">
<value>MEDIUM SCAN tomó {0} ms.</value>
</data>
<data name="PIONEER_READ_CD_DA_took_0_ms" xml:space="preserve">
<data name="PIONEER_READ_CD_DA_took_0_ms" xml:space="preserve">
<value>PIONEER READ CD-DA tomó {0} ms.</value>
</data>
<data name="PIONEER_READ_CD_DA_MSF_took_0_ms" xml:space="preserve">
<data name="PIONEER_READ_CD_DA_MSF_took_0_ms" xml:space="preserve">
<value>PIONEER READ CD-DA MSF tomó {0} ms.</value>
</data>
<data name="PIONEER_READ_CD_XA_took_0_ms" xml:space="preserve">
<data name="PIONEER_READ_CD_XA_took_0_ms" xml:space="preserve">
<value>PIONEER READ CD-XA tomó {0} ms.</value>
</data>
<data name="PLASMON_READ_SECTOR_LOCATION_took_0_ms" xml:space="preserve">
<data name="PLASMON_READ_SECTOR_LOCATION_took_0_ms" xml:space="preserve">
<value>PLASMON READ SECTOR LOCATION tomó {0} ms.</value>
</data>
<data name="Plextor_READ_CD_DA_LBA_1_Block_Size_2_Transfer_Length_3_Subchannel_4_Sense_5_Last_Error_6_took_0_ms"
xml:space="preserve">
<data name="Plextor_READ_CD_DA_LBA_1_Block_Size_2_Transfer_Length_3_Subchannel_4_Sense_5_Last_Error_6_took_0_ms"
xml:space="preserve">
<value>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.</value>
</data>
<data name="Plextor_READ_DVD_RAW_took_0_ms" xml:space="preserve">
<data name="Plextor_READ_DVD_RAW_took_0_ms" xml:space="preserve">
<value>Plextor READ DVD (RAW) tomó {0} ms.</value>
</data>
<data name="PLEXTOR_READ_EEPROM_took_0_ms" xml:space="preserve">
<data name="PLEXTOR_READ_EEPROM_took_0_ms" xml:space="preserve">
<value>PLEXTOR READ EEPROM tomó {0} ms.</value>
</data>
<data name="PLEXTOR_POWEREC_GET_SPEEDS_took_0_ms" xml:space="preserve">
<data name="PLEXTOR_POWEREC_GET_SPEEDS_took_0_ms" xml:space="preserve">
<value>PLEXTOR POWEREC GET SPEEDS tomó {0} ms.</value>
</data>
<data name="PLEXTOR_GET_SILENT_MODE_took_0_ms" xml:space="preserve">
<data name="PLEXTOR_GET_SILENT_MODE_took_0_ms" xml:space="preserve">
<value>PLEXTOR GET SILENT MODE tomó {0} ms.</value>
</data>
<data name="PLEXTOR_GET_GIGAREC_took_0_ms" xml:space="preserve">
<data name="PLEXTOR_GET_GIGAREC_took_0_ms" xml:space="preserve">
<value>PLEXTOR GET GIGAREC tomó {0} ms.</value>
</data>
<data name="PLEXTOR_GET_VARIREC_took_0_ms" xml:space="preserve">
<data name="PLEXTOR_GET_VARIREC_took_0_ms" xml:space="preserve">
<value>PLEXTOR GET VARIREC tomó {0} ms.</value>
</data>
<data name="PLEXTOR_GET_SECUREC_took_0_ms" xml:space="preserve">
<data name="PLEXTOR_GET_SECUREC_took_0_ms" xml:space="preserve">
<value>PLEXTOR GET SECUREC tomó {0} ms.</value>
</data>
<data name="PLEXTOR_GET_SPEEDREAD_took_0_ms" xml:space="preserve">
<data name="PLEXTOR_GET_SPEEDREAD_took_0_ms" xml:space="preserve">
<value>PLEXTOR GET SPEEDREAD tomó {0} ms.</value>
</data>
<data name="PLEXTOR_GET_SINGLE_SESSION_HIDE_CD_R_took_0_ms" xml:space="preserve">
<data name="PLEXTOR_GET_SINGLE_SESSION_HIDE_CD_R_took_0_ms" xml:space="preserve">
<value>PLEXTOR GET SINGLE-SESSION / HIDE CD-R tomó {0} ms.</value>
</data>
<data name="PLEXTOR_GET_BOOK_BITSETTING_took_0_ms" xml:space="preserve">
<data name="PLEXTOR_GET_BOOK_BITSETTING_took_0_ms" xml:space="preserve">
<value>PLEXTOR GET BOOK BITSETTING tomó {0} ms.</value>
</data>
<data name="PLEXTOR_GET_TEST_WRITE_DVD_took_0_ms" xml:space="preserve">
<data name="PLEXTOR_GET_TEST_WRITE_DVD_took_0_ms" xml:space="preserve">
<value>PLEXTOR GET TEST WRITE DVD+ tomó {0} ms.</value>
</data>
<data name="READ_6_took_0_ms" xml:space="preserve">
<data name="READ_6_took_0_ms" xml:space="preserve">
<value>READ (6) tomó {0} ms.</value>
</data>
<data name="READ_10_took_0_ms" xml:space="preserve">
<data name="READ_10_took_0_ms" xml:space="preserve">
<value>READ (10) tomó {0} ms.</value>
</data>
<data name="READ_12_took_0_ms" xml:space="preserve">
<data name="READ_12_took_0_ms" xml:space="preserve">
<value>READ (12) tomó {0} ms.</value>
</data>
<data name="READ_16_took_0_ms" xml:space="preserve">
<data name="READ_16_took_0_ms" xml:space="preserve">
<value>READ (16) tomó {0} ms.</value>
</data>
<data name="READ_LONG_10_took_0_ms" xml:space="preserve">
<data name="READ_LONG_10_took_0_ms" xml:space="preserve">
<value>READ LONG (10) tomó {0} ms.</value>
</data>
<data name="READ_LONG_16_took_0_ms" xml:space="preserve">
<data name="READ_LONG_16_took_0_ms" xml:space="preserve">
<value>READ LONG (16) tomó {0} ms.</value>
</data>
<data name="SEEK_6_took_0_ms" xml:space="preserve">
<data name="SEEK_6_took_0_ms" xml:space="preserve">
<value>SEEK (6) tomó {0} ms.</value>
</data>
<data name="SEEK_10_took_0_ms" xml:space="preserve">
<data name="SEEK_10_took_0_ms" xml:space="preserve">
<value>SEEK (10) tomó {0} ms.</value>
</data>
<data name="READ_ATTRIBUTE_took_0_ms" xml:space="preserve">
<data name="READ_ATTRIBUTE_took_0_ms" xml:space="preserve">
<value>READ ATTRIBUTE tomó {0} ms.</value>
</data>
<data name="INQUIRY_took_0_ms" xml:space="preserve">
<data name="INQUIRY_took_0_ms" xml:space="preserve">
<value>INQUIRY tomó {0} ms.</value>
</data>
<data name="TEST_UNIT_READY_took_0_ms" xml:space="preserve">
<data name="TEST_UNIT_READY_took_0_ms" xml:space="preserve">
<value>TEST UNIT READY tomó {0} ms.</value>
</data>
<data name="MODE_SENSE_6_took_0_ms" xml:space="preserve">
<data name="MODE_SENSE_6_took_0_ms" xml:space="preserve">
<value>MODE SENSE(6) tomó {0} ms.</value>
</data>
<data name="MODE_SENSE_10_took_0_ms" xml:space="preserve">
<data name="MODE_SENSE_10_took_0_ms" xml:space="preserve">
<value>MODE SENSE(10) tomó {0} ms.</value>
</data>
<data name="PREVENT_ALLOW_MEDIUM_REMOVAL_took_0_ms" xml:space="preserve">
<data name="PREVENT_ALLOW_MEDIUM_REMOVAL_took_0_ms" xml:space="preserve">
<value>PREVENT ALLOW MEDIUM REMOVAL tomó {0} ms.</value>
</data>
<data name="READ_CAPACITY_took_0_ms" xml:space="preserve">
<data name="READ_CAPACITY_took_0_ms" xml:space="preserve">
<value>READ CAPACITY tomó {0} ms.</value>
</data>
<data name="READ_CAPACITY_16_took_0_ms" xml:space="preserve">
<data name="READ_CAPACITY_16_took_0_ms" xml:space="preserve">
<value>READ CAPACITY(16) tomó {0} ms.</value>
</data>
<data name="READ_MEDIA_SERIAL_NUMBER_took_0_ms" xml:space="preserve">
<data name="READ_MEDIA_SERIAL_NUMBER_took_0_ms" xml:space="preserve">
<value>READ MEDIA SERIAL NUMBER tomó {0} ms.</value>
</data>
<data name="MODE_SELECT_6_took_0_ms" xml:space="preserve">
<data name="MODE_SELECT_6_took_0_ms" xml:space="preserve">
<value>MODE SELECT(6) tomó {0} ms.</value>
</data>
<data name="MODE_SELECT_10_took_0_ms" xml:space="preserve">
<data name="MODE_SELECT_10_took_0_ms" xml:space="preserve">
<value>MODE SELECT(10) tomó {0} ms.</value>
</data>
<data name="REQUEST_SENSE_took_0_ms" xml:space="preserve">
<data name="REQUEST_SENSE_took_0_ms" xml:space="preserve">
<value>REQUEST SENSE tomó {0} ms.</value>
</data>
<data name="LOAD_UNLOAD_6_took_0_ms" xml:space="preserve">
<data name="LOAD_UNLOAD_6_took_0_ms" xml:space="preserve">
<value>LOAD UNLOAD (6) tomó {0} ms.</value>
</data>
<data name="LOCATE_10_took_0_ms" xml:space="preserve">
<data name="LOCATE_10_took_0_ms" xml:space="preserve">
<value>LOCATE (10) tomó {0} ms.</value>
</data>
<data name="LOCATE_16_took_0_ms" xml:space="preserve">
<data name="LOCATE_16_took_0_ms" xml:space="preserve">
<value>LOCATE (16) tomó {0} ms.</value>
</data>
<data name="READ_BLOCK_LIMITS_took_0_ms" xml:space="preserve">
<data name="READ_BLOCK_LIMITS_took_0_ms" xml:space="preserve">
<value>READ BLOCK LIMITS tomó {0} ms.</value>
</data>
<data name="READ_POSITION_took_0_ms" xml:space="preserve">
<data name="READ_POSITION_took_0_ms" xml:space="preserve">
<value>READ POSITION tomó {0} ms.</value>
</data>
<data name="READ_REVERSE_6_took_0_ms" xml:space="preserve">
<data name="READ_REVERSE_6_took_0_ms" xml:space="preserve">
<value>READ REVERSE (6) tomó {0} ms.</value>
</data>
<data name="READ_REVERSE_16_took_0_ms" xml:space="preserve">
<data name="READ_REVERSE_16_took_0_ms" xml:space="preserve">
<value>READ REVERSE (16) tomó {0} ms.</value>
</data>
<data name="RECOVER_BUFFERED_DATA_took_0_ms" xml:space="preserve">
<data name="RECOVER_BUFFERED_DATA_took_0_ms" xml:space="preserve">
<value>RECOVER BUFFERED DATA tomó {0} ms.</value>
</data>
<data name="REPORT_DENSITY_SUPPORT_took_0_ms" xml:space="preserve">
<data name="REPORT_DENSITY_SUPPORT_took_0_ms" xml:space="preserve">
<value>REPORT DENSITY SUPPORT tomó {0} ms.</value>
</data>
<data name="REWIND_took_0_ms" xml:space="preserve">
<data name="REWIND_took_0_ms" xml:space="preserve">
<value>REWIND tomó {0} ms.</value>
</data>
<data name="TRACK_SELECT_took_0_ms" xml:space="preserve">
<data name="TRACK_SELECT_took_0_ms" xml:space="preserve">
<value>TRACK SELECT tomó {0} ms.</value>
</data>
<data name="SPACE_took_0_ms" xml:space="preserve">
<data name="SPACE_took_0_ms" xml:space="preserve">
<value>SPACE tomó {0} ms.</value>
</data>
<data name="SYQUEST_READ_6_took_0_ms" xml:space="preserve">
<data name="SYQUEST_READ_6_took_0_ms" xml:space="preserve">
<value>SYQUEST READ (6) tomó {0} ms.</value>
</data>
<data name="SYQUEST_READ_10_took_0_ms" xml:space="preserve">
<data name="SYQUEST_READ_10_took_0_ms" xml:space="preserve">
<value>SYQUEST READ (10) tomó {0} ms.</value>
</data>
<data name="Platform_0_not_yet_supported" xml:space="preserve">
<data name="Platform_0_not_yet_supported" xml:space="preserve">
<value>La plataforma {0} no está soportada.</value>
</data>
<data name="Invalid_remote_URI" xml:space="preserve">
<data name="Invalid_remote_URI" xml:space="preserve">
<value>URI remota inválida.</value>
</data>
<data name="Error_connecting_to_host" xml:space="preserve">
<data name="Error_connecting_to_host" xml:space="preserve">
<value>Error al conectar al servidor.</value>
</data>
<data name="Invalid_remote_protocol" xml:space="preserve">
<data name="Invalid_remote_protocol" xml:space="preserve">
<value>Protocolo remoto inválido.</value>
</data>
<data name="Host_not_found" xml:space="preserve">
<data name="Host_not_found" xml:space="preserve">
<value>Servidor no encontrado</value>
</data>
<data name="Connected_to_0" xml:space="preserve">
<data name="Connected_to_0" xml:space="preserve">
<value>Conectado a {0}</value>
</data>
<data name="Could_not_read_from_the_network" xml:space="preserve">
<data name="Could_not_read_from_the_network" xml:space="preserve">
<value>No se pudo leer desde la red...</value>
</data>
<data name="Received_data_is_not_an_Aaru_Remote_Packet" xml:space="preserve">
<data name="Received_data_is_not_an_Aaru_Remote_Packet" xml:space="preserve">
<value>Los datos recibidos no son un paquete Aaru Remote...</value>
</data>
<data name="Expected_Hello_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_Hello_Packet_got_packet_type_0" xml:space="preserve">
<value>Se esperaba paquete de saludo, se recibió paquete tipo {0}...</value>
</data>
<data name="Unrecognized_packet_version" xml:space="preserve">
<data name="Unrecognized_packet_version" xml:space="preserve">
<value>Versión de paquete no reconocida...</value>
</data>
<data name="Could_not_write_to_the_network" xml:space="preserve">
<data name="Could_not_write_to_the_network" xml:space="preserve">
<value>No se pudo escribir hacia la red...</value>
</data>
<data name="Remote_IsRoot_Expected_Am_I_Root_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Remote_IsRoot_Expected_Am_I_Root_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Se esperaba paquete de respuesta ¿Soy root?, pero se recibió paquete tipo {0}</value>
</data>
<data name="Remote_ListDevices_Expected_List_Devices_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Remote_ListDevices_Expected_List_Devices_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Se esperaba paquete de respuesta de listado de dispositivos, pero se recibió paquete tipo {0}</value>
</data>
<data name="Expected_SCSI_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_SCSI_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Se esperaba paquete de respuesta SCSI, se recibió paquete tipo {0}...</value>
</data>
<data name="Expected_ATA_CHS_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_ATA_CHS_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Se esperaba paquete de respuesta ATA CHS, se recibió paquete tipo {0}...</value>
</data>
<data name="Expected_ATA_LBA28_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_ATA_LBA28_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Se esperaba paquete de respuesta ATA LBA48, se recibió paquete tipo {0}...</value>
</data>
<data name="Expected_ATA_LBA48_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_ATA_LBA48_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Se esperaba paquete de respuesta ATA LBA48, se recibió paquete tipo {0}...</value>
</data>
<data name="Expected_SDHCI_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_SDHCI_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Se esperaba paquete de respuesta SDHCI, se recibió paquete tipo {0}</value>
</data>
<data name="Expected_Device_Type_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_Device_Type_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Se esperaba paquete de respuesta Tipo de Dispositivo, se recibió paquete tipo {0}...</value>
</data>
<data name="Expected_USB_Data_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_USB_Data_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Se esperaba paquete de respuesta de datos USB, pero se recibió paquete tipo {0}...</value>
</data>
<data name="Expected_FireWire_Data_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_FireWire_Data_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Se esperaba paquete de respuesta de datos FireWire, se recibió paquete tipo {0}...</value>
</data>
<data name="Expected_PCMCIA_Data_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_PCMCIA_Data_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Se esperaba paquete de respuesta de datos PCMCIA, se recibió paquete tipo {0}...</value>
</data>
<data name="Expected_multi_MMC_SD_command_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_multi_MMC_SD_command_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Se esperaba paquete de respuesta de multi comando MMC/SD, se recibió paquete tipo {0}...</value>
</data>
<data name="Expected_the_response_to_0_SD_MMC_commands_but_got_1_responses" xml:space="preserve">
<data name="Expected_the_response_to_0_SD_MMC_commands_but_got_1_responses" xml:space="preserve">
<value>Se esperaban {0} respuestas a comandos SD/MMC, pero se recibieron {1} respuestas...</value>
</data>
<data name="Expected_NOP_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_NOP_Packet_got_packet_type_0" xml:space="preserve">
<value>Se esperaba paquete NOP, se recibió paquete tipo {0}...</value>
</data>
<data name="ReOpen_error_closing_device" xml:space="preserve">
<data name="ReOpen_error_closing_device" xml:space="preserve">
<value>Error de reapertura cerrando dispositivo...</value>
</data>
<data name="ReOpen_error_0_with_reason_1" xml:space="preserve">
<data name="ReOpen_error_0_with_reason_1" xml:space="preserve">
<value>Error {0} al reabrir con razón: {1}...</value>
</data>
<data name="Expected_OS_Read_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_OS_Read_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Se esperaba paquete de respuesta de lectura de SO, se recibió paquete tipo {0}...</value>
</data>
<data name="Remote_error_0_in_OS_Read" xml:space="preserve">
<data name="Remote_error_0_in_OS_Read" xml:space="preserve">
<value>Error remoto {0} en lectura de OS...</value>
</data>
</root>

View File

@@ -1,509 +1,511 @@
<?xml version="1.0" encoding="utf-8" ?>
<root>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root"
xmlns="">
<xsd:element name="root" msdata:IsDataSet="true"></xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<data name="READ_BUFFER_took_0_ms" xml:space="preserve">
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
id="root"
xmlns="">
<xsd:element name="root" msdata:IsDataSet="true"></xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<data name="READ_BUFFER_took_0_ms" xml:space="preserve">
<value>READ BUFFER took {0} ms.</value>
</data>
<data name="READ_BUFFER_DMA_took_0_ms" xml:space="preserve">
<data name="READ_BUFFER_DMA_took_0_ms" xml:space="preserve">
<value>READ BUFFER DMA took {0} ms.</value>
</data>
<data name="READ_DMA_took_0_ms" xml:space="preserve">
<data name="READ_DMA_took_0_ms" xml:space="preserve">
<value>READ DMA took {0} ms.</value>
</data>
<data name="READ_MULTIPLE_took_0_ms" xml:space="preserve">
<data name="READ_MULTIPLE_took_0_ms" xml:space="preserve">
<value>READ MULTIPLE took {0} ms.</value>
</data>
<data name="READ_NATIVE_MAX_ADDRESS_took_0_ms" xml:space="preserve">
<data name="READ_NATIVE_MAX_ADDRESS_took_0_ms" xml:space="preserve">
<value>READ NATIVE MAX ADDRESS took {0} ms.</value>
</data>
<data name="READ_SECTORS_took_0_ms" xml:space="preserve">
<data name="READ_SECTORS_took_0_ms" xml:space="preserve">
<value>READ SECTORS took {0} ms.</value>
</data>
<data name="READ_LONG_took_0_ms" xml:space="preserve">
<data name="READ_LONG_took_0_ms" xml:space="preserve">
<value>READ LONG took {0} ms.</value>
</data>
<data name="SEEK_took_0_ms" xml:space="preserve">
<data name="SEEK_took_0_ms" xml:space="preserve">
<value>SEEK took {0} ms.</value>
</data>
<data name="GET_NATIVE_MAX_ADDRESS_EXT_took_0_ms" xml:space="preserve">
<data name="GET_NATIVE_MAX_ADDRESS_EXT_took_0_ms" xml:space="preserve">
<value>GET NATIVE MAX ADDRESS EXT took {0} ms.</value>
</data>
<data name="READ_DMA_EXT_took_0_ms" xml:space="preserve">
<data name="READ_DMA_EXT_took_0_ms" xml:space="preserve">
<value>READ DMA EXT took {0} ms.</value>
</data>
<data name="READ_LOG_EXT_took_0_ms" xml:space="preserve">
<data name="READ_LOG_EXT_took_0_ms" xml:space="preserve">
<value>READ LOG EXT took {0} ms.</value>
</data>
<data name="READ_LOG_DMA_EXT_took_0_ms" xml:space="preserve">
<data name="READ_LOG_DMA_EXT_took_0_ms" xml:space="preserve">
<value>READ LOG DMA EXT took {0} ms.</value>
</data>
<data name="READ_MULTIPLE_EXT_took_0_ms" xml:space="preserve">
<data name="READ_MULTIPLE_EXT_took_0_ms" xml:space="preserve">
<value>READ MULTIPLE EXT took {0} ms.</value>
</data>
<data name="READ_NATIVE_MAX_ADDRESS_EXT_took_0_ms" xml:space="preserve">
<data name="READ_NATIVE_MAX_ADDRESS_EXT_took_0_ms" xml:space="preserve">
<value>READ NATIVE MAX ADDRESS EXT took {0} ms.</value>
</data>
<data name="READ_SECTORS_EXT_took_0_ms" xml:space="preserve">
<data name="READ_SECTORS_EXT_took_0_ms" xml:space="preserve">
<value>READ SECTORS EXT took {0} ms.</value>
</data>
<data name="SET_FEATURES_took_0_ms" xml:space="preserve">
<data name="SET_FEATURES_took_0_ms" xml:space="preserve">
<value>SET FEATURES took {0} ms.</value>
</data>
<data name="DOOR_LOCK_took_0_ms" xml:space="preserve">
<data name="DOOR_LOCK_took_0_ms" xml:space="preserve">
<value>DOOR LOCK took {0} ms.</value>
</data>
<data name="DOOR_UNLOCK_took_0_ms" xml:space="preserve">
<data name="DOOR_UNLOCK_took_0_ms" xml:space="preserve">
<value>DOOR UNLOCK took {0} ms.</value>
</data>
<data name="MEDIA_EJECT_took_0_ms" xml:space="preserve">
<data name="MEDIA_EJECT_took_0_ms" xml:space="preserve">
<value>MEDIA EJECT took {0} ms.</value>
</data>
<data name="IDENTIFY_PACKET_DEVICE_took_0_ms" xml:space="preserve">
<data name="IDENTIFY_PACKET_DEVICE_took_0_ms" xml:space="preserve">
<value>IDENTIFY PACKET DEVICE took {0} ms.</value>
</data>
<data name="CFA_TRANSLATE_SECTOR_took_0_ms" xml:space="preserve">
<data name="CFA_TRANSLATE_SECTOR_took_0_ms" xml:space="preserve">
<value>CFA TRANSLATE SECTOR took {0} ms.</value>
</data>
<data name="CFA_REQUEST_EXTENDED_ERROR_CODE_took_0_ms" xml:space="preserve">
<data name="CFA_REQUEST_EXTENDED_ERROR_CODE_took_0_ms" xml:space="preserve">
<value>CFA REQUEST EXTENDED ERROR CODE took {0} ms.</value>
</data>
<data name="CHECK_MEDIA_CARD_TYPE_took_0_ms" xml:space="preserve">
<data name="CHECK_MEDIA_CARD_TYPE_took_0_ms" xml:space="preserve">
<value>CHECK MEDIA CARD TYPE took {0} ms.</value>
</data>
<data name="SMART_DISABLE_OPERATIONS_took_0_ms" xml:space="preserve">
<data name="SMART_DISABLE_OPERATIONS_took_0_ms" xml:space="preserve">
<value>SMART DISABLE OPERATIONS took {0} ms.</value>
</data>
<data name="SMART_ENABLE_ATTRIBUTE_AUTOSAVE_took_0_ms" xml:space="preserve">
<data name="SMART_ENABLE_ATTRIBUTE_AUTOSAVE_took_0_ms" xml:space="preserve">
<value>SMART ENABLE ATTRIBUTE AUTOSAVE took {0} ms.</value>
</data>
<data name="SMART_DISABLE_ATTRIBUTE_AUTOSAVE_took_0_ms" xml:space="preserve">
<data name="SMART_DISABLE_ATTRIBUTE_AUTOSAVE_took_0_ms" xml:space="preserve">
<value>SMART DISABLE ATTRIBUTE AUTOSAVE took {0} ms.</value>
</data>
<data name="SMART_ENABLE_OPERATIONS_took_0_ms" xml:space="preserve">
<data name="SMART_ENABLE_OPERATIONS_took_0_ms" xml:space="preserve">
<value>SMART ENABLE OPERATIONS took {0} ms.</value>
</data>
<data name="SMART_EXECUTE_OFF_LINE_IMMEDIATE_took_0_ms" xml:space="preserve">
<data name="SMART_EXECUTE_OFF_LINE_IMMEDIATE_took_0_ms" xml:space="preserve">
<value>SMART EXECUTE OFF-LINE IMMEDIATE took {0} ms.</value>
</data>
<data name="SMART_READ_DATA_took_0_ms" xml:space="preserve">
<data name="SMART_READ_DATA_took_0_ms" xml:space="preserve">
<value>SMART READ DATA took {0} ms.</value>
</data>
<data name="SMART_READ_LOG_took_0_ms" xml:space="preserve">
<data name="SMART_READ_LOG_took_0_ms" xml:space="preserve">
<value>SMART READ LOG took {0} ms.</value>
</data>
<data name="SMART_RETURN_STATUS_took_0_ms" xml:space="preserve">
<data name="SMART_RETURN_STATUS_took_0_ms" xml:space="preserve">
<value>SMART RETURN STATUS took {0} ms.</value>
</data>
<data name="SEND_CSD_took_0_ms" xml:space="preserve">
<data name="SEND_CSD_took_0_ms" xml:space="preserve">
<value>SEND_CSD took {0} ms.</value>
</data>
<data name="SEND_CID_took_0_ms" xml:space="preserve">
<data name="SEND_CID_took_0_ms" xml:space="preserve">
<value>SEND_CID took {0} ms.</value>
</data>
<data name="SEND_OP_COND_took_0_ms" xml:space="preserve">
<data name="SEND_OP_COND_took_0_ms" xml:space="preserve">
<value>SEND_OP_COND took {0} ms.</value>
</data>
<data name="SEND_EXT_CSD_took_0_ms" xml:space="preserve">
<data name="SEND_EXT_CSD_took_0_ms" xml:space="preserve">
<value>SEND_EXT_CSD took {0} ms.</value>
</data>
<data name="SET_BLOCKLEN_took_0_ms" xml:space="preserve">
<data name="SET_BLOCKLEN_took_0_ms" xml:space="preserve">
<value>SET_BLOCKLEN took {0} ms.</value>
</data>
<data name="READ_SINGLE_BLOCK_took_0_ms" xml:space="preserve">
<data name="READ_SINGLE_BLOCK_took_0_ms" xml:space="preserve">
<value>READ_SINGLE_BLOCK took {0} ms.</value>
</data>
<data name="READ_MULTIPLE_BLOCK_took_0_ms" xml:space="preserve">
<data name="READ_MULTIPLE_BLOCK_took_0_ms" xml:space="preserve">
<value>READ_MULTIPLE_BLOCK took {0} ms.</value>
</data>
<data name="Multiple_READ_SINGLE_BLOCKs_took_0_ms" xml:space="preserve">
<data name="Multiple_READ_SINGLE_BLOCKs_took_0_ms" xml:space="preserve">
<value>Multiple READ_SINGLE_BLOCKs took {0} ms.</value>
</data>
<data name="SEND_STATUS_took_0_ms" xml:space="preserve">
<data name="SEND_STATUS_took_0_ms" xml:space="preserve">
<value>SEND_STATUS took {0} ms.</value>
</data>
<data name="SD_STATUS_took_0_ms" xml:space="preserve">
<data name="SD_STATUS_took_0_ms" xml:space="preserve">
<value>SD_STATUS took {0} ms.</value>
</data>
<data name="SD_SEND_OP_COND_took_0_ms" xml:space="preserve">
<data name="SD_SEND_OP_COND_took_0_ms" xml:space="preserve">
<value>SD_SEND_OP_COND took {0} ms.</value>
</data>
<data name="SEND_SCR_took_0_ms" xml:space="preserve">
<data name="SEND_SCR_took_0_ms" xml:space="preserve">
<value>SEND_SCR took {0} ms.</value>
</data>
<data name="ADAPTEC_TRANSLATE_took_0_ms" xml:space="preserve">
<data name="ADAPTEC_TRANSLATE_took_0_ms" xml:space="preserve">
<value>ADAPTEC TRANSLATE took {0} ms.</value>
</data>
<data name="ADAPTEC_SET_ERROR_THRESHOLD_took_0_ms" xml:space="preserve">
<data name="ADAPTEC_SET_ERROR_THRESHOLD_took_0_ms" xml:space="preserve">
<value>ADAPTEC SET ERROR THRESHOLD took {0} ms.</value>
</data>
<data name="ADAPTEC_READ_RESET_USAGE_COUNTER_took_0_ms" xml:space="preserve">
<data name="ADAPTEC_READ_RESET_USAGE_COUNTER_took_0_ms" xml:space="preserve">
<value>ADAPTEC READ/RESET USAGE COUNTER took {0} ms.</value>
</data>
<data name="ADAPTEC_WRITE_DATA_BUFFER_took_0_ms" xml:space="preserve">
<data name="ADAPTEC_WRITE_DATA_BUFFER_took_0_ms" xml:space="preserve">
<value>ADAPTEC WRITE DATA BUFFER took {0} ms.</value>
</data>
<data name="ADAPTEC_READ_DATA_BUFFER_took_0_ms" xml:space="preserve">
<data name="ADAPTEC_READ_DATA_BUFFER_took_0_ms" xml:space="preserve">
<value>ADAPTEC READ DATA BUFFER took {0} ms.</value>
</data>
<data name="ARCHIVE_CORP_REQUEST_BLOCK_ADDRESS_took_0_ms" xml:space="preserve">
<data name="ARCHIVE_CORP_REQUEST_BLOCK_ADDRESS_took_0_ms" xml:space="preserve">
<value>ARCHIVE CORP. REQUEST BLOCK ADDRESS took {0} ms.</value>
</data>
<data name="ARCHIVE_CORP_SEEK_BLOCK_took_0_ms" xml:space="preserve">
<data name="ARCHIVE_CORP_SEEK_BLOCK_took_0_ms" xml:space="preserve">
<value>ARCHIVE CORP. SEEK BLOCK took {0} ms.</value>
</data>
<data name="CERTANCE_PARK_UNPARK_took_0_ms" xml:space="preserve">
<data name="CERTANCE_PARK_UNPARK_took_0_ms" xml:space="preserve">
<value>CERTANCE PARK UNPARK took {0} ms.</value>
</data>
<data name="FUJITSU_DISPLAY_took_0_ms" xml:space="preserve">
<data name="FUJITSU_DISPLAY_took_0_ms" xml:space="preserve">
<value>FUJITSU DISPLAY took {0} ms.</value>
</data>
<data name="HL_DT_ST_READ_DVD_RAW_took_0_ms" xml:space="preserve">
<data name="HL_DT_ST_READ_DVD_RAW_took_0_ms" xml:space="preserve">
<value>HL-DT-ST READ DVD (RAW) took {0} ms.</value>
</data>
<data name="HP_READ_LONG_took_0_ms" xml:space="preserve">
<data name="HP_READ_LONG_took_0_ms" xml:space="preserve">
<value>HP READ LONG took {0} ms.</value>
</data>
<data name="KREON_DEPRECATED_UNLOCK_took_0_ms" xml:space="preserve">
<data name="KREON_DEPRECATED_UNLOCK_took_0_ms" xml:space="preserve">
<value>KREON DEPRECATED UNLOCK took {0} ms.</value>
</data>
<data name="KREON_SET_LOCK_STATE_took_0_ms" xml:space="preserve">
<data name="KREON_SET_LOCK_STATE_took_0_ms" xml:space="preserve">
<value>KREON SET LOCK STATE took {0} ms.</value>
</data>
<data name="KREON_GET_FEATURE_LIST_took_0_ms" xml:space="preserve">
<data name="KREON_GET_FEATURE_LIST_took_0_ms" xml:space="preserve">
<value>KREON GET FEATURE LIST took {0} ms.</value>
</data>
<data name="KREON_EXTRACT_SS_took_0_ms" xml:space="preserve">
<data name="KREON_EXTRACT_SS_took_0_ms" xml:space="preserve">
<value>KREON EXTRACT SS took {0} ms.</value>
</data>
<data name="MediaTek_READ_DRAM_took_0_ms" xml:space="preserve">
<data name="MediaTek_READ_DRAM_took_0_ms" xml:space="preserve">
<value>MediaTek READ DRAM took {0} ms.</value>
</data>
<data name="MINIDISC_READ_DTOC_took_0_ms" xml:space="preserve">
<data name="MINIDISC_READ_DTOC_took_0_ms" xml:space="preserve">
<value>MINIDISC READ DTOC took {0} ms.</value>
</data>
<data name="MINIDISC_READ_UTOC_took_0_ms" xml:space="preserve">
<data name="MINIDISC_READ_UTOC_took_0_ms" xml:space="preserve">
<value>MINIDISC READ UTOC took {0} ms.</value>
</data>
<data name="MINIDISC_command_D5h_took_0_ms" xml:space="preserve">
<data name="MINIDISC_command_D5h_took_0_ms" xml:space="preserve">
<value>MINIDISC command D5h took {0} ms.</value>
</data>
<data name="MINIDISC_STOP_PLAY_took_0_ms" xml:space="preserve">
<data name="MINIDISC_STOP_PLAY_took_0_ms" xml:space="preserve">
<value>MINIDISC STOP PLAY took {0} ms.</value>
</data>
<data name="MINIDISC_READ_POSITION_took_0_ms" xml:space="preserve">
<data name="MINIDISC_READ_POSITION_took_0_ms" xml:space="preserve">
<value>MINIDISC READ POSITION took {0} ms.</value>
</data>
<data name="MINIDISC_GET_TYPE_took_0_ms" xml:space="preserve">
<data name="MINIDISC_GET_TYPE_took_0_ms" xml:space="preserve">
<value>MINIDISC GET TYPE took {0} ms.</value>
</data>
<data name="GET_CONFIGURATION_Starting_Feature_Number_1_Return_Type_2_Sense_3_Last_Error_4_took_0_ms"
xml:space="preserve">
<data name="GET_CONFIGURATION_Starting_Feature_Number_1_Return_Type_2_Sense_3_Last_Error_4_took_0_ms"
xml:space="preserve">
<value>GET CONFIGURATION (Starting Feature Number: {1}, Return Type: {2}, Sense: {3}, Last Error: {4}) took {0} ms.</value>
</data>
<data name="READ_DISC_STRUCTURE_Media_Type_1_Address_2_Layer_Number_3_Format_4_AGID_5_Sense_6_Last_Error_7_took_0_ms"
xml:space="preserve">
<data name="READ_DISC_STRUCTURE_Media_Type_1_Address_2_Layer_Number_3_Format_4_AGID_5_Sense_6_Last_Error_7_took_0_ms"
xml:space="preserve">
<value>READ DISC STRUCTURE (Media Type: {1}, Address: {2}, Layer Number: {3}, Format: {4}, AGID: {5}, Sense: {6}, Last Error: {7}) took {0} ms.</value>
</data>
<data name="READ_TOC_PMA_ATIP_took_MSF_1_Format_2_Track_Session_Number_3_Sense_4_LastError_5_0_ms"
xml:space="preserve">
<data name="READ_TOC_PMA_ATIP_took_MSF_1_Format_2_Track_Session_Number_3_Sense_4_LastError_5_0_ms"
xml:space="preserve">
<value>READ TOC/PMA/ATIP took (MSF: {1}, Format: {2}, Track/Session Number: {3}, Sense: {4}, LastError: {5}) {0} ms.</value>
</data>
<data name="READ_DISC_INFORMATION_Data_Type_1_Sense_2_Last_Error_3_took_0_ms" xml:space="preserve">
<data name="READ_DISC_INFORMATION_Data_Type_1_Sense_2_Last_Error_3_took_0_ms" xml:space="preserve">
<value>READ DISC INFORMATION (Data Type: {1}, Sense: {2}, Last Error: {3}) took {0} ms.</value>
</data>
<data
name="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"
xml:space="preserve">
<data
name="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"
xml:space="preserve">
<value>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.</value>
</data>
<data
name="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"
xml:space="preserve">
<data
name="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"
xml:space="preserve">
<value>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.</value>
</data>
<data name="PREVENT_ALLOW_MEDIUM_REMOVAL_Persistent_1_Prevent_2_Sense_3_LastError_4_took_0_ms" xml:space="preserve">
<data name="PREVENT_ALLOW_MEDIUM_REMOVAL_Persistent_1_Prevent_2_Sense_3_LastError_4_took_0_ms" xml:space="preserve">
<value>PREVENT ALLOW MEDIUM REMOVAL (Persistent: {1}, Prevent: {2}, Sense: {3}, LastError: {4}) took {0} ms.</value>
</data>
<data
name="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"
xml:space="preserve">
<data
name="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"
xml:space="preserve">
<value>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.</value>
</data>
<data name="READ_READ_SUB_CHANNEL_MCN_Sense_1_Last_Error_2_took_0_ms" xml:space="preserve">
<data name="READ_READ_SUB_CHANNEL_MCN_Sense_1_Last_Error_2_took_0_ms" xml:space="preserve">
<value>READ READ SUB-CHANNEL (MCN, Sense {1}, Last Error {2}) took {0} ms.</value>
</data>
<data name="READ_READ_SUB_CHANNEL_ISRC_Track_Number_1_Sense_2_Last_Error_3_took_0_ms" xml:space="preserve">
<data name="READ_READ_SUB_CHANNEL_ISRC_Track_Number_1_Sense_2_Last_Error_3_took_0_ms" xml:space="preserve">
<value>READ READ SUB-CHANNEL (ISRC, Track Number: {1}, Sense: {2}, Last Error: {3}) took {0} ms.</value>
</data>
<data name="SET_CD_SPEED_Rotational_Control_1_Read_Speed_2_Write_Speed_3_Sense_4_Last_Error_5_took_0_ms"
xml:space="preserve">
<data name="SET_CD_SPEED_Rotational_Control_1_Read_Speed_2_Write_Speed_3_Sense_4_Last_Error_5_took_0_ms"
xml:space="preserve">
<value>SET CD SPEED (Rotational Control: {1}, Read Speed: {2}, Write Speed: {3}, Sense: {4}, Last Error: {5}) took {0} ms.</value>
</data>
<data name="READ_TRACK_INFORMATION_Data_Type_1_Sense_2_Last_Error_3_took_0_ms" xml:space="preserve">
<data name="READ_TRACK_INFORMATION_Data_Type_1_Sense_2_Last_Error_3_took_0_ms" xml:space="preserve">
<value>READ TRACK INFORMATION (Data Type: {1}, Sense: {2}, Last Error: {3}) took {0} ms.</value>
</data>
<data name="NEC_READ_CD_DA_took_0_ms" xml:space="preserve">
<data name="NEC_READ_CD_DA_took_0_ms" xml:space="preserve">
<value>NEC READ CD-DA took {0} ms.</value>
</data>
<data name="MEDIUM_SCAN_took_0_ms" xml:space="preserve">
<data name="MEDIUM_SCAN_took_0_ms" xml:space="preserve">
<value>MEDIUM SCAN took {0} ms.</value>
</data>
<data name="PIONEER_READ_CD_DA_took_0_ms" xml:space="preserve">
<data name="PIONEER_READ_CD_DA_took_0_ms" xml:space="preserve">
<value>PIONEER READ CD-DA took {0} ms.</value>
</data>
<data name="PIONEER_READ_CD_DA_MSF_took_0_ms" xml:space="preserve">
<data name="PIONEER_READ_CD_DA_MSF_took_0_ms" xml:space="preserve">
<value>PIONEER READ CD-DA MSF took {0} ms.</value>
</data>
<data name="PIONEER_READ_CD_XA_took_0_ms" xml:space="preserve">
<data name="PIONEER_READ_CD_XA_took_0_ms" xml:space="preserve">
<value>PIONEER READ CD-XA took {0} ms.</value>
</data>
<data name="PLASMON_READ_SECTOR_LOCATION_took_0_ms" xml:space="preserve">
<data name="PLASMON_READ_SECTOR_LOCATION_took_0_ms" xml:space="preserve">
<value>PLASMON READ SECTOR LOCATION took {0} ms.</value>
</data>
<data name="Plextor_READ_CD_DA_LBA_1_Block_Size_2_Transfer_Length_3_Subchannel_4_Sense_5_Last_Error_6_took_0_ms"
xml:space="preserve">
<data name="Plextor_READ_CD_DA_LBA_1_Block_Size_2_Transfer_Length_3_Subchannel_4_Sense_5_Last_Error_6_took_0_ms"
xml:space="preserve">
<value>Plextor READ CD-DA (LBA: {1}, Block Size: {2}, Transfer Length: {3}, Subchannel: {4}, Sense: {5}, Last Error: {6}) took {0} ms.</value>
</data>
<data name="Plextor_READ_DVD_RAW_took_0_ms" xml:space="preserve">
<data name="Plextor_READ_DVD_RAW_took_0_ms" xml:space="preserve">
<value>Plextor READ DVD (RAW) took {0} ms.</value>
</data>
<data name="PLEXTOR_READ_EEPROM_took_0_ms" xml:space="preserve">
<data name="PLEXTOR_READ_EEPROM_took_0_ms" xml:space="preserve">
<value>PLEXTOR READ EEPROM took {0} ms.</value>
</data>
<data name="PLEXTOR_POWEREC_GET_SPEEDS_took_0_ms" xml:space="preserve">
<data name="PLEXTOR_POWEREC_GET_SPEEDS_took_0_ms" xml:space="preserve">
<value>PLEXTOR POWEREC GET SPEEDS took {0} ms.</value>
</data>
<data name="PLEXTOR_GET_SILENT_MODE_took_0_ms" xml:space="preserve">
<data name="PLEXTOR_GET_SILENT_MODE_took_0_ms" xml:space="preserve">
<value>PLEXTOR GET SILENT MODE took {0} ms.</value>
</data>
<data name="PLEXTOR_GET_GIGAREC_took_0_ms" xml:space="preserve">
<data name="PLEXTOR_GET_GIGAREC_took_0_ms" xml:space="preserve">
<value>PLEXTOR GET GIGAREC took {0} ms.</value>
</data>
<data name="PLEXTOR_GET_VARIREC_took_0_ms" xml:space="preserve">
<data name="PLEXTOR_GET_VARIREC_took_0_ms" xml:space="preserve">
<value>PLEXTOR GET VARIREC took {0} ms.</value>
</data>
<data name="PLEXTOR_GET_SECUREC_took_0_ms" xml:space="preserve">
<data name="PLEXTOR_GET_SECUREC_took_0_ms" xml:space="preserve">
<value>PLEXTOR GET SECUREC took {0} ms.</value>
</data>
<data name="PLEXTOR_GET_SPEEDREAD_took_0_ms" xml:space="preserve">
<data name="PLEXTOR_GET_SPEEDREAD_took_0_ms" xml:space="preserve">
<value>PLEXTOR GET SPEEDREAD took {0} ms.</value>
</data>
<data name="PLEXTOR_GET_SINGLE_SESSION_HIDE_CD_R_took_0_ms" xml:space="preserve">
<data name="PLEXTOR_GET_SINGLE_SESSION_HIDE_CD_R_took_0_ms" xml:space="preserve">
<value>PLEXTOR GET SINGLE-SESSION / HIDE CD-R took {0} ms.</value>
</data>
<data name="PLEXTOR_GET_BOOK_BITSETTING_took_0_ms" xml:space="preserve">
<data name="PLEXTOR_GET_BOOK_BITSETTING_took_0_ms" xml:space="preserve">
<value>PLEXTOR GET BOOK BITSETTING took {0} ms.</value>
</data>
<data name="PLEXTOR_GET_TEST_WRITE_DVD_took_0_ms" xml:space="preserve">
<data name="PLEXTOR_GET_TEST_WRITE_DVD_took_0_ms" xml:space="preserve">
<value>PLEXTOR GET TEST WRITE DVD+ took {0} ms.</value>
</data>
<data name="READ_6_took_0_ms" xml:space="preserve">
<data name="READ_6_took_0_ms" xml:space="preserve">
<value>READ (6) took {0} ms.</value>
</data>
<data name="READ_10_took_0_ms" xml:space="preserve">
<data name="READ_10_took_0_ms" xml:space="preserve">
<value>READ (10) took {0} ms.</value>
</data>
<data name="READ_12_took_0_ms" xml:space="preserve">
<data name="READ_12_took_0_ms" xml:space="preserve">
<value>READ (12) took {0} ms.</value>
</data>
<data name="READ_16_took_0_ms" xml:space="preserve">
<data name="READ_16_took_0_ms" xml:space="preserve">
<value>READ (16) took {0} ms.</value>
</data>
<data name="READ_LONG_10_took_0_ms" xml:space="preserve">
<data name="READ_LONG_10_took_0_ms" xml:space="preserve">
<value>READ LONG (10) took {0} ms.</value>
</data>
<data name="READ_LONG_16_took_0_ms" xml:space="preserve">
<data name="READ_LONG_16_took_0_ms" xml:space="preserve">
<value>READ LONG (16) took {0} ms.</value>
</data>
<data name="SEEK_6_took_0_ms" xml:space="preserve">
<data name="SEEK_6_took_0_ms" xml:space="preserve">
<value>SEEK (6) took {0} ms.</value>
</data>
<data name="SEEK_10_took_0_ms" xml:space="preserve">
<data name="SEEK_10_took_0_ms" xml:space="preserve">
<value>SEEK (10) took {0} ms.</value>
</data>
<data name="READ_ATTRIBUTE_took_0_ms" xml:space="preserve">
<data name="READ_ATTRIBUTE_took_0_ms" xml:space="preserve">
<value>READ ATTRIBUTE took {0} ms.</value>
</data>
<data name="INQUIRY_took_0_ms" xml:space="preserve">
<data name="INQUIRY_took_0_ms" xml:space="preserve">
<value>INQUIRY took {0} ms.</value>
</data>
<data name="TEST_UNIT_READY_took_0_ms" xml:space="preserve">
<data name="TEST_UNIT_READY_took_0_ms" xml:space="preserve">
<value>TEST UNIT READY took {0} ms.</value>
</data>
<data name="MODE_SENSE_6_took_0_ms" xml:space="preserve">
<data name="MODE_SENSE_6_took_0_ms" xml:space="preserve">
<value>MODE SENSE(6) took {0} ms.</value>
</data>
<data name="MODE_SENSE_10_took_0_ms" xml:space="preserve">
<data name="MODE_SENSE_10_took_0_ms" xml:space="preserve">
<value>MODE SENSE(10) took {0} ms.</value>
</data>
<data name="PREVENT_ALLOW_MEDIUM_REMOVAL_took_0_ms" xml:space="preserve">
<data name="PREVENT_ALLOW_MEDIUM_REMOVAL_took_0_ms" xml:space="preserve">
<value>PREVENT ALLOW MEDIUM REMOVAL took {0} ms.</value>
</data>
<data name="READ_CAPACITY_took_0_ms" xml:space="preserve">
<data name="READ_CAPACITY_took_0_ms" xml:space="preserve">
<value>READ CAPACITY took {0} ms.</value>
</data>
<data name="READ_CAPACITY_16_took_0_ms" xml:space="preserve">
<data name="READ_CAPACITY_16_took_0_ms" xml:space="preserve">
<value>READ CAPACITY(16) took {0} ms.</value>
</data>
<data name="READ_MEDIA_SERIAL_NUMBER_took_0_ms" xml:space="preserve">
<data name="READ_MEDIA_SERIAL_NUMBER_took_0_ms" xml:space="preserve">
<value>READ MEDIA SERIAL NUMBER took {0} ms.</value>
</data>
<data name="MODE_SELECT_6_took_0_ms" xml:space="preserve">
<data name="MODE_SELECT_6_took_0_ms" xml:space="preserve">
<value>MODE SELECT(6) took {0} ms.</value>
</data>
<data name="MODE_SELECT_10_took_0_ms" xml:space="preserve">
<data name="MODE_SELECT_10_took_0_ms" xml:space="preserve">
<value>MODE SELECT(10) took {0} ms.</value>
</data>
<data name="REQUEST_SENSE_took_0_ms" xml:space="preserve">
<data name="REQUEST_SENSE_took_0_ms" xml:space="preserve">
<value>REQUEST SENSE took {0} ms.</value>
</data>
<data name="LOAD_UNLOAD_6_took_0_ms" xml:space="preserve">
<data name="LOAD_UNLOAD_6_took_0_ms" xml:space="preserve">
<value>LOAD UNLOAD (6) took {0} ms.</value>
</data>
<data name="LOCATE_10_took_0_ms" xml:space="preserve">
<data name="LOCATE_10_took_0_ms" xml:space="preserve">
<value>LOCATE (10) took {0} ms.</value>
</data>
<data name="LOCATE_16_took_0_ms" xml:space="preserve">
<data name="LOCATE_16_took_0_ms" xml:space="preserve">
<value>LOCATE (16) took {0} ms.</value>
</data>
<data name="READ_BLOCK_LIMITS_took_0_ms" xml:space="preserve">
<data name="READ_BLOCK_LIMITS_took_0_ms" xml:space="preserve">
<value>READ BLOCK LIMITS took {0} ms.</value>
</data>
<data name="READ_POSITION_took_0_ms" xml:space="preserve">
<data name="READ_POSITION_took_0_ms" xml:space="preserve">
<value>READ POSITION took {0} ms.</value>
</data>
<data name="READ_REVERSE_6_took_0_ms" xml:space="preserve">
<data name="READ_REVERSE_6_took_0_ms" xml:space="preserve">
<value>READ REVERSE (6) took {0} ms.</value>
</data>
<data name="READ_REVERSE_16_took_0_ms" xml:space="preserve">
<data name="READ_REVERSE_16_took_0_ms" xml:space="preserve">
<value>READ REVERSE (16) took {0} ms.</value>
</data>
<data name="RECOVER_BUFFERED_DATA_took_0_ms" xml:space="preserve">
<data name="RECOVER_BUFFERED_DATA_took_0_ms" xml:space="preserve">
<value>RECOVER BUFFERED DATA took {0} ms.</value>
</data>
<data name="REPORT_DENSITY_SUPPORT_took_0_ms" xml:space="preserve">
<data name="REPORT_DENSITY_SUPPORT_took_0_ms" xml:space="preserve">
<value>REPORT DENSITY SUPPORT took {0} ms.</value>
</data>
<data name="REWIND_took_0_ms" xml:space="preserve">
<data name="REWIND_took_0_ms" xml:space="preserve">
<value>REWIND took {0} ms.</value>
</data>
<data name="TRACK_SELECT_took_0_ms" xml:space="preserve">
<data name="TRACK_SELECT_took_0_ms" xml:space="preserve">
<value>TRACK SELECT took {0} ms.</value>
</data>
<data name="SPACE_took_0_ms" xml:space="preserve">
<data name="SPACE_took_0_ms" xml:space="preserve">
<value>SPACE took {0} ms.</value>
</data>
<data name="SYQUEST_READ_6_took_0_ms" xml:space="preserve">
<data name="SYQUEST_READ_6_took_0_ms" xml:space="preserve">
<value>SYQUEST READ (6) took {0} ms.</value>
</data>
<data name="SYQUEST_READ_10_took_0_ms" xml:space="preserve">
<data name="SYQUEST_READ_10_took_0_ms" xml:space="preserve">
<value>SYQUEST READ (10) took {0} ms.</value>
</data>
<data name="Platform_0_not_yet_supported" xml:space="preserve">
<data name="Platform_0_not_yet_supported" xml:space="preserve">
<value>Platform {0} not yet supported.</value>
</data>
<data name="Invalid_remote_URI" xml:space="preserve">
<data name="Invalid_remote_URI" xml:space="preserve">
<value>Invalid remote URI.</value>
</data>
<data name="Error_connecting_to_host" xml:space="preserve">
<data name="Error_connecting_to_host" xml:space="preserve">
<value>Error connecting to host.</value>
</data>
<data name="Invalid_remote_protocol" xml:space="preserve">
<data name="Invalid_remote_protocol" xml:space="preserve">
<value>Invalid remote protocol.</value>
</data>
<data name="Host_not_found" xml:space="preserve">
<data name="Host_not_found" xml:space="preserve">
<value>Host not found</value>
</data>
<data name="Connected_to_0" xml:space="preserve">
<data name="Connected_to_0" xml:space="preserve">
<value>Connected to {0}</value>
</data>
<data name="Could_not_read_from_the_network" xml:space="preserve">
<data name="Could_not_read_from_the_network" xml:space="preserve">
<value>Could not read from the network...</value>
</data>
<data name="Received_data_is_not_an_Aaru_Remote_Packet" xml:space="preserve">
<data name="Received_data_is_not_an_Aaru_Remote_Packet" xml:space="preserve">
<value>Received data is not an Aaru Remote Packet...</value>
</data>
<data name="Expected_Hello_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_Hello_Packet_got_packet_type_0" xml:space="preserve">
<value>Expected Hello Packet, got packet type {0}...</value>
</data>
<data name="Unrecognized_packet_version" xml:space="preserve">
<data name="Unrecognized_packet_version" xml:space="preserve">
<value>Unrecognized packet version...</value>
</data>
<data name="Could_not_write_to_the_network" xml:space="preserve">
<data name="Could_not_write_to_the_network" xml:space="preserve">
<value>Could not write to the network...</value>
</data>
<data name="Remote_IsRoot_Expected_Am_I_Root_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Remote_IsRoot_Expected_Am_I_Root_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Expected Am I Root? Response Packet, got packet type {0}...</value>
</data>
<data name="Remote_ListDevices_Expected_List_Devices_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Remote_ListDevices_Expected_List_Devices_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Expected List Devices Response Packet, got packet type {0}...</value>
</data>
<data name="Expected_SCSI_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_SCSI_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Expected SCSI Response Packet, got packet type {0}...</value>
</data>
<data name="Expected_ATA_CHS_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_ATA_CHS_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Expected ATA CHS Response Packet, got packet type {0}...</value>
</data>
<data name="Expected_ATA_LBA28_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_ATA_LBA28_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Expected ATA LBA28 Response Packet, got packet type {0}...</value>
</data>
<data name="Expected_ATA_LBA48_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_ATA_LBA48_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Expected ATA LBA48 Response Packet, got packet type {0}...</value>
</data>
<data name="Expected_SDHCI_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_SDHCI_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Expected SDHCI Response Packet, got packet type {0}...</value>
</data>
<data name="Expected_Device_Type_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_Device_Type_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Expected Device Type Response Packet, got packet type {0}...</value>
</data>
<data name="Expected_USB_Data_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_USB_Data_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Expected USB Data Response Packet, got packet type {0}...</value>
</data>
<data name="Expected_FireWire_Data_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_FireWire_Data_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Expected FireWire Data Response Packet, got packet type {0}...</value>
</data>
<data name="Expected_PCMCIA_Data_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_PCMCIA_Data_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Expected PCMCIA Data Response Packet, got packet type {0}...</value>
</data>
<data name="Expected_multi_MMC_SD_command_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_multi_MMC_SD_command_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Expected multi MMC/SD command Response Packet, got packet type {0}...</value>
</data>
<data name="Expected_the_response_to_0_SD_MMC_commands_but_got_1_responses" xml:space="preserve">
<data name="Expected_the_response_to_0_SD_MMC_commands_but_got_1_responses" xml:space="preserve">
<value>Expected the response to {0} SD/MMC commands, but got {1} responses...</value>
</data>
<data name="Expected_NOP_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_NOP_Packet_got_packet_type_0" xml:space="preserve">
<value>Expected NOP Packet, got packet type {0}...</value>
</data>
<data name="ReOpen_error_closing_device" xml:space="preserve">
<data name="ReOpen_error_closing_device" xml:space="preserve">
<value>ReOpen error closing device...</value>
</data>
<data name="ReOpen_error_0_with_reason_1" xml:space="preserve">
<data name="ReOpen_error_0_with_reason_1" xml:space="preserve">
<value>ReOpen error {0} with reason: {1}...</value>
</data>
<data name="Expected_OS_Read_Response_Packet_got_packet_type_0" xml:space="preserve">
<data name="Expected_OS_Read_Response_Packet_got_packet_type_0" xml:space="preserve">
<value>Expected OS Read Response Packet, got packet type {0}...</value>
</data>
<data name="Remote_error_0_in_OS_Read" xml:space="preserve">
<data name="Remote_error_0_in_OS_Read" xml:space="preserve">
<value>Remote error {0} in OS Read...</value>
</data>
</root>

View File

@@ -41,7 +41,7 @@ namespace Aaru.Devices.Remote;
public partial class Device
{
/// <inheritdoc />
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
}
/// <inheritdoc />
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
/// <inheritdoc />
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;

View File

@@ -42,8 +42,11 @@ namespace Aaru.Devices.Remote;
/// <inheritdoc />
public sealed partial class Device : Devices.Device
{
bool? _isRemoteAdmin;
Remote _remote;
Device() {}
/// <summary>Returns if remote is running under administrative (aka root) privileges</summary>
public bool IsAdmin
{
@@ -57,21 +60,24 @@ public sealed partial class Device : Devices.Device
/// <summary>Current device is remote</summary>
public bool IsRemote => _remote != null;
/// <summary>Remote application</summary>
public string RemoteApplication => _remote?.ServerApplication;
/// <summary>Remote application server</summary>
public string RemoteVersion => _remote?.ServerVersion;
/// <summary>Remote operating system name</summary>
public string RemoteOperatingSystem => _remote?.ServerOperatingSystem;
/// <summary>Remote operating system version</summary>
public string RemoteOperatingSystemVersion => _remote?.ServerOperatingSystemVersion;
/// <summary>Remote architecture</summary>
public string RemoteArchitecture => _remote?.ServerArchitecture;
/// <summary>Remote protocol version</summary>
public int RemoteProtocolVersion => _remote?.ServerProtocolVersion ?? 0;
bool? _isRemoteAdmin;
Device() {}
/// <summary>Opens the device for sending direct commands</summary>
/// <param name="aaruUri">AaruRemote URI</param>
@@ -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;
}

View File

@@ -35,19 +35,41 @@ namespace Aaru.Devices.Remote;
/// <summary>Packet type enumeration</summary>
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
}
/// <summary>Reasons for non-data request or response</summary>

View File

@@ -89,7 +89,7 @@ public class Remote : IDisposable
AaruConsole.WriteLine(Localization.Connected_to_0, uri.Host);
byte[] hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
var hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
int len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek);
@@ -196,14 +196,19 @@ public class Remote : IDisposable
/// <summary>Remote server application</summary>
public string ServerApplication { get; }
/// <summary>Remote server application version</summary>
public string ServerVersion { get; }
/// <summary>Remote server operating system</summary>
public string ServerOperatingSystem { get; }
/// <summary>Remote server operating system version</summary>
public string ServerOperatingSystemVersion { get; }
/// <summary>Remote server architecture</summary>
public string ServerArchitecture { get; }
/// <summary>Remote server protocol version</summary>
public int ServerProtocolVersion { get; }
@@ -235,7 +240,7 @@ public class Remote : IDisposable
return false;
}
byte[] hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
var hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek);
@@ -281,9 +286,13 @@ public class Remote : IDisposable
}
}
#region IDisposable Members
/// <inheritdoc />
public void Dispose() => Disconnect();
#endregion
/// <summary>Disconnects from remote</summary>
public void Disconnect()
{
@@ -325,7 +334,7 @@ public class Remote : IDisposable
return Array.Empty<DeviceInfo>();
}
byte[] hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
var hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
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<DeviceInfo>();
}
@@ -446,7 +456,7 @@ public class Remote : IDisposable
return false;
}
byte[] hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
var hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
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
/// <c>True</c> if SCSI command returned non-OK status and <paramref name="senseBuffer" /> contains
/// SCSI sense
/// </param>
public int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout,
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<AaruPacketCmdScsi>() + 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<AaruPacketCmdScsi>());
@@ -565,7 +577,7 @@ public class Remote : IDisposable
return -1;
}
byte[] hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
var hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek);
@@ -659,7 +671,7 @@ public class Remote : IDisposable
cmdPkt.hdr.len = (uint)(Marshal.SizeOf<AaruPacketCmdAtaChs>() + 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<AaruPacketCmdAtaChs>());
@@ -675,7 +687,7 @@ public class Remote : IDisposable
return -1;
}
byte[] hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
var hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek);
@@ -739,8 +751,8 @@ public class Remote : IDisposable
/// <param name="duration">Time it took to execute the command in milliseconds</param>
/// <param name="sense"><c>True</c> if ATA/ATAPI command returned non-OK status</param>
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<AaruPacketCmdAtaLba28>() + 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<AaruPacketCmdAtaLba28>());
@@ -784,7 +796,7 @@ public class Remote : IDisposable
return -1;
}
byte[] hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
var hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek);
@@ -849,8 +861,8 @@ public class Remote : IDisposable
/// <param name="duration">Time it took to execute the command in milliseconds</param>
/// <param name="sense"><c>True</c> if ATA/ATAPI command returned non-OK status</param>
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<AaruPacketCmdAtaLba48>() + 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<AaruPacketCmdAtaLba48>());
@@ -894,7 +906,7 @@ public class Remote : IDisposable
return -1;
}
byte[] hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
var hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek);
@@ -994,7 +1006,7 @@ public class Remote : IDisposable
cmdPkt.hdr.len = (uint)(Marshal.SizeOf<AaruPacketCmdSdhci>() + 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<AaruPacketCmdSdhci>());
@@ -1010,7 +1022,7 @@ public class Remote : IDisposable
return -1;
}
byte[] hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
var hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
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<AaruPacketHeader>()];
var hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek);
@@ -1172,7 +1184,7 @@ public class Remote : IDisposable
return false;
}
byte[] hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
var hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
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
/// <param name="serial">USB serial number string</param>
/// <returns><c>true</c> if the device is attached via USB, <c>false</c> otherwise</returns>
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<AaruPacketHeader>()];
var hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek);
@@ -1363,7 +1376,7 @@ public class Remote : IDisposable
/// <param name="model">FireWire model string</param>
/// <param name="guid">FireWire GUID</param>
/// <returns><c>true</c> if the device is attached via FireWire, <c>false</c> otherwise</returns>
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<AaruPacketHeader>()];
var hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek);
@@ -1478,7 +1491,7 @@ public class Remote : IDisposable
return false;
}
byte[] hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
var hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek);
@@ -1535,7 +1548,7 @@ public class Remote : IDisposable
/// <returns>Retrieved number of bytes</returns>
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
/// <param name="timeout">Maximum allowed time to execute a single command</param>
/// <returns>0 if no error occurred, otherwise, errno</returns>
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<AaruPacketMultiCmdSdhci>() +
(Marshal.SizeOf<AaruCmdSdhci>() * commands.LongLength);
Marshal.SizeOf<AaruCmdSdhci>() * 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<AaruPacketHeader>()];
var hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek);
@@ -1708,7 +1721,7 @@ public class Remote : IDisposable
off = Marshal.SizeOf<AaruPacketMultiCmdSdhci>();
int error = 0;
var error = 0;
foreach(Devices.Device.MmcSingleCommand command in commands)
{
@@ -1750,16 +1763,16 @@ public class Remote : IDisposable
/// <param name="timeout">Maximum allowed time to execute a single command</param>
/// <returns>0 if no error occurred, otherwise, errno</returns>
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<AaruPacketHeader>()];
var hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
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<AaruPacketHeader>()];
var hdrBuf = new byte[Marshal.SizeOf<AaruPacketHeader>()];
len = Receive(_socket, hdrBuf, hdrBuf.Length, SocketFlags.Peek);

View File

@@ -44,7 +44,7 @@ namespace Aaru.Devices.Windows;
partial class Device
{
/// <inheritdoc />
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
}
/// <inheritdoc />
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
/// <inheritdoc />
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)
{

View File

@@ -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;
}

View File

@@ -234,7 +234,8 @@ enum ScsiIoctlDirection : byte
enum WindowsIoctl : uint
{
IoctlAtaPassThrough = 0x4D02C, IoctlAtaPassThroughDirect = 0x4D030,
IoctlAtaPassThrough = 0x4D02C,
IoctlAtaPassThroughDirect = 0x4D030,
/// <summary>ScsiPassThrough</summary>
IoctlScsiPassThrough = 0x4D004,
@@ -243,9 +244,12 @@ enum WindowsIoctl : uint
IoctlScsiPassThroughDirect = 0x4D014,
/// <summary>ScsiGetAddress</summary>
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
}

View File

@@ -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);
}

View File

@@ -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<string> deviceIDs = new List<string>();
var deviceIDs = new List<string>();
try
{
@@ -94,7 +94,7 @@ static class ListDevices
#endif
}
List<DeviceInfo> devList = new List<DeviceInfo>();
var devList = new List<DeviceInfo>();
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,

View File

@@ -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
{
/// <summary>Length in bytes of this structure</summary>
@@ -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;

View File

@@ -42,15 +42,16 @@ namespace Aaru.Devices.Windows;
// TODO: Even after cleaning, refactoring and xml-documenting, this code needs some love
/// <summary>Implements functions for getting and accessing information from the USB bus</summary>
[SuppressMessage("ReSharper", "UnusedMember.Local"), SuppressMessage("ReSharper", "UnusedType.Local")]
[SuppressMessage("ReSharper", "UnusedMember.Local")]
[SuppressMessage("ReSharper", "UnusedType.Local")]
static partial class Usb
{
/// <summary>Return a list of USB Host Controllers</summary>
/// <returns>List of USB Host Controllers</returns>
static IEnumerable<UsbController> GetHostControllers()
{
List<UsbController> hostList = new List<UsbController>();
var hostGuid = new Guid(GUID_DEVINTERFACE_HUBCONTROLLER);
var hostList = new List<UsbController>();
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
/// <returns>USB device description</returns>
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
/// <returns>Device instance ID</returns>
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
/// <summary>Represents a USB Host Controller</summary>
sealed class UsbController
{
@@ -339,6 +342,61 @@ static partial class Usb
}
}
#endregion
#region Nested type: UsbDevice
/// <summary>Represents an USB device</summary>
internal class UsbDevice
{
internal byte[] _binaryDeviceDescriptors;
internal UsbDeviceDescriptor _deviceDescriptor;
internal string _deviceDriverKey, _deviceHubDevicePath, _deviceInstanceId, _deviceName;
internal string _deviceManufacturer, _deviceProduct, _deviceSerialNumber;
internal int _devicePortNumber;
/// <summary>a simple default constructor</summary>
internal UsbDevice()
{
_devicePortNumber = 0;
_deviceHubDevicePath = "";
_deviceDriverKey = "";
_deviceManufacturer = "";
_deviceProduct = "Unknown USB Device";
_deviceSerialNumber = "";
_deviceName = "";
_deviceInstanceId = "";
_binaryDeviceDescriptors = null;
}
/// <summary>return Port Index of the Hub</summary>
internal int PortNumber => _devicePortNumber;
/// <summary>return the Device Path of the Hub (the parent device)</summary>
internal string HubDevicePath => _deviceHubDevicePath;
/// <summary>useful as a search key</summary>
internal string DriverKey => _deviceDriverKey;
/// <summary>the device path of this device</summary>
internal string InstanceId => _deviceInstanceId;
/// <summary>the friendly name</summary>
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
/// <summary>The Hub class</summary>
internal class UsbHub
{
@@ -396,7 +454,7 @@ static partial class Usb
/// <returns>List of downstream ports</returns>
internal IEnumerable<UsbPort> GetPorts()
{
List<UsbPort> portList = new List<UsbPort>();
var portList = new List<UsbPort>();
// 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
/// <summary>Represents an USB port</summary>
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
}
}
/// <summary>Represents an USB device</summary>
internal class UsbDevice
{
internal byte[] _binaryDeviceDescriptors;
internal UsbDeviceDescriptor _deviceDescriptor;
internal string _deviceDriverKey, _deviceHubDevicePath, _deviceInstanceId, _deviceName;
internal string _deviceManufacturer, _deviceProduct, _deviceSerialNumber;
internal int _devicePortNumber;
#endregion
/// <summary>a simple default constructor</summary>
internal UsbDevice()
{
_devicePortNumber = 0;
_deviceHubDevicePath = "";
_deviceDriverKey = "";
_deviceManufacturer = "";
_deviceProduct = "Unknown USB Device";
_deviceSerialNumber = "";
_deviceName = "";
_deviceInstanceId = "";
_binaryDeviceDescriptors = null;
}
#region "API Region"
/// <summary>return Port Index of the Hub</summary>
internal int PortNumber => _devicePortNumber;
/// <summary>return the Device Path of the Hub (the parent device)</summary>
internal string HubDevicePath => _deviceHubDevicePath;
/// <summary>useful as a search key</summary>
internal string DriverKey => _deviceDriverKey;
/// <summary>the device path of this device</summary>
internal string InstanceId => _deviceInstanceId;
/// <summary>the friendly name</summary>
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
}

View File

@@ -55,7 +55,7 @@ static partial class Usb
/// <returns>List of usb devices</returns>
internal static List<UsbDevice> GetConnectedDevices()
{
List<UsbDevice> devList = new List<UsbDevice>();
var devList = new List<UsbDevice>();
foreach(UsbController controller in GetHostControllers())
ListHub(controller.GetRootHub(), devList);
@@ -69,6 +69,7 @@ static partial class Usb
static void ListHub(UsbHub hub, ICollection<UsbDevice> 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());
}
}
}
/// <summary>Find a device based upon it's DriverKeyName</summary>
@@ -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;
}
}
}
/// <summary>Find a device based upon it's Instance ID</summary>
@@ -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
}