Hardware/HDD/HDDGeneric.cs
author moel.mich
Sat, 03 Nov 2012 17:58:55 +0000
changeset 388 c25816e366bd
parent 358 7962499f9cd6
permissions -rw-r--r--
Added additional Fintek chips to the lm-sensors interface.
     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) 2011-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
     8 	Copyright (C) 2010 Paul Werelds
     9   Copyright (C) 2011 Roland Reinl <roland-reinl@gmx.de>
    10 	
    11 */
    12 
    13 using System;
    14 using System.Collections.Generic;
    15 using System.Text;
    16 using OpenHardwareMonitor.Collections;
    17 
    18 namespace OpenHardwareMonitor.Hardware.HDD {
    19 
    20   [NamePrefix("")]
    21   internal class GenericHarddisk : AbstractHarddrive {
    22 
    23     private static readonly List<SmartAttribute> smartAttributes =
    24       new List<SmartAttribute> {
    25       new SmartAttribute(0x01, SmartNames.ReadErrorRate),
    26       new SmartAttribute(0x02, SmartNames.ThroughputPerformance),
    27       new SmartAttribute(0x03, SmartNames.SpinUpTime),
    28       new SmartAttribute(0x04, SmartNames.StartStopCount, RawToInt),
    29       new SmartAttribute(0x05, SmartNames.ReallocatedSectorsCount),
    30       new SmartAttribute(0x06, SmartNames.ReadChannelMargin),
    31       new SmartAttribute(0x07, SmartNames.SeekErrorRate),
    32       new SmartAttribute(0x08, SmartNames.SeekTimePerformance),
    33       new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt),
    34       new SmartAttribute(0x0A, SmartNames.SpinRetryCount),
    35       new SmartAttribute(0x0B, SmartNames.RecalibrationRetries),
    36       new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt),
    37       new SmartAttribute(0x0D, SmartNames.SoftReadErrorRate),
    38       new SmartAttribute(0xAA, SmartNames.Unknown), 
    39       new SmartAttribute(0xAB, SmartNames.Unknown), 
    40       new SmartAttribute(0xAC, SmartNames.Unknown),
    41       new SmartAttribute(0xB7, SmartNames.SataDownshiftErrorCount, RawToInt),
    42       new SmartAttribute(0xB8, SmartNames.EndToEndError),
    43       new SmartAttribute(0xB9, SmartNames.HeadStability),
    44       new SmartAttribute(0xBA, SmartNames.InducedOpVibrationDetection),
    45       new SmartAttribute(0xBB, SmartNames.ReportedUncorrectableErrors, RawToInt),
    46       new SmartAttribute(0xBC, SmartNames.CommandTimeout, RawToInt),
    47       new SmartAttribute(0xBD, SmartNames.HighFlyWrites),
    48       new SmartAttribute(0xBF, SmartNames.GSenseErrorRate),
    49       new SmartAttribute(0xC0, SmartNames.EmergencyRetractCycleCount),
    50       new SmartAttribute(0xC1, SmartNames.LoadCycleCount),
    51       new SmartAttribute(0xC3, SmartNames.HardwareEccRecovered),
    52       new SmartAttribute(0xC4, SmartNames.ReallocationEventCount),
    53       new SmartAttribute(0xC5, SmartNames.CurrentPendingSectorCount),
    54       new SmartAttribute(0xC6, SmartNames.UncorrectableSectorCount),
    55       new SmartAttribute(0xC7, SmartNames.UltraDmaCrcErrorCount),
    56       new SmartAttribute(0xC8, SmartNames.WriteErrorRate),
    57       new SmartAttribute(0xCA, SmartNames.DataAddressMarkErrors),
    58       new SmartAttribute(0xCB, SmartNames.RunOutCancel),
    59       new SmartAttribute(0xCC, SmartNames.SoftEccCorrection),
    60       new SmartAttribute(0xCD, SmartNames.ThermalAsperityRate),
    61       new SmartAttribute(0xCE, SmartNames.FlyingHeight),
    62       new SmartAttribute(0xCF, SmartNames.SpinHighCurrent),
    63       new SmartAttribute(0xD0, SmartNames.SpinBuzz),
    64       new SmartAttribute(0xD1, SmartNames.OfflineSeekPerformance),
    65       new SmartAttribute(0xD3, SmartNames.VibrationDuringWrite),
    66       new SmartAttribute(0xD4, SmartNames.ShockDuringWrite),
    67       new SmartAttribute(0xDC, SmartNames.DiskShift),
    68       new SmartAttribute(0xDD, SmartNames.AlternativeGSenseErrorRate), 
    69       new SmartAttribute(0xDE, SmartNames.LoadedHours),
    70       new SmartAttribute(0xDF, SmartNames.LoadUnloadRetryCount),
    71       new SmartAttribute(0xE0, SmartNames.LoadFriction),
    72       new SmartAttribute(0xE1, SmartNames.LoadUnloadCycleCount),
    73       new SmartAttribute(0xE2, SmartNames.LoadInTime),
    74       new SmartAttribute(0xE3, SmartNames.TorqueAmplificationCount),
    75       new SmartAttribute(0xE4, SmartNames.PowerOffRetractCycle),
    76       new SmartAttribute(0xE6, SmartNames.GmrHeadAmplitude),      
    77       new SmartAttribute(0xE8, SmartNames.EnduranceRemaining),
    78       new SmartAttribute(0xE9, SmartNames.PowerOnHours),
    79       new SmartAttribute(0xF0, SmartNames.HeadFlyingHours),
    80       new SmartAttribute(0xF1, SmartNames.TotalLbasWritten),
    81       new SmartAttribute(0xF2, SmartNames.TotalLbasRead),
    82       new SmartAttribute(0xFA, SmartNames.ReadErrorRetryRate),
    83       new SmartAttribute(0xFE, SmartNames.FreeFallProtection),
    84 
    85       new SmartAttribute(0xC2, SmartNames.Temperature, 
    86         (byte[] r, byte v, IReadOnlyArray<IParameter> p) 
    87           => { return r[0] + (p == null ? 0 : p[0].Value); }, 
    88           SensorType.Temperature, 0, false, 
    89         new[] { new ParameterDescription("Offset [°C]", 
    90                   "Temperature offset of the thermal sensor.\n" + 
    91                   "Temperature = Value + Offset.", 0) }),
    92       new SmartAttribute(0xE7, SmartNames.Temperature, 
    93         (byte[] r, byte v, IReadOnlyArray<IParameter> p) 
    94           => { return r[0] + (p == null ? 0 : p[0].Value); }, 
    95           SensorType.Temperature, 0, false, 
    96         new[] { new ParameterDescription("Offset [°C]", 
    97                   "Temperature offset of the thermal sensor.\n" + 
    98                   "Temperature = Value + Offset.", 0) }),
    99       new SmartAttribute(0xBE, SmartNames.TemperatureDifferenceFrom100, 
   100         null, SensorType.Temperature, 0)
   101     };
   102 
   103     public GenericHarddisk(ISmart smart, string name, string firmwareRevision, 
   104       int index, ISettings settings)
   105       : base(smart, name, firmwareRevision, index, smartAttributes, settings) {}
   106   }
   107 }