mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Added IBM vendor EVPD, MODE pages and INQUIRY fields.
This commit is contained in:
@@ -7489,6 +7489,286 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
}
|
||||
|
||||
#endregion Mode Page 0x1D: Medium Configuration Mode Page
|
||||
|
||||
#region IBM Mode Page 0x24: Drive Capabilities Control Mode page
|
||||
public struct IBM_ModePage_24
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters can be saved
|
||||
/// </summary>
|
||||
public bool PS;
|
||||
public byte ModeControl;
|
||||
public byte VelocitySetting;
|
||||
public bool EncryptionEnabled;
|
||||
public bool EncryptionCapable;
|
||||
}
|
||||
|
||||
public static IBM_ModePage_24? DecodeIBMModePage_24(byte[] pageResponse)
|
||||
{
|
||||
if(pageResponse == null)
|
||||
return null;
|
||||
|
||||
if((pageResponse[0] & 0x40) == 0x40)
|
||||
return null;
|
||||
|
||||
if((pageResponse[0] & 0x3F) != 0x24)
|
||||
return null;
|
||||
|
||||
if(pageResponse[1] + 2 != pageResponse.Length)
|
||||
return null;
|
||||
|
||||
if(pageResponse.Length != 8)
|
||||
return null;
|
||||
|
||||
IBM_ModePage_24 decoded = new IBM_ModePage_24();
|
||||
|
||||
decoded.PS |= (pageResponse[0] & 0x80) == 0x80;
|
||||
decoded.ModeControl = pageResponse[2];
|
||||
decoded.VelocitySetting = pageResponse[3];
|
||||
decoded.EncryptionEnabled |= (pageResponse[7] & 0x08) == 0x08;
|
||||
decoded.EncryptionCapable |= (pageResponse[7] & 0x01) == 0x01;
|
||||
|
||||
return decoded;
|
||||
}
|
||||
|
||||
public static string PrettifyIBMModePage_24(byte[] pageResponse)
|
||||
{
|
||||
return PrettifyIBMModePage_24(DecodeIBMModePage_24(pageResponse));
|
||||
}
|
||||
|
||||
public static string PrettifyIBMModePage_24(IBM_ModePage_24? modePage)
|
||||
{
|
||||
if(!modePage.HasValue)
|
||||
return null;
|
||||
|
||||
IBM_ModePage_24 page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("IBM Vendor-Specific Control Mode Page:");
|
||||
|
||||
if(page.PS)
|
||||
sb.AppendLine("\tParameters can be saved");
|
||||
|
||||
sb.AppendFormat("\tVendor-specific mode control: {0}", page.ModeControl);
|
||||
sb.AppendFormat("\tVendor-specific velocity setting: {0}", page.VelocitySetting);
|
||||
|
||||
if(page.EncryptionCapable)
|
||||
{
|
||||
sb.AppendLine("\tDrive supports encryption");
|
||||
if(page.EncryptionEnabled)
|
||||
sb.AppendLine("\tDrive has encryption enabled");
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
#endregion IBM Mode Page 0x24: Drive Capabilities Control Mode page
|
||||
|
||||
#region IBM Mode Page 0x2F: Behaviour Configuration Mode page
|
||||
public struct IBM_ModePage_2F
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters can be saved
|
||||
/// </summary>
|
||||
public bool PS;
|
||||
public byte FenceBehaviour;
|
||||
public byte CleanBehaviour;
|
||||
public byte WORMEmulation;
|
||||
public byte SenseDataBehaviour;
|
||||
public bool CCDM;
|
||||
public bool DDEOR;
|
||||
public bool CLNCHK;
|
||||
public byte FirmwareUpdateBehaviour;
|
||||
public byte UOE_D;
|
||||
public byte UOE_F;
|
||||
public byte UOE_C;
|
||||
}
|
||||
|
||||
public static IBM_ModePage_2F? DecodeIBMModePage_2F(byte[] pageResponse)
|
||||
{
|
||||
if(pageResponse == null)
|
||||
return null;
|
||||
|
||||
if((pageResponse[0] & 0x40) == 0x40)
|
||||
return null;
|
||||
|
||||
if((pageResponse[0] & 0x3F) != 0x2F)
|
||||
return null;
|
||||
|
||||
if(pageResponse[1] + 2 != pageResponse.Length)
|
||||
return null;
|
||||
|
||||
if(pageResponse.Length < 8)
|
||||
return null;
|
||||
|
||||
IBM_ModePage_2F decoded = new IBM_ModePage_2F();
|
||||
|
||||
decoded.PS |= (pageResponse[0] & 0x80) == 0x80;
|
||||
decoded.FenceBehaviour = pageResponse[2];
|
||||
decoded.CleanBehaviour = pageResponse[3];
|
||||
decoded.WORMEmulation = pageResponse[4];
|
||||
decoded.SenseDataBehaviour = pageResponse[5];
|
||||
decoded.CCDM |= (pageResponse[6] & 0x04) == 0x04;
|
||||
decoded.DDEOR |= (pageResponse[6] & 0x02) == 0x02;
|
||||
decoded.CLNCHK |= (pageResponse[6] & 0x01) == 0x01;
|
||||
decoded.FirmwareUpdateBehaviour = pageResponse[7];
|
||||
decoded.UOE_C = (byte)((pageResponse[8] & 0x30) >> 4);
|
||||
decoded.UOE_F = (byte)((pageResponse[8] & 0x0C) >> 2);
|
||||
decoded.UOE_F = ((byte)(pageResponse[8] & 0x03));
|
||||
|
||||
return decoded;
|
||||
}
|
||||
|
||||
public static string PrettifyIBMModePage_2F(byte[] pageResponse)
|
||||
{
|
||||
return PrettifyIBMModePage_2F(DecodeIBMModePage_2F(pageResponse));
|
||||
}
|
||||
|
||||
public static string PrettifyIBMModePage_2F(IBM_ModePage_2F? modePage)
|
||||
{
|
||||
if(!modePage.HasValue)
|
||||
return null;
|
||||
|
||||
IBM_ModePage_2F page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("IBM Behaviour Configuration Mode Page:");
|
||||
|
||||
if(page.PS)
|
||||
sb.AppendLine("\tParameters can be saved");
|
||||
|
||||
switch(page.FenceBehaviour)
|
||||
{
|
||||
case 0:
|
||||
sb.AppendLine("\tFence behaviour is normal");
|
||||
break;
|
||||
case 1:
|
||||
sb.AppendLine("\tPanic fence behaviour is enabled");
|
||||
break;
|
||||
default:
|
||||
sb.AppendFormat("\tUnknown fence behaviour code {0}", page.FenceBehaviour).AppendLine();
|
||||
break;
|
||||
}
|
||||
|
||||
switch(page.CleanBehaviour)
|
||||
{
|
||||
case 0:
|
||||
sb.AppendLine("\tCleaning behaviour is normal");
|
||||
break;
|
||||
case 1:
|
||||
sb.AppendLine("\tDrive will periodically request cleaning");
|
||||
break;
|
||||
default:
|
||||
sb.AppendFormat("\tUnknown cleaning behaviour code {0}", page.CleanBehaviour).AppendLine();
|
||||
break;
|
||||
}
|
||||
|
||||
switch(page.WORMEmulation)
|
||||
{
|
||||
case 0:
|
||||
sb.AppendLine("\tWORM emulation is disabled");
|
||||
break;
|
||||
case 1:
|
||||
sb.AppendLine("\tWORM emulation is enabled");
|
||||
break;
|
||||
default:
|
||||
sb.AppendFormat("\tUnknown WORM emulation code {0}", page.WORMEmulation).AppendLine();
|
||||
break;
|
||||
}
|
||||
|
||||
switch(page.SenseDataBehaviour)
|
||||
{
|
||||
case 0:
|
||||
sb.AppendLine("\tUses 35-bytes sense data");
|
||||
break;
|
||||
case 1:
|
||||
sb.AppendLine("\tUses 96-bytes sense data");
|
||||
break;
|
||||
default:
|
||||
sb.AppendFormat("\tUnknown sense data behaviour code {0}", page.WORMEmulation).AppendLine();
|
||||
break;
|
||||
}
|
||||
|
||||
if(page.CLNCHK)
|
||||
sb.AppendLine("\tDrive will set Check Condition when cleaning is needed");
|
||||
if(page.DDEOR)
|
||||
sb.AppendLine("\tNo deferred error will be reported to a rewind command");
|
||||
if(page.CCDM)
|
||||
sb.AppendLine("\tDrive will set Check Condition when the criteria for Dead Media is met");
|
||||
if(page.FirmwareUpdateBehaviour > 0)
|
||||
sb.AppendLine("\tDrive will not accept downlevel firmware via an FMR tape");
|
||||
|
||||
if(page.UOE_C == 1)
|
||||
sb.AppendLine("\tDrive will eject cleaning cartridges on error");
|
||||
if(page.UOE_F == 1)
|
||||
sb.AppendLine("\tDrive will eject firmware cartridges on error");
|
||||
if(page.UOE_D == 1)
|
||||
sb.AppendLine("\tDrive will eject data cartridges on error");
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
#endregion IBM Mode Page 0x24: Drive Capabilities Control Mode page
|
||||
|
||||
#region IBM Mode Page 0x3D: Behaviour Configuration Mode page
|
||||
public struct IBM_ModePage_3D
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters can be saved
|
||||
/// </summary>
|
||||
public bool PS;
|
||||
public ushort NumberOfWraps;
|
||||
}
|
||||
|
||||
public static IBM_ModePage_3D? DecodeIBMModePage_3D(byte[] pageResponse)
|
||||
{
|
||||
if(pageResponse == null)
|
||||
return null;
|
||||
|
||||
if((pageResponse[0] & 0x40) == 0x40)
|
||||
return null;
|
||||
|
||||
if((pageResponse[0] & 0x3F) != 0x3D)
|
||||
return null;
|
||||
|
||||
if(pageResponse[1] + 2 != pageResponse.Length)
|
||||
return null;
|
||||
|
||||
if(pageResponse.Length != 5)
|
||||
return null;
|
||||
|
||||
IBM_ModePage_3D decoded = new IBM_ModePage_3D();
|
||||
|
||||
decoded.PS |= (pageResponse[0] & 0x80) == 0x80;
|
||||
decoded.NumberOfWraps = (ushort)((pageResponse[3] << 8) + pageResponse[4]);
|
||||
|
||||
return decoded;
|
||||
}
|
||||
|
||||
public static string PrettifyIBMModePage_3D(byte[] pageResponse)
|
||||
{
|
||||
return PrettifyIBMModePage_3D(DecodeIBMModePage_3D(pageResponse));
|
||||
}
|
||||
|
||||
public static string PrettifyIBMModePage_3D(IBM_ModePage_3D? modePage)
|
||||
{
|
||||
if(!modePage.HasValue)
|
||||
return null;
|
||||
|
||||
IBM_ModePage_3D page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("IBM LEOT Mode Page:");
|
||||
|
||||
if(page.PS)
|
||||
sb.AppendLine("\tParameters can be saved");
|
||||
|
||||
sb.AppendFormat("\t{0} wraps", page.NumberOfWraps).AppendLine();
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
#endregion IBM Mode Page 0x24: Drive Capabilities Control Mode page
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user