Hardware/HDD/SSDMicron.cs
author moel.mich
Wed, 18 Jul 2012 20:20:26 +0000
changeset 367 45215572a774
child 374 ea86cea126bc
permissions -rw-r--r--
Added more report output to the kernel driver loading code. Hopefully this helps to find the problems in Issue 253.
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@358
    11
namespace OpenHardwareMonitor.Hardware.HDD {
moel@358
    12
  using System.Collections.Generic;
moel@358
    13
moel@358
    14
  [NamePrefix(""), RequireSmart(0xAA), RequireSmart(0xAB), RequireSmart(0xAC), 
moel@358
    15
   RequireSmart(0xAD), RequireSmart(0xAE), RequireSmart(0xCA)]
moel@358
    16
  internal class SSDMicron : AbstractHarddrive {
moel@358
    17
moel@358
    18
    private static readonly IEnumerable<SmartAttribute> smartAttributes =
moel@358
    19
      new List<SmartAttribute> {
moel@358
    20
      
moel@358
    21
      new SmartAttribute(0x01, SmartNames.ReadErrorRate, RawToInt),
moel@358
    22
      new SmartAttribute(0x05, SmartNames.ReallocatedSectorsCount, RawToInt),
moel@358
    23
      new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt),
moel@358
    24
      new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt),
moel@358
    25
      new SmartAttribute(0xAA, SmartNames.NewFailingBlockCount, RawToInt),
moel@358
    26
      new SmartAttribute(0xAB, SmartNames.ProgramFailCount, RawToInt),
moel@358
    27
      new SmartAttribute(0xAC, SmartNames.EraseFailCount, RawToInt),
moel@358
    28
      new SmartAttribute(0xAD, SmartNames.WearLevelingCount, RawToInt),
moel@358
    29
      new SmartAttribute(0xAE, SmartNames.UnexpectedPowerLossCount, RawToInt),
moel@358
    30
      new SmartAttribute(0xB5, SmartNames.Non4kAlignedAccess, 
moel@358
    31
        (byte[] raw, byte value) => { return 6e4f * ((raw[5] << 8) | raw[4]); }),
moel@358
    32
      new SmartAttribute(0xB7, SmartNames.SataDownshiftErrorCount, RawToInt),
moel@358
    33
      new SmartAttribute(0xBB, SmartNames.ReportedUncorrectableErrors, RawToInt),
moel@358
    34
      new SmartAttribute(0xBC, SmartNames.CommandTimeout, RawToInt),
moel@358
    35
      new SmartAttribute(0xBD, SmartNames.FactoryBadBlockCount, RawToInt),
moel@358
    36
      new SmartAttribute(0xC4, SmartNames.ReallocationEventCount, RawToInt),
moel@358
    37
      new SmartAttribute(0xC5, SmartNames.CurrentPendingSectorCount),
moel@358
    38
      new SmartAttribute(0xC6, SmartNames.OffLineUncorrectableErrorCount, RawToInt),
moel@358
    39
      new SmartAttribute(0xC7, SmartNames.UltraDmaCrcErrorCount, RawToInt),
moel@358
    40
      new SmartAttribute(0xCA, SmartNames.RemainingLife, 
moel@358
    41
        (byte[] raw, byte value) => { return 100 - RawToInt(raw, value); }, 
moel@358
    42
        SensorType.Level, 0),
moel@358
    43
      new SmartAttribute(0xCE, SmartNames.WriteErrorRate, 
moel@358
    44
         (byte[] raw, byte value) => { return 6e4f * ((raw[1] << 8) | raw[0]); }),
moel@358
    45
    };
moel@358
    46
moel@358
    47
    public SSDMicron(ISmart smart, string name, string firmwareRevision, 
moel@358
    48
      int index, ISettings settings)
moel@358
    49
      : base(smart, name, firmwareRevision, index, smartAttributes, settings) {}
moel@358
    50
  }
moel@358
    51
}