Hardware/Heatmaster/HeatmasterGroup.cs
changeset 175 e4ee19d583bd
parent 173 fb96c0ca3c2d
child 182 4801e9eaf979
     1.1 --- a/Hardware/Heatmaster/HeatmasterGroup.cs	Tue Aug 24 20:14:54 2010 +0000
     1.2 +++ b/Hardware/Heatmaster/HeatmasterGroup.cs	Tue Aug 24 22:11:10 2010 +0000
     1.3 @@ -69,20 +69,20 @@
     1.4  
     1.5      private static string[] GetRegistryPortNames() {
     1.6        List<string> result = new List<string>();
     1.7 +      string[] paths = { "", "&MI_00" };
     1.8        try {
     1.9 -        RegistryKey key = Registry.LocalMachine.OpenSubKey(
    1.10 -          @"SYSTEM\CurrentControlSet\Enum\USB\VID_10C4&PID_EA60");
    1.11 -        if (key == null)
    1.12 -          key = Registry.LocalMachine.OpenSubKey(
    1.13 -            @"SYSTEM\CurrentControlSet\Enum\USB\VID_10C4&PID_EA60&MI_00");           
    1.14 -        if (key != null) {
    1.15 -          foreach (string subKeyName in key.GetSubKeyNames()) {
    1.16 -            RegistryKey subKey =
    1.17 -              key.OpenSubKey(subKeyName + "\\" + "Device Parameters");
    1.18 -            if (subKey != null) {
    1.19 -              string name = subKey.GetValue("PortName") as string;
    1.20 -              if (name != null)
    1.21 -                result.Add((string)name);
    1.22 +        foreach (string path in paths) {
    1.23 +          RegistryKey key = Registry.LocalMachine.OpenSubKey(
    1.24 +            @"SYSTEM\CurrentControlSet\Enum\USB\VID_10C4&PID_EA60" + path);
    1.25 +          if (key != null) {
    1.26 +            foreach (string subKeyName in key.GetSubKeyNames()) {
    1.27 +              RegistryKey subKey =
    1.28 +                key.OpenSubKey(subKeyName + "\\" + "Device Parameters");
    1.29 +              if (subKey != null) {
    1.30 +                string name = subKey.GetValue("PortName") as string;
    1.31 +                if (name != null && !result.Contains(name))
    1.32 +                  result.Add((string)name);
    1.33 +              }
    1.34              }
    1.35            }
    1.36          }