Hardware/HDD/SSDSamsung.cs
author StephaneLenclud
Sun, 03 Feb 2013 18:01:50 +0100
branchMiniDisplay
changeset 433 090259cfd699
parent 344 3145aadca3d2
permissions -rw-r--r--
Adding SoundGraphDisplay and SensorFrontView classes.
They were respectively based on SystemTray and SensorNotifyIcon.
SoundGraphDisplay is now able to load iMONDisplay.dll providing it lives on your PATH.
Adding option to sensor context menu for adding it into FrontView.
moel@328
     1
/*
moel@328
     2
 
moel@344
     3
  This Source Code Form is subject to the terms of the Mozilla Public
moel@344
     4
  License, v. 2.0. If a copy of the MPL was not distributed with this
moel@344
     5
  file, You can obtain one at http://mozilla.org/MPL/2.0/.
moel@328
     6
 
moel@406
     7
  Copyright (C) 2012-2013 Michael Möller <mmoeller@openhardwaremonitor.org>
moel@344
     8
	
moel@328
     9
*/
moel@328
    10
moel@328
    11
namespace OpenHardwareMonitor.Hardware.HDD {
moel@328
    12
  using System.Collections.Generic;
moel@406
    13
  using OpenHardwareMonitor.Collections;
moel@328
    14
moel@406
    15
  [NamePrefix(""), RequireSmart(0xB1), RequireSmart(0xB3), RequireSmart(0xB5),
moel@406
    16
    RequireSmart(0xB6), RequireSmart(0xB7), RequireSmart(0xBB), 
moel@406
    17
    RequireSmart(0xC3), RequireSmart(0xC7)]
moel@328
    18
  internal class SSDSamsung : AbstractHarddrive {
moel@328
    19
moel@328
    20
    private static readonly IEnumerable<SmartAttribute> smartAttributes =
moel@328
    21
      new List<SmartAttribute> {
moel@406
    22
      new SmartAttribute(0x05, SmartNames.ReallocatedSectorsCount),
moel@328
    23
      new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt),
moel@328
    24
      new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt),
moel@328
    25
      new SmartAttribute(0xAF, SmartNames.ProgramFailCountChip, RawToInt),
moel@328
    26
      new SmartAttribute(0xB0, SmartNames.EraseFailCountChip, RawToInt),
moel@328
    27
      new SmartAttribute(0xB1, SmartNames.WearLevelingCount, RawToInt),
moel@328
    28
      new SmartAttribute(0xB2, SmartNames.UsedReservedBlockCountChip, RawToInt),
moel@328
    29
      new SmartAttribute(0xB3, SmartNames.UsedReservedBlockCountTotal, RawToInt),
moel@328
    30
moel@328
    31
      // Unused Reserved Block Count (Total)
moel@328
    32
      new SmartAttribute(0xB4, SmartNames.RemainingLife,
moel@328
    33
        null, SensorType.Level, 0),
moel@328
    34
      
moel@328
    35
      new SmartAttribute(0xB5, SmartNames.ProgramFailCountTotal, RawToInt),
moel@328
    36
      new SmartAttribute(0xB6, SmartNames.EraseFailCountTotal, RawToInt),
moel@328
    37
      new SmartAttribute(0xB7, SmartNames.RuntimeBadBlockTotal, RawToInt),
moel@328
    38
      new SmartAttribute(0xBB, SmartNames.UncorrectableErrorCount, RawToInt),
moel@406
    39
      new SmartAttribute(0xBE, SmartNames.Temperature, 
moel@406
    40
        (byte[] r, byte v, IReadOnlyArray<IParameter> p) 
moel@406
    41
          => { return r[0] + (p == null ? 0 : p[0].Value); }, 
moel@406
    42
          SensorType.Temperature, 0, false, 
moel@406
    43
        new[] { new ParameterDescription("Offset [°C]", 
moel@406
    44
                  "Temperature offset of the thermal sensor.\n" + 
moel@406
    45
                  "Temperature = Value + Offset.", 0) }),
moel@328
    46
      new SmartAttribute(0xC2, SmartNames.AirflowTemperature),
moel@328
    47
      new SmartAttribute(0xC3, SmartNames.ECCRate),
moel@328
    48
      new SmartAttribute(0xC6, SmartNames.OffLineUncorrectableErrorCount, RawToInt),
moel@328
    49
      new SmartAttribute(0xC7, SmartNames.CRCErrorCount, RawToInt),
moel@328
    50
      new SmartAttribute(0xC9, SmartNames.SupercapStatus),
moel@406
    51
      new SmartAttribute(0xCA, SmartNames.ExceptionModeStatus),
moel@406
    52
      new SmartAttribute(0xEB, SmartNames.PowerRecoveryCount),
moel@406
    53
      new SmartAttribute(0xF1, SmartNames.TotalLBAWritten)
moel@328
    54
    };
moel@328
    55
moel@328
    56
    public SSDSamsung(ISmart smart, string name, string firmwareRevision,
moel@328
    57
      int index, ISettings settings)
moel@328
    58
      : base(smart, name, firmwareRevision, index, smartAttributes, settings) { }
moel@328
    59
  }
moel@328
    60
}