mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Code cleanup.
This commit is contained in:
@@ -50,26 +50,28 @@ namespace DiscImageChef.Devices
|
||||
/// <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 element,
|
||||
byte elementType, byte volume, byte partition, ushort firstAttribute, bool cache,
|
||||
uint timeout, out double duration)
|
||||
public bool ReadAttribute(out byte[] buffer, out byte[] senseBuffer, ScsiAttributeAction action,
|
||||
ushort element,
|
||||
byte elementType, byte volume, byte partition,
|
||||
ushort firstAttribute, bool cache,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[256];
|
||||
byte[] cdb = new byte[16];
|
||||
senseBuffer = new byte[32];
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ReadAttribute;
|
||||
cdb[1] = (byte)((byte)action & 0x1F);
|
||||
cdb[2] = (byte)((element & 0xFF00) >> 8);
|
||||
cdb[3] = (byte)(element & 0xFF);
|
||||
cdb[4] = (byte)(elementType & 0x0F);
|
||||
cdb[5] = volume;
|
||||
cdb[7] = partition;
|
||||
cdb[8] = (byte)((firstAttribute & 0xFF00) >> 8);
|
||||
cdb[9] = (byte)(firstAttribute & 0xFF);
|
||||
cdb[0] = (byte)ScsiCommands.ReadAttribute;
|
||||
cdb[1] = (byte)((byte)action & 0x1F);
|
||||
cdb[2] = (byte)((element & 0xFF00) >> 8);
|
||||
cdb[3] = (byte)(element & 0xFF);
|
||||
cdb[4] = (byte)(elementType & 0x0F);
|
||||
cdb[5] = volume;
|
||||
cdb[7] = partition;
|
||||
cdb[8] = (byte)((firstAttribute & 0xFF00) >> 8);
|
||||
cdb[9] = (byte)(firstAttribute & 0xFF);
|
||||
cdb[10] = (byte)((buffer.Length & 0xFF000000) >> 24);
|
||||
cdb[11] = (byte)((buffer.Length & 0xFF0000) >> 16);
|
||||
cdb[12] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
cdb[11] = (byte)((buffer.Length & 0xFF0000) >> 16);
|
||||
cdb[12] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
cdb[13] = (byte)(buffer.Length & 0xFF);
|
||||
if(cache) cdb[14] += 0x01;
|
||||
|
||||
@@ -80,11 +82,11 @@ namespace DiscImageChef.Devices
|
||||
if(sense) return true;
|
||||
|
||||
uint attrLen = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3] + 4);
|
||||
buffer = new byte[attrLen];
|
||||
cdb[10] = (byte)((buffer.Length & 0xFF000000) >> 24);
|
||||
cdb[11] = (byte)((buffer.Length & 0xFF0000) >> 16);
|
||||
cdb[12] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
cdb[13] = (byte)(buffer.Length & 0xFF);
|
||||
buffer = new byte[attrLen];
|
||||
cdb[10] = (byte)((buffer.Length & 0xFF000000) >> 24);
|
||||
cdb[11] = (byte)((buffer.Length & 0xFF0000) >> 16);
|
||||
cdb[12] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
cdb[13] = (byte)(buffer.Length & 0xFF);
|
||||
senseBuffer = new byte[32];
|
||||
|
||||
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
|
||||
Reference in New Issue
Block a user