Hardware/LPC/LMSensors.cs
changeset 266 2687ac753d90
parent 228 458a6c3de579
child 268 844ba72c11de
     1.1 --- a/Hardware/LPC/LMSensors.cs	Sat Mar 19 22:55:05 2011 +0000
     1.2 +++ b/Hardware/LPC/LMSensors.cs	Sat Apr 09 20:16:42 2011 +0000
     1.3 @@ -16,7 +16,7 @@
     1.4  
     1.5    The Initial Developer of the Original Code is 
     1.6    Michael Möller <m.moeller@gmx.ch>.
     1.7 -  Portions created by the Initial Developer are Copyright (C) 2009-2010
     1.8 +  Portions created by the Initial Developer are Copyright (C) 2009-2011
     1.9    the Initial Developer. All Rights Reserved.
    1.10  
    1.11    Contributor(s):
    1.12 @@ -46,44 +46,52 @@
    1.13      private readonly List<LMChip> lmChips = new List<LMChip>();
    1.14  
    1.15      public LMSensors() {
    1.16 -      string[] devicePaths = Directory.GetDirectories("/sys/class/hwmon/");
    1.17 -      foreach (string path in devicePaths) {
    1.18 -        string name = null;
    1.19 -        try {
    1.20 -          using (StreamReader reader = new StreamReader(path + "/device/name")) 
    1.21 -            name = reader.ReadLine();
    1.22 -        } catch (IOException) { }
    1.23 -        switch (name) {
    1.24 -          case "f71858fg":
    1.25 -            lmChips.Add(new LMChip(Chip.F71858, path + "/device")); break;
    1.26 -          case "f71862fg":
    1.27 -            lmChips.Add(new LMChip(Chip.F71862, path + "/device")); break;
    1.28 -          case "f71882fg":
    1.29 -            lmChips.Add(new LMChip(Chip.F71882, path + "/device")); break;
    1.30 -          case "f71889fg":
    1.31 -            lmChips.Add(new LMChip(Chip.F71889F, path + "/device")); break;
    1.32 +      string[] basePaths = Directory.GetDirectories("/sys/class/hwmon/");
    1.33 +      foreach (string basePath in basePaths) {
    1.34 +        foreach (string devicePath in new[] { "/device", "" }) {
    1.35 +          string path = basePath + devicePath;
    1.36  
    1.37 -          case "it8712":
    1.38 -            lmChips.Add(new LMChip(Chip.IT8712F, path + "/device")); break;
    1.39 -          case "it8716":
    1.40 -            lmChips.Add(new LMChip(Chip.IT8716F, path + "/device")); break;
    1.41 -          case "it8718":
    1.42 -            lmChips.Add(new LMChip(Chip.IT8718F, path + "/device")); break;
    1.43 -          case "it8720":
    1.44 -            lmChips.Add(new LMChip(Chip.IT8720F, path + "/device")); break;
    1.45 +          string name = null;
    1.46 +          try {
    1.47 +            using (StreamReader reader = new StreamReader(path + "/name"))
    1.48 +              name = reader.ReadLine();
    1.49 +          } catch (IOException) { }
    1.50  
    1.51 -          case "w83627ehf":
    1.52 -            lmChips.Add(new LMChip(Chip.W83627EHF, path + "/device")); break;
    1.53 -          case "w83627dhg":
    1.54 -            lmChips.Add(new LMChip(Chip.W83627DHG, path + "/device")); break;
    1.55 -          case "w83667hg":
    1.56 -            lmChips.Add(new LMChip(Chip.W83667HG, path + "/device")); break;
    1.57 -          case "w83627hf":
    1.58 -            lmChips.Add(new LMChip(Chip.W83627HF, path + "/device")); break;
    1.59 -          case "w83627thf":
    1.60 -            lmChips.Add(new LMChip(Chip.W83627THF, path + "/device")); break;
    1.61 -          case "w83687thf":
    1.62 -            lmChips.Add(new LMChip(Chip.W83687THF, path + "/device")); break;
    1.63 +          switch (name) {
    1.64 +            case "atk0110":
    1.65 +              lmChips.Add(new LMChip(Chip.ATK0110, path)); break;
    1.66 +
    1.67 +            case "f71858fg":
    1.68 +              lmChips.Add(new LMChip(Chip.F71858, path)); break;
    1.69 +            case "f71862fg":
    1.70 +              lmChips.Add(new LMChip(Chip.F71862, path)); break;
    1.71 +            case "f71882fg":
    1.72 +              lmChips.Add(new LMChip(Chip.F71882, path)); break;
    1.73 +            case "f71889fg":
    1.74 +              lmChips.Add(new LMChip(Chip.F71889F, path)); break;
    1.75 +
    1.76 +            case "it8712":
    1.77 +              lmChips.Add(new LMChip(Chip.IT8712F, path)); break;
    1.78 +            case "it8716":
    1.79 +              lmChips.Add(new LMChip(Chip.IT8716F, path)); break;
    1.80 +            case "it8718":
    1.81 +              lmChips.Add(new LMChip(Chip.IT8718F, path)); break;
    1.82 +            case "it8720":
    1.83 +              lmChips.Add(new LMChip(Chip.IT8720F, path)); break;
    1.84 +
    1.85 +            case "w83627ehf":
    1.86 +              lmChips.Add(new LMChip(Chip.W83627EHF, path)); break;
    1.87 +            case "w83627dhg":
    1.88 +              lmChips.Add(new LMChip(Chip.W83627DHG, path)); break;
    1.89 +            case "w83667hg":
    1.90 +              lmChips.Add(new LMChip(Chip.W83667HG, path)); break;
    1.91 +            case "w83627hf":
    1.92 +              lmChips.Add(new LMChip(Chip.W83627HF, path)); break;
    1.93 +            case "w83627thf":
    1.94 +              lmChips.Add(new LMChip(Chip.W83627THF, path)); break;
    1.95 +            case "w83687thf":
    1.96 +              lmChips.Add(new LMChip(Chip.W83687THF, path)); break;
    1.97 +          }
    1.98          }
    1.99        }
   1.100      }