Skip to content

Commit

Permalink
On debug add more binary data from the responses to the report.
Browse files Browse the repository at this point in the history
  • Loading branch information
claunia committed Sep 5, 2017
1 parent 6d4c3f3 commit 5e2dff4
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 12 deletions.
4 changes: 3 additions & 1 deletion DiscImageChef.Core/Devices/Report/ATA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,9 @@ public static void Report(Device dev, ref DeviceReport report, bool debug, ref b
report.ATA.WRVSectorCountMode2 = ataId.WRVSectorCountMode2;
report.ATA.WRVSectorCountMode2Specified = true;
}

if(debug)
report.ATA.Identify = buffer;

if(removable)
{
List<testedMediaType> mediaTests = new List<testedMediaType>();
Expand Down
2 changes: 2 additions & 0 deletions DiscImageChef.Core/Devices/Report/ATAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ public static void Report(Device dev, ref DeviceReport report, bool debug, ref b
report.ATAPI.WRVSectorCountMode2 = atapiId.WRVSectorCountMode2;
report.ATAPI.WRVSectorCountMode2Specified = true;
}
if(debug)
report.ATAPI.Identify = buffer;
}
}
}
Expand Down
34 changes: 25 additions & 9 deletions DiscImageChef.Core/Devices/Report/SCSI/General.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ public static void Report(Device dev, ref DeviceReport report, bool debug, ref b
report.SCSI.Inquiry.SyncTransfer = inq.Sync;
report.SCSI.Inquiry.WideBus16 = inq.WBus16;
report.SCSI.Inquiry.WideBus32 = inq.WBus32;

if(debug)
report.SCSI.Inquiry.Data = buffer;
}

DicConsole.WriteLine("Querying list of SCSI EVPDs...");
Expand Down Expand Up @@ -233,47 +236,52 @@ public static void Report(Device dev, ref DeviceReport report, bool debug, ref b
Decoders.SCSI.PeripheralDeviceTypes devType = dev.SCSIType;

DicConsole.WriteLine("Querying all mode pages and subpages using SCSI MODE SENSE (10)...");
sense = dev.ModeSense10(out buffer, out senseBuffer, false, true, ScsiModeSensePageControl.Default, 0x3F, 0xFF, timeout, out duration);
sense = dev.ModeSense10(out byte[] mode10Buffer, out senseBuffer, false, true, ScsiModeSensePageControl.Default, 0x3F, 0xFF, timeout, out duration);
if(sense || dev.Error)
{
DicConsole.WriteLine("Querying all mode pages using SCSI MODE SENSE (10)...");
sense = dev.ModeSense10(out buffer, out senseBuffer, false, true, ScsiModeSensePageControl.Default, 0x3F, 0x00, timeout, out duration);
sense = dev.ModeSense10(out mode10Buffer, out senseBuffer, false, true, ScsiModeSensePageControl.Default, 0x3F, 0x00, timeout, out duration);
if(!sense && dev.Error)
{
report.SCSI.SupportsModeSense10 = true;
report.SCSI.SupportsModeSubpages = false;
decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, devType);
decMode = Decoders.SCSI.Modes.DecodeMode10(mode10Buffer, devType);
}
}
else
{
report.SCSI.SupportsModeSense10 = true;
report.SCSI.SupportsModeSubpages = true;
decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, devType);
decMode = Decoders.SCSI.Modes.DecodeMode10(mode10Buffer, devType);
}

DicConsole.WriteLine("Querying all mode pages and subpages using SCSI MODE SENSE (6)...");
sense = dev.ModeSense6(out buffer, out senseBuffer, false, ScsiModeSensePageControl.Default, 0x3F, 0xFF, timeout, out duration);
sense = dev.ModeSense6(out byte[] mode6Buffer, out senseBuffer, false, ScsiModeSensePageControl.Default, 0x3F, 0xFF, timeout, out duration);
if(sense || dev.Error)
{
DicConsole.WriteLine("Querying all mode pages using SCSI MODE SENSE (6)...");
sense = dev.ModeSense6(out buffer, out senseBuffer, false, ScsiModeSensePageControl.Default, 0x3F, 0x00, timeout, out duration);
sense = dev.ModeSense6(out mode6Buffer, out senseBuffer, false, ScsiModeSensePageControl.Default, 0x3F, 0x00, timeout, out duration);
if(sense || dev.Error)
{
DicConsole.WriteLine("Querying SCSI MODE SENSE (6)...");
sense = dev.ModeSense(out buffer, out senseBuffer, timeout, out duration);
sense = dev.ModeSense(out mode6Buffer, out senseBuffer, timeout, out duration);
}
}
else
report.SCSI.SupportsModeSubpages = true;

if(!sense && !dev.Error && !decMode.HasValue)
decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, devType);
decMode = Decoders.SCSI.Modes.DecodeMode6(mode6Buffer, devType);

report.SCSI.SupportsModeSense6 |= (!sense && !dev.Error);

Decoders.SCSI.Modes.ModePage_2A? cdromMode = null;

if(debug && report.SCSI.SupportsModeSense6)
report.SCSI.ModeSense6Data = mode6Buffer;
if(debug && report.SCSI.SupportsModeSense10)
report.SCSI.ModeSense10Data = mode10Buffer;

if(decMode.HasValue)
{
report.SCSI.ModeSense = new modeType();
Expand Down Expand Up @@ -320,7 +328,7 @@ public static void Report(Device dev, ref DeviceReport report, bool debug, ref b
if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
MMC.Report(dev, ref report, debug, ref cdromMode, ref mediaTypes);
else if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess)
SSC.Report(dev, ref report);
SSC.Report(dev, ref report, debug);
else
{
if(removable)
Expand Down Expand Up @@ -438,6 +446,8 @@ public static void Report(Device dev, ref DeviceReport report, bool debug, ref b
{
report.SCSI.SupportsModeSense10 = true;
decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.SCSIType);
if(debug)
mediaTest.ModeSense10Data = buffer;
}

DicConsole.WriteLine("Querying SCSI MODE SENSE...");
Expand All @@ -447,6 +457,8 @@ public static void Report(Device dev, ref DeviceReport report, bool debug, ref b
report.SCSI.SupportsModeSense6 = true;
if(!decMode.HasValue)
decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.SCSIType);
if(debug)
mediaTest.ModeSense6Data = buffer;
}

if(decMode.HasValue)
Expand Down Expand Up @@ -658,6 +670,8 @@ public static void Report(Device dev, ref DeviceReport report, bool debug, ref b
{
report.SCSI.SupportsModeSense10 = true;
decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.SCSIType);
if(debug)
report.SCSI.ReadCapabilities.ModeSense10Data = buffer;
}

DicConsole.WriteLine("Querying SCSI MODE SENSE...");
Expand All @@ -667,6 +681,8 @@ public static void Report(Device dev, ref DeviceReport report, bool debug, ref b
report.SCSI.SupportsModeSense6 = true;
if(!decMode.HasValue)
decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.SCSIType);
if(debug)
report.SCSI.ReadCapabilities.ModeSense10Data = buffer;
}

if(decMode.HasValue)
Expand Down
4 changes: 4 additions & 0 deletions DiscImageChef.Core/Devices/Report/SCSI/MMC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,8 @@ internal static void Report(Device dev, ref DeviceReport report, bool debug, ref
{
report.SCSI.SupportsModeSense10 = true;
decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.SCSIType);
if(debug)
mediaTest.ModeSense10Data = buffer;
}
DicConsole.WriteLine("Querying SCSI MODE SENSE...");
sense = dev.ModeSense(out buffer, out senseBuffer, timeout, out duration);
Expand All @@ -852,6 +854,8 @@ internal static void Report(Device dev, ref DeviceReport report, bool debug, ref
report.SCSI.SupportsModeSense6 = true;
if(!decMode.HasValue)
decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.SCSIType);
if(debug)
mediaTest.ModeSense6Data = buffer;
}

if(decMode.HasValue)
Expand Down
6 changes: 5 additions & 1 deletion DiscImageChef.Core/Devices/Report/SCSI/SSC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
{
internal static class SSC
{
internal static void Report(Device dev, ref DeviceReport report)
internal static void Report(Device dev, ref DeviceReport report, bool debug)
{
if(report == null)
return;
Expand Down Expand Up @@ -220,6 +220,8 @@ internal static void Report(Device dev, ref DeviceReport report)
{
report.SCSI.SupportsModeSense10 = true;
decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.SCSIType);
if(debug)
seqTest.ModeSense10Data = buffer;
}

DicConsole.WriteLine("Querying SCSI MODE SENSE...");
Expand All @@ -229,6 +231,8 @@ internal static void Report(Device dev, ref DeviceReport report)
report.SCSI.SupportsModeSense6 = true;
if(!decMode.HasValue)
decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.SCSIType);
if(debug)
seqTest.ModeSense6Data = buffer;
}

if(decMode.HasValue)
Expand Down
2 changes: 2 additions & 0 deletions DiscImageChef.Core/Devices/Report/USB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public static void Report(Device dev, ref DeviceReport report, bool debug, ref b

report.USB.RemovableMedia = pressedKey.Key == ConsoleKey.Y;
removable = report.USB.RemovableMedia;
if(debug)
report.USB.Descriptors = dev.USBDescriptors;
}
}
}
Expand Down
13 changes: 12 additions & 1 deletion DiscImageChef.Metadata/DeviceReport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public class usbType
public string Manufacturer { get; set; }
public string Product { get; set; }
public bool RemovableMedia { get; set; }
public byte[] Descriptors { get; set; }
}

public class firewireType
Expand Down Expand Up @@ -154,10 +155,11 @@ public class ataType
public uint WRVSectorCountMode3 { get; set; }
public uint WRVSectorCountMode2 { get; set; }

public byte[] Identify { get; set; }

public testedMediaType ReadCapabilities { get; set; }
public testedMediaType[] RemovableMedias { get; set; }


[XmlIgnore]
public bool AdditionalPIDSpecified { get; set; }
[XmlIgnore]
Expand Down Expand Up @@ -339,6 +341,8 @@ public class scsiType
public testedMediaType ReadCapabilities { get; set; }
public testedMediaType[] RemovableMedias { get; set; }
public sscType SequentialDevice { get; set; }
public byte[] ModeSense6Data { get; set; }
public byte[] ModeSense10Data { get; set; }

[XmlIgnore]
public bool ReadCapabilitiesSpecified { get; set; }
Expand Down Expand Up @@ -385,6 +389,7 @@ public class scsiInquiryType
public ushort[] VersionDescriptors { get; set; }
public bool WideBus16 { get; set; }
public bool WideBus32 { get; set; }
public byte[] Data { get; set; }

[XmlIgnore]
public bool ANSIVersionSpecified { get; set; }
Expand Down Expand Up @@ -750,6 +755,9 @@ public class testedMediaType
public bool SupportsReadLong16 { get; set; }
public bool SupportsReadLong { get; set; }

public byte[] ModeSense6Data { get; set; }
public byte[] ModeSense10Data { get; set; }

[XmlIgnore]
public bool BlocksSpecified { get; set; }
[XmlIgnore]
Expand Down Expand Up @@ -995,6 +1003,9 @@ public struct SequentialMedia
public SupportedDensity[] SupportedDensities { get; set; }
public SupportedMedia[] SupportedMediaTypes { get; set; }

public byte[] ModeSense6Data { get; set; }
public byte[] ModeSense10Data { get; set; }

[XmlIgnore]
public bool CanReadMediaSerialSpecified { get; set; }
[XmlIgnore]
Expand Down

0 comments on commit 5e2dff4

Please sign in to comment.