Added initial support for the ITE IT8772E super I/O chip.
3 Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 The contents of this file are subject to the Mozilla Public License Version
6 1.1 (the "License"); you may not use this file except in compliance with
7 the License. You may obtain a copy of the License at
9 http://www.mozilla.org/MPL/
11 Software distributed under the License is distributed on an "AS IS" basis,
12 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 for the specific language governing rights and limitations under the License.
15 The Original Code is the Open Hardware Monitor code.
17 The Initial Developer of the Original Code is
18 Michael Möller <m.moeller@gmx.ch>.
19 Portions created by the Initial Developer are Copyright (C) 2009-2011
20 the Initial Developer. All Rights Reserved.
24 Alternatively, the contents of this file may be used under the terms of
25 either the GNU General Public License Version 2 or later (the "GPL"), or
26 the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 in which case the provisions of the GPL or the LGPL are applicable instead
28 of those above. If you wish to allow use of your version of this file only
29 under the terms of either the GPL or the LGPL, and not to allow others to
30 use your version of this file under the terms of the MPL, indicate your
31 decision by deleting the provisions above and replace them with the notice
32 and other provisions required by the GPL or the LGPL. If you do not delete
33 the provisions above, a recipient may use your version of this file under
34 the terms of any one of the MPL, the GPL or the LGPL.
40 using OpenHardwareMonitor.Hardware.LPC;
42 namespace OpenHardwareMonitor.Hardware.Mainboard {
43 internal class Mainboard : IHardware {
44 private readonly SMBIOS smbios;
45 private readonly string name;
46 private string customName;
47 private readonly ISettings settings;
48 private readonly LPCIO lpcio;
49 private readonly LMSensors lmSensors;
50 private readonly Hardware[] superIOHardware;
52 public Mainboard(ISettings settings) {
53 this.settings = settings;
54 this.smbios = new SMBIOS();
56 if (smbios.Board != null) {
57 if (!string.IsNullOrEmpty(smbios.Board.ProductName)) {
58 if (smbios.Board.Manufacturer == Manufacturer.Unknown)
59 this.name = smbios.Board.ProductName;
61 this.name = smbios.Board.Manufacturer + " " +
62 smbios.Board.ProductName;
64 this.name = smbios.Board.Manufacturer.ToString();
67 this.name = Manufacturer.Unknown.ToString();
70 this.customName = settings.GetValue(
71 new Identifier(Identifier, "name").ToString(), name);
74 int p = (int)Environment.OSVersion.Platform;
75 if ((p == 4) || (p == 128)) {
76 this.lmSensors = new LMSensors();
77 superIO = lmSensors.SuperIO;
79 this.lpcio = new LPCIO();
80 superIO = lpcio.SuperIO;
83 superIOHardware = new Hardware[superIO.Length];
84 for (int i = 0; i < superIO.Length; i++)
85 superIOHardware[i] = new SuperIOHardware(this, superIO[i],
86 smbios.Board != null ? smbios.Board.Manufacturer :
87 Manufacturer.Unknown, smbios.Board != null ? smbios.Board.Model :
88 Model.Unknown, settings);
96 if (!string.IsNullOrEmpty(value))
100 settings.SetValue(new Identifier(Identifier, "name").ToString(),
105 public Identifier Identifier {
106 get { return new Identifier("mainboard"); }
109 public HardwareType HardwareType {
110 get { return HardwareType.Mainboard; }
113 public virtual IHardware Parent {
117 public string GetReport() {
118 StringBuilder r = new StringBuilder();
120 r.AppendLine("Mainboard");
122 r.Append(smbios.GetReport());
125 r.Append(lpcio.GetReport());
128 FirmwareTable.GetTable(FirmwareTable.Provider.ACPI, "TAMG");
130 GigabyteTAMG tamg = new GigabyteTAMG(table);
131 r.Append(tamg.GetReport());
137 public void Update() { }
139 public void Close() {
140 if (lmSensors != null)
142 foreach (Hardware hardware in superIOHardware)
146 public IHardware[] SubHardware {
147 get { return superIOHardware; }
150 public ISensor[] Sensors {
151 get { return new ISensor[0]; }
154 #pragma warning disable 67
155 public event SensorEventHandler SensorAdded;
156 public event SensorEventHandler SensorRemoved;
157 #pragma warning restore 67
159 public void Accept(IVisitor visitor) {
161 throw new ArgumentNullException("visitor");
162 visitor.VisitHardware(this);
165 public void Traverse(IVisitor visitor) {
166 foreach (IHardware hardware in superIOHardware)
167 hardware.Accept(visitor);