Added EVPD pages B1h, B2h, B3h and B4h.

This commit is contained in:
2016-10-14 00:02:42 +01:00
parent 6491e59989
commit d7746415b1
4 changed files with 137 additions and 0 deletions

View File

@@ -1,3 +1,7 @@
2016-10-14 Natalia Portillo <claunia@claunia.com>
* EVPD.cs: Added EVPD pages B1h, B2h, B3h and B4h.
2016-10-13 Natalia Portillo <claunia@claunia.com>
* EVPD.cs: Added EVPD page B0h.

View File

@@ -2137,6 +2137,7 @@ namespace DiscImageChef.Decoders.SCSI
/// The length of the page.
/// </summary>
public ushort PageLength;
public bool TSMC;
public bool WORM;
}
@@ -2160,6 +2161,7 @@ namespace DiscImageChef.Decoders.SCSI
decoded.PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F);
decoded.PageLength = (ushort)((pageResponse[2] << 8) + pageResponse[3] + 4);
decoded.TSMC = (pageResponse[4] & 0x02) == 0x02;
decoded.WORM = (pageResponse[4] & 0x01) == 0x01;
return decoded;
@@ -2182,12 +2184,102 @@ namespace DiscImageChef.Decoders.SCSI
if(page.WORM)
sb.AppendLine("\tDevice supports WORM media");
if(page.TSMC)
sb.AppendLine("\tDevice supports Tape Stream Mirroring");
return sb.ToString();
}
#endregion EVPD Page 0xB0: Sequential-access device capabilities page
#region EVPD Page 0xB1: Manufacturer-assigned Serial Number page
public static string DecodePageB1(byte[] page)
{
if(page == null)
return null;
if(page[1] != 0xB1)
return null;
if(page.Length != page[3] + 4)
return null;
byte[] ascii = new byte[page.Length - 4];
Array.Copy(page, 4, ascii, 0, page.Length - 4);
return StringHandlers.CToString(ascii).Trim();
}
#endregion EVPD Page 0xB1: Manufacturer-assigned Serial Number page
#region EVPD Page 0xB2: TapeAlert Supported Flags page
public static ulong DecodePageB2(byte[] page)
{
if(page == null)
return 0;
if(page[1] != 0xB2)
return 0;
if(page.Length != 12)
return 0;
byte[] bitmap = new byte[8];
Array.Copy(page, 4, bitmap, 0, 8);
return BitConverter.ToUInt64(bitmap.Reverse().ToArray(), 0);
}
#endregion EVPD Page 0xB2: TapeAlert Supported Flags page
#region EVPD Page 0xB3: Automation Device Serial Number page
public static string DecodePageB3(byte[] page)
{
if(page == null)
return null;
if(page[1] != 0xB3)
return null;
if(page.Length != page[3] + 4)
return null;
byte[] ascii = new byte[page.Length - 4];
Array.Copy(page, 4, ascii, 0, page.Length - 4);
return StringHandlers.CToString(ascii).Trim();
}
#region EVPD Page 0xB3: Automation Device Serial Number page
#region EVPD Page 0xB4: Data Transfer Device Element Address page
public static string DecodePageB4(byte[] page)
{
if(page == null)
return null;
if(page[1] != 0xB3)
return null;
if(page.Length != page[3] + 4)
return null;
byte[] element = new byte[page.Length - 4];
StringBuilder sb = new StringBuilder();
foreach(byte b in element)
sb.AppendFormat("{0:X2}", b);
return sb.ToString();
}
#endregion EVPD Page 0xB4: Data Transfer Device Element Address page
}
}

View File

@@ -1,3 +1,8 @@
2016-10-14 Natalia Portillo <claunia@claunia.com>
* Commands/DeviceInfo.cs:
Added EVPD pages B1h, B2h, B3h and B4h.
2016-10-13 Natalia Portillo <claunia@claunia.com>
* Commands/DeviceInfo.cs:

View File

@@ -310,6 +310,42 @@ namespace DiscImageChef.Commands
doWriteFile(options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf);
}
}
else if(page == 0xB1)
{
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
if(!sense)
{
DicConsole.WriteLine("Manufacturer-assigned Serial Number: {0}", Decoders.SCSI.EVPD.DecodePageB1(inqBuf));
doWriteFile(options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf);
}
}
else if(page == 0xB2)
{
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
if(!sense)
{
DicConsole.WriteLine("TapeAlert Supported Flags Bitmap: 0x{0:X16}", Decoders.SCSI.EVPD.DecodePageB2(inqBuf));
doWriteFile(options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf);
}
}
else if(page == 0xB3)
{
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
if(!sense)
{
DicConsole.WriteLine("Automation Device Serial Number: {0}", Decoders.SCSI.EVPD.DecodePageB3(inqBuf));
doWriteFile(options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf);
}
}
else if(page == 0xB4)
{
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
if(!sense)
{
DicConsole.WriteLine("Data Transfer Device Element Address: 0x{0}", Decoders.SCSI.EVPD.DecodePageB4(inqBuf));
doWriteFile(options.OutputPrefix, string.Format("_scsi_evpd_{0:X2}h.bin", page), string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf);
}
}
else if(page == 0xC0 && StringHandlers.CToString(inq.Value.VendorIdentification).ToLowerInvariant().Trim() == "quantum")
{
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);