Hardware/HDD/SSDMicron.cs
author moel.mich
Sat, 14 Jul 2012 19:24:04 +0000
changeset 363 daa9590e1bee
child 374 ea86cea126bc
permissions -rw-r--r--
Fixed Issue 269.
     1 /*
     2  
     3   This Source Code Form is subject to the terms of the Mozilla Public
     4   License, v. 2.0. If a copy of the MPL was not distributed with this
     5   file, You can obtain one at http://mozilla.org/MPL/2.0/.
     6  
     7   Copyright (C) 2012 Michael Möller <mmoeller@openhardwaremonitor.org>
     8 	
     9 */
    10 
    11 namespace OpenHardwareMonitor.Hardware.HDD {
    12   using System.Collections.Generic;
    13 
    14   [NamePrefix(""), RequireSmart(0xAA), RequireSmart(0xAB), RequireSmart(0xAC), 
    15    RequireSmart(0xAD), RequireSmart(0xAE), RequireSmart(0xCA)]
    16   internal class SSDMicron : AbstractHarddrive {
    17 
    18     private static readonly IEnumerable<SmartAttribute> smartAttributes =
    19       new List<SmartAttribute> {
    20       
    21       new SmartAttribute(0x01, SmartNames.ReadErrorRate, RawToInt),
    22       new SmartAttribute(0x05, SmartNames.ReallocatedSectorsCount, RawToInt),
    23       new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt),
    24       new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt),
    25       new SmartAttribute(0xAA, SmartNames.NewFailingBlockCount, RawToInt),
    26       new SmartAttribute(0xAB, SmartNames.ProgramFailCount, RawToInt),
    27       new SmartAttribute(0xAC, SmartNames.EraseFailCount, RawToInt),
    28       new SmartAttribute(0xAD, SmartNames.WearLevelingCount, RawToInt),
    29       new SmartAttribute(0xAE, SmartNames.UnexpectedPowerLossCount, RawToInt),
    30       new SmartAttribute(0xB5, SmartNames.Non4kAlignedAccess, 
    31         (byte[] raw, byte value) => { return 6e4f * ((raw[5] << 8) | raw[4]); }),
    32       new SmartAttribute(0xB7, SmartNames.SataDownshiftErrorCount, RawToInt),
    33       new SmartAttribute(0xBB, SmartNames.ReportedUncorrectableErrors, RawToInt),
    34       new SmartAttribute(0xBC, SmartNames.CommandTimeout, RawToInt),
    35       new SmartAttribute(0xBD, SmartNames.FactoryBadBlockCount, RawToInt),
    36       new SmartAttribute(0xC4, SmartNames.ReallocationEventCount, RawToInt),
    37       new SmartAttribute(0xC5, SmartNames.CurrentPendingSectorCount),
    38       new SmartAttribute(0xC6, SmartNames.OffLineUncorrectableErrorCount, RawToInt),
    39       new SmartAttribute(0xC7, SmartNames.UltraDmaCrcErrorCount, RawToInt),
    40       new SmartAttribute(0xCA, SmartNames.RemainingLife, 
    41         (byte[] raw, byte value) => { return 100 - RawToInt(raw, value); }, 
    42         SensorType.Level, 0),
    43       new SmartAttribute(0xCE, SmartNames.WriteErrorRate, 
    44          (byte[] raw, byte value) => { return 6e4f * ((raw[1] << 8) | raw[0]); }),
    45     };
    46 
    47     public SSDMicron(ISmart smart, string name, string firmwareRevision, 
    48       int index, ISettings settings)
    49       : base(smart, name, firmwareRevision, index, smartAttributes, settings) {}
    50   }
    51 }