X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Fadapter%2FPulse-Eight%2FUSBCECAdapterDetection.cpp;h=da101e702a60e1d86c77c3b3319fdea141114f84;hb=1e9904b38b80c664d5df32305ac3a4ef70158054;hp=4d408ada4972ccb1fdb1df8f55e846ec54da0763;hpb=6407418d7cfd07ebe01087f314622863310b7a32;p=deb_libcec.git diff --git a/src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp b/src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp index 4d408ad..da101e7 100644 --- a/src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp +++ b/src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp @@ -262,10 +262,11 @@ 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. - if (iFound == 0 || strcmp(deviceList[iFound].comm, bsdPath)) + if (iFound == 0 || strcmp(deviceList[iFound-1].comm, bsdPath)) { - snprintf(deviceList[iFound ].path, sizeof(deviceList[iFound].path), "%s", bsdPath); - snprintf(deviceList[iFound++].comm, sizeof(deviceList[iFound].path), "%s", bsdPath); + snprintf(deviceList[iFound].path, sizeof(deviceList[iFound].path), "%s", bsdPath); + snprintf(deviceList[iFound].comm, sizeof(deviceList[iFound].path), "%s", bsdPath); + iFound++; } } } @@ -311,10 +312,11 @@ uint8_t CUSBCECAdapterDetection::FindAdapters(cec_adapter *deviceList, uint8_t i if (!strDevicePath || !strcmp(strPath.c_str(), strDevicePath)) { CStdString strComm(strPath); - if (FindComPort(strComm) && (iFound == 0 || strcmp(deviceList[iFound].comm, strComm.c_str()))) + if (FindComPort(strComm) && (iFound == 0 || strcmp(deviceList[iFound-1].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()); + snprintf(deviceList[iFound].path, sizeof(deviceList[iFound].path), "%s", strPath.c_str()); + snprintf(deviceList[iFound].comm, sizeof(deviceList[iFound].path), "%s", strComm.c_str()); + iFound++; } } } @@ -425,10 +427,13 @@ uint8_t CUSBCECAdapterDetection::FindAdapters(cec_adapter *deviceList, uint8_t i for (i = 0; i < 8; ++i) { (void)snprintf(devicePath, sizeof(devicePath), "/dev/ttyU%d", i); + if (strDevicePath && strcmp(devicePath, strDevicePath) != 0) + continue; if (!access(devicePath, 0)) { - snprintf(deviceList[iFound ].path, sizeof(deviceList[iFound].path), "%s", devicePath); - snprintf(deviceList[iFound++].comm, sizeof(deviceList[iFound].path), "%s", devicePath); + snprintf(deviceList[iFound].path, sizeof(deviceList[iFound].path), "%s", devicePath); + snprintf(deviceList[iFound].comm, sizeof(deviceList[iFound].path), "%s", devicePath); + iFound++; } } #else @@ -437,7 +442,7 @@ uint8_t CUSBCECAdapterDetection::FindAdapters(cec_adapter *deviceList, uint8_t i tmp = (void *)strDevicePath; #endif - iBufSize = 0; /* silence "unused" warning on linux/osx */ + iBufSize = 0; if(!iBufSize){} /* silence "unused" warning on linux/osx */ return iFound; }