Esempio n. 1
0
        public static string PrettifyModePage_07(ModePage_07?modePage)
        {
            if (!modePage.HasValue)
            {
                return(null);
            }

            ModePage_07 page = modePage.Value;
            var         sb   = new StringBuilder();

            sb.AppendLine("SCSI Verify error recovery page:");

            if (page.PS)
            {
                sb.AppendLine("\tParameters can be saved");
            }

            if (page.EER)
            {
                sb.AppendLine("\tDrive will use the most expedient form of error recovery first");
            }

            if (page.PER)
            {
                sb.AppendLine("\tDrive shall report recovered errors");
            }

            if (page.DTE)
            {
                sb.AppendLine("\tTransfer will be terminated upon error detection");
            }

            if (page.DCR)
            {
                sb.AppendLine("\tError correction is disabled");
            }

            if (page.VerifyRetryCount > 0)
            {
                sb.AppendFormat("\tDrive will repeat verify operations {0} times", page.VerifyRetryCount).AppendLine();
            }

            if (page.RecoveryTimeLimit > 0)
            {
                sb.AppendFormat("\tDrive will employ a maximum of {0} ms to recover data", page.RecoveryTimeLimit).
                AppendLine();
            }

            return(sb.ToString());
        }
Esempio n. 2
0
        public static ModePage_07?DecodeModePage_07(byte[] pageResponse)
        {
            if ((pageResponse?[0] &0x40) == 0x40)
            {
                return(null);
            }

            if ((pageResponse?[0] &0x3F) != 0x07)
            {
                return(null);
            }

            if (pageResponse[1] + 2 != pageResponse.Length)
            {
                return(null);
            }

            if (pageResponse.Length < 12)
            {
                return(null);
            }

            ModePage_07 decoded = new ModePage_07();

            decoded.PS  |= (pageResponse[0] & 0x80) == 0x80;
            decoded.EER |= (pageResponse[2] & 0x08) == 0x08;
            decoded.PER |= (pageResponse[2] & 0x04) == 0x04;
            decoded.DTE |= (pageResponse[2] & 0x02) == 0x02;
            decoded.DCR |= (pageResponse[2] & 0x01) == 0x01;

            decoded.VerifyRetryCount  = pageResponse[3];
            decoded.CorrectionSpan    = pageResponse[4];
            decoded.RecoveryTimeLimit = (ushort)((pageResponse[10] << 8) + pageResponse[11]);

            return(decoded);
        }