From f2a66ab30e0cf372ffb3d4f10fdce8dd07f71ad6 Mon Sep 17 00:00:00 2001 From: Antoine Brodin Date: Wed, 12 Jun 2013 19:05:12 +0000 Subject: [PATCH] Update adapter detection patch to report correct IDs PR: ports/179517 Submitted by: Mickael Maillot Approved by: Manuel Creach (maintainer) --- multimedia/libcec/Makefile | 1 + ...r__Pulse-Eight__USBCECAdapterDetection.cpp | 25 +++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/multimedia/libcec/Makefile b/multimedia/libcec/Makefile index 60cf3e8fc556..7d0f873f31a0 100644 --- a/multimedia/libcec/Makefile +++ b/multimedia/libcec/Makefile @@ -3,6 +3,7 @@ PORTNAME= libcec PORTVERSION= 2.1.3 +PORTREVISION= 1 CATEGORIES= multimedia MASTER_SITES= GH diff --git a/multimedia/libcec/files/patch-src__lib__adapter__Pulse-Eight__USBCECAdapterDetection.cpp b/multimedia/libcec/files/patch-src__lib__adapter__Pulse-Eight__USBCECAdapterDetection.cpp index dd8829f8f7a3..7e2d53e224d5 100644 --- a/multimedia/libcec/files/patch-src__lib__adapter__Pulse-Eight__USBCECAdapterDetection.cpp +++ b/multimedia/libcec/files/patch-src__lib__adapter__Pulse-Eight__USBCECAdapterDetection.cpp @@ -1,5 +1,5 @@ ---- ./src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp.orig 2013-05-13 13:09:14.000000000 +0000 -+++ ./src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp 2013-06-08 12:30:51.000000000 +0000 +--- ./src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp.orig 2013-05-13 15:09:14.000000000 +0200 ++++ ./src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp 2013-06-12 16:31:03.000000000 +0200 @@ -61,6 +61,8 @@ #include } @@ -9,7 +9,7 @@ #include #include #endif -@@ -434,22 +436,68 @@ +@@ -434,22 +436,77 @@ } #elif defined(__FreeBSD__) char devicePath[PATH_MAX + 1]; @@ -25,13 +25,15 @@ { - (void)snprintf(devicePath, sizeof(devicePath), "/dev/ttyU%d", i); - if (strDevicePath && strcmp(devicePath, strDevicePath) != 0) ++ unsigned int iVendor, iProduct; + memset(infos, 0, sizeof(infos)); + (void)snprintf(sysctlname, sizeof(sysctlname), + "dev.umodem.%d.%%pnpinfo", i); + if (sysctlbyname(sysctlname, infos, &infos_size, + NULL, 0) != 0) + break; -+ if (strstr(infos, "vendor=0x2548") == NULL) ++ pos = strstr(infos, "vendor="); ++ if (pos == NULL) continue; - if (!access(devicePath, 0)) - { @@ -41,9 +43,16 @@ - deviceList[iFound].iProductId = CEC_VID; - deviceList[iFound].adapterType = ADAPTERTYPE_P8_EXTERNAL; // will be overridden when not doing a "quick scan" by the actual type - iFound++; -+ if (strstr(infos, "product=0x1001") == NULL -+ && strstr(infos, "product=0x1002") == NULL) ++ sscanf(pos, "vendor=%x ", &iVendor); ++ ++ pos = strstr(infos, "product="); ++ if (pos == NULL) + continue; ++ sscanf(pos, "product=%x ", &iProduct); ++ ++ if (iVendor != CEC_VID || (iProduct != CEC_PID && iProduct != CEC_PID2)) ++ continue; ++ + pos = strstr(infos, "ttyname="); + if (pos == NULL) + continue; @@ -82,8 +91,8 @@ } + snprintf(deviceList[iFound].strComPath, sizeof(deviceList[iFound].strComPath), "%s", devicePath); + snprintf(deviceList[iFound].strComName, sizeof(deviceList[iFound].strComName), "%s", devicePath); -+ deviceList[iFound].iVendorId = CEC_VID; -+ deviceList[iFound].iProductId = CEC_VID; ++ deviceList[iFound].iVendorId = iVendor; ++ deviceList[iFound].iProductId = iProduct; + deviceList[iFound].adapterType = ADAPTERTYPE_P8_EXTERNAL; // will be overridden when not doing a "quick scan" by the actual type + iFound++; }