From 59171c7a030f8a9c913abbce931967a6a8ff6897 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Thu, 15 Nov 2012 02:17:17 +0100 Subject: [PATCH] [cec] get the CEC devices that are connected to the system from libCEC, rather than getting them from usb device scanning (or other methods). this way all adapters that libCEC supports are automatically supported by XBMC, without the need for specific device scanning code. bumped libCEC to 2.1.0 --- XBMC.xcodeproj/project.pbxproj | 14 +++ configure.in | 40 +-------- project/BuildDependencies/scripts/libcec_d.txt | 2 +- project/VS2010Express/XBMC.vcxproj | 2 + project/VS2010Express/XBMC.vcxproj.filters | 6 ++ system/peripherals.xml | 25 +----- tools/android/depends/libcec/Makefile | 4 +- tools/darwin/depends/libcec/Makefile | 2 +- xbmc/peripherals/PeripheralTypes.h | 7 +- xbmc/peripherals/Peripherals.cpp | 11 +-- xbmc/peripherals/bus/Makefile.in | 4 +- xbmc/peripherals/bus/linux/PeripheralBusRPi.cpp | 69 --------------- xbmc/peripherals/bus/linux/PeripheralBusRPi.h | 40 --------- xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp | 101 ++++++++++++++++++++++ xbmc/peripherals/bus/virtual/PeripheralBusCEC.h | 57 ++++++++++++ xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 3 +- 16 files changed, 202 insertions(+), 185 deletions(-) delete mode 100644 xbmc/peripherals/bus/linux/PeripheralBusRPi.cpp delete mode 100644 xbmc/peripherals/bus/linux/PeripheralBusRPi.h create mode 100644 xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp create mode 100644 xbmc/peripherals/bus/virtual/PeripheralBusCEC.h diff --git a/XBMC.xcodeproj/project.pbxproj b/XBMC.xcodeproj/project.pbxproj index ee73a42..bd51c46 100644 --- a/XBMC.xcodeproj/project.pbxproj +++ b/XBMC.xcodeproj/project.pbxproj @@ -173,6 +173,7 @@ 18E7CACB1578C26D001D4554 /* CDDARipJob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18E7CAC91578C26D001D4554 /* CDDARipJob.cpp */; }; 18ECC96213CF178D00A9ED6C /* StreamUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18ECC96013CF178D00A9ED6C /* StreamUtils.cpp */; }; 1D638128161E211E003603ED /* PeripheralImon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1D638126161E211E003603ED /* PeripheralImon.cpp */; }; + 1DAFDB7C16DFDCA7007F8C68 /* PeripheralBusCEC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1DAFDB7A16DFDCA7007F8C68 /* PeripheralBusCEC.cpp */; }; 1DE0443515828F4B005DDB4D /* Exception.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1DE0443315828F4B005DDB4D /* Exception.cpp */; }; 32C631281423A90F00F18420 /* JpegIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 32C631261423A90F00F18420 /* JpegIO.cpp */; }; 36A9443D15821E2800727135 /* DatabaseUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 36A9443B15821E2800727135 /* DatabaseUtils.cpp */; }; @@ -1384,6 +1385,8 @@ 18ECC96113CF178D00A9ED6C /* StreamUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StreamUtils.h; sourceTree = ""; }; 1D638126161E211E003603ED /* PeripheralImon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PeripheralImon.cpp; sourceTree = ""; }; 1D638127161E211E003603ED /* PeripheralImon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PeripheralImon.h; sourceTree = ""; }; + 1DAFDB7A16DFDCA7007F8C68 /* PeripheralBusCEC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PeripheralBusCEC.cpp; sourceTree = ""; }; + 1DAFDB7B16DFDCA7007F8C68 /* PeripheralBusCEC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PeripheralBusCEC.h; sourceTree = ""; }; 1DE0443315828F4B005DDB4D /* Exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Exception.cpp; path = commons/Exception.cpp; sourceTree = ""; }; 1DE0443415828F4B005DDB4D /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Exception.h; path = commons/Exception.h; sourceTree = ""; }; 32C631261423A90F00F18420 /* JpegIO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JpegIO.cpp; sourceTree = ""; }; @@ -3743,6 +3746,15 @@ name = Products; sourceTree = ""; }; + 1DAFDB7916DFDCA7007F8C68 /* virtual */ = { + isa = PBXGroup; + children = ( + 1DAFDB7A16DFDCA7007F8C68 /* PeripheralBusCEC.cpp */, + 1DAFDB7B16DFDCA7007F8C68 /* PeripheralBusCEC.h */, + ); + path = virtual; + sourceTree = ""; + }; 38F4E56013CCCB3B00664821 /* platform */ = { isa = PBXGroup; children = ( @@ -6391,6 +6403,7 @@ F5E1050D140AA38000175026 /* bus */ = { isa = PBXGroup; children = ( + 1DAFDB7916DFDCA7007F8C68 /* virtual */, F5E10512140AA38000175026 /* osx */, F5E10515140AA38000175026 /* PeripheralBus.cpp */, F5E10516140AA38000175026 /* PeripheralBus.h */, @@ -7746,6 +7759,7 @@ DF404A3A16B9896C00D8023E /* imagefactory.cpp in Sources */, DFD5812516C828500008EEA0 /* DAVCommon.cpp in Sources */, DFD5812616C828500008EEA0 /* DAVFile.cpp in Sources */, + 1DAFDB7C16DFDCA7007F8C68 /* PeripheralBusCEC.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/configure.in b/configure.in index b176919..7837c2d 100644 --- a/configure.in +++ b/configure.in @@ -159,8 +159,6 @@ libusb_disabled="== libusb disabled. Plug and play USB device support will not b libusb_disabled_udev_found="== libusb disabled. ==" libcec_enabled="== libcec enabled. ==" libcec_disabled="== libcec disabled. CEC adapter support will not be available. ==" -libcec_disabled_missing_libs="== libcec disabled because it either needs libudev, or libusb a compatible version of the RPi API. CEC adapter support will not be available. ==" -cec_rpi_api_missing="== no compatible RPi API found ==" # External library message strings external_libraries_enabled="== Use of all supported external libraries enabled. ==" @@ -1497,46 +1495,18 @@ fi # libcec USE_LIBCEC=0 -USE_CEC_RPI_API=0 -use_rpi_cec_api="auto" if test "x$use_libcec" != "xno"; then - case "${host_cpu}" in - arm*) - echo "will check for RPi support" - AC_CHECK_HEADER(interface/vmcs_host/vc_cec.h,,use_rpi_cec_api="no") - ;; - *) - echo "will not check for RPi support (unsupported cpu: ${host_cpu})" - use_rpi_cec_api="no" - ;; - esac - - # libcec needs libudev, libusb or the RPi API under linux, or the device will never be detected. - if test "$host_vendor" != "apple" && test "$use_libusb" = "no" && test "$use_libudev" = "no" && test "$use_rpi_cec_api" = "no"; then - if test "x$use_libcec" != "xauto"; then - AC_MSG_ERROR($libcec_disabled_missing_libs) - else - use_libcec="no" - AC_MSG_NOTICE($libcec_disabled_missing_libs) - fi - fi - # libcec is dyloaded, so we need to check for its headers and link any depends. if test "x$use_libcec" != "xno"; then if test "x$use_libcec" != "xauto"; then - PKG_CHECK_MODULES([CEC],[libcec >= 2.0.0],,[use_libcec="no";AC_MSG_ERROR($libcec_disabled)]) + PKG_CHECK_MODULES([CEC],[libcec >= 2.1.0],,[use_libcec="no";AC_MSG_ERROR($libcec_disabled)]) else - PKG_CHECK_MODULES([CEC],[libcec >= 2.0.0],,[use_libcec="no";AC_MSG_RESULT($libcec_disabled)]) + PKG_CHECK_MODULES([CEC],[libcec >= 2.1.0],,[use_libcec="no";AC_MSG_RESULT($libcec_disabled)]) fi if test "x$use_libcec" != "xno"; then INCLUDES="$INCLUDES $CEC_CFLAGS" USE_LIBCEC=1;AC_DEFINE([HAVE_LIBCEC],[1],["Define to 1 if libcec is installed"]) - if test "x$use_rpi_cec_api" != "xno"; then - LIBS+=" -lvcos -lvchiq_arm" - AC_DEFINE([HAVE_CEC_RPI_API],[1],["Define to 1 if the CEC RPi API is installed"]) - USE_CEC_RPI_API=1 - fi XB_FIND_SONAME([LIBCEC],[cec],[use_libcec]) AC_MSG_NOTICE($libcec_enabled) else @@ -2289,11 +2259,6 @@ fi if test "x$use_libcec" != "xno"; then final_message="$final_message\n libcec support:\tYes" - if test "x$use_rpi_cec_api" != "xno"; then - final_message="$final_message\n libcec RPi support:\tYes" - else - final_message="$final_message\n libcec RPi support:\tNo" - fi else final_message="$final_message\n libcec support:\tNo" fi @@ -2487,7 +2452,6 @@ AC_SUBST(USE_AIRTUNES) AC_SUBST(USE_LIBUDEV) AC_SUBST(USE_LIBUSB) AC_SUBST(USE_LIBCEC) -AC_SUBST(USE_CEC_RPI_API) AC_SUBST(USE_MYSQL) AC_SUBST(USE_WEB_SERVER) AC_SUBST(USE_UPNP) diff --git a/project/BuildDependencies/scripts/libcec_d.txt b/project/BuildDependencies/scripts/libcec_d.txt index c1419b5..2c7d495 100644 --- a/project/BuildDependencies/scripts/libcec_d.txt +++ b/project/BuildDependencies/scripts/libcec_d.txt @@ -1,3 +1,3 @@ ; filename source of the file -libcec-2.0.5.zip http://mirrors.xbmc.org/build-deps/win32/ +libcec-2.1.0.zip http://mirrors.xbmc.org/build-deps/win32/ diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj index 6143060..78439a2 100644 --- a/project/VS2010Express/XBMC.vcxproj +++ b/project/VS2010Express/XBMC.vcxproj @@ -860,6 +860,7 @@ + @@ -1090,6 +1091,7 @@ + diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters index 3b62970..c8ba9ea 100644 --- a/project/VS2010Express/XBMC.vcxproj.filters +++ b/project/VS2010Express/XBMC.vcxproj.filters @@ -2981,6 +2981,9 @@ filesystem + + peripherals\bus + @@ -5827,6 +5830,9 @@ filesystem + + peripherals\bus + diff --git a/system/peripherals.xml b/system/peripherals.xml index 967b96c..df8674d 100644 --- a/system/peripherals.xml +++ b/system/peripherals.xml @@ -7,30 +7,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/tools/android/depends/libcec/Makefile b/tools/android/depends/libcec/Makefile index 7d9b6b8..0147147 100644 --- a/tools/android/depends/libcec/Makefile +++ b/tools/android/depends/libcec/Makefile @@ -3,7 +3,7 @@ DEPS= ../Makefile.include Makefile # lib name, version LIBNAME=libcec -VERSION=2.0.5-3 +VERSION=2.1.0 SOURCE=$(LIBNAME)-$(VERSION) ARCHIVE=$(SOURCE).tar.gz @@ -11,7 +11,7 @@ ARCHIVE=$(SOURCE).tar.gz CONFIGURE=./configure --prefix=$(PREFIX) --host=$(HOST) \ ac_cv_search_dlopen=yes -LIBDYLIB=$(PLATFORM)/src/lib/.libs/libcec.so.2.0.0 +LIBDYLIB=$(PLATFORM)/src/lib/.libs/libcec.so.2.0.1 all: .installed-$(PLATFORM) diff --git a/tools/darwin/depends/libcec/Makefile b/tools/darwin/depends/libcec/Makefile index 3e84bff..b7970dd 100644 --- a/tools/darwin/depends/libcec/Makefile +++ b/tools/darwin/depends/libcec/Makefile @@ -3,7 +3,7 @@ include ../config.site.mk # lib name, version LIBNAME=libcec -VERSION=2.0.5-3 +VERSION=2.1.0 SOURCE=$(LIBNAME)-$(VERSION) ARCHIVE=$(SOURCE).tar.gz diff --git a/xbmc/peripherals/PeripheralTypes.h b/xbmc/peripherals/PeripheralTypes.h index 897440b..5fb1a45 100644 --- a/xbmc/peripherals/PeripheralTypes.h +++ b/xbmc/peripherals/PeripheralTypes.h @@ -35,7 +35,8 @@ namespace PERIPHERALS PERIPHERAL_BUS_UNKNOWN = 0, PERIPHERAL_BUS_USB, PERIPHERAL_BUS_PCI, - PERIPHERAL_BUS_RPI + PERIPHERAL_BUS_RPI, + PERIPHERAL_BUS_CEC }; enum PeripheralFeature @@ -143,6 +144,8 @@ namespace PERIPHERALS return "pci"; case PERIPHERAL_BUS_RPI: return "rpi"; + case PERIPHERAL_BUS_CEC: + return "cec"; default: return "unknown"; } @@ -159,6 +162,8 @@ namespace PERIPHERALS return PERIPHERAL_BUS_PCI; else if (strTypeLowerCase.Equals("rpi")) return PERIPHERAL_BUS_RPI; + else if (strTypeLowerCase.Equals("cec")) + return PERIPHERAL_BUS_CEC; return PERIPHERAL_BUS_UNKNOWN; }; diff --git a/xbmc/peripherals/Peripherals.cpp b/xbmc/peripherals/Peripherals.cpp index 07ae383..51852ad 100644 --- a/xbmc/peripherals/Peripherals.cpp +++ b/xbmc/peripherals/Peripherals.cpp @@ -31,8 +31,8 @@ #include "bus/PeripheralBusUSB.h" #include "dialogs/GUIDialogPeripheralManager.h" -#ifdef HAVE_CEC_RPI_API -#include "bus/linux/PeripheralBusRPi.h" +#if defined(HAVE_LIBCEC) +#include "bus/virtual/PeripheralBusCEC.h" #endif #include "threads/SingleLock.h" @@ -84,8 +84,8 @@ void CPeripherals::Initialise(void) #if defined(HAVE_PERIPHERAL_BUS_USB) m_busses.push_back(new CPeripheralBusUSB(this)); #endif -#ifdef HAVE_CEC_RPI_API - m_busses.push_back(new CPeripheralBusRPi(this)); +#if defined(HAVE_LIBCEC) + m_busses.push_back(new CPeripheralBusCEC(this)); #endif /* initialise all known busses */ @@ -276,7 +276,8 @@ CPeripheral *CPeripherals::CreatePeripheral(CPeripheralBus &bus, const Periphera case PERIPHERAL_CEC: #if defined(HAVE_LIBCEC) - peripheral = new CPeripheralCecAdapter(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId); + if (bus.Type() == PERIPHERAL_BUS_CEC) + peripheral = new CPeripheralCecAdapter(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId); #else if (!m_bMissingLibCecWarningDisplayed) { diff --git a/xbmc/peripherals/bus/Makefile.in b/xbmc/peripherals/bus/Makefile.in index 01fa4e2..2262e4a 100644 --- a/xbmc/peripherals/bus/Makefile.in +++ b/xbmc/peripherals/bus/Makefile.in @@ -12,8 +12,8 @@ ifeq ($(findstring osx,@ARCH@),osx) SRCS += osx/PeripheralBusUSB.cpp endif -ifeq (@USE_CEC_RPI_API@,1) -SRCS += linux/PeripheralBusRPi.cpp +ifeq (@USE_LIBCEC@,1) +SRCS += virtual/PeripheralBusCEC.cpp endif LIB = peripheral-bus.a diff --git a/xbmc/peripherals/bus/linux/PeripheralBusRPi.cpp b/xbmc/peripherals/bus/linux/PeripheralBusRPi.cpp deleted file mode 100644 index 7d49faa..0000000 --- a/xbmc/peripherals/bus/linux/PeripheralBusRPi.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#include "PeripheralBusRPi.h" -#include - -extern "C" { -#include -#include -} - -using namespace PERIPHERALS; - -#define RPI_PERIPHERAL_BUS_VID 0x2708 -#define RPI_PERIPHERAL_CEC_PID 0x1001 - -CPeripheralBusRPi::CPeripheralBusRPi(CPeripherals *manager) : - CPeripheralBus(manager, PERIPHERAL_BUS_RPI) -{ - m_bNeedsPolling = false; -} - -bool CPeripheralBusRPi::PerformDeviceScan(PeripheralScanResults &results) -{ - if (FindAdapter()) - { - PeripheralScanResult result; - result.m_iVendorId = RPI_PERIPHERAL_BUS_VID; - result.m_iProductId = RPI_PERIPHERAL_CEC_PID; - result.m_type = PERIPHERAL_CEC; - result.m_strLocation = CEC_RPI_VIRTUAL_COM; - - if (!results.ContainsResult(result)) - results.m_results.push_back(result); - } - - return true; -} - -bool CPeripheralBusRPi::FindAdapter(void) -{ - uint8_t iResult; - - VCHI_INSTANCE_T vchiq_instance; - if ((iResult = vchi_initialise(&vchiq_instance)) != VCHIQ_SUCCESS) - return false; - - if ((iResult = vchi_connect(NULL, 0, vchiq_instance)) != VCHIQ_SUCCESS) - return false; - - return true; -} diff --git a/xbmc/peripherals/bus/linux/PeripheralBusRPi.h b/xbmc/peripherals/bus/linux/PeripheralBusRPi.h deleted file mode 100644 index 413239f..0000000 --- a/xbmc/peripherals/bus/linux/PeripheralBusRPi.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#include "peripherals/bus/PeripheralBus.h" -#include "peripherals/devices/Peripheral.h" - -namespace PERIPHERALS -{ - class CPeripherals; - - class CPeripheralBusRPi : public CPeripheralBus - { - public: - CPeripheralBusRPi(CPeripherals *manager); - virtual ~CPeripheralBusRPi(void) {}; - - bool PerformDeviceScan(PeripheralScanResults &results); - - private: - bool FindAdapter(void); - }; -} diff --git a/xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp b/xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp new file mode 100644 index 0000000..f3e255f --- /dev/null +++ b/xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2005-2012 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#include "system.h" +#if defined(HAVE_LIBCEC) +#include "PeripheralBusCEC.h" +#include "peripherals/Peripherals.h" +#include "utils/log.h" +#include "DynamicDll.h" + +#include + +using namespace PERIPHERALS; +using namespace CEC; +using namespace std; + +class DllLibCECInterface +{ +public: + virtual ~DllLibCECInterface() {} + virtual ICECAdapter* CECInitialise(libcec_configuration *configuration)=0; + virtual void* CECDestroy(ICECAdapter *adapter)=0; +}; + +class PERIPHERALS::DllLibCEC : public DllDynamic, DllLibCECInterface +{ + DECLARE_DLL_WRAPPER(DllLibCEC, DLL_PATH_LIBCEC) + + DEFINE_METHOD1(ICECAdapter*, CECInitialise, (libcec_configuration *p1)) + DEFINE_METHOD1(void* , CECDestroy, (ICECAdapter *p1)) + + BEGIN_METHOD_RESOLVE() + RESOLVE_METHOD_RENAME(CECInitialise, CECInitialise) + RESOLVE_METHOD_RENAME(CECDestroy, CECDestroy) + END_METHOD_RESOLVE() +}; + +CPeripheralBusCEC::CPeripheralBusCEC(CPeripherals *manager) : + CPeripheralBus(manager, PERIPHERAL_BUS_CEC), + m_dll(new DllLibCEC), + m_cecAdapter(NULL) +{ + m_iRescanTime = 1000; + if (!m_dll->Load() || !m_dll->IsLoaded()) + { + delete m_dll; + m_dll = NULL; + } + else + { + m_cecAdapter = m_dll->CECInitialise(&m_configuration); + } +} + +CPeripheralBusCEC::~CPeripheralBusCEC(void) +{ + if (m_dll && m_cecAdapter) + m_dll->CECDestroy(m_cecAdapter); + delete m_dll; +} + +bool CPeripheralBusCEC::PerformDeviceScan(PeripheralScanResults &results) +{ + if (!m_dll || !m_cecAdapter) + return false; + + cec_adapter_descriptor deviceList[10]; + int8_t iFound = m_cecAdapter->DetectAdapters(deviceList, 10, NULL, true); + + for (uint8_t iDevicePtr = 0; iDevicePtr < iFound; iDevicePtr++) + { + PeripheralScanResult result; + result.m_iVendorId = deviceList[iDevicePtr].iVendorId; + result.m_iProductId = deviceList[iDevicePtr].iProductId; + result.m_strLocation = deviceList[iDevicePtr].strComPath; + result.m_type = PERIPHERAL_CEC; + + if (!results.ContainsResult(result)) + results.m_results.push_back(result); + } + return true; +} + +#endif diff --git a/xbmc/peripherals/bus/virtual/PeripheralBusCEC.h b/xbmc/peripherals/bus/virtual/PeripheralBusCEC.h new file mode 100644 index 0000000..acba01a --- /dev/null +++ b/xbmc/peripherals/bus/virtual/PeripheralBusCEC.h @@ -0,0 +1,57 @@ +#pragma once +/* + * Copyright (C) 2005-2013 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#include "peripherals/bus/PeripheralBus.h" +#include "peripherals/devices/Peripheral.h" + +// undefine macro isset, it collides with function in cectypes.h +#ifdef isset +#undef isset +#endif +#include + +namespace CEC +{ + class ICECAdapter; +} + +namespace PERIPHERALS +{ + class CPeripherals; + class DllLibCEC; + + class CPeripheralBusCEC : public CPeripheralBus + { + public: + CPeripheralBusCEC(CPeripherals *manager); + virtual ~CPeripheralBusCEC(void); + + /*! + * @see PeripheralBus::PerformDeviceScan() + */ + bool PerformDeviceScan(PeripheralScanResults &results); + + private: + DllLibCEC* m_dll; + CEC::ICECAdapter* m_cecAdapter; + CEC::libcec_configuration m_configuration; + }; +} diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp index 616d0f8..03c9e18 100644 --- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp @@ -1255,8 +1255,7 @@ int CPeripheralCecAdapter::CecLogMessage(void *cbParam, const cec_log_message me bool CPeripheralCecAdapter::TranslateComPort(CStdString &strLocation) { - if ((strLocation.Left(18).Equals("peripherals://usb/") || - strLocation.Left(18).Equals("peripherals://rpi/")) && + if ((strLocation.Left(18).Equals("peripherals://cec/")) && strLocation.Right(4).Equals(".dev")) { strLocation = strLocation.Right(strLocation.length() - 18); -- 2.7.4