Added mainboard specific configurations for the following Gigabyte mainboards: EX58-UD3R, G41M-Combo, G41MT-S2, G41MT-S2P, GA-MA770T-UD3P, GA-MA785GM-US2H, GA-MA78LM-S2H, GA-MA790X-UD3P, H55-USB3, H55N-USB3, H61M-DS2 REV 1.2, H61M-USB3-B3 REV 2.0, H67A-USB3-B3, P55A-UD3, P67A-UD3-B3, P67A-UD3R-B3, Z68A-D3H-B3, Z68AP-D3, Z68X-UD3H-B3.
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-2011 Michael Möller <mmoeller@openhardwaremonitor.org>
13 using OpenHardwareMonitor.Hardware.LPC;
15 namespace OpenHardwareMonitor.Hardware.Mainboard {
16 internal class Mainboard : IHardware {
17 private readonly SMBIOS smbios;
18 private readonly string name;
19 private string customName;
20 private readonly ISettings settings;
21 private readonly LPCIO lpcio;
22 private readonly LMSensors lmSensors;
23 private readonly Hardware[] superIOHardware;
25 public Mainboard(ISettings settings) {
26 this.settings = settings;
27 this.smbios = new SMBIOS();
29 if (smbios.Board != null) {
30 if (!string.IsNullOrEmpty(smbios.Board.ProductName)) {
31 if (smbios.Board.Manufacturer == Manufacturer.Unknown)
32 this.name = smbios.Board.ProductName;
34 this.name = smbios.Board.Manufacturer + " " +
35 smbios.Board.ProductName;
37 this.name = smbios.Board.Manufacturer.ToString();
40 this.name = Manufacturer.Unknown.ToString();
43 this.customName = settings.GetValue(
44 new Identifier(Identifier, "name").ToString(), name);
47 int p = (int)Environment.OSVersion.Platform;
48 if ((p == 4) || (p == 128)) {
49 this.lmSensors = new LMSensors();
50 superIO = lmSensors.SuperIO;
52 this.lpcio = new LPCIO();
53 superIO = lpcio.SuperIO;
56 superIOHardware = new Hardware[superIO.Length];
57 for (int i = 0; i < superIO.Length; i++)
58 superIOHardware[i] = new SuperIOHardware(this, superIO[i],
59 smbios.Board != null ? smbios.Board.Manufacturer :
60 Manufacturer.Unknown, smbios.Board != null ? smbios.Board.Model :
61 Model.Unknown, settings);
69 if (!string.IsNullOrEmpty(value))
73 settings.SetValue(new Identifier(Identifier, "name").ToString(),
78 public Identifier Identifier {
79 get { return new Identifier("mainboard"); }
82 public HardwareType HardwareType {
83 get { return HardwareType.Mainboard; }
86 public virtual IHardware Parent {
90 public string GetReport() {
91 StringBuilder r = new StringBuilder();
93 r.AppendLine("Mainboard");
95 r.Append(smbios.GetReport());
98 r.Append(lpcio.GetReport());
101 FirmwareTable.GetTable(FirmwareTable.Provider.ACPI, "TAMG");
103 GigabyteTAMG tamg = new GigabyteTAMG(table);
104 r.Append(tamg.GetReport());
110 public void Update() { }
112 public void Close() {
113 if (lmSensors != null)
115 foreach (Hardware hardware in superIOHardware)
119 public IHardware[] SubHardware {
120 get { return superIOHardware; }
123 public ISensor[] Sensors {
124 get { return new ISensor[0]; }
127 #pragma warning disable 67
128 public event SensorEventHandler SensorAdded;
129 public event SensorEventHandler SensorRemoved;
130 #pragma warning restore 67
132 public void Accept(IVisitor visitor) {
134 throw new ArgumentNullException("visitor");
135 visitor.VisitHardware(this);
138 public void Traverse(IVisitor visitor) {
139 foreach (IHardware hardware in superIOHardware)
140 hardware.Accept(visitor);