Added a check to verify the FTDI chip ID before opening the T-Balancer port.
authormoel.mich
Wed, 15 Sep 2010 18:43:15 +0000
changeset 186010d719f9245
parent 185 edb59f3745e8
child 187 a7c93597137f
Added a check to verify the FTDI chip ID before opening the T-Balancer port.
GUI/SensorGadget.cs
Hardware/TBalancer/FTD2XX.cs
Hardware/TBalancer/TBalancerGroup.cs
     1.1 --- a/GUI/SensorGadget.cs	Tue Sep 14 19:23:11 2010 +0000
     1.2 +++ b/GUI/SensorGadget.cs	Wed Sep 15 18:43:15 2010 +0000
     1.3 @@ -339,7 +339,7 @@
     1.4          y += pair.Value.Count * sensorLineHeight;
     1.5        }
     1.6        y += bottomMargin;
     1.7 -      y = Math.Max(y, topBorder + bottomBorder + 10);
     1.8 +      y = Math.Max(y, topBorder + hardwareLineHeight + bottomBorder);
     1.9        this.Size = new Size(width, y);
    1.10      }
    1.11  
    1.12 @@ -399,6 +399,13 @@
    1.13  
    1.14        int x;
    1.15        int y = topMargin;
    1.16 +
    1.17 +      if (sensors.Count == 0) {
    1.18 +        x = leftBorder + 1;
    1.19 +        g.DrawString("Add a sensor ...", smallFont, Brushes.White,
    1.20 +          new Rectangle(x, y - 1, w - rightBorder - x, 0));
    1.21 +      }
    1.22 +
    1.23        foreach (KeyValuePair<IHardware, IList<ISensor>> pair in sensors) {
    1.24          if (hardwareNames.Value) {
    1.25            if (y > topMargin)
     2.1 --- a/Hardware/TBalancer/FTD2XX.cs	Tue Sep 14 19:23:11 2010 +0000
     2.2 +++ b/Hardware/TBalancer/FTD2XX.cs	Wed Sep 15 18:43:15 2010 +0000
     2.3 @@ -41,11 +41,11 @@
     2.4  namespace OpenHardwareMonitor.Hardware.TBalancer {
     2.5  
     2.6    internal enum FT_DEVICE : uint {
     2.7 -    FT_DEVICE_BM,
     2.8 -    FT_DEVICE_AM,
     2.9 +    FT_DEVICE_232BM,
    2.10 +    FT_DEVICE_232AM,
    2.11      FT_DEVICE_100AX,
    2.12      FT_DEVICE_UNKNOWN,
    2.13 -    FT_DEVICE_2232,
    2.14 +    FT_DEVICE_2232C,
    2.15      FT_DEVICE_232R,
    2.16      FT_DEVICE_2232H,
    2.17      FT_DEVICE_4232H
     3.1 --- a/Hardware/TBalancer/TBalancerGroup.cs	Tue Sep 14 19:23:11 2010 +0000
     3.2 +++ b/Hardware/TBalancer/TBalancerGroup.cs	Wed Sep 15 18:43:15 2010 +0000
     3.3 @@ -63,7 +63,15 @@
     3.4        for (int i = 0; i < numDevices; i++) {
     3.5          report.Append("Device Index: ");
     3.6          report.AppendLine(i.ToString(CultureInfo.InvariantCulture));
     3.7 -        
     3.8 +        report.Append("Device Type: ");
     3.9 +        report.AppendLine(info[i].Type.ToString());
    3.10 +
    3.11 +        // the T-Balancer always uses an FT232BM
    3.12 +        if (info[i].Type != FT_DEVICE.FT_DEVICE_232BM) {
    3.13 +          report.AppendLine("Status: Wrong device type");
    3.14 +          continue;
    3.15 +        }
    3.16 +
    3.17          FT_HANDLE handle;
    3.18          FT_STATUS status;
    3.19          status = FTD2XX.FT_Open(i, out handle);