Hardware/HDD/SSDMicron.cs
author StephaneLenclud
Thu, 18 Apr 2013 23:25:10 +0200
branchMiniDisplay
changeset 444 9b09e2ee0968
parent 358 7962499f9cd6
permissions -rw-r--r--
Front View plug-in does not init if no sensor added.
Fixing some format to make strings shorter.
Now trying to start SoundGraphAccess.exe process from same directory.
Packed mode now can display three sensors along with the current time.
moel@358
     1
/*
moel@358
     2
 
moel@358
     3
  This Source Code Form is subject to the terms of the Mozilla Public
moel@358
     4
  License, v. 2.0. If a copy of the MPL was not distributed with this
moel@358
     5
  file, You can obtain one at http://mozilla.org/MPL/2.0/.
moel@358
     6
 
moel@358
     7
  Copyright (C) 2012 Michael Möller <mmoeller@openhardwaremonitor.org>
moel@358
     8
	
moel@358
     9
*/
moel@358
    10
moel@374
    11
using System.Collections.Generic;
moel@374
    12
using OpenHardwareMonitor.Collections;
moel@374
    13
moel@374
    14
namespace OpenHardwareMonitor.Hardware.HDD {  
moel@358
    15
moel@358
    16
  [NamePrefix(""), RequireSmart(0xAA), RequireSmart(0xAB), RequireSmart(0xAC), 
moel@358
    17
   RequireSmart(0xAD), RequireSmart(0xAE), RequireSmart(0xCA)]
moel@358
    18
  internal class SSDMicron : AbstractHarddrive {
moel@358
    19
moel@358
    20
    private static readonly IEnumerable<SmartAttribute> smartAttributes =
moel@358
    21
      new List<SmartAttribute> {
moel@358
    22
      
moel@358
    23
      new SmartAttribute(0x01, SmartNames.ReadErrorRate, RawToInt),
moel@358
    24
      new SmartAttribute(0x05, SmartNames.ReallocatedSectorsCount, RawToInt),
moel@358
    25
      new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt),
moel@358
    26
      new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt),
moel@358
    27
      new SmartAttribute(0xAA, SmartNames.NewFailingBlockCount, RawToInt),
moel@358
    28
      new SmartAttribute(0xAB, SmartNames.ProgramFailCount, RawToInt),
moel@358
    29
      new SmartAttribute(0xAC, SmartNames.EraseFailCount, RawToInt),
moel@358
    30
      new SmartAttribute(0xAD, SmartNames.WearLevelingCount, RawToInt),
moel@358
    31
      new SmartAttribute(0xAE, SmartNames.UnexpectedPowerLossCount, RawToInt),
moel@358
    32
      new SmartAttribute(0xB5, SmartNames.Non4kAlignedAccess, 
moel@374
    33
        (byte[] raw, byte value, IReadOnlyArray<IParameter> p) 
moel@374
    34
          => { return 6e4f * ((raw[5] << 8) | raw[4]); }),
moel@358
    35
      new SmartAttribute(0xB7, SmartNames.SataDownshiftErrorCount, RawToInt),
moel@358
    36
      new SmartAttribute(0xBB, SmartNames.ReportedUncorrectableErrors, RawToInt),
moel@358
    37
      new SmartAttribute(0xBC, SmartNames.CommandTimeout, RawToInt),
moel@358
    38
      new SmartAttribute(0xBD, SmartNames.FactoryBadBlockCount, RawToInt),
moel@358
    39
      new SmartAttribute(0xC4, SmartNames.ReallocationEventCount, RawToInt),
moel@358
    40
      new SmartAttribute(0xC5, SmartNames.CurrentPendingSectorCount),
moel@358
    41
      new SmartAttribute(0xC6, SmartNames.OffLineUncorrectableErrorCount, RawToInt),
moel@358
    42
      new SmartAttribute(0xC7, SmartNames.UltraDmaCrcErrorCount, RawToInt),
moel@358
    43
      new SmartAttribute(0xCA, SmartNames.RemainingLife, 
moel@374
    44
        (byte[] raw, byte value, IReadOnlyArray<IParameter> p) 
moel@374
    45
          => { return 100 - RawToInt(raw, value, p); }, 
moel@358
    46
        SensorType.Level, 0),
moel@358
    47
      new SmartAttribute(0xCE, SmartNames.WriteErrorRate, 
moel@374
    48
         (byte[] raw, byte value, IReadOnlyArray<IParameter> p)
moel@374
    49
           => { return 6e4f * ((raw[1] << 8) | raw[0]); }),
moel@358
    50
    };
moel@358
    51
moel@358
    52
    public SSDMicron(ISmart smart, string name, string firmwareRevision, 
moel@358
    53
      int index, ISettings settings)
moel@358
    54
      : base(smart, name, firmwareRevision, index, smartAttributes, settings) {}
moel@358
    55
  }
moel@358
    56
}