public static ModePage_1B?DecodeModePage_1B(byte[] pageResponse) { if ((pageResponse?[0] &0x40) == 0x40) { return(null); } if ((pageResponse?[0] &0x3F) != 0x1B) { return(null); } if (pageResponse[1] + 2 != pageResponse.Length) { return(null); } if (pageResponse.Length < 12) { return(null); } var decoded = new ModePage_1B(); decoded.PS |= (pageResponse[0] & 0x80) == 0x80; decoded.SFLP |= (pageResponse[2] & 0x80) == 0x80; decoded.SRFP |= (pageResponse[2] & 0x40) == 0x40; decoded.NCD |= (pageResponse[3] & 0x80) == 0x80; decoded.SML |= (pageResponse[3] & 0x40) == 0x40; decoded.TLUN = (byte)(pageResponse[3] & 0x07); return(decoded); }
public static string PrettifyModePage_1B(ModePage_1B?modePage) { if (!modePage.HasValue) { return(null); } ModePage_1B page = modePage.Value; var sb = new StringBuilder(); sb.AppendLine("SCSI Removable Block Access Capabilities page:"); if (page.PS) { sb.AppendLine("\tParameters can be saved"); } if (page.SFLP) { sb.AppendLine("\tDrive can be used as a system floppy device"); } if (page.SRFP) { sb.AppendLine("\tDrive supports reporting progress of format"); } if (page.NCD) { sb.AppendLine("\tDrive is a Non-CD Optical Device"); } if (page.SML) { sb.AppendLine("\tDevice is a dual device supporting CD and Non-CD Optical"); } if (page.TLUN > 0) { sb.AppendFormat("\tDrive supports {0} LUNs", page.TLUN).AppendLine(); } return(sb.ToString()); }