Changed the system tray icon font scaling to adapt to the size of the tray icon in pixels, because on Windows 7 the tray icon scales with the system font size, while on Windows XP the tray icons are always 16 pixels large.
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/.
7 Copyright (C) 2009-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
8 Copyright (C) 2010 Paul Werelds
12 namespace OpenHardwareMonitor.Hardware.HDD {
13 using System.Collections.Generic;
15 [NamePrefix(""), RequireSmart(0xAB), RequireSmart(0xB1)]
16 internal class SSDSandforce : AbstractHarddrive {
18 private static readonly IEnumerable<SmartAttribute> smartAttributes =
19 new List<SmartAttribute> {
20 new SmartAttribute(0x01, SmartNames.RawReadErrorRate),
21 new SmartAttribute(0x05, SmartNames.RetiredBlockCount, RawToInt),
22 new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt),
23 new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt),
24 new SmartAttribute(0xAB, SmartNames.ProgramFailCount, RawToInt),
25 new SmartAttribute(0xAC, SmartNames.EraseFailCount, RawToInt),
26 new SmartAttribute(0xAE, SmartNames.UnexpectedPowerLossCount, RawToInt),
27 new SmartAttribute(0xB1, SmartNames.WearRangeDelta, RawToInt),
28 new SmartAttribute(0xB5, SmartNames.AlternativeProgramFailCount, RawToInt),
29 new SmartAttribute(0xB6, SmartNames.AlternativeEraseFailCount, RawToInt),
30 new SmartAttribute(0xBB, SmartNames.UncorrectableErrorCount, RawToInt),
31 new SmartAttribute(0xC2, SmartNames.Temperature, (byte[] raw, byte value)
32 => { return value; }, SensorType.Temperature, 0, true),
33 new SmartAttribute(0xC3, SmartNames.UnrecoverableEcc),
34 new SmartAttribute(0xC4, SmartNames.ReallocationEventCount, RawToInt),
35 new SmartAttribute(0xE7, SmartNames.RemainingLife, null,
37 new SmartAttribute(0xE9, SmartNames.ControllerWritesToNAND, RawToInt,
39 new SmartAttribute(0xEA, SmartNames.HostWritesToController, RawToInt,
41 new SmartAttribute(0xF1, SmartNames.HostWrites, RawToInt,
43 new SmartAttribute(0xF2, SmartNames.HostReads, RawToInt,
47 private Sensor writeAmplification;
49 public SSDSandforce(ISmart smart, string name, string firmwareRevision,
50 int index, ISettings settings)
51 : base(smart, name, firmwareRevision, index, smartAttributes, settings)
53 this.writeAmplification = new Sensor("Write Amplification", 1,
54 SensorType.Factor, this, settings);
57 public override void UpdateAdditionalSensors(DriveAttributeValue[] values) {
58 float? controllerWritesToNAND = null;
59 float? hostWritesToController = null;
60 foreach (DriveAttributeValue value in values) {
61 if (value.Identifier == 0xE9)
62 controllerWritesToNAND = RawToInt(value.RawValue, value.AttrValue);
64 if (value.Identifier == 0xEA)
65 hostWritesToController = RawToInt(value.RawValue, value.AttrValue);
67 if (controllerWritesToNAND.HasValue && hostWritesToController.HasValue) {
68 if (hostWritesToController.Value > 0)
69 writeAmplification.Value =
70 controllerWritesToNAND.Value / hostWritesToController.Value;
72 writeAmplification.Value = 0;
73 ActivateSensor(writeAmplification);