Added a check to verify the FTDI chip ID before opening the T-Balancer port.

This commit is contained in:
Michael Möller
2010-09-15 18:43:15 +00:00
parent 4158415801
commit 49fad56e8c
3 changed files with 20 additions and 5 deletions
+8 -1
View File
@@ -339,7 +339,7 @@ namespace OpenHardwareMonitor.GUI {
y += pair.Value.Count * sensorLineHeight;
}
y += bottomMargin;
y = Math.Max(y, topBorder + bottomBorder + 10);
y = Math.Max(y, topBorder + hardwareLineHeight + bottomBorder);
this.Size = new Size(width, y);
}
@@ -399,6 +399,13 @@ namespace OpenHardwareMonitor.GUI {
int x;
int y = topMargin;
if (sensors.Count == 0) {
x = leftBorder + 1;
g.DrawString("Add a sensor ...", smallFont, Brushes.White,
new Rectangle(x, y - 1, w - rightBorder - x, 0));
}
foreach (KeyValuePair<IHardware, IList<ISensor>> pair in sensors) {
if (hardwareNames.Value) {
if (y > topMargin)
+3 -3
View File
@@ -41,11 +41,11 @@ using System.Runtime.InteropServices;
namespace OpenHardwareMonitor.Hardware.TBalancer {
internal enum FT_DEVICE : uint {
FT_DEVICE_BM,
FT_DEVICE_AM,
FT_DEVICE_232BM,
FT_DEVICE_232AM,
FT_DEVICE_100AX,
FT_DEVICE_UNKNOWN,
FT_DEVICE_2232,
FT_DEVICE_2232C,
FT_DEVICE_232R,
FT_DEVICE_2232H,
FT_DEVICE_4232H
+9 -1
View File
@@ -63,7 +63,15 @@ namespace OpenHardwareMonitor.Hardware.TBalancer {
for (int i = 0; i < numDevices; i++) {
report.Append("Device Index: ");
report.AppendLine(i.ToString(CultureInfo.InvariantCulture));
report.Append("Device Type: ");
report.AppendLine(info[i].Type.ToString());
// the T-Balancer always uses an FT232BM
if (info[i].Type != FT_DEVICE.FT_DEVICE_232BM) {
report.AppendLine("Status: Wrong device type");
continue;
}
FT_HANDLE handle;
FT_STATUS status;
status = FTD2XX.FT_Open(i, out handle);