if (!strDevicePath || !strcmp(bsdPath, strDevicePath))
{
// on darwin, the device path is the same as the comm path.
- snprintf(deviceList[iFound ].path, sizeof(deviceList[iFound].path), "%s", bsdPath);
- snprintf(deviceList[iFound++].comm, sizeof(deviceList[iFound].path), "%s", bsdPath);
+ if (iFound == 0 || strcmp(deviceList[iFound].comm, bsdPath))
+ {
+ snprintf(deviceList[iFound ].path, sizeof(deviceList[iFound].path), "%s", bsdPath);
+ snprintf(deviceList[iFound++].comm, sizeof(deviceList[iFound].path), "%s", bsdPath);
+ }
}
}
}
- IOObjectRelease(serialService);
+ IOObjectRelease(serialService);
}
}
IOObjectRelease(serialPortIterator);
if (!strDevicePath || !strcmp(strPath.c_str(), strDevicePath))
{
CStdString strComm(strPath);
- if (FindComPort(strComm))
+ if (FindComPort(strComm) && (iFound == 0 || strcmp(deviceList[iFound].comm, strComm.c_str())))
{
snprintf(deviceList[iFound ].path, sizeof(deviceList[iFound].path), "%s", strPath.c_str());
snprintf(deviceList[iFound++].comm, sizeof(deviceList[iFound].path), "%s", strComm.c_str());