From 7ea1a9988e418715520d82e5330ddb64200d366c Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 13 Oct 2016 22:59:48 +0100 Subject: [PATCH] Added EVPD page B0h. --- ChangeLog | 4 +++ SCSI/EVPD.cs | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/ChangeLog b/ChangeLog index 76338ef1f..0dabc3c1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-10-13 Natalia Portillo + + * EVPD.cs: Added EVPD page B0h. + 2016-10-13 Natalia Portillo * EVPD.cs: diff --git a/SCSI/EVPD.cs b/SCSI/EVPD.cs index 5dd0ac09f..cf421008f 100644 --- a/SCSI/EVPD.cs +++ b/SCSI/EVPD.cs @@ -2113,6 +2113,81 @@ namespace DiscImageChef.Decoders.SCSI #endregion EVPD Page 0xC1 (IBM): Drive Serial Numbers page + #region EVPD Page 0xB0: Sequential-access device capabilities page + + /// + /// Sequential-access device capabilities page + /// Page code 0xB0 + /// + public struct Page_B0 + { + /// + /// The peripheral qualifier. + /// + public PeripheralQualifiers PeripheralQualifier; + /// + /// The type of the peripheral device. + /// + public PeripheralDeviceTypes PeripheralDeviceType; + /// + /// The page code. + /// + public byte PageCode; + /// + /// The length of the page. + /// + public ushort PageLength; + public bool WORM; + } + + public static Page_B0? DecodePage_B0(byte[] pageResponse) + { + if(pageResponse == null) + return null; + + if(pageResponse[1] != 0xB0) + return null; + + if((pageResponse[2] << 8) + pageResponse[3] + 4 != pageResponse.Length) + return null; + + if(pageResponse.Length < 5) + return null; + + Page_B0 decoded = new Page_B0(); + + decoded.PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5); + decoded.PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F); + decoded.PageLength = (ushort)((pageResponse[2] << 8) + pageResponse[3] + 4); + + decoded.WORM = (pageResponse[4] & 0x01) == 0x01; + + return decoded; + } + + public static string PrettifyPage_B0(byte[] pageResponse) + { + return PrettifyPage_B0(DecodePage_B0(pageResponse)); + } + + public static string PrettifyPage_B0(Page_B0? modePage) + { + if(!modePage.HasValue) + return null; + + Page_B0 page = modePage.Value; + StringBuilder sb = new StringBuilder(); + + sb.AppendLine("SCSI Sequential-access Device Capabilities:"); + + if(page.WORM) + sb.AppendLine("\tDevice supports WORM media"); + + return sb.ToString(); + } + + #endregion EVPD Page 0xB0: Sequential-access device capabilities page + } }