Hardware/HDD/SSDSamsung.cs
author moel.mich
Sat, 27 Oct 2012 11:40:28 +0000
changeset 384 76f859f4aea1
parent 328 f837f9f0973e
child 406 3890d78140c2
permissions -rw-r--r--
Reduced the amount of dynamic memory allocation when reading from the T-Balancer or creating tray icons.
     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(0xB0), RequireSmart(0xB1), RequireSmart(0xB2), 
    15     RequireSmart(0xB3), RequireSmart(0xB4), RequireSmart(0xB5), 
    16     RequireSmart(0xB6), RequireSmart(0xB7)]
    17   internal class SSDSamsung : AbstractHarddrive {
    18 
    19     private static readonly IEnumerable<SmartAttribute> smartAttributes =
    20       new List<SmartAttribute> {
    21       new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt),
    22       new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt),
    23       new SmartAttribute(0xAF, SmartNames.ProgramFailCountChip, RawToInt),
    24       new SmartAttribute(0xB0, SmartNames.EraseFailCountChip, RawToInt),
    25       new SmartAttribute(0xB1, SmartNames.WearLevelingCount, RawToInt),
    26       new SmartAttribute(0xB2, SmartNames.UsedReservedBlockCountChip, RawToInt),
    27       new SmartAttribute(0xB3, SmartNames.UsedReservedBlockCountTotal, RawToInt),
    28 
    29       // Unused Reserved Block Count (Total)
    30       new SmartAttribute(0xB4, SmartNames.RemainingLife,
    31         null, SensorType.Level, 0),
    32       
    33       new SmartAttribute(0xB5, SmartNames.ProgramFailCountTotal, RawToInt),
    34       new SmartAttribute(0xB6, SmartNames.EraseFailCountTotal, RawToInt),
    35       new SmartAttribute(0xB7, SmartNames.RuntimeBadBlockTotal, RawToInt),
    36       new SmartAttribute(0xBB, SmartNames.UncorrectableErrorCount, RawToInt),
    37       new SmartAttribute(0xBE, SmartNames.TemperatureExceedCount, RawToInt),
    38       new SmartAttribute(0xC2, SmartNames.AirflowTemperature),
    39       new SmartAttribute(0xC3, SmartNames.ECCRate),
    40       new SmartAttribute(0xC6, SmartNames.OffLineUncorrectableErrorCount, RawToInt),
    41       new SmartAttribute(0xC7, SmartNames.CRCErrorCount, RawToInt),
    42       new SmartAttribute(0xC9, SmartNames.SupercapStatus),
    43       new SmartAttribute(0xCA, SmartNames.ExceptionModeStatus)
    44     };
    45 
    46     public SSDSamsung(ISmart smart, string name, string firmwareRevision,
    47       int index, ISettings settings)
    48       : base(smart, name, firmwareRevision, index, smartAttributes, settings) { }
    49   }
    50 }