2017-12-19 03:50:57 +00:00
|
|
|
|
// /***************************************************************************
|
|
|
|
|
|
// The Disc Image Chef
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : ViewReport.aspx.cs
|
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
|
//
|
|
|
|
|
|
// Component : DiscImageChef Server.
|
|
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Renders a device report.
|
|
|
|
|
|
//
|
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// This library is free software; you can redistribute it and/or modify
|
|
|
|
|
|
// it under the terms of the GNU Lesser General Public License as
|
|
|
|
|
|
// published by the Free Software Foundation; either version 2.1 of the
|
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
|
//
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful, but
|
|
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
|
|
//
|
|
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
|
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
// Copyright © 2011-2018 Natalia Portillo
|
|
|
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
2017-12-19 19:33:46 +00:00
|
|
|
|
using System.Collections.Generic;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
using System.IO;
|
2017-12-19 19:33:46 +00:00
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Web;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
using System.Xml.Serialization;
|
|
|
|
|
|
using DiscImageChef.Decoders.SCSI;
|
2017-12-19 19:33:46 +00:00
|
|
|
|
using DiscImageChef.Metadata;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
using DiscImageChef.Server.App_Start;
|
2017-06-03 01:10:46 +01:00
|
|
|
|
|
|
|
|
|
|
namespace DiscImageChef.Server
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class ViewReport : System.Web.UI.Page
|
|
|
|
|
|
{
|
2017-06-03 01:19:47 +01:00
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
string manufacturer = Request.QueryString["manufacturer"];
|
|
|
|
|
|
string model = Request.QueryString["model"];
|
|
|
|
|
|
string revision = Request.QueryString["revision"];
|
2017-06-03 01:10:46 +01:00
|
|
|
|
|
2017-06-03 01:19:47 +01:00
|
|
|
|
// Strip non-ascii, strip slashes and question marks
|
|
|
|
|
|
if(manufacturer != null)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
manufacturer = Encoding
|
|
|
|
|
|
.ASCII.GetString(Encoding.Convert(Encoding.UTF8, Encoding.ASCII,
|
|
|
|
|
|
Encoding.UTF8.GetBytes(manufacturer))).Replace('/', '_')
|
|
|
|
|
|
.Replace('\\', '_').Replace('?', '_');
|
2017-06-03 01:19:47 +01:00
|
|
|
|
if(model != null)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
model = Encoding
|
|
|
|
|
|
.ASCII.GetString(Encoding.Convert(Encoding.UTF8, Encoding.ASCII, Encoding.UTF8.GetBytes(model)))
|
|
|
|
|
|
.Replace('/', '_').Replace('\\', '_').Replace('?', '_');
|
2017-06-03 01:19:47 +01:00
|
|
|
|
if(revision != null)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
revision = Encoding
|
|
|
|
|
|
.ASCII.GetString(Encoding.Convert(Encoding.UTF8, Encoding.ASCII,
|
|
|
|
|
|
Encoding.UTF8.GetBytes(revision))).Replace('/', '_')
|
|
|
|
|
|
.Replace('\\', '_').Replace('?', '_');
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
string xmlFile = null;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(!string.IsNullOrWhiteSpace(manufacturer) && !string.IsNullOrWhiteSpace(model) &&
|
|
|
|
|
|
!string.IsNullOrWhiteSpace(revision)) xmlFile = manufacturer + "_" + model + "_" + revision + ".xml";
|
2017-06-03 01:19:47 +01:00
|
|
|
|
else if(!string.IsNullOrWhiteSpace(manufacturer) && !string.IsNullOrWhiteSpace(model))
|
|
|
|
|
|
xmlFile = manufacturer + "_" + model + ".xml";
|
|
|
|
|
|
else if(!string.IsNullOrWhiteSpace(model) && !string.IsNullOrWhiteSpace(revision))
|
|
|
|
|
|
xmlFile = model + "_" + revision + ".xml";
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else if(!string.IsNullOrWhiteSpace(model)) xmlFile = model + ".xml";
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(xmlFile == null ||
|
|
|
|
|
|
!File.Exists(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Reports", xmlFile)))
|
2017-06-03 01:19:47 +01:00
|
|
|
|
{
|
|
|
|
|
|
content.InnerHtml = "<b>Could not find the specified report</b>";
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-06-05 17:46:27 +01:00
|
|
|
|
lblManufacturer.Text = Request.QueryString["manufacturer"];
|
|
|
|
|
|
lblModel.Text = Request.QueryString["model"];
|
|
|
|
|
|
lblRevision.Text = Request.QueryString["revision"];
|
|
|
|
|
|
|
2017-06-03 01:19:47 +01:00
|
|
|
|
DeviceReport report = new DeviceReport();
|
|
|
|
|
|
XmlSerializer xs = new XmlSerializer(report.GetType());
|
2017-12-19 20:33:03 +00:00
|
|
|
|
StreamReader sr =
|
|
|
|
|
|
new StreamReader(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Reports",
|
|
|
|
|
|
xmlFile));
|
2017-06-03 01:19:47 +01:00
|
|
|
|
report = (DeviceReport)xs.Deserialize(sr);
|
|
|
|
|
|
sr.Close();
|
|
|
|
|
|
|
|
|
|
|
|
if(report.USB != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
string usbVendorDescription = null;
|
|
|
|
|
|
string usbProductDescription = null;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
GetUsbDescriptions(report.USB.VendorID, report.USB.ProductID, out usbVendorDescription,
|
|
|
|
|
|
out usbProductDescription);
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
lblUsbManufacturer.Text = HttpUtility.HtmlEncode(report.USB.Manufacturer);
|
|
|
|
|
|
lblUsbProduct.Text = HttpUtility.HtmlEncode(report.USB.Product);
|
|
|
|
|
|
lblUsbVendor.Text = string.Format("0x{0:x4}", report.USB.VendorID);
|
|
|
|
|
|
if(usbVendorDescription != null)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
lblUsbVendorDescription.Text =
|
|
|
|
|
|
string.Format("({0})", HttpUtility.HtmlEncode(usbVendorDescription));
|
2017-06-03 01:19:47 +01:00
|
|
|
|
lblUsbProductId.Text = string.Format("0x{0:x4}", report.USB.ProductID);
|
|
|
|
|
|
if(usbProductDescription != null)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
lblUsbProductDescription.Text =
|
|
|
|
|
|
string.Format("({0})", HttpUtility.HtmlEncode(usbProductDescription));
|
2017-06-03 01:19:47 +01:00
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else divUsb.Visible = false;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
if(report.FireWire != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
lblFirewireManufacturer.Text = HttpUtility.HtmlEncode(report.FireWire.Manufacturer);
|
|
|
|
|
|
lblFirewireProduct.Text = HttpUtility.HtmlEncode(report.FireWire.Product);
|
|
|
|
|
|
lblFirewireVendor.Text = string.Format("0x{0:x8}", report.FireWire.VendorID);
|
|
|
|
|
|
lblFirewireProductId.Text = string.Format("0x{0:x8}", report.FireWire.ProductID);
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else divFirewire.Visible = false;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
if(report.PCMCIA != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
lblPcmciaManufacturer.Text = HttpUtility.HtmlEncode(report.PCMCIA.Manufacturer);
|
|
|
|
|
|
lblPcmciaProduct.Text = HttpUtility.HtmlEncode(report.PCMCIA.ProductName);
|
|
|
|
|
|
lblPcmciaManufacturerCode.Text = string.Format("0x{0:x4}", report.PCMCIA.ManufacturerCode);
|
|
|
|
|
|
lblPcmciaCardCode.Text = string.Format("0x{0:x4}", report.PCMCIA.CardCode);
|
|
|
|
|
|
lblPcmciaCompliance.Text = HttpUtility.HtmlEncode(report.PCMCIA.Compliance);
|
|
|
|
|
|
Decoders.PCMCIA.Tuple[] tuples = Decoders.PCMCIA.CIS.GetTuples(report.PCMCIA.CIS);
|
|
|
|
|
|
if(tuples != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
Dictionary<string, string> decodedTuples = new Dictionary<string, string>();
|
|
|
|
|
|
foreach(Decoders.PCMCIA.Tuple tuple in tuples)
|
|
|
|
|
|
{
|
|
|
|
|
|
switch(tuple.Code)
|
|
|
|
|
|
{
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_NULL:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_END:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_MANFID:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_VERS_1: break;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICEGEO:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICEGEO_A:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
Decoders.PCMCIA.DeviceGeometryTuple geom =
|
|
|
|
|
|
Decoders.PCMCIA.CIS.DecodeDeviceGeometryTuple(tuple.Data);
|
2017-06-03 01:19:47 +01:00
|
|
|
|
if(geom != null && geom.Geometries != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach(Decoders.PCMCIA.DeviceGeometry geometry in geom.Geometries)
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
decodedTuples.Add("Device width",
|
|
|
|
|
|
string.Format("{0} bits",
|
|
|
|
|
|
(1 << (geometry.CardInterface - 1)) * 8));
|
|
|
|
|
|
decodedTuples.Add("Erase block",
|
|
|
|
|
|
string.Format("{0} bytes",
|
|
|
|
|
|
(1 << (geometry.EraseBlockSize - 1)) *
|
|
|
|
|
|
(1 << (geometry.Interleaving - 1))));
|
|
|
|
|
|
decodedTuples.Add("Read block",
|
|
|
|
|
|
string.Format("{0} bytes",
|
|
|
|
|
|
(1 << (geometry.ReadBlockSize - 1)) *
|
|
|
|
|
|
(1 << (geometry.Interleaving - 1))));
|
|
|
|
|
|
decodedTuples.Add("Write block",
|
|
|
|
|
|
string.Format("{0} bytes",
|
|
|
|
|
|
(1 << (geometry.WriteBlockSize - 1)) *
|
|
|
|
|
|
(1 << (geometry.Interleaving - 1))));
|
|
|
|
|
|
decodedTuples.Add("Partition alignment",
|
|
|
|
|
|
string.Format("{0} bytes",
|
|
|
|
|
|
(1 << (geometry.EraseBlockSize - 1)) *
|
|
|
|
|
|
(1 << (geometry.Interleaving - 1)) *
|
|
|
|
|
|
(1 << (geometry.Partitions - 1))));
|
2017-06-03 01:19:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-06-03 01:19:47 +01:00
|
|
|
|
break;
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_ALTSTR:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_BAR:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_BATTERY:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_BYTEORDER:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_CFTABLE_ENTRY:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_CFTABLE_ENTRY_CB:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_CHECKSUM:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_CONFIG:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_CONFIG_CB:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_DATE:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICE:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICE_A:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICE_OA:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICE_OC:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_EXTDEVIC:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_FORMAT:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_FORMAT_A:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_FUNCE:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_FUNCID:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_GEOMETRY:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_INDIRECT:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_JEDEC_A:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_JEDEC_C:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_LINKTARGET:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_LONGLINK_A:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_LONGLINK_C:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_LONGLINK_CB:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_LONGLINK_MFC:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_NO_LINK:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_ORG:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_PWR_MGMNT:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_SPCL:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_SWIL:
|
|
|
|
|
|
case Decoders.PCMCIA.TupleCodes.CISTPL_VERS_2:
|
|
|
|
|
|
decodedTuples.Add("Undecoded tuple ID", tuple.Code.ToString());
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
decodedTuples.Add("Unknown tuple ID", string.Format("0x{0:X2}", (byte)tuple.Code));
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(decodedTuples.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
repPcmciaTuples.DataSource = decodedTuples;
|
|
|
|
|
|
repPcmciaTuples.DataBind();
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else repPcmciaTuples.Visible = false;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else repPcmciaTuples.Visible = false;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else divPcmcia.Visible = false;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
bool removable = true;
|
|
|
|
|
|
testedMediaType[] testedMedia = null;
|
|
|
|
|
|
bool ata = false;
|
|
|
|
|
|
bool atapi = false;
|
|
|
|
|
|
bool sscMedia = false;
|
|
|
|
|
|
|
|
|
|
|
|
if(report.ATA != null || report.ATAPI != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
ata = true;
|
|
|
|
|
|
List<string> ataOneValue = new List<string>();
|
|
|
|
|
|
Dictionary<string, string> ataTwoValue = new Dictionary<string, string>();
|
|
|
|
|
|
ataType ataReport;
|
|
|
|
|
|
|
|
|
|
|
|
if(report.ATAPI != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
lblAtapi.Text = "PI";
|
|
|
|
|
|
ataReport = report.ATAPI;
|
|
|
|
|
|
atapi = true;
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else ataReport = report.ATA;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
bool cfa = report.CompactFlashSpecified && report.CompactFlash;
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(atapi && !cfa) lblAtaDeviceType.Text = "ATAPI device";
|
|
|
|
|
|
else if(!atapi && cfa) lblAtaDeviceType.Text = "CompactFlash device";
|
|
|
|
|
|
else lblAtaDeviceType.Text = "ATA device";
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
Ata.Report(ataReport, cfa, atapi, ref removable, ref ataOneValue, ref ataTwoValue, ref testedMedia);
|
|
|
|
|
|
|
|
|
|
|
|
repAtaOne.DataSource = ataOneValue;
|
|
|
|
|
|
repAtaOne.DataBind();
|
|
|
|
|
|
repAtaTwo.DataSource = ataTwoValue;
|
|
|
|
|
|
repAtaTwo.DataBind();
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else divAta.Visible = false;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
if(report.SCSI != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<string> scsiOneValue = new List<string>();
|
|
|
|
|
|
Dictionary<string, string> modePages = new Dictionary<string, string>();
|
|
|
|
|
|
Dictionary<string, string> evpdPages = new Dictionary<string, string>();
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(VendorString.Prettify(report.SCSI.Inquiry.VendorIdentification) !=
|
|
|
|
|
|
report.SCSI.Inquiry.VendorIdentification)
|
|
|
|
|
|
lblScsiVendor.Text = string.Format("{0} ({1})", report.SCSI.Inquiry.VendorIdentification,
|
|
|
|
|
|
VendorString.Prettify(report.SCSI.Inquiry
|
|
|
|
|
|
.VendorIdentification));
|
|
|
|
|
|
else lblScsiVendor.Text = report.SCSI.Inquiry.VendorIdentification;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
lblScsiProduct.Text = report.SCSI.Inquiry.ProductIdentification;
|
|
|
|
|
|
lblScsiRevision.Text = report.SCSI.Inquiry.ProductRevisionLevel;
|
|
|
|
|
|
|
|
|
|
|
|
scsiOneValue.AddRange(ScsiInquiry.Report(report.SCSI.Inquiry));
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(report.SCSI.SupportsModeSense6) scsiOneValue.Add("Device supports MODE SENSE (6)");
|
|
|
|
|
|
if(report.SCSI.SupportsModeSense10) scsiOneValue.Add("Device supports MODE SENSE (10)");
|
|
|
|
|
|
if(report.SCSI.SupportsModeSubpages) scsiOneValue.Add("Device supports MODE SENSE subpages");
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
if(report.SCSI.ModeSense != null)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
ScsiModeSense.Report(report.SCSI.ModeSense, report.SCSI.Inquiry.VendorIdentification,
|
|
|
|
|
|
report.SCSI.Inquiry.PeripheralDeviceType, ref scsiOneValue, ref modePages);
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
if(modePages.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
repModeSense.DataSource = modePages;
|
|
|
|
|
|
repModeSense.DataBind();
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else divScsiModeSense.Visible = false;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
if(report.SCSI.EVPDPages != null)
|
|
|
|
|
|
ScsiEvpd.Report(report.SCSI.EVPDPages, report.SCSI.Inquiry.VendorIdentification, ref evpdPages);
|
|
|
|
|
|
|
|
|
|
|
|
if(evpdPages.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
repEvpd.DataSource = evpdPages;
|
|
|
|
|
|
repEvpd.DataBind();
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else divScsiEvpd.Visible = false;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
divScsiMmcMode.Visible = false;
|
|
|
|
|
|
divScsiMmcFeatures.Visible = false;
|
|
|
|
|
|
divScsiSsc.Visible = false;
|
|
|
|
|
|
|
|
|
|
|
|
if(report.SCSI.MultiMediaDevice != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
testedMedia = report.SCSI.MultiMediaDevice.TestedMedia;
|
|
|
|
|
|
|
|
|
|
|
|
if(report.SCSI.MultiMediaDevice.ModeSense2A != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<string> mmcModeOneValue = new List<string>();
|
|
|
|
|
|
ScsiMmcMode.Report(report.SCSI.MultiMediaDevice.ModeSense2A, ref mmcModeOneValue);
|
|
|
|
|
|
if(mmcModeOneValue.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
divScsiMmcMode.Visible = true;
|
|
|
|
|
|
repScsiMmcMode.DataSource = mmcModeOneValue;
|
|
|
|
|
|
repScsiMmcMode.DataBind();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(report.SCSI.MultiMediaDevice.Features != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<string> mmcFeaturesOneValue = new List<string>();
|
|
|
|
|
|
ScsiMmcFeatures.Report(report.SCSI.MultiMediaDevice.Features, ref mmcFeaturesOneValue);
|
|
|
|
|
|
if(mmcFeaturesOneValue.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
divScsiMmcFeatures.Visible = true;
|
|
|
|
|
|
repScsiMmcFeatures.DataSource = mmcFeaturesOneValue;
|
|
|
|
|
|
repScsiMmcFeatures.DataBind();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else if(report.SCSI.SequentialDevice != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
divScsiSsc.Visible = true;
|
|
|
|
|
|
|
|
|
|
|
|
if(report.SCSI.SequentialDevice.BlockSizeGranularitySpecified)
|
|
|
|
|
|
lblScsiSscGranularity.Text = report.SCSI.SequentialDevice.BlockSizeGranularity.ToString();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else lblScsiSscGranularity.Text = "Unspecified";
|
|
|
|
|
|
|
2017-06-03 01:19:47 +01:00
|
|
|
|
if(report.SCSI.SequentialDevice.MaxBlockLengthSpecified)
|
|
|
|
|
|
lblScsiSscMaxBlock.Text = report.SCSI.SequentialDevice.MaxBlockLength.ToString();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else lblScsiSscMaxBlock.Text = "Unspecified";
|
|
|
|
|
|
|
2017-06-03 01:19:47 +01:00
|
|
|
|
if(report.SCSI.SequentialDevice.MinBlockLengthSpecified)
|
|
|
|
|
|
lblScsiSscMinBlock.Text = report.SCSI.SequentialDevice.MinBlockLength.ToString();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else lblScsiSscMinBlock.Text = "Unspecified";
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
if(report.SCSI.SequentialDevice.SupportedDensities != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
repScsiSscDensities.DataSource = report.SCSI.SequentialDevice.SupportedDensities;
|
|
|
|
|
|
repScsiSscDensities.DataBind();
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else repScsiSscDensities.Visible = false;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
if(report.SCSI.SequentialDevice.SupportedMediaTypes != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
repScsiSscMedias.DataSource = report.SCSI.SequentialDevice.SupportedMediaTypes;
|
|
|
|
|
|
repScsiSscMedias.DataBind();
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else repScsiSscMedias.Visible = false;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
if(report.SCSI.SequentialDevice.TestedMedia != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<string> mediaOneValue = new List<string>();
|
|
|
|
|
|
SscTestedMedia.Report(report.SCSI.SequentialDevice.TestedMedia, ref mediaOneValue);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(mediaOneValue.Count > 0)
|
2017-06-03 01:19:47 +01:00
|
|
|
|
{
|
|
|
|
|
|
sscMedia = true;
|
|
|
|
|
|
repTestedMedia.DataSource = mediaOneValue;
|
|
|
|
|
|
repTestedMedia.DataBind();
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else divTestedMedia.Visible = false;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else divTestedMedia.Visible = false;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
else if(report.SCSI.ReadCapabilities != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
removable = false;
|
2017-06-05 18:21:32 +01:00
|
|
|
|
scsiOneValue.Add("");
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(report.SCSI.ReadCapabilities.BlocksSpecified &&
|
|
|
|
|
|
report.SCSI.ReadCapabilities.BlockSizeSpecified)
|
2017-06-03 01:19:47 +01:00
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
scsiOneValue.Add(string.Format("Device has {0} blocks of {1} bytes each",
|
|
|
|
|
|
report.SCSI.ReadCapabilities.Blocks,
|
|
|
|
|
|
report.SCSI.ReadCapabilities.BlockSize));
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(((report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 /
|
|
|
|
|
|
1024) > 1000000)
|
2017-06-03 01:19:47 +01:00
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
scsiOneValue.Add(string.Format("Device size: {0} bytes, {1} Tb, {2:F2} TiB",
|
|
|
|
|
|
report.SCSI.ReadCapabilities.Blocks *
|
|
|
|
|
|
report.SCSI.ReadCapabilities.BlockSize,
|
|
|
|
|
|
(report.SCSI.ReadCapabilities.Blocks *
|
|
|
|
|
|
report.SCSI.ReadCapabilities.BlockSize) / 1000 / 1000 /
|
|
|
|
|
|
1000 / 1000,
|
|
|
|
|
|
(double)(report.SCSI.ReadCapabilities.Blocks *
|
|
|
|
|
|
report.SCSI.ReadCapabilities.BlockSize) / 1024 /
|
|
|
|
|
|
1024 / 1024 / 1024));
|
2017-06-03 01:19:47 +01:00
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else if(
|
|
|
|
|
|
((report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 /
|
|
|
|
|
|
1024) > 1000)
|
2017-06-03 01:19:47 +01:00
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
scsiOneValue.Add(string.Format("Device size: {0} bytes, {1} Gb, {2:F2} GiB",
|
|
|
|
|
|
report.SCSI.ReadCapabilities.Blocks *
|
|
|
|
|
|
report.SCSI.ReadCapabilities.BlockSize,
|
|
|
|
|
|
(report.SCSI.ReadCapabilities.Blocks *
|
|
|
|
|
|
report.SCSI.ReadCapabilities.BlockSize) / 1000 / 1000 /
|
|
|
|
|
|
1000,
|
|
|
|
|
|
(double)(report.SCSI.ReadCapabilities.Blocks *
|
|
|
|
|
|
report.SCSI.ReadCapabilities.BlockSize) / 1024 /
|
|
|
|
|
|
1024 / 1024));
|
2017-06-03 01:19:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
scsiOneValue.Add(string.Format("Device size: {0} bytes, {1} Mb, {2:F2} MiB",
|
|
|
|
|
|
report.SCSI.ReadCapabilities.Blocks *
|
|
|
|
|
|
report.SCSI.ReadCapabilities.BlockSize,
|
|
|
|
|
|
(report.SCSI.ReadCapabilities.Blocks *
|
|
|
|
|
|
report.SCSI.ReadCapabilities.BlockSize) / 1000 / 1000,
|
|
|
|
|
|
(double)(report.SCSI.ReadCapabilities.Blocks *
|
|
|
|
|
|
report.SCSI.ReadCapabilities.BlockSize) / 1024 /
|
|
|
|
|
|
1024));
|
2017-06-03 01:19:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(report.SCSI.ReadCapabilities.MediumTypeSpecified)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
scsiOneValue.Add(string.Format("Medium type code: {0:X2}h",
|
|
|
|
|
|
report.SCSI.ReadCapabilities.MediumType));
|
2017-06-03 01:19:47 +01:00
|
|
|
|
if(report.SCSI.ReadCapabilities.DensitySpecified)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
scsiOneValue.Add(string.Format("Density code: {0:X2}h",
|
|
|
|
|
|
report.SCSI.ReadCapabilities.Density));
|
|
|
|
|
|
if((report.SCSI.ReadCapabilities.SupportsReadLong ||
|
|
|
|
|
|
report.SCSI.ReadCapabilities.SupportsReadLong16) &&
|
2017-06-03 01:19:47 +01:00
|
|
|
|
report.SCSI.ReadCapabilities.LongBlockSizeSpecified)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
scsiOneValue.Add(string.Format("Long block size: {0} bytes",
|
|
|
|
|
|
report.SCSI.ReadCapabilities.LongBlockSize));
|
2017-06-03 01:19:47 +01:00
|
|
|
|
if(report.SCSI.ReadCapabilities.SupportsReadCapacity)
|
|
|
|
|
|
scsiOneValue.Add("Device supports READ CAPACITY (10) command.");
|
|
|
|
|
|
if(report.SCSI.ReadCapabilities.SupportsReadCapacity16)
|
|
|
|
|
|
scsiOneValue.Add("Device supports READ CAPACITY (16) command.");
|
|
|
|
|
|
if(report.SCSI.ReadCapabilities.SupportsRead)
|
|
|
|
|
|
scsiOneValue.Add("Device supports READ (6) command.");
|
|
|
|
|
|
if(report.SCSI.ReadCapabilities.SupportsRead10)
|
|
|
|
|
|
scsiOneValue.Add("Device supports READ (10) command.");
|
|
|
|
|
|
if(report.SCSI.ReadCapabilities.SupportsRead12)
|
|
|
|
|
|
scsiOneValue.Add("Device supports READ (12) command.");
|
|
|
|
|
|
if(report.SCSI.ReadCapabilities.SupportsRead16)
|
|
|
|
|
|
scsiOneValue.Add("Device supports READ (16) command.");
|
|
|
|
|
|
if(report.SCSI.ReadCapabilities.SupportsReadLong)
|
|
|
|
|
|
scsiOneValue.Add("Device supports READ LONG (10) command.");
|
|
|
|
|
|
if(report.SCSI.ReadCapabilities.SupportsReadLong16)
|
|
|
|
|
|
scsiOneValue.Add("Device supports READ LONG (16) command.");
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else testedMedia = report.SCSI.RemovableMedias;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
repScsi.DataSource = scsiOneValue;
|
|
|
|
|
|
repScsi.DataBind();
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else divScsi.Visible = false;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
2017-09-29 15:36:15 +01:00
|
|
|
|
if(report.MultiMediaCard != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<string> mmcOneValue = new List<string>();
|
|
|
|
|
|
|
|
|
|
|
|
if(report.MultiMediaCard.CID != null)
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCID(report.MultiMediaCard.CID)
|
|
|
|
|
|
.Replace("\n", "<br/>"));
|
2017-09-29 15:36:15 +01:00
|
|
|
|
mmcOneValue.Add("");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(report.MultiMediaCard.CSD != null)
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCSD(report.MultiMediaCard.CSD)
|
|
|
|
|
|
.Replace("\n", "<br/>"));
|
2017-09-29 15:36:15 +01:00
|
|
|
|
mmcOneValue.Add("");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(report.MultiMediaCard.ExtendedCSD != null)
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyExtendedCSD(report.MultiMediaCard.ExtendedCSD)
|
|
|
|
|
|
.Replace("\n", "<br/>"));
|
2017-09-29 15:36:15 +01:00
|
|
|
|
mmcOneValue.Add("");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(report.MultiMediaCard.OCR != null)
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCSD(report.MultiMediaCard.OCR)
|
|
|
|
|
|
.Replace("\n", "<br/>"));
|
2017-09-29 15:36:15 +01:00
|
|
|
|
mmcOneValue.Add("");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
repMMC.DataSource = mmcOneValue;
|
|
|
|
|
|
repMMC.DataBind();
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else divMMC.Visible = false;
|
2017-09-29 15:36:15 +01:00
|
|
|
|
|
|
|
|
|
|
if(report.SecureDigital != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<string> sdOneValue = new List<string>();
|
|
|
|
|
|
|
|
|
|
|
|
if(report.SecureDigital.CID != null)
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCID(report.SecureDigital.CID)
|
|
|
|
|
|
.Replace("\n", "<br/>"));
|
2017-09-29 15:36:15 +01:00
|
|
|
|
sdOneValue.Add("");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(report.SecureDigital.CSD != null)
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCSD(report.SecureDigital.CSD)
|
|
|
|
|
|
.Replace("\n", "<br/>"));
|
2017-09-29 15:36:15 +01:00
|
|
|
|
sdOneValue.Add("");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(report.SecureDigital.SCR != null)
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifySCR(report.SecureDigital.SCR)
|
|
|
|
|
|
.Replace("\n", "<br/>"));
|
2017-09-29 15:36:15 +01:00
|
|
|
|
sdOneValue.Add("");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(report.SecureDigital.OCR != null)
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCSD(report.SecureDigital.OCR)
|
|
|
|
|
|
.Replace("\n", "<br/>"));
|
2017-09-29 15:36:15 +01:00
|
|
|
|
sdOneValue.Add("");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
repSD.DataSource = sdOneValue;
|
|
|
|
|
|
repSD.DataBind();
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else divSD.Visible = false;
|
2017-09-29 15:36:15 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(removable && !sscMedia && testedMedia != null)
|
2017-06-03 01:19:47 +01:00
|
|
|
|
{
|
|
|
|
|
|
List<string> mediaOneValue = new List<string>();
|
|
|
|
|
|
TestedMedia.Report(testedMedia, ata, ref mediaOneValue);
|
|
|
|
|
|
if(mediaOneValue.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
sscMedia = true;
|
|
|
|
|
|
repTestedMedia.DataSource = mediaOneValue;
|
|
|
|
|
|
repTestedMedia.DataBind();
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else divTestedMedia.Visible = false;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
else divTestedMedia.Visible &= sscMedia;
|
|
|
|
|
|
}
|
|
|
|
|
|
catch(Exception)
|
|
|
|
|
|
{
|
|
|
|
|
|
content.InnerHtml = "<b>Could not load device report</b>";
|
|
|
|
|
|
#if DEBUG
|
|
|
|
|
|
throw;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
static void GetUsbDescriptions(ushort vendor, ushort product, out string vendorDescription,
|
|
|
|
|
|
out string productDescription)
|
2017-06-03 01:19:47 +01:00
|
|
|
|
{
|
|
|
|
|
|
vendorDescription = null;
|
|
|
|
|
|
productDescription = null;
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(!File.Exists(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "usb.ids"))) return;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
StreamReader tocStream =
|
|
|
|
|
|
new StreamReader(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "usb.ids"));
|
2017-06-03 01:19:47 +01:00
|
|
|
|
string _line;
|
|
|
|
|
|
bool inManufacturer = false;
|
|
|
|
|
|
ushort number;
|
|
|
|
|
|
|
|
|
|
|
|
while(tocStream.Peek() >= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
_line = tocStream.ReadLine();
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(_line.Length == 0 || _line[0] == '#') continue;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
if(inManufacturer)
|
|
|
|
|
|
{
|
|
|
|
|
|
// Finished with the manufacturer
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(_line[0] != '\t') return;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
number = Convert.ToUInt16(_line.Substring(1, 4), 16);
|
|
|
|
|
|
|
|
|
|
|
|
if(number == product)
|
|
|
|
|
|
{
|
|
|
|
|
|
productDescription = _line.Substring(7);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
// Skip products
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(_line[0] == '\t') continue;
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
try { number = Convert.ToUInt16(_line.Substring(0, 4), 16); }
|
|
|
|
|
|
catch(FormatException) { continue; }
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
if(number == vendor)
|
|
|
|
|
|
{
|
|
|
|
|
|
vendorDescription = _line.Substring(6);
|
|
|
|
|
|
inManufacturer = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-06-03 01:10:46 +01:00
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|