From: Lars Op den Kamp Date: Wed, 29 Aug 2012 11:36:24 +0000 (+0200) Subject: only match one interface, not all three when detecting devices on linux and darwin X-Git-Tag: upstream/2.2.0~1^2~18^2^2~20 X-Git-Url: https://git.piment-noir.org/?p=deb_libcec.git;a=commitdiff_plain;h=41b12347891d698c650cbc6fcfc40759d5e1db11 only match one interface, not all three when detecting devices on linux and darwin --- diff --git a/src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp b/src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp index 9789bf7..04daf46 100644 --- a/src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp +++ b/src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp @@ -186,12 +186,15 @@ uint8_t CUSBCECAdapterDetection::FindAdapters(cec_adapter *deviceList, uint8_t i 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); @@ -232,7 +235,7 @@ uint8_t CUSBCECAdapterDetection::FindAdapters(cec_adapter *deviceList, uint8_t i 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());