* DiscImageChef.Console/DicConsole.cs:

Added methods without formatting.

	* DiscImageChef.Decoders/ATA.cs:
	  Typo.

	* DiscImageChef.Decoders/SCSI.cs:
	  Don't try to decode Version Descriptors if there are none.
	Also there are devices on the wild with less than 8 VDs.

	* DiscImageChef/Commands/DeviceInfo.cs:
	  Use a format-less output.
This commit is contained in:
2015-10-19 01:37:23 +01:00
parent e9e55162d9
commit b661febe57
7 changed files with 1474 additions and 1421 deletions

View File

@@ -1,3 +1,8 @@
2015-10-19 Natalia Portillo <claunia@claunia.com>
* DicConsole.cs:
Added methods without formatting.
2015-10-18 Natalia Portillo <claunia@claunia.com>
* DicConsole.cs:

View File

@@ -156,6 +156,31 @@ namespace DiscImageChef.Console
if (DebugWriteEvent != null)
DebugWriteEvent("", null);
}
public static void WriteLine(string format)
{
if (WriteLineEvent != null)
WriteLineEvent(format, null);
}
public static void ErrorWriteLine(string format)
{
if (ErrorWriteLineEvent != null)
ErrorWriteLineEvent(format, null);
}
public static void VerboseWriteLine(string format)
{
if (VerboseWriteLineEvent != null)
VerboseWriteLineEvent(format, null);
}
public static void DebugWriteLine(string module, string format)
{
if (DebugWriteLineEvent != null)
DebugWriteLineEvent("DEBUG (" + module + "): " + format, null);
}
}
}

View File

@@ -1853,7 +1853,7 @@ namespace DiscImageChef.Decoders
public static IdentifyDevice? DecodeIdentifyDevice(byte[] IdentifyDeviceResponse)
{
if (IdentifyDeviceResponse != null)
if (IdentifyDeviceResponse == null)
return null;
if (IdentifyDeviceResponse.Length != 512)

View File

@@ -1,3 +1,12 @@
2015-10-19 Natalia Portillo <claunia@claunia.com>
* ATA.cs:
Typo.
* SCSI.cs:
Don't try to decode Version Descriptors if there are none.
Also there are devices on the wild with less than 8 VDs.
2015-10-19 Natalia Portillo <claunia@claunia.com>
* ATA.cs:

View File

@@ -1989,13 +1989,19 @@ namespace DiscImageChef.Decoders
}
if (SCSIInquiryResponse.Length >= 58)
decoded.Reserved4 = SCSIInquiryResponse[57];
if (SCSIInquiryResponse.Length >= 60)
{
int descriptorsNo;
if (SCSIInquiryResponse.Length >= 74)
descriptorsNo = 8;
else
descriptorsNo = (SCSIInquiryResponse.Length - 58) / 2;
decoded.VersionDescriptors = new ushort[descriptorsNo];
for (int i = 0; i < descriptorsNo; i++)
{
decoded.VersionDescriptors = new ushort[8];
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
for (int i = 0; i < 8; i++)
{
decoded.VersionDescriptors[i] = BigEndianBitConverter.ToUInt16(SCSIInquiryResponse, 58 + (i * 2));
decoded.VersionDescriptors[i] = BitConverter.ToUInt16(SCSIInquiryResponse, 58 + (i * 2));
}
}
if (SCSIInquiryResponse.Length >= 75 && SCSIInquiryResponse.Length < 96)
@@ -2273,6 +2279,8 @@ namespace DiscImageChef.Decoders
break;
}
if (response.VersionDescriptors != null)
{
foreach (UInt16 VersionDescriptor in response.VersionDescriptors)
{
switch (VersionDescriptor)
@@ -3689,6 +3697,7 @@ namespace DiscImageChef.Decoders
break;
}
}
}
#if DEBUG
if(response.DeviceTypeModifier != 0)

View File

@@ -1,3 +1,8 @@
2015-10-19 Natalia Portillo <claunia@claunia.com>
* Commands/DeviceInfo.cs:
Use a format-less output.
2015-10-19 Natalia Portillo <claunia@claunia.com>
* Commands/Decode.cs:

View File

@@ -81,7 +81,7 @@ namespace DiscImageChef.Commands
else
DicConsole.WriteLine("SCSI OK");
DicConsole.WriteLine("{0}", Decoders.SCSI.PrettifySCSIInquiry(inqBuf));
DicConsole.WriteLine(Decoders.SCSI.PrettifySCSIInquiry(inqBuf));
Structs.AtaErrorRegistersCHS errorRegisters;
@@ -116,7 +116,7 @@ namespace DiscImageChef.Commands
else
{
DicConsole.WriteLine("ATAPI OK");
DicConsole.WriteLine("{0}", Decoders.ATA.PrettifyIdentifyDevice(ataBuf));
DicConsole.WriteLine(Decoders.ATA.PrettifyIdentifyDevice(ataBuf));
}
}
else
@@ -137,7 +137,7 @@ namespace DiscImageChef.Commands
else
{
DicConsole.WriteLine("ATA OK");
DicConsole.WriteLine("{0}", Decoders.ATA.PrettifyIdentifyDevice(ataBuf));
DicConsole.WriteLine(Decoders.ATA.PrettifyIdentifyDevice(ataBuf));
}
}
}