Fixed Issue 213.
1.1 --- a/Hardware/ATI/ADL.cs Sun Jan 15 14:05:52 2012 +0000
1.2 +++ b/Hardware/ATI/ADL.cs Sun Jan 15 15:07:23 2012 +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-2012
1.9 the Initial Developer. All Rights Reserved.
1.10
1.11 Contributor(s):
1.12 @@ -37,6 +37,7 @@
1.13
1.14 using System;
1.15 using System.Runtime.InteropServices;
1.16 +using System.Text.RegularExpressions;
1.17
1.18 namespace OpenHardwareMonitor.Hardware.ATI {
1.19
1.20 @@ -124,8 +125,7 @@
1.21 public const int ADL_DL_FANCTRL_SUPPORTS_RPM_WRITE = 8;
1.22 public const int ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED = 1;
1.23
1.24 - public const int ATI_VENDOR_ID1 = 1002;
1.25 - public const int ATI_VENDOR_ID2 = 0x1002;
1.26 + public const int ATI_VENDOR_ID = 0x1002;
1.27
1.28 private delegate int ADL_Main_Control_CreateDelegate(
1.29 ADL_Main_Memory_AllocDelegate callback, int enumConnectedAdapters);
1.30 @@ -261,6 +261,23 @@
1.31 Marshal.PtrToStructure((IntPtr)((long)ptr + i * elementSize),
1.32 typeof(ADLAdapterInfo));
1.33 Marshal.FreeHGlobal(ptr);
1.34 +
1.35 + // the ADLAdapterInfo.VendorID field reported by ADL is wrong on
1.36 + // Windows systems (parse error), so we fix this here
1.37 + for (int i = 0; i < info.Length; i++) {
1.38 + // try Windows UDID format
1.39 + Match m = Regex.Match(info[i].UDID, "PCI_VEN_([A-Fa-f0-9]{1,4})&.*");
1.40 + if (m.Success && m.Groups.Count == 2) {
1.41 + info[i].VendorID = Convert.ToInt32(m.Groups[1].Value, 16);
1.42 + continue;
1.43 + }
1.44 + // if above failed, try Unix UDID format
1.45 + m = Regex.Match(info[i].UDID, "[0-9]+:[0-9]+:([0-9]+):[0-9]+:[0-9]+");
1.46 + if (m.Success && m.Groups.Count == 2) {
1.47 + info[i].VendorID = Convert.ToInt32(m.Groups[1].Value, 10);
1.48 + }
1.49 + }
1.50 +
1.51 return result;
1.52 }
1.53
2.1 --- a/Hardware/ATI/ATIGroup.cs Sun Jan 15 14:05:52 2012 +0000
2.2 +++ b/Hardware/ATI/ATIGroup.cs Sun Jan 15 15:07:23 2012 +0000
2.3 @@ -16,7 +16,7 @@
2.4
2.5 The Initial Developer of the Original Code is
2.6 Michael Möller <m.moeller@gmx.ch>.
2.7 - Portions created by the Initial Developer are Copyright (C) 2009-2010
2.8 + Portions created by the Initial Developer are Copyright (C) 2009-2012
2.9 the Initial Developer. All Rights Reserved.
2.10
2.11 Contributor(s):
2.12 @@ -87,8 +87,8 @@
2.13 report.Append("Present: ");
2.14 report.AppendLine(adapterInfo[i].Present.ToString(
2.15 CultureInfo.InvariantCulture));
2.16 - report.Append("VendorID: ");
2.17 - report.AppendLine(adapterInfo[i].VendorID.ToString(
2.18 + report.Append("VendorID: 0x");
2.19 + report.AppendLine(adapterInfo[i].VendorID.ToString("X",
2.20 CultureInfo.InvariantCulture));
2.21 report.Append("BusNumber: ");
2.22 report.AppendLine(adapterInfo[i].BusNumber.ToString(
2.23 @@ -104,8 +104,8 @@
2.24 CultureInfo.InvariantCulture));
2.25
2.26 if (!string.IsNullOrEmpty(adapterInfo[i].UDID) &&
2.27 - (adapterInfo[i].VendorID == ADL.ATI_VENDOR_ID1 ||
2.28 - adapterInfo[i].VendorID == ADL.ATI_VENDOR_ID2)) {
2.29 + adapterInfo[i].VendorID == ADL.ATI_VENDOR_ID)
2.30 + {
2.31 bool found = false;
2.32 foreach (ATIGPU gpu in hardware)
2.33 if (gpu.BusNumber == adapterInfo[i].BusNumber &&