Hardware/HDD/SSDMicron.cs
author moel.mich
Sat, 11 Aug 2012 21:32:59 +0000
changeset 378 64d3ddf8d73b
parent 358 7962499f9cd6
permissions -rw-r--r--
Changed a few context menu items to display a radio option style. Added additional information from the SMBIOS to the report.
     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 using System.Collections.Generic;
    12 using OpenHardwareMonitor.Collections;
    13 
    14 namespace OpenHardwareMonitor.Hardware.HDD {  
    15 
    16   [NamePrefix(""), RequireSmart(0xAA), RequireSmart(0xAB), RequireSmart(0xAC), 
    17    RequireSmart(0xAD), RequireSmart(0xAE), RequireSmart(0xCA)]
    18   internal class SSDMicron : AbstractHarddrive {
    19 
    20     private static readonly IEnumerable<SmartAttribute> smartAttributes =
    21       new List<SmartAttribute> {
    22       
    23       new SmartAttribute(0x01, SmartNames.ReadErrorRate, RawToInt),
    24       new SmartAttribute(0x05, SmartNames.ReallocatedSectorsCount, RawToInt),
    25       new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt),
    26       new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt),
    27       new SmartAttribute(0xAA, SmartNames.NewFailingBlockCount, RawToInt),
    28       new SmartAttribute(0xAB, SmartNames.ProgramFailCount, RawToInt),
    29       new SmartAttribute(0xAC, SmartNames.EraseFailCount, RawToInt),
    30       new SmartAttribute(0xAD, SmartNames.WearLevelingCount, RawToInt),
    31       new SmartAttribute(0xAE, SmartNames.UnexpectedPowerLossCount, RawToInt),
    32       new SmartAttribute(0xB5, SmartNames.Non4kAlignedAccess, 
    33         (byte[] raw, byte value, IReadOnlyArray<IParameter> p) 
    34           => { return 6e4f * ((raw[5] << 8) | raw[4]); }),
    35       new SmartAttribute(0xB7, SmartNames.SataDownshiftErrorCount, RawToInt),
    36       new SmartAttribute(0xBB, SmartNames.ReportedUncorrectableErrors, RawToInt),
    37       new SmartAttribute(0xBC, SmartNames.CommandTimeout, RawToInt),
    38       new SmartAttribute(0xBD, SmartNames.FactoryBadBlockCount, RawToInt),
    39       new SmartAttribute(0xC4, SmartNames.ReallocationEventCount, RawToInt),
    40       new SmartAttribute(0xC5, SmartNames.CurrentPendingSectorCount),
    41       new SmartAttribute(0xC6, SmartNames.OffLineUncorrectableErrorCount, RawToInt),
    42       new SmartAttribute(0xC7, SmartNames.UltraDmaCrcErrorCount, RawToInt),
    43       new SmartAttribute(0xCA, SmartNames.RemainingLife, 
    44         (byte[] raw, byte value, IReadOnlyArray<IParameter> p) 
    45           => { return 100 - RawToInt(raw, value, p); }, 
    46         SensorType.Level, 0),
    47       new SmartAttribute(0xCE, SmartNames.WriteErrorRate, 
    48          (byte[] raw, byte value, IReadOnlyArray<IParameter> p)
    49            => { return 6e4f * ((raw[1] << 8) | raw[0]); }),
    50     };
    51 
    52     public SSDMicron(ISmart smart, string name, string firmwareRevision, 
    53       int index, ISettings settings)
    54       : base(smart, name, firmwareRevision, index, smartAttributes, settings) {}
    55   }
    56 }