Implemented Mode Page 0x1C: Timer & Protect page.

This commit is contained in:
2015-10-31 05:23:35 +00:00
parent 362ac9aa6c
commit 6ae8513315
2 changed files with 138 additions and 0 deletions

View File

@@ -5307,6 +5307,139 @@ namespace DiscImageChef.Decoders.SCSI
return sb.ToString();
}
#endregion Mode Page 0x1B: Removable Block Access Capabilities page
#region Mode Page 0x1C: Timer & Protect page
/// <summary>
/// Timer & Protect page
/// Page code 0x1C
/// 8 bytes in INF-8070
/// </summary>
public struct ModePage_1C_SFF
{
/// <summary>
/// Parameters can be saved
/// </summary>
public bool PS;
/// <summary>
/// Time the device shall remain in the current state after seek, read or write operation
/// </summary>
public byte InactivityTimeMultiplier;
/// <summary>
/// Disabled until power cycle
/// </summary>
public bool DISP;
/// <summary>
/// Software Write Protect until Power-down
/// </summary>
public bool SWPP;
}
public static ModePage_1C_SFF? DecodeModePage_1C_SFF(byte[] pageResponse)
{
if (pageResponse == null)
return null;
if ((pageResponse[0] & 0x40) == 0x40)
return null;
if ((pageResponse[0] & 0x3F) != 0x1C)
return null;
if (pageResponse[1] + 2 != pageResponse.Length)
return null;
if (pageResponse.Length < 8)
return null;
ModePage_1C_SFF decoded = new ModePage_1C_SFF();
decoded.PS |= (pageResponse[0] & 0x80) == 0x80;
decoded.DISP |= (pageResponse[2] & 0x02) == 0x02;
decoded.SWPP |= (pageResponse[3] & 0x01) == 0x01;
decoded.InactivityTimeMultiplier = (byte)(pageResponse[3] & 0x0F);
return decoded;
}
public static string PrettifyModePage_1C_SFF(byte[] pageResponse)
{
return PrettifyModePage_1C_SFF(DecodeModePage_1C_SFF(pageResponse));
}
public static string PrettifyModePage_1C_SFF(ModePage_1C_SFF? modePage)
{
if (!modePage.HasValue)
return null;
ModePage_1C_SFF page = modePage.Value;
StringBuilder sb = new StringBuilder();
sb.AppendLine("SCSI Timer & Protect page:");
if (page.PS)
sb.AppendLine("\tParameters can be saved");
if (page.DISP)
sb.AppendLine("\tDrive is disabled until power is cycled");
if (page.SWPP)
sb.AppendLine("\tDrive is software write-protected until powered down");
switch (page.InactivityTimeMultiplier)
{
case 0:
sb.AppendLine("Drive will remain in same status a vendor-specified time after a seek, read or write operation");
break;
case 1:
sb.AppendLine("Drive will remain in same status 125 ms after a seek, read or write operation");
break;
case 2:
sb.AppendLine("Drive will remain in same status 250 ms after a seek, read or write operation");
break;
case 3:
sb.AppendLine("Drive will remain in same status 500 ms after a seek, read or write operation");
break;
case 4:
sb.AppendLine("Drive will remain in same status 1 second after a seek, read or write operation");
break;
case 5:
sb.AppendLine("Drive will remain in same status 2 seconds after a seek, read or write operation");
break;
case 6:
sb.AppendLine("Drive will remain in same status 4 seconds after a seek, read or write operation");
break;
case 7:
sb.AppendLine("Drive will remain in same status 8 seconds after a seek, read or write operation");
break;
case 8:
sb.AppendLine("Drive will remain in same status 16 seconds after a seek, read or write operation");
break;
case 9:
sb.AppendLine("Drive will remain in same status 32 seconds after a seek, read or write operation");
break;
case 10:
sb.AppendLine("Drive will remain in same status 1 minute after a seek, read or write operation");
break;
case 11:
sb.AppendLine("Drive will remain in same status 2 minutes after a seek, read or write operation");
break;
case 12:
sb.AppendLine("Drive will remain in same status 4 minutes after a seek, read or write operation");
break;
case 13:
sb.AppendLine("Drive will remain in same status 8 minutes after a seek, read or write operation");
break;
case 14:
sb.AppendLine("Drive will remain in same status 16 minutes after a seek, read or write operation");
break;
case 15:
sb.AppendLine("Drive will remain in same status 32 minutes after a seek, read or write operation");
break;
}
return sb.ToString();
}
#endregion Mode Page 0x1C: Timer & Protect page
}
}